コード例 #1
0
        public ActionResult CreateAdjustment(LossesAndAdjustmentsViewModel viewModel)
        {
            var newViewModel = new LossesAndAdjustmentsViewModel();
            var user         = _userProfileService.GetUser(User.Identity.Name);

            viewModel.IsLoss = false;
            _adjustmentService.AddNewLossAndAdjustment(viewModel, user);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult CreateAdjustment()
        {
            var user                  = _userProfileService.GetUser(User.Identity.Name);
            var commodity             = _commodityService.GetAllParents();
            var stores                = _hubService.GetAllStoreByUser(user);
            var adjustmentReasonMinus = _adjustmentReasonService.GetAllAdjustmentReason().Where(c => c.Direction == "-").ToList();
            var adjustmentReasonPlus  = _adjustmentReasonService.GetAllAdjustmentReason().Where(c => c.Direction == "+").ToList();
            var units                 = _unitService.GetAllUnit().ToList();
            var programs              = _programService.GetAllProgramsForReport();
            var viewModel             = new LossesAndAdjustmentsViewModel(commodity, stores, adjustmentReasonMinus, adjustmentReasonPlus, units, programs, user, 2);

            return(View(viewModel));
        }
コード例 #3
0
        public ActionResult CreateLoss(LossesAndAdjustmentsViewModel viewModel)
        {
            List <Commodity>        commodity;
            List <StoreViewModel>   stores;
            List <AdjustmentReason> adjustmentReasonMinus;
            List <AdjustmentReason> adjustmentReasonPlus;
            List <Unit>             units;
            List <ProgramViewModel> programs;

            UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            commodity             = _commodityService.GetAllParents();
            stores                = _hubService.GetAllStoreByUser(user);
            adjustmentReasonMinus = _adjustmentReasonService.GetAllAdjustmentReason().Where(c => c.Direction == "-").ToList();
            adjustmentReasonPlus  = _adjustmentReasonService.GetAllAdjustmentReason().Where(c => c.Direction == "+").ToList();
            units    = _unitService.GetAllUnit().ToList();
            programs = _programService.GetAllProgramsForReport();

            //if (ModelState.IsValid)
            //{

            LossesAndAdjustmentsViewModel newViewModel = new LossesAndAdjustmentsViewModel(commodity, stores,
                                                                                           adjustmentReasonMinus,
                                                                                           adjustmentReasonPlus,
                                                                                           units, programs, user, 1);



            if (viewModel.QuantityInMt >
                _TransactionService.GetCommodityBalanceForStore(viewModel.StoreId, viewModel.CommodityId,
                                                                viewModel.ShippingInstructionId,
                                                                viewModel.ProjectCodeId))
            {
                ModelState.AddModelError("QuantityInMT", "You have nothing to loss");
                return(View(newViewModel));
            }

            if (viewModel.QuantityInMt <= 0)
            {
                ModelState.AddModelError("QuantityInMT", "You have nothing to loss");

                return(View(newViewModel));
            }
            viewModel.IsLoss = true;
            _adjustmentService.AddNewLossAndAdjustment(viewModel, user);
            return(RedirectToAction("Index"));
            //}
            //return View();
        }
コード例 #4
0
        public ActionResult CreateAdjustment()
        {
            List <Commodity>        commodity;
            List <StoreViewModel>   stores;
            List <AdjustmentReason> adjustmentReasonMinus;
            List <AdjustmentReason> adjustmentReasonPlus;
            List <Unit>             units;
            List <ProgramViewModel> programs;

            UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            commodity             = _commodityService.GetAllParents();
            stores                = _hubService.GetAllStoreByUser(user);
            adjustmentReasonMinus = _adjustmentReasonService.GetAllAdjustmentReason().Where(c => c.Direction == "-").ToList();
            adjustmentReasonPlus  = _adjustmentReasonService.GetAllAdjustmentReason().Where(c => c.Direction == "+").ToList();
            units    = _unitService.GetAllUnit().ToList();
            programs = _programService.GetAllProgramsForReport();



            LossesAndAdjustmentsViewModel viewModel = new LossesAndAdjustmentsViewModel(commodity, stores, adjustmentReasonMinus, adjustmentReasonPlus, units, programs, user, 2);

            return(View(viewModel));
        }
コード例 #5
0
ファイル: AdjustmentService.cs プロジェクト: nathnael/cats
 public void AddNewLossAndAdjustment(LossesAndAdjustmentsViewModel viewModel, UserProfile user)
 {
     _transactionService.SaveLossAdjustmentTransaction(viewModel, user);
 }