public ViewResult Index(FormCollection collection, int?page) { ViewBag.StartDate = collection["txtFromDate"] ?? Request.QueryString["txtFromDate"]; ViewBag.EndDate = collection["txtToDate"] ?? Request.QueryString["txtToDate"]; ViewBag.Status = collection["ddlStatus"] ?? Request.QueryString["ddlStatus"]; ViewBag.Email = collection["txtEmail"] ?? Request.QueryString["txtEmail"]; ViewBag.ResellerName = collection["txtResellerName"] ?? Request.QueryString["txtResellerName"]; ViewBag.TotalPurchase = collection["ddlTotalPurchase"] ?? Request.QueryString["ddlTotalPurchase"]; RecordStatus?eRecordStatus = null; if (!PagingInputValidator.IsPagingInputValid(ref page)) { return(View()); } DateTime dtStartDate = ViewBag.StartDate == null?DateTimeWithZone.Now.AddYears(-1) : Convert.ToDateTime(ViewBag.StartDate); DateTime dtEndDate = ViewBag.EndDate == null ? DateTimeWithZone.Now : Convert.ToDateTime(ViewBag.EndDate); decimal MinPrice = 0, MaxPrice = Decimal.MaxValue; if (!string.IsNullOrEmpty(ViewBag.TotalPurchase)) { string[] strVal = ViewBag.TotalPurchase.ToString().Split('-'); if (strVal != null && strVal.Length > 1) { MinPrice = Convert.ToDecimal(strVal[0]); MaxPrice = Convert.ToDecimal(strVal[1]); } } if (!string.IsNullOrEmpty(ViewBag.Status)) { eRecordStatus = (RecordStatus?)Enum.Parse(typeof(RecordStatus), ViewBag.Status.ToString(), true); } ViewBag.Status = eRecordStatus.ToString(); string strResellerName = ViewBag.ResellerName, strEmail = ViewBag.Email; if (collection["btnExport"] != null && collection["btnExport"].ToString().ToLower().Equals("export to csv")) { ExportDataToCSV(strResellerName, strEmail, eRecordStatus, dtStartDate, dtEndDate, MinPrice, MaxPrice); return(View()); } else { var resellers = _service.GetResellerData(Site.ID, strResellerName, strEmail, eRecordStatus, dtStartDate, dtEndDate, MinPrice, MaxPrice).OrderBy(ord => ord.TotalPurchase).ThenBy(t => t.CompanyName).ThenBy(n => n.FirstName).ToPagedList(page.HasValue ? page.Value - 1 : 0, WBHelper.PageSize(Site)); resellers.ActionName = "Index"; resellers.ControllerName = "Reseller"; if (!PagingInputValidator.IsPagingInputValid(ref page, resellers)) { return(View()); } return(View(resellers)); } }
public ViewResult Index(FormCollection collection, int?page) { ViewBag.Email = collection["txtEmail"] ?? Request.QueryString["email"]; ViewBag.Name = collection["txtName"] ?? Request.QueryString["name"]; string strName = ViewBag.Name, strEmail = ViewBag.Email; if (Request.Form["btnExport"] != null && Request.Form["btnExport"].ToString().ToLower().Equals("export to csv")) { ExportDataToCSV(strName, strEmail); return(View()); } else { if (!PagingInputValidator.IsPagingInputValid(ref page)) { return(View()); } int userid = LoginUser.ID; var cutomers = _repository.Find(u => u.SiteID == Site.ID && u.ID != userid && u.UserTypeID != (int)UserType.RESELLER && u.UserTypeID != (int)UserType.CUSTOMER && u.RecordStatusID != (int)RecordStatus.DELETED && (u.FirstName + " " + u.LastName).Contains((string.IsNullOrEmpty(strName) ? u.FirstName : strName)) && u.Email.Contains((string.IsNullOrEmpty(strEmail) ? u.Email : strEmail))).EagerLoad(u => u.AuditDetails).OrderBy(t => t.CompanyName).ThenBy(n => n.FirstName).ToPagedList(page.HasValue ? page.Value - 1 : 0, WBHelper.PageSize(Site)); cutomers.ActionName = "Index"; cutomers.ControllerName = "Adminusers"; if (!PagingInputValidator.IsPagingInputValid(ref page, cutomers)) { return(View()); } return(View(cutomers)); } }
public ViewResult Index(FormCollection collection, int?page) { ViewBag.Email = collection["txtEmail"] ?? Request.QueryString["email"]; ViewBag.Name = collection["txtName"] ?? Request.QueryString["name"]; string strName = ViewBag.Name, strEmail = ViewBag.Email; if (Request.Form["btnExport"] != null && Request.Form["btnExport"].ToString().ToLower().Equals("export to csv")) { ExportDataToCSV(strName, strEmail); return(View()); } else { if (!PagingInputValidator.IsPagingInputValid(ref page)) { return(View()); } var cutomers = _service.GetCustomerList(Site.ID, strName, strEmail).OrderBy(ord => ord.TotalPurchase).ThenBy(t => t.CompanyName).ThenBy(n => n.FirstName).ToPagedList(page.HasValue ? page.Value - 1 : 0, WBHelper.PageSize(Site)); cutomers.ActionName = "Index"; cutomers.ControllerName = "Customer"; if (!PagingInputValidator.IsPagingInputValid(ref page, cutomers)) { return(View()); } return(View(cutomers)); } }
public ViewResult Index(int?page) { if (!PagingInputValidator.IsPagingInputValid(ref page)) { return(View()); } var Testimaonial = _repository.Find(t => t.SiteID == Site.ID && t.RecordStatusID != (int)TestimonialStatus.DELETED).ToPagedList(page.HasValue ? page.Value - 1 : 0, WBHelper.PageSize(Site)); Testimaonial.ActionName = "index"; Testimaonial.ControllerName = "testimonials"; if (!PagingInputValidator.IsPagingInputValid(ref page, Testimaonial)) { return(View()); } return(View(Testimaonial)); }
// // GET: /Admin/PromoCode/ public ActionResult Index(FormCollection collection, int?page) { ViewBag.PromoCode = collection["txtPromoCode"] ?? Request.QueryString["promo"]; ViewBag.Status = collection["ddlStatus"] ?? Request.QueryString["status"]; ViewBag.ProductID = collection["ddlProducts"] ?? Request.QueryString["productid"]; if (!PagingInputValidator.IsPagingInputValid(ref page)) { return(View()); } int ProductID = !string.IsNullOrEmpty(ViewBag.ProductID) ? Convert.ToInt16(ViewBag.ProductID) : 0; int Status = !string.IsNullOrEmpty(ViewBag.Status) ? Convert.ToInt16(ViewBag.Status) : 0; string PromoCode = Convert.ToString(ViewBag.PromoCode); IPagedList <PromoCode> lstPromo = null; if (Status == 2) { lstPromo = _repository.Find(pc => pc.SiteID == Site.ID && pc.Code.Contains((string.IsNullOrEmpty(PromoCode) ? pc.Code : PromoCode)) && pc.ProductID == (ProductID > 0 ? ProductID : pc.ProductID) && System.Data.Entity.DbFunctions.DiffDays(DateTimeWithZone.Now, pc.EndDate) < 0 ).OrderByDescending(pc => pc.AuditDetails.DateCreated).ToPagedList(page.HasValue ? page.Value - 1 : 0, WBHelper.PageSize(Site)); } else { lstPromo = _repository.Find(pc => pc.SiteID == Site.ID && pc.Code.Contains((string.IsNullOrEmpty(PromoCode) ? pc.Code : PromoCode)) && pc.ProductID == (ProductID > 0 ? ProductID : pc.ProductID) && System.Data.Entity.DbFunctions.DiffDays((Status == 1 ? DateTimeWithZone.Now : pc.EndDate), pc.EndDate) >= 0 ).OrderByDescending(pc => pc.AuditDetails.DateCreated).ToPagedList(page.HasValue ? page.Value - 1 : 0, WBHelper.PageSize(Site)); } ViewBag.Products = from pro in _service.GetAllProductAvailablity(Site.ID).ToList() select pro.Product; ViewBag.PromoCode = PromoCode; ViewBag.Status = Status == 0 ? "" : Status.ToString(); ViewBag.ProductID = ProductID == 0 ? "" : ProductID.ToString(); if (!PagingInputValidator.IsPagingInputValid(ref page, lstPromo)) { return(View()); } return(View(lstPromo)); }