public ActionResult List(int?customerId = null) { try { CustomerInfoViewModel custInfoVM = new CustomerInfoViewModel(); if (TempData["CustomerInfo"] != null) { custInfoVM = (CustomerInfoViewModel)TempData["CustomerInfo"]; TempData["CustomerInfo"] = custInfoVM; // Keep for change Tab } else { return(RedirectToAction("Search", "Customer")); } Logger.Info(_logMsg.Clear().SetPrefixMsg("InitList CustomerLog").Add("CustomerId", custInfoVM.CustomerId).ToInputLogString()); _commonFacade = new CommonFacade(); _customerFacade = new CustomerFacade(); CustomerLogViewModel custLogVM = new CustomerLogViewModel(); custLogVM.CustomerInfo = custInfoVM; if (custInfoVM.CustomerId.HasValue) { // CustomerLog list custLogVM.SearchFilter = new CustomerLogSearchFilter { CustomerId = custInfoVM.CustomerId.Value, PageNo = 1, PageSize = _commonFacade.GetPageSizeStart(), SortField = "CreateDate", SortOrder = "DESC" }; custLogVM.CustomerLogList = _customerFacade.GetCustomerLogList(custLogVM.SearchFilter); ViewBag.PageSize = custLogVM.SearchFilter.PageSize; ViewBag.PageSizeList = _commonFacade.GetPageSizeList(); ViewBag.Message = string.Empty; } return(View(custLogVM)); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("InitList CustomerLog").Add("Error Message", ex.Message).ToFailLogString()); return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString()))); } }
public ActionResult CustomerLogList(CustomerLogSearchFilter searchFilter) { Logger.Info(_logMsg.Clear().SetPrefixMsg("List CustomerLog").Add("CustomerId", searchFilter.CustomerId) .ToInputLogString()); try { if (ModelState.IsValid) { _commonFacade = new CommonFacade(); _customerFacade = new CustomerFacade(); CustomerLogViewModel custLogVM = new CustomerLogViewModel(); custLogVM.SearchFilter = searchFilter; custLogVM.CustomerLogList = _customerFacade.GetCustomerLogList(custLogVM.SearchFilter); ViewBag.PageSize = custLogVM.SearchFilter.PageSize; ViewBag.PageSizeList = _commonFacade.GetPageSizeList(); Logger.Info(_logMsg.Clear().SetPrefixMsg("CustomerLogList").ToSuccessLogString()); return(PartialView("~/Views/CustomerLog/_CustomerLogList.cshtml", custLogVM)); } return(Json(new { Valid = false, Error = string.Empty, Errors = GetModelValidationErrors() })); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("List CustomerLog").Add("Error Message", ex.Message).ToFailLogString()); return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString()))); } }