コード例 #1
0
        // Начисление ЗП за хранение шин
        public async Task Payroll(int idOrder, int idBrigade, int idAdmin, ReviwOrderModelBll reviwOrder) // ??? срочно проверить оформление заказа шин
        {
            var amountOfCurrentOrder = reviwOrder.priceSilicone + reviwOrder.priceWheelWash;

            OrderCarWashWorkersBll orderCarWashWorkers = new OrderCarWashWorkersBll();

            orderCarWashWorkers.IdCarWashWorkers  = idBrigade;
            orderCarWashWorkers.IdOrder           = idOrder;
            orderCarWashWorkers.CalculationStatus = false;
            orderCarWashWorkers.typeServicesId    = StatusTypeServises(8, 2); // изменить
            orderCarWashWorkers.Payroll           = await PercentOfTheOrder(idBrigade, 1, amountOfCurrentOrder, false, orderCarWashWorkers.typeServicesId.Value);

            orderCarWashWorkers.closedDayStatus = false;

            await _orderCarWashWorkers.Insert(orderCarWashWorkers);

            orderCarWashWorkers.IdCarWashWorkers = idAdmin;
            orderCarWashWorkers.typeServicesId   = StatusTypeServises(7, 1); // изменить
            orderCarWashWorkers.Payroll          = await PercentOfTheOrder(idAdmin, 1, amountOfCurrentOrder, true, orderCarWashWorkers.typeServicesId.Value);

            await _orderCarWashWorkers.Insert(orderCarWashWorkers);
        }
コード例 #2
0
        public async Task <ActionResult> ReviewTireStorageOrder(double?sum, int?idPaymentState, int?idStatusOrder, int?StockNumber)
        {
            if (StockNumber != null)
            {
                if (TempData.ContainsKey("TireStorageOrder") && TempData.ContainsKey("ReviwOrderMode"))
                {
                    var pageCreateResult  = TempData["TireStorageOrder"] as OrderTireStorageModelView;
                    var reviwOrderModules = TempData["ReviwOrderMode"] as ReviwOrderModelView;

                    OrderTireStorageModelBll orderTireStorage = Mapper.Map <OrderTireStorageModelView, OrderTireStorageModelBll>(pageCreateResult);
                    ReviwOrderModelBll       orderModelBll    = Mapper.Map <ReviwOrderModelView, ReviwOrderModelBll>(reviwOrderModules);

                    int idOrder = await _createOrder.SaveOrderTireFitting(reviwOrderModules.priceOfTire, reviwOrderModules.priceOfTire, idPaymentState.Value, idStatusOrder.Value, orderTireStorage.ClientId.Value, 5);

                    int idStorageFee = await _order.CreateStorageFee(orderTireStorage.storageTime.Value, sum);

                    if (reviwOrderModules.priceSilicone != 0 || reviwOrderModules.priceWheelWash != 0)
                    {
                        idOrderServices = await _createOrder.SaveOrderTireFitting(sum.Value, sum.Value, idPaymentState.Value, 1, orderTireStorage.ClientId.Value, 2);

                        if (reviwOrderModules.priceSilicone != 0)
                        {
                            var AdditionalTireStorageServicesEntity = new AdditionalTireStorageServicesView
                            {
                                clientsOfCarWashId     = orderTireStorage.ClientId.Value,
                                orderServicesCarWashId = idOrderServices.Value,
                                tireStorageServicesd   = orderModelBll.IdpriceSilicone,
                                Price = orderModelBll.priceSilicone
                            };

                            await _additionalTireStorageServices.Insert(TransformAnEntity(AdditionalTireStorageServicesEntity));
                        }

                        if (reviwOrderModules.priceWheelWash != 0)
                        {
                            var AdditionalTireStorageServicesEntity = new AdditionalTireStorageServicesView
                            {
                                clientsOfCarWashId     = orderTireStorage.ClientId.Value,
                                orderServicesCarWashId = idOrderServices.Value,
                                tireStorageServicesd   = orderModelBll.IdWheelWash,
                                Price = orderModelBll.priceWheelWash
                            };

                            await _additionalTireStorageServices.Insert(TransformAnEntity(AdditionalTireStorageServicesEntity));
                        }
                    }

                    var tireStorage = new TireStorageBll
                    {
                        serviceCostTirePackages = orderModelBll.priceNumberOfPackets,
                        dateOfAdoption          = orderTireStorage.dateOfAdoption,
                        quantity               = orderTireStorage.quantity,
                        radius                 = orderTireStorage.radius,
                        firm                   = orderTireStorage.firm,
                        discAvailability       = orderTireStorage.discAvailability,
                        storageFeeId           = idStorageFee,
                        tireStorageBags        = orderTireStorage.tireStorageBags,
                        wheelWash              = orderTireStorage.wheelWash,
                        IdOrderServicesCarWash = idOrder,
                        silicone               = orderTireStorage.silicone,
                        RelatedOrders          = idOrderServices,
                        stockNumber            = StockNumber
                    };

                    await _tireStorage.Insert(tireStorage);

                    await _wage.AdminWageTireStorage(idOrder, pageCreateResult.quantity.Value);
                }

                return(RedirectToAction("OrderTireStorage", "Order", new RouteValueDictionary(new
                {
                    typeOfOrder = 5,
                    statusOrder = 5
                })));
            }
            else
            {
                if (TempData.ContainsKey("Client"))
                {
                    TempData.Keep("Client");
                }

                if (TempData.ContainsKey("TireStorageOrder"))
                {
                    TempData.Keep("TireStorageOrder");
                }

                TempData.Keep("ReviwOrderMode");

                return(RedirectToAction("ReviewTireStorageOrder"));
            }
        }