コード例 #1
0
        public async Task <ActionResult> ServicesDelete(int?idOrder, int?discont, int idServices = 0)
        {
            if (idServices != 0)
            {
                await _servisesCarWash.ServicesDelete(idServices, nameof(OrderController));

                await _order.RecountOrder(idOrder.Value, discont);

                var order = await _order.GetId(idOrder);

                if (await _wageModules.SalaryForTheCurrentOrder(order.Id))
                {
                    // Начисление заработной платы сотрудникам
                    var selectEmployees = _wageModules.GetCurrentEmployees(order);
                    await _wageModules.Payroll(order, selectEmployees, order.typeOfOrder.Value);

                    // Начисление заработной платы Администраору
                    var selectAdmin = _wageModules.GetCurrentAdministrator((int)TypeService.Sales, order);
                    await _wageModules.AdminWage(order, (int)TypeService.Sales, selectAdmin, true);

                    // Наичление заработной платы Тим лидеру
                    var selectTeamLead = _wageModules.GetCurrentAdministrator(order.typeOfOrder.Value, order);
                    await _wageModules.AdminWage(order, order.typeOfOrder.Value, selectTeamLead, true);
                }

                return(RedirectToAction("OrderInfo"));
            }
            else
            {
                await _order.DeleteOrder(idOrder.Value);

                return(RedirectToAction("Index"));
            }
        }
コード例 #2
0
        public async Task <ActionResult> OrderPreview(List <double> carBody, List <int> id, List <int> sum, List <string> idBrigade, double total, int?idOrder = null)
        {
            if (idOrder == null)
            {
                int service = 0;

                if (TempData.ContainsKey("typeServices"))
                {
                    service = Convert.ToInt32(TempData["typeServices"]);
                }

                await _orderServicesInsert.InsertOrders(service, carBody, id, sum, total);
            }
            else
            {
                await _orderServicesInsert.InsertOrders(carBody, id, sum, total, idOrder);

                var order = await _orderServicesInsert.GetId(idOrder);

                if (await _wageModules.SalaryForTheCurrentOrder(order.Id))
                {
                    // Начисление заработной платы сотрудникам
                    var selectEmployees = _wageModules.GetCurrentEmployees(order);
                    await _wageModules.Payroll(order, selectEmployees, order.typeOfOrder.Value);

                    // Начисление заработной платы Администраору
                    var selectAdmin = _wageModules.GetCurrentAdministrator((int)TypeService.Sales, order);
                    await _wageModules.AdminWage(order, (int)TypeService.Sales, selectAdmin, true);

                    // Наичление заработной платы Тим лидеру
                    var selectTeamLead = _wageModules.GetCurrentAdministrator(order.typeOfOrder.Value, order);
                    await _wageModules.AdminWage(order, order.typeOfOrder.Value, selectTeamLead, true);
                }
            }

            return(RedirectToAction("Index", "Order"));
        }
コード例 #3
0
        public async Task <ActionResult> InfoOrder(int?idOrder, int?idClient, int?idCompany, int?idAdmin, int idStatusOrder, int idPaymentState)
        {
            bool typePaymentState = idPaymentState == 1 || idPaymentState == 2 ? true : false;

            if (idOrder == null || idClient == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (idCompany == null || idStatusOrder == 1)
            {
                return(RedirectToAction("Color", "InfoOrder", new RouteValueDictionary(new { idOrder = idOrder, idClient = idClient })));
            }

            if (idStatusOrder == 4 && idPaymentState == 3)
            {
                await _orderColor.UpdateServises(idOrder, idStatusOrder, idPaymentState);

                return(RedirectToAction("Index", "Color"));
            }

            if (idStatusOrder == 2 && typePaymentState)
            {
                await _orderColor.UpdateServises(idOrder, idStatusOrder, idPaymentState);

                // Начисление заработной платы Администраору
                var order = await _orderServices.GetId(idOrder);

                await _wageModules.AdminWage(order, (int)TypeService.Sales, idAdmin.Value);

                // Начисления процента исполнителю
                await _orderСompany.SaveOrder(idOrder, idCompany, idAdmin, (int)TypeService.DryCleaningKohler, order.DiscountPrice);

                return(RedirectToAction("Index", "Color"));
            }

            if (idStatusOrder == 3 && idOrder != null)
            {
                await _orderServices.DeleteOrder(idOrder.Value);

                return(RedirectToAction("Index", "Color"));
            }

            return(View());
        }
コード例 #4
0
        public async Task <ActionResult> AboutOrder([Bind(Include = "orderCompletionDate")] OrderCarpetWashingView orderCarpetWashingView, int idOrderServis,
                                                    int idOrder, int?idPage, int?PaymentStateList, int?idClient, List <string> idBrigade = null, int?idAdmin = null, int?idTeamLead = null, bool orderDelete = false)
        {
            if (orderDelete)
            {
                await _orderServicesCarWash.DeleteOrder(idOrderServis);

                return(RedirectToAction("OrderCarpetWashing"));
            }

            if (idPage == 2)
            {
                if (PaymentStateList == 3)
                {
                    if (idBrigade != null && idTeamLead != null)
                    {
                        int idOrderServices = await EditOrderCarpetWashing(idOrder, idPage.Value, PaymentStateList.Value);

                        var order = await _orderServicesCarWash.GetId(idOrderServices);

                        if (idAdmin != null)
                        {
                            // Начисление заработной платы Администраору
                            await _wageModules.AdminWage(order, (int)TypeService.Sales, idAdmin.Value);
                        }

                        // Наичление заработной платы Тим лидеру
                        await _wageModules.AdminWage(order, (int)TypeService.CarpetCleaning, idTeamLead.Value);

                        // Начисление заработной платы сотрудникам
                        await _wageModules.Payroll(order, _wageModules.ConvertListToIEnumerable(idBrigade), (int)TypeService.CarpetCleaning);

                        OrderServicesCarWashView orderServices = Mapper.Map <OrderServicesCarWashView>(await _orderServicesCarWash.GetId(idOrderServices));
                        orderServices.PaymentState = PaymentStateList;
                        orderServices.StatusOrder  = (int)StatusOrder.AwaitingPayment;

                        if (orderServices.ClosingData == null)
                        {
                            orderServices.ClosingData = DateTime.Now;
                        }

                        await SaveOrderServices(orderServices);
                    }
                    else
                    {
                        int idOrderServices = await EditOrderCarpetWashing(idOrder, idPage.Value, PaymentStateList.Value);

                        OrderServicesCarWashView orderServices = Mapper.Map <OrderServicesCarWashView>(await _orderServicesCarWash.GetId(idOrderServices));
                        orderServices.PaymentState = PaymentStateList;
                        orderServices.StatusOrder  = (int)StatusOrder.AwaitingPayment;

                        if (orderServices.ClosingData == null)
                        {
                            orderServices.ClosingData = DateTime.Now;
                        }

                        await SaveOrderServices(orderServices);
                    }
                }
                else if (PaymentStateList == 1 || PaymentStateList == 2)
                {
                    if (idBrigade != null && idTeamLead != null)
                    {
                        int idOrderServices = await EditOrderCarpetWashing(idOrder, idPage.Value, PaymentStateList.Value);

                        var order = await _orderServicesCarWash.GetId(idOrderServices);

                        if (idAdmin != null)
                        {
                            // Начисление заработной платы Администраору
                            await _wageModules.AdminWage(order, (int)TypeService.Sales, idAdmin.Value);
                        }

                        // Наичление заработной платы Тим лидеру
                        await _wageModules.AdminWage(order, (int)TypeService.CarpetCleaning, idTeamLead.Value);

                        // Начисление заработной платы сотрудникам
                        await _wageModules.Payroll(order, _wageModules.ConvertListToIEnumerable(idBrigade), (int)TypeService.CarpetCleaning);

                        OrderServicesCarWashView orderServices = Mapper.Map <OrderServicesCarWashView>(await _orderServicesCarWash.GetId(idOrderServices));
                        orderServices.PaymentState = PaymentStateList;
                        orderServices.StatusOrder  = (int)StatusOrder.Completed;

                        if (orderServices.ClosingData == null)
                        {
                            orderServices.ClosingData = DateTime.Now;
                        }

                        await SaveOrderServices(orderServices);
                    }
                    else
                    {
                        int idOrderServices = await EditOrderCarpetWashing(idOrder, idPage.Value, PaymentStateList.Value);

                        OrderServicesCarWashView orderServices = Mapper.Map <OrderServicesCarWashView>(await _orderServicesCarWash.GetId(idOrderServices));
                        orderServices.PaymentState = PaymentStateList;
                        orderServices.StatusOrder  = (int)StatusOrder.Completed;

                        if (orderServices.ClosingData == null)
                        {
                            orderServices.ClosingData = DateTime.Now;
                        }

                        await SaveOrderServices(orderServices);
                    }
                }
                else
                {
                    return(RedirectToAction("AboutOrder", "OrderCarpetWashing", new RouteValueDictionary(new
                    {
                        idOrder = idOrder,
                        idClient = idClient,
                        idPage = idPage
                    })));
                }
            }

            return(RedirectToAction("OrderCarpetWashing"));
        }
コード例 #5
0
        public async Task <ActionResult> OrderPreview(List <string> idBrigade, double Total, int idPaymentState, int idStatusOrder, int?idAdmin, int?idTeamLead)
        {
            CreateOrderView createOrderView = new CreateOrderView();

            int idOrder = 0;

            if (idStatusOrder == (int)StatusOrder.Completed && idBrigade == null)
            {
                TempData.Keep("CreateOrder");

                return(RedirectToAction("OrderPreview", "TireChangeService", new RouteValueDictionary(new
                {
                    Error = true
                })));
            }

            if (TempData.ContainsKey("CreateOrder"))
            {
                createOrderView = (CreateOrderView)TempData["CreateOrder"];

                double priceListTireFittingAdditionalsSum = 0;

                if (createOrderView.priceListTireFittingAdditionals != null)
                {
                    priceListTireFittingAdditionalsSum = createOrderView.priceListTireFittingAdditionals.Sum(x => x.TheCost).Value;
                }

                if (createOrderView.numberOfTires != 0 || createOrderView.priceListTireFittings != null)
                {
                    double TotalSum = SumTireChangeService(createOrderView.priceListTireFittings, createOrderView.numberOfTires.Value) + priceListTireFittingAdditionalsSum;
                    idOrder = await _createOrder.SaveOrderTireFitting(TotalSum, Total, idPaymentState, idStatusOrder, createOrderView.client.Value, 4);
                }
                else if (priceListTireFittingAdditionalsSum != 0)
                {
                    idOrder = await _createOrder.SaveOrderTireFitting(priceListTireFittingAdditionalsSum, Total, idPaymentState, idStatusOrder, createOrderView.client, 4);
                }

                if (createOrderView.priceListTireFittingAdditionals != null)
                {
                    List <PriceListTireFittingAdditionalServicesBll> priceListTireFittings = new List <PriceListTireFittingAdditionalServicesBll>();
                    priceListTireFittings = Mapper.Map <List <PriceListTireFittingAdditionalServicesView>, List <PriceListTireFittingAdditionalServicesBll> >(createOrderView.priceListTireFittingAdditionals);

                    await _createOrder.SeveTireService(createOrderView.client, idOrder, priceListTireFittings);
                }

                if (createOrderView.priceListTireFittings != null)
                {
                    List <PriceListTireFittingBll> listTireFittingBlls = new List <PriceListTireFittingBll>();
                    listTireFittingBlls = Mapper.Map <List <PriceListTireFittingView>, List <PriceListTireFittingBll> >(createOrderView.priceListTireFittings);

                    await _createOrder.SaveTireChangeService(idOrder, createOrderView.numberOfTires.Value, listTireFittingBlls);
                }

                var order = await _orderServices.GetId(idOrder);

                if (idBrigade != null)
                {
                    // Начисление заработной платы сотрудникам
                    await _wageModules.Payroll(order, _wageModules.ConvertListToIEnumerable(idBrigade), (int)TypeService.TireFitting);
                }

                if (idAdmin != null)
                {
                    // Начисление заработной платы Администраору
                    await _wageModules.AdminWage(order, (int)TypeService.Sales, idAdmin.Value);
                }

                if (idTeamLead != null)
                {
                    // Наичление заработной платы Тим лидеру
                    await _wageModules.AdminWage(order, (int)TypeService.TireFitting, idTeamLead.Value);
                }

                TempData.Remove("CreateOrder");

                return(RedirectToAction("../Order/Index"));
            }

            TempData.Keep("CreateOrder");

            return(View());
        }