Exemplo n.º 1
0
        public IActionResult AddSpecialMedical(ConsumptionViewModel model, IFormCollection form)
        {
            string[] products = form["key"].ToArray();
            string[] values   = form["value"].ToArray();

            var farm = _farm.SaveConsumption(model.CostCenterId, products, values,
                                             GetCurrentUserAsync().Result.UserName, model.LateDateTime).Result;

            if (farm.Succeeded)
            {
                _toastNotification.AddSuccessToastMessage(farm.OkMessage, new ToastrOptions
                {
                    PositionClass = ToastPositions.TopCenter
                });
                return(RedirectToAction(nameof(SelectMealCostCenter)));
            }

            _toastNotification.AddWarningToastMessage(farm.Errors, new ToastrOptions
            {
                PositionClass = ToastPositions.TopCenter
            });
            var newConsumption = new ConsumptionViewModel
            {
                CostCenterId   = model.CostCenterId,
                CostCenterName = model.CostCenterName,
                ProductLists   = _farm.GetProductListFailed(model.CostCenterId, "Medical", products, values).ToList()
            };

            return(View(nameof(AddSpecialMeal), newConsumption));
        }
Exemplo n.º 2
0
        public IActionResult AddSpecialMedical(long id)
        {
            var costCenter      = _farm.GetCostCenterById(id);
            var prodList        = _farm.GetProductList(id, "Medical").ToList();
            var consumptionList = new ConsumptionViewModel
            {
                CostCenterName = costCenter.Name,
                CostCenterId   = costCenter.Id,
                ProductLists   = prodList
            };

            return(View(consumptionList));
        }
        public IActionResult AddMedical(long id)
        {
            var costCenter      = _farm.GetCostCenterById(id);
            var prodList        = _farm.GetProductList(id, "Medical").ToList();
            var consumptionList = new ConsumptionViewModel
            {
                CostCenterName = costCenter.Name,
                CostCenterId   = costCenter.Id,
                ProductLists   = prodList
            };
            var list = string.Empty;

            foreach (var item in prodList)
            {
                list = list + "<option>" + item.Name + "<option/>";
            }

            ViewBag.Complete = prodList;

            return(View(consumptionList));
        }
Exemplo n.º 4
0
 public MainViewModel()
 {
     Consumption = new ConsumptionViewModel(new ConsumersService());
     Production  = new ProductionViewModel(new ProductionService());
     Retail      = new RetailViewModel();
 }