Example #1
0
        public InformationPreviousPeriod AnalyticsFormationPaymentForThePreviousPeriod(IEnumerable <OrderServicesCarWashBll> orderCarWashes)
        {
            InformationPreviousPeriod model = new InformationPreviousPeriod();

            var orderServicesCarWashesWashing = orderCarWashes.Where(x => x.typeOfOrder == 2);
            var result = OrdersForThePreviousPeriodCaunt(orderServicesCarWashesWashing);

            model.Washing            = new OrdersForThePreviousPeriod();
            model.Washing.OrderSum   = result.Item2;
            model.Washing.OrderCount = result.Item1;

            var orderServicesCarWashesDetailing = orderCarWashes.Where(x => x.typeOfOrder == 1);

            result = OrdersForThePreviousPeriodCaunt(orderServicesCarWashesDetailing);

            model.Detailing            = new OrdersForThePreviousPeriod();
            model.Detailing.OrderSum   = result.Item2;
            model.Detailing.OrderCount = result.Item1;

            var orderServicesCarWashesCarpetWashing = orderCarWashes.Where(x => x.typeOfOrder == 3);

            result = OrdersForThePreviousPeriodCaunt(orderServicesCarWashesCarpetWashing);

            model.CarpetWashing            = new OrdersForThePreviousPeriod();
            model.CarpetWashing.OrderSum   = result.Item2;
            model.CarpetWashing.OrderCount = result.Item1;

            var orderServicesCarWashesTireFitting = orderCarWashes.Where(x => x.typeOfOrder == 4);

            result = OrdersForThePreviousPeriodCaunt(orderServicesCarWashesTireFitting);

            model.TireFitting            = new OrdersForThePreviousPeriod();
            model.TireFitting.OrderSum   = result.Item2;
            model.TireFitting.OrderCount = result.Item1;

            var orderServicesCarWashesTireStorage = orderCarWashes.Where(x => x.typeOfOrder == 5);

            result = OrdersForThePreviousPeriodCaunt(orderServicesCarWashesTireStorage);

            model.TireStorage            = new OrdersForThePreviousPeriod();
            model.TireStorage.OrderSum   = result.Item2;
            model.TireStorage.OrderCount = result.Item1;

            return(model);
        }
 private double SumOrdersForThePreviousPeriod(InformationPreviousPeriod informationSum)
 {
     return(Math.Round(informationSum.CarpetWashing.OrderSum + informationSum.Washing.OrderSum + informationSum.Detailing.OrderSum +
                       informationSum.TireFitting.OrderSum + informationSum.TireStorage.OrderSum, 1));
 }