Beispiel #1
0
        public ActionResult LogPartial()
        {
            var strTimKiem = Session["strTimKiem_Log"] == null ? string.Empty : Session["strTimKiem_Log"].ToString();
            var fromDate   = Session["fromDate_Log"] == null ? null : (DateTime?)(Session["fromDate_Log"]);
            var toDate     = Session["toDate_Log"] == null ? null : (DateTime?)Session["toDate_Log"];
            var IsAdmin    = false;

            if (nguoidung.TENDANGNHAP == "admin")
            {
                IsAdmin = true;
            }
            int?sobanghi  = null;
            var lstLog    = LogService.GetByFilter(strTimKiem, fromDate, toDate, IsAdmin, nguoidung.TENDANGNHAP);
            var viewModel = GridViewExtension.GetViewModel(nameGrid);

            if (viewModel == null)
            {
                viewModel = CreateGridViewModelWithSummary();
            }
            viewModel.Pager.PageSize = (sobanghi ?? 15);
            sobanghi_CSG             = (sobanghi ?? 15);
            List <LogSystem> list = new List <LogSystem>();

            if (Session["ListLog"] != null)
            {
                list = (List <LogSystem>)Session["ListLog"];
            }
            gridViewHanders.Model = list.AsQueryable();
            Session["ListLog"]    = lstLog;
            return(AdvancedCustomBindingCore(viewModel));
            //return PartialView("LogPartial", LogService.GetByFilter(strTimKiem, fromDate, toDate,IsAdmin,nguoidung.TENDANGNHAP));
        }
Beispiel #2
0
        public ActionResult Index(LogIndexModel model, int?page)
        {
            int total                  = 0;
            int pagesize               = 10;
            int currentPageIndex       = page.HasValue ? page.Value - 1 : 0;
            ILogSystemService logSrv   = IoC.Resolve <ILogSystemService>();
            string            kw       = !string.IsNullOrEmpty(model.keyword) ? model.keyword.Trim() : null;
            DateTime          DateFrom = String.IsNullOrEmpty(model.fromdate) ? DateTime.MinValue : DateTime.ParseExact(model.fromdate, "dd/MM/yyyy", null);
            DateTime          DateTo   = String.IsNullOrEmpty(model.todate) ? DateTime.MaxValue : DateTime.ParseExact(model.todate, "dd/MM/yyyy", null);

            if (DateFrom == DateTo)
            {
                DateTo = DateFrom.AddHours(12);
            }
            var list = logSrv.GetByFilter(kw, DateFrom, DateTo, currentPageIndex, pagesize, out total);

            model.LogData = new PagedList <LogData>(list, currentPageIndex, pagesize, total);
            return(View(model));
        }