Esempio n. 1
0
        public ActionResult DrumHistoryReport(CMSReportViewModels model, ServiceResult msgresult)
        {
            var uService = new UserService();
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0016);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            model.Modify = prole.Modify;
            model.View   = prole.View;
            model.result = msgresult; // return result from http post
            var cmsService = new CMSService();
            var cbService  = new ComboService();
            var hasCri     = new ComboCriteria()
            {
                Date_Delivered = true, Delivery_Order_No = true
            };

            model.cSortlist = cbService.LstSortAction(false, hasCri);

            model.cProductCodelist = cbService.LstProductByCode(true);

            model.chargelist = new List <CMS_Charge>();

            if (!string.IsNullOrEmpty(model.Date_From) || !string.IsNullOrEmpty(model.Date_To) || !string.IsNullOrEmpty(model.Product_Code))
            {
                var cri = new CMSCriteria();
                cri.Product_Code         = model.Product_Code;
                cri.Date_From            = model.Date_From;
                cri.Date_To              = model.Date_To;
                cri.Sort_By              = model.Sort_By;
                cri.Drum_Code_Have_Value = true;
                var result = cmsService.GetCMSCharge(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.chargelist = result.Object as List <CMS_Charge>;
                }
            }
            return(View(model));
        }