Beispiel #1
0
        public List <QuoteCalculation> GetModelList(int QuoteID)
        {
            List <QuoteCalculation> modellist = new List <QuoteCalculation>();

            QuoteCalculationsQuery qry = new QuoteCalculationsQuery()
            {
                QuoteID = QuoteID
            };
            IEnumerable <EWS.Domain.Data.DataModel.QuoteCalculation> entitylist = _queryProcessor.Execute(qry);

            foreach (EWS.Domain.Data.DataModel.QuoteCalculation entity in entitylist)
            {
                QuoteCalculation model = new QuoteCalculation()
                {
                    ContractTypeID   = entity.ContractTypeID,
                    ContractType     = entity.ContractType.ContractTypeName,
                    BasePrice        = entity.SellingPricePercAmount / (entity.SellingPricePerc / 100),
                    SellingPricePerc = entity.SellingPricePerc,
                    ROEPortion       = entity.ROEPortion,
                    ZARPortion       = entity.ZARPortion,
                    ROEPortionAmount = entity.ROEPortionAmount,
                    ZARPortionAmount = entity.ZARPortionAmount
                };

                //ContractTermQuery ctqry = new ContractTermQuery() { NoOfMonths = entity.ContractTerm };
                //EWS.Domain.Data.DataModel.ContractTerm contractterm = _queryProcessor.Execute(ctqry);
                //model.ContractTerm = contractterm;

                modellist.Add(model);
            }

            return(modellist);
        }
Beispiel #2
0
        private EWS.Domain.Model.Quote GetQuote_Model(EWS.Domain.Data.DataModel.Quote entity)
        {
            EWS.Domain.Model.Quote model = new EWS.Domain.Model.Quote();
            model.QuoteID             = entity.ID;
            model.QuoteRef            = entity.QuoteRef;
            model.ContractID          = entity.BaseContractID;
            model.TenderNumber        = entity.TenderNo;
            model.VAT                 = entity.VAT;
            model.SellingPriceExclVAT = entity.SellingPrice;
            model.SellingPriceInclVAT = Math.Round(entity.SellingPrice * Convert.ToDecimal(entity.VAT / 100 + 1), 2);
            model.NoOfMonths          = entity.ContractTerm;

            model.Customer = GetCustomer_Model(entity.CustomerID);

            DeviceQuery dqry = new Domain.Data.Queries.DeviceQuery()
            {
                DeviceID = entity.DeviceID
            };

            model.Device = _queryProcessor.Execute(dqry);

            model.ExchangeRate = new ExchangeRate()
            {
                Rate = entity.ROE,
                Date = entity.ROEDate
            };

            QuoteCalculationsQuery qcqry = new QuoteCalculationsQuery()
            {
                QuoteID = entity.ID
            };
            IEnumerable <Domain.Data.DataModel.QuoteCalculation> listofQuoteCalcs = _queryProcessor.Execute(qcqry);

            model.ContractCalculations = new List <QuoteCalculation>();

            foreach (Domain.Data.DataModel.QuoteCalculation calc in listofQuoteCalcs)
            {
                QuoteCalculation calcmodel = new QuoteCalculation();
                MapEntityToModel(calc, calcmodel);
                model.ContractCalculations.Add(calcmodel);

                QuoteCalculationItem[] years = GetQuoteCalculationItemsStructure(calc, (short)(model.NoOfMonths / 12), model.StartDate);
                calcmodel.QuoteCalculationItems = Recalculate(calcmodel, years, model.StartDate);
            }


            return(model);
        }
Beispiel #3
0
        private void UpdateModelFromSavedValues(List <QuoteCalculation> models, int QuoteID)
        {
            QuoteCalculationsQuery query = new QuoteCalculationsQuery()
            {
                QuoteID = QuoteID
            };
            IEnumerable <Domain.Data.DataModel.QuoteCalculation> calcs = _queryProcessor.Execute(query);

            foreach (QuoteCalculation model in models)
            {
                Domain.Data.DataModel.QuoteCalculation calc = calcs.FirstOrDefault(c => c.ContractTypeID == model.ContractTypeID);
                if (calc == null)
                {
                    model.Selected = false;
                }
                else
                {
                    model.Selected = true;
                    MapEntityToModel(calc, model);
                }
            }
        }