using Hcs.Client; using Hcs.Client.Api.Payload.HouseManagement; using Hcs.Client.Api.Registry; using Hcs.Service.Async.HouseManagement; using System; namespace Hcs.TestApp.Scenario { internal class HouseManagementScenario(UniClient client) { private readonly UniClient client = client; internal void ExportAllSupplyResourceContractData() { var result = client.HouseManagement.ExportSupplyResourceContractDataAsync().Result; Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed")); } internal void ExportSupplyResourceContractDataByGuid() { var result = client.HouseManagement.ExportSupplyResourceContractDataAsync(Guid.Parse("575a7ff9-5473-4ab4-b077-fa80c1f85f0b")).Result; Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed")); } internal void ExportSupplyResourceContractDataByNumber() { var result = client.HouseManagement.ExportSupplyResourceContractDataAsync("239009043").Result; Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed")); } internal void ExportSupplyResourceContractObjectAddressData() { var result = client.HouseManagement.ExportSupplyResourceContractObjectAddressDataAsync(Guid.Parse("575a7ff9-5473-4ab4-b077-fa80c1f85f0b")).Result; Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed")); } internal void ImportSupplyResourceContractData() { var signingDate = new DateTime(2017, 01, 01); var effectiveDate = new DateTime(2017, 01, 01); var comptetionDate = new DateTime(2078, 12, 31); var objectAddressGuid = Guid.NewGuid().ToString(); var contractSubjectGuid = Guid.NewGuid().ToString(); var normGuid = Guid.NewGuid().ToString(); var payload = new ImportSupplyResourceContractDataPayload() { isContract = false, contractNumber = "239297999", signingDate = signingDate, effectiveDate = effectiveDate, indefiniteTerm = false, automaticRollOverOneYear = true, comptetionDate = comptetionDate, period = new SupplyResourceContractTypePeriod() { Start = new SupplyResourceContractTypePeriodStart() { StartDate = 20, NextMonth = false, NextMonthSpecified = true }, End = new SupplyResourceContractTypePeriodEnd() { EndDate = 25, NextMonth = false, NextMonthSpecified = true } }, isPlannedVolume = false, contractSubject = [new SupplyResourceContractTypeContractSubject() { TransportGUID = contractSubjectGuid, ServiceType = Registry3.Element6, MunicipalResource = Registry239.Element4, StartSupplyDate = effectiveDate, EndSupplyDate = comptetionDate, EndSupplyDateSpecified = true }], specifyingQualityIndicators = SupplyResourceContractTypeSpecifyingQualityIndicators.D, objectAddress = [new SupplyResourceContractTypeObjectAddress() { TransportGUID = objectAddressGuid, Pair = [new SupplyResourceContractTypeObjectAddressPair() { PairKey = contractSubjectGuid, StartSupplyDate = effectiveDate, EndSupplyDate = comptetionDate, EndSupplyDateSpecified = true, HeatingSystemType = new SupplyResourceContractTypeObjectAddressPairHeatingSystemType() { OpenOrNot = SupplyResourceContractTypeObjectAddressPairHeatingSystemTypeOpenOrNot.Opened, CentralizedOrNot = SupplyResourceContractTypeObjectAddressPairHeatingSystemTypeCentralizedOrNot.Decentralized } }], FIASHouseGuid = "e606fca9-1ac4-41a1-8478-a9feb6cdfa78" }], quality = [new SupplyResourceContractTypeQuality() { PairKey = contractSubjectGuid, QualityIndicator = Registry276.Element4, IndicatorValue = new SupplyResourceContractTypeQualityIndicatorValue() { Items = [9.76m, 10m, "214"], ItemsElementName = [ItemsChoiceType10.StartRange, ItemsChoiceType10.EndRange, ItemsChoiceType10.OKEI] } }, new SupplyResourceContractTypeQuality() { PairKey = contractSubjectGuid, QualityIndicator = Registry276.Element10, IndicatorValue = new SupplyResourceContractTypeQualityIndicatorValue() { Items = [0.05m, 0.3m, "298"], ItemsElementName = [ItemsChoiceType10.StartRange, ItemsChoiceType10.EndRange, ItemsChoiceType10.OKEI] } }], billingDate = new SupplyResourceContractTypeBillingDate() { Date = 1, DateType = SupplyResourceContractTypeBillingDateDateType.N }, paymentDate = new SupplyResourceContractTypePaymentDate() { Date = 10, DateType = SupplyResourceContractTypePaymentDateDateType.N }, meteringDeviceInformation = true, volumeDepends = false, oneTimePayment = false, norm = [new SupplyResourceContractTypeNorm() { PairKey = contractSubjectGuid, Items = [true], NormGUID = normGuid }] }; var result = client.HouseManagement.ImportSupplyResourceContractDataAsync(payload).Result; Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed")); } } }