protected override void OnActionExecuted(ActionExecutedContext filterContext) { var sess = (NguoiDung)Session[Core.Constants.SESSION.USERNAME]; if (sess == null) { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary(new { controller = "Account", action = "Login", area = "" })); } else if (!sess.PhanQuyen.Contains("admin")) { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary(new { controller = "Account", action = "Login" })); } else { ViewBag.currentUser = sess; var request = String.Format("{{ {0} = chưa duyệt }}", nameof(HoaDonDaiLyManager.Properties.TrangThai)); ViewBag.HoaDonChuaDuyet = HoaDonDaiLyManager.filter(request).Count; request = String.Format("{{ {0} = chưa duyệt }}", nameof(PhieuXuatManager.Properties.TrangThai)); ViewBag.PhieuXuatChuaDuyet = PhieuXuatManager.filter(request).Count; request = String.Format("{{ {0} = đã duyệt }} {{ {1} = {2} }}", nameof(HoaDonDaiLyManager.Properties.TrangThai), nameof(HoaDonDaiLyManager.Properties.NgayLap), String.Format("{0:yyyy/MM}", DateTime.Now)); ViewBag.ThanhToanTrongThang = HoaDonDaiLyManager.filter(request).Count; if (Session[Core.Constants.SESSION.PAGE_SIZE] != null) { ViewBag.PageSize = Session[Core.Constants.SESSION.PAGE_SIZE]; } } }
// GET: PhieuNhap public ActionResult All(int page = 1, int pageSize = 10, string search = null) { List <HoaDonDaiLy> DMHoaDon = null; ViewBag.cultureInfo = CultureInfo; if (!String.IsNullOrEmpty(search)) { DMHoaDon = HoaDonDaiLyManager.filter(search); ViewBag.SearchKey = search; } else { DMHoaDon = HoaDonDaiLyManager.getAll(); } ViewBag.tongTien = DMHoaDon.Sum(hd => hd.TongTien); var models = DMHoaDon.ToPagedList(page, pageSize); setAlertMessage(); return(View(models)); }