예제 #1
0
        public ActionResult SortingAndPagingAccounts(string loginName,
                                                     string sortBy = null,
                                                     bool sortDesc = true,
                                                     int page      = 1,
                                                     int pageSize  = 25)
        {
            if (Request.IsAjaxRequest())
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = page,
                    SortBy           = sortBy,
                    SortDescending   = sortDesc,
                    PageSize         = pageSize
                };

                int totalRecords;
                ViewBag.Accounts = _accountSvc.GetAllAccount(out totalRecords,
                                                             model.CurrentPageIndex,
                                                             pageSize,
                                                             sortBy,
                                                             sortDesc,
                                                             loginName);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;
            }
            ViewBag.ModelSearch = new AccountSearchModel
            {
                LoginName = loginName
            };

            return(PartialView("Partial", ViewBag.Accounts));
        }
예제 #2
0
 public ActionResult SearchActionLog(LogActionSearchModel search, int pageSize)
 {
     if (Request.IsAjaxRequest())
     {
         if (ModelState.IsValid)
         {
             var model = new SortAndPageModel
             {
                 CurrentPageIndex = 1,
                 SortBy           = DefaultActionLogSortBy,
                 SortDescending   = false,
                 PageSize         = pageSize
             };
             int totalRecords;
             ViewBag.LogActionItems = _svcLog.GetAllActionLogItems(out totalRecords,
                                                                   pageSize: pageSize,
                                                                   currentPage: model.CurrentPageIndex,
                                                                   loginName: search.LoginName,
                                                                   actionContent: search.ActionContent,
                                                                   actionType: search.ActionType);
             model.TotalRecordCount = totalRecords;
             ViewBag.SortAndPage    = model;
         }
         ViewBag.ModelSearch = search;
     }
     return(PartialView("PartialActionLogItem", ViewBag.LogActionItems));
 }
예제 #3
0
        public ActionResult Index()
        {
            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = 1,
                    SortBy           = DefaultItemSortBy,
                    SortDescending   = false
                };

                int totalRecords;
                ViewBag.Accounts       = _accountSvc.GetAllAccount(out totalRecords);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;
                ViewBag.ModelSearch    = new AccountSearchModel
                {
                    LoginName = null
                };
                return(View());
            }
            catch
            {
                return(RedirectToAction("Index", "Menus", new { area = "Admin" }));
            }
        }
예제 #4
0
        public ActionResult SearchAccounts(AccountSearchModel search, int pageSize)
        {
            if (Request.IsAjaxRequest())
            {
                if (ModelState.IsValid)
                {
                    var model = new SortAndPageModel
                    {
                        CurrentPageIndex = 1,
                        SortBy           = "",
                        SortDescending   = false,
                        PageSize         = pageSize
                    };

                    int totalRecords;
                    ViewBag.Accounts = _accountSvc.GetAllAccount(out totalRecords,
                                                                 model.CurrentPageIndex,
                                                                 pageSize,
                                                                 descending: true,
                                                                 loginName: search.LoginName);

                    model.TotalRecordCount = totalRecords;
                    ViewBag.SortAndPage    = model;
                }
                ViewBag.ModelSearch = search;
            }
            return(PartialView("Partial", ViewBag.Accounts));
        }
예제 #5
0
        public ActionResult Index()
        {
            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = 1,
                    SortBy           = DefaultSortBy,
                    SortDescending   = false
                };

                int totalRecords;
                ViewBag.Invoice        = _invoice.GetAllInvoice(out totalRecords);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;
                var searchInvoiceModel = new SearchInvoiceModel()
                {
                    ListNo = ListNos()
                };
                return(View(searchInvoiceModel));
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString();
                return(RedirectToAction("Index", "Error", new { area = "" }));
            }
        }
예제 #6
0
        public ActionResult Index(string sortBy, int?page)
        {
            int p        = 1;
            int numOfRec = 20;

            if (page != null && page.HasValue)
            {
                p = page.GetValueOrDefault();
            }

            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = p,
                    SortBy           = DefaultSortBy,
                    SortDescending   = false,
                    PageSize         = numOfRec
                };

                int totalRecords;
                ViewBag.Product        = _product.GetAllProduct(out totalRecords, p, numOfRec);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;

                return(View());
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString();
                return(RedirectToAction("Index", "Error", new { area = "" }));
            }
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="message"></param>
        /// <param name="messageType"></param>
        /// <returns></returns>
        public ActionResult Index(string message, string messageType)
        {
            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = 1,
                    SortBy           = DefaultSortBy,
                    SortDescending   = false
                };

                int totalRecords;
                ViewBag.Customer       = _customer.GetAllCustomer(out totalRecords);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;

                ViewBag.Message     = message;
                ViewBag.MessageType = messageType;

                return(View());
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString();
                return(RedirectToAction("Index", "Error", new { area = "" }));
            }
        }
        public ActionResult SearchListReleaseInvoice(SearchListReleaseInvoiceModel search, int pageSize = 1)
        {
            if (Request.IsAjaxRequest())
            {
                if (ModelState.IsValid)
                {
                    var model = new SortAndPageModel
                    {
                        CurrentPageIndex = 1,
                        SortBy           = "",
                        SortDescending   = false,
                        PageSize         = pageSize
                    };

                    int totalRecords;
                    ViewBag.ListReleaseInvoice = _listReleaseInvoice.GetAllListReleaseInvoice(out totalRecords,
                                                                                              model.CurrentPageIndex,
                                                                                              pageSize,
                                                                                              descending: true);

                    model.TotalRecordCount = totalRecords;
                    ViewBag.SortAndPage    = model;
                }
                ViewBag.ModelSearch = search;
            }
            return(PartialView("Partial", ViewBag.ListReleaseInvoice));
        }
        public ActionResult Index(string message, string messageType)
        {
            if (!Request.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Home"));
            }

            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = 1,
                    SortBy           = DefaultSortBy,
                    SortDescending   = false
                };

                int totalRecords;

                var invoiceTemplate = _templateInvoice.GetAll();
                Dictionary <string, string> temp = new Dictionary <string, string>();
                if (invoiceTemplate != null && invoiceTemplate.Count() > 0)
                {
                    foreach (var t in invoiceTemplate)
                    {
                        temp.Add(t.TemplateCode, t.TemplateName);
                    }
                }

                var listRelease = _listReleaseInvoice.GetAllListReleaseInvoice(out totalRecords);
                foreach (var t in listRelease)
                {
                    if (t == null || string.IsNullOrEmpty(t.TemplateCode) || !temp.ContainsKey(t.TemplateCode))
                    {
                        continue;
                    }
                    t.TemplateName = temp[t.TemplateCode];
                }
                ViewBag.ListReleaseInvoice = listRelease;

                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;

                ViewBag.Message     = message;
                ViewBag.MessageType = messageType;
                return(View());
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString();
                return(RedirectToAction("Index", "Error", new { area = "" }));
            }
        }
예제 #10
0
        public ActionResult SortingAndPagingItem(
            string loginName,
            string sortBy,
            bool sortDesc,
            string fromDate,
            string toDate,
            bool?status,
            int page,
            int pageSize)
        {
            if (Request.IsAjaxRequest())
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = page,
                    SortBy           = sortBy,
                    SortDescending   = sortDesc,
                    PageSize         = pageSize
                };

                int totalRecords;
                var from = !string.IsNullOrEmpty(fromDate)
                               ? DateTime.Parse(fromDate,
                                                System.Globalization.CultureInfo.GetCultureInfo("vi-VN").DateTimeFormat)
                               : (DateTime?)null;
                var to = !string.IsNullOrEmpty(toDate)
                             ? DateTime.Parse(toDate,
                                              System.Globalization.CultureInfo.GetCultureInfo("vi-VN").DateTimeFormat)
                             : (DateTime?)null;
                ViewBag.LogItems = _svcLog.GetAllLogItems(out totalRecords, model.CurrentPageIndex, pageSize, sortDesc, sortBy,
                                                          status: status,
                                                          loginName: string.IsNullOrEmpty(loginName) ? "" : loginName,
                                                          fromDate: from,
                                                          toDate: to);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;
            }
            ViewBag.ModelSearch = new LogItemSearchModel
            {
                LoginName = loginName,
                FromDate  = fromDate,
                ToDate    = toDate,
                Status    = status
            };

            return(PartialView("PartialLogItem", ViewBag.LogItems));
        }
예제 #11
0
        public ActionResult ActionLog()
        {
            var model = new SortAndPageModel {
                CurrentPageIndex = 1, SortBy = DefaultActionLogSortBy, SortDescending = true
            };

            int totalRecords;

            ViewBag.LogItems = _svcLog.GetAllActionLogItems(out totalRecords);

            model.TotalRecordCount = totalRecords;
            ViewBag.ModelSearch    = new LogActionSearchModel
            {
                Id            = -1,
                LoginName     = "",
                ActionContent = "",
                ActionTime    = ""
            };
            ViewBag.SortAndPage = model;
            return(View());
        }
예제 #12
0
 public ActionResult SearchLogItem(LogItemSearchModel search, int pageSize)
 {
     if (Request.IsAjaxRequest())
     {
         if (ModelState.IsValid)
         {
             var model = new SortAndPageModel
             {
                 CurrentPageIndex = 1,
                 SortBy           = DefaultItemSortBy,
                 SortDescending   = true,
                 PageSize         = pageSize
             };
             int totalRecords;
             ViewBag.LogItems = _svcLog.GetAllLogItems(out totalRecords,
                                                       pageSize: pageSize,
                                                       currentPage: model.CurrentPageIndex,
                                                       loginName: search.LoginName,
                                                       fromDate: string.IsNullOrEmpty(search.FromDate)
                                                     ? (DateTime?)null
                                                     : DateTime.Parse(search.FromDate,
                                                                      System.Globalization.CultureInfo.
                                                                      GetCultureInfo("vi-VN").
                                                                      DateTimeFormat),
                                                       toDate: string.IsNullOrEmpty(search.ToDate)
                                                     ? (DateTime?)null
                                                     : DateTime.Parse(search.ToDate,
                                                                      System.Globalization.CultureInfo.
                                                                      GetCultureInfo("vi-VN").
                                                                      DateTimeFormat),
                                                       status: search.Status);
             model.TotalRecordCount = totalRecords;
             ViewBag.SortAndPage    = model;
         }
         ViewBag.ModelSearch = search;
     }
     return(PartialView("PartialLogItem", ViewBag.LogItems));
 }
예제 #13
0
        //
        // GET: /Log/
        public ActionResult Index()
        {
            var model = new SortAndPageModel {
                CurrentPageIndex = 1, SortBy = DefaultItemSortBy, SortDescending = true
            };
            int totalRecords;

            ViewBag.LogItems = _svcLog.GetAllLogItems(out totalRecords);

            model.TotalRecordCount = totalRecords;
            ViewBag.ModelSearch    = new LogItemSearchModel
            {
                Id        = -1,
                LoginName = "",
                FromDate  = null,
                ToDate    = null,
                LoginIP   = "",
                LoginTime = null,
                Status    = null
            };

            ViewBag.SortAndPage = model;
            return(View());
        }
예제 #14
0
        public ActionResult SortingAndPagingActionLog(
            string loginName,
            string sortBy,
            bool sortDesc,
            string actionContent,
            LogActionType?actionType,
            int page,
            int pageSize)
        {
            if (Request.IsAjaxRequest())
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = page,
                    SortBy           = sortBy,
                    SortDescending   = sortDesc,
                    PageSize         = pageSize
                };

                int totalRecords;
                ViewBag.LogActionItems = _svcLog.GetAllActionLogItems(out totalRecords, model.CurrentPageIndex, pageSize, sortDesc, sortBy,
                                                                      string.IsNullOrEmpty(loginName) ? "" : loginName,
                                                                      string.IsNullOrEmpty(actionContent) ? "" : actionContent,
                                                                      actionType.HasValue ? actionType : null);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;
            }
            ViewBag.ModelSearch = new LogActionSearchModel
            {
                LoginName     = loginName,
                ActionContent = actionContent,
                ActionType    = actionType
            };

            return(PartialView("PartialActionLogItem", ViewBag.LogActionItems));
        }
예제 #15
0
        public ActionResult Index()
        {
            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = 1,
                    SortBy           = DefaultSortBy,
                    SortDescending   = false
                };

                int totalRecords;
                ViewBag.Unit           = _unit.GetAllUnit(out totalRecords);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;

                return(View());
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString();
                return(RedirectToAction("Index", "Error", new { area = "" }));
            }
        }