コード例 #1
0
        private async Task <IEnumerable <ContractItemNav> > CreateContractItemNavList(MoveInRequest request)
        {
            var premiseInstallation = await _deviceApi.GetPremiseInstallation(request.PremiseId);

            var contractItemNavList = new List <ContractItemNav>();

            foreach (var installationId in request.InstallationIds)
            {
                var premiseInstallDetails = premiseInstallation.Data.Installations.FirstOrDefault(x => x.InstallationId == installationId);
                if (premiseInstallDetails == null)
                {
                    throw new BadRequestException(
                              "Unable to find premise installation details with provided installation id");
                }
                var contractItemNav = new ContractItemNav()
                {
                    ContractStartDate   = DateTimeOffset.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss"),
                    ContractEndDate     = DateTime.MaxValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss"),
                    BusinessAgreementID = request.ContractAccountId.ToString(),
                    TransferCA          = "",
                    ProductID           = GetProductId(premiseInstallDetails.DivisionId),
                    DivisionID          = premiseInstallDetails.DivisionId,
                    PointOfDeliveryGUID = premiseInstallDetails.InstallationGuid,
                };

                contractItemNavList.Add(contractItemNav);
            }

            return(contractItemNavList);
        }
コード例 #2
0
        public async Task <IEnumerable <ContractItemNav> > CreateCleanMoveInContractItemNavList(CleanMoveInRequest request, string newContractAccountId)
        {
            var contractItemNavList = new List <ContractItemNav>();

            foreach (var installation in request.Installations)
            {
                var contractItemNav = new ContractItemNav()
                {
                    ContractStartDate   = DateTimeOffset.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss"),
                    ContractEndDate     = DateTime.MaxValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss"),
                    BusinessAgreementID = newContractAccountId,
                    TransferCA          = "",
                    ProductID           = GetProductId(installation.DivisionId),
                    DivisionID          = installation.DivisionId,
                    PointOfDeliveryGUID = installation.InstallationGuid
                };

                contractItemNavList.Add(contractItemNav);
            }

            return(contractItemNavList);
        }