Example #1
0
        private async Task <AgreementResponse> SavePriceProtectedStorageAgreement(PriceHedgeFormModel formModel, Customer customer)
        {
            var storageAgreement = new PriceProtectStorageAgreement()
            {
                CustomerUserName  = customer.CustomerName,
                WatchDate         = formModel.PriceWatchEndDate,
                WatchPrice        = formModel.UpperPrice,
                WatchPriceMinimum = formModel.LowerPrice,
                WatchAction       = formModel.TargetAction,
                AgreementId       = formModel.AgreementId.ToString()
            };

            //TODO: waiting Olle to update the service, saving method should return AgreementResponse obj ==>done!
            return(await _agreementRepository.SavePriceProtectedStorageAgreementAsync(storageAgreement));
        }
Example #2
0
        private async Task <AgreementResponse> SavePriceProtectedStorageAgreement(PurchasingAgreementFormModel formModel,
                                                                                  string customerName)
        {
            var purchasePeriod = GenerateFromDatePeriod(formModel.AgreementPeriod);
            var agreement      = new PriceProtectStorageAgreement
            {
                CustomerUserName  = customerName,
                WatchPrice        = formModel.UpperPrice,
                WatchPriceMinimum = formModel.LowerPrice,
                WatchDate         = formModel.PriceWatchEndDate,
                AgreementId       = formModel.AgreementId.ToString(),
                WatchAction       = formModel.TargetAction,
                PriceType         = purchasePeriod.PriceType,
                ValidTo           = purchasePeriod.ValidTo,
                ValidFrom         = purchasePeriod.ValidFrom,
            };

            return(await _agreementRepository.SavePriceProtectedStorageAgreementAsync(agreement));
        }