Exemplo n.º 1
0
        public ActionResult PurgeHistoryReport(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.purgelist = new List <CMS_Purge>();

            if (!string.IsNullOrEmpty(model.Date_From) || !string.IsNullOrEmpty(model.Date_To) || !string.IsNullOrEmpty(model.Drum_Code))
            {
                var cri = new CMSCriteria();
                cri.Date_From            = model.Date_From;
                cri.Date_To              = model.Date_To;
                cri.Drum_Code            = model.Drum_Code;
                cri.Drum_Code_Have_Value = true;
                var result = cmsService.GetCMSPurge(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.purgelist = result.Object as List <CMS_Purge>;
                }

                cri = new CMSCriteria();
                cri.Drum_Code_Have_Value = true;
                var result2 = cmsService.GetCMSPurge(cri);
                if (result2.Code == ReturnCode.SUCCESS)
                {
                    model.purgelistAll = result2.Object as List <CMS_Purge>;
                }
            }
            return(View(model));
        }