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 ImportAccountData() { var payload = new ImportAccountDataPayload() { accountNumber = "385635479641", accountReasons = new AccountReasonsImportType() { SupplyResourceContract = [ new() { Items = ["0aca4ebc-8d5c-4a39-801c-e25f0867adc6"], ItemsElementName = [ItemsChoiceType17.ContractGUID] } ] }, accountType = ImportAccountDataPayload.AccountType.RC, livingPersonsNumber = 1, totalSquare = 29.3m, residentialSquare = 29.3m, heatedArea = 29.3m, accomodations = [ new() { Item = "db041c58-4a14-45ce-8ecc-d99727e9683f", ItemElementName = ItemChoiceType9.FIASHouseGuid } ], payerInfo = new AccountTypePayerInfo() { IsRenter = true, IsRenterSpecified = true, Item = new AccountIndType() { Item = "62392021264", FirstName = "Имя", Surname = "Фамилия", Patronymic = "Отчество" } } }; var result = client.HouseManagement.ImportAccountDataAsync(payload).Result; Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed")); } internal void ImportLivingHouseUOData() { var payload = new ImportLivingHouseUODataPayload() { fiasHouseGuid = Guid.Parse("db041c58-4a14-45ce-8ecc-d99727e9683f"), totalSquare = 29.3m, state = Registry24.Element2, lifeCycleStage = Registry338.Element1, usedYear = 2000, floorCount = 1, oktmo = new OKTMORefType() { code = "98641101001" }, olsonTZ = Registry32.Element11, culturalHeritage = false, isMunicipalProperty = false, isRegionProperty = false, conditionalNumber = "1234567890" }; var result = client.HouseManagement.ImportHouseUODataAsync(payload).Result; Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed")); } internal void ImportNotificationData() { var payload = new ImportNotificationDataPayload() { topic = "Тема новости", isImportant = true, content = "Содержимое новости", destinations = [ new(ItemsChoiceType29.IsAll, true) ], isNotLimit = true, isShipOff = true }; var result = client.HouseManagement.ImportNotificationDataAsync(payload).Result; Console.WriteLine("Scenario execution " + (result ? "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 payload = new ImportSupplyResourceContractDataPayload() { isContract = false, contractNumber = "239297999", signingDate = signingDate, effectiveDate = effectiveDate, automaticRollOverOneYear = true, comptetionDate = comptetionDate, // TODO: Не дает выгрузить период //period = new SupplyResourceContractTypePeriod() //{ // Start = new SupplyResourceContractTypePeriodStart() // { // StartDate = 20 // }, // End = new SupplyResourceContractTypePeriodEnd() // { // EndDate = 25 // } //}, counterparty = 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 = "db041c58-4a14-45ce-8ecc-d99727e9683f" }], 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 }, // TODO: Не дает задать этот параметр, из-за чего приходится удалять период //meteringDeviceInformation = true, volumeDepends = false, oneTimePayment = false, // TODO: Пока не понятно, откуда берется NormGUID //norm = [new SupplyResourceContractTypeNorm() //{ // PairKey = contractSubjectGuid, // Items = [true], // NormGUID = "" //}] }; var result = client.HouseManagement.ImportSupplyResourceContractDataAsync(payload).Result; Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed")); } } }