Example #1
0
        public async Task InsertOrders(int service, List <double> carBody, List <int> id, List <int> sum, double total)
        {
            OrderServicesCarWashBll OrderFormation = new OrderServicesCarWashBll();

            OrderFormation = new OrderServicesCarWashBll
            {
                IdClientsOfCarWash     = OrderServices.idClient,
                StatusOrder            = 1,
                OrderDate              = DateTime.Now,
                TotalCostOfAllServices = _orderServices.OrderPrice(),
                DiscountPrice          = Math.Round(total),
                typeOfOrder            = service
            };

            int orderServicesCar = await CreateOrder(OrderFormation);

            foreach (var item in OrderServices.OrderList)
            {
                _servisesCar = new ServisesCarWashOrderBll
                {
                    IdClientsOfCarWash     = Convert.ToInt32(OrderServices.idClient),
                    IdOrderServicesCarWash = orderServicesCar,
                    IdWashServices         = item.Id,
                    Price = PriceServices(carBody, id, sum, item.Id)
                };

                ServisesCarWashOrder servisesCarWash = Mapper.Map <ServisesCarWashOrderBll, ServisesCarWashOrder>(_servisesCar);

                _unitOfWork.ServisesCarWashOrderUnitOfWork.Insert(servisesCarWash);

                await _unitOfWork.Save();
            }

            _orderServices.ClearListOrder();
        }
Example #2
0
        public async Task InsertOrders(List <double> carBody, List <int> id, List <int> sum, double total, int?idOrder)
        {
            var OrderServicesCarWashGetId = Mapper.Map <OrderServicesCarWashBll>(await _unitOfWork.OrderServicesCarWashUnitOfWork.GetById(idOrder));

            OrderServicesCarWashGetId.TotalCostOfAllServices = OrderServicesCarWashGetId.TotalCostOfAllServices + _orderServices.OrderPrice();
            OrderServicesCarWashGetId.DiscountPrice          = Math.Round(total);

            await SaveOrder(OrderServicesCarWashGetId);

            foreach (var item in OrderServices.OrderList)
            {
                _servisesCar = new ServisesCarWashOrderBll
                {
                    IdClientsOfCarWash     = Convert.ToInt32(OrderServices.idClient),
                    IdOrderServicesCarWash = idOrder,
                    IdWashServices         = item.Id,
                    Price = PriceServices(carBody, id, sum, item.Id)
                };

                ServisesCarWashOrder servisesCarWash = Mapper.Map <ServisesCarWashOrderBll, ServisesCarWashOrder>(_servisesCar);

                _unitOfWork.ServisesCarWashOrderUnitOfWork.Insert(servisesCarWash);
                await _unitOfWork.Save();
            }

            _orderServices.ClearListOrder();
        }
Example #3
0
 public OrderServicesCarWashServices(
     IUnitOfWork unitOfWork,
     IOrderServices orderServices,
     ServisesCarWashOrderBll servisesCar,
     IOrderCarWashWorkersServices orderCarWash,
     IServisesCarWashOrderServices servisesCarWashOrder
     )
 {
     _unitOfWork    = unitOfWork;
     _orderServices = orderServices;
     _servisesCar   = servisesCar;
     _orderCarWashWorkersServices = orderCarWash;
     _servisesCarWashOrder        = servisesCarWashOrder;
 }