public ActionResult ListOutletVisitReasonsTypes(bool? showInactive, int itemsperpage = 10, int page = 1, string srchparam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } ViewBag.srchparam = srchparam; var currentPageIndex = page - 1 < 0 ? 0 : page - 1; var take = itemsperpage; var skip = currentPageIndex * take; var query = new QueryStandard { Name = srchparam, ShowInactive = showinactive, Skip = skip, Take = take }; var ls = _outletVisitReasonsTypeViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data.ToList(); return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { ViewBag.msg = ex.Message; return View(); } }
public QueryResult<Distributor> Query(QueryStandard query) { IQueryable<tblCostCentre> distributorquery; if (query.ShowInactive) distributorquery = _ctx.tblCostCentre.Where(p => p.IM_Status != (int)EntityStatus.Deleted && p.CostCentreType==(int)CostCentreType.Distributor).AsQueryable(); else distributorquery = _ctx.tblCostCentre.Where(p => p.IM_Status == (int)EntityStatus.Active && p.CostCentreType == (int)CostCentreType.Distributor).AsQueryable(); var queryResult = new QueryResult<Distributor>(); if (!string.IsNullOrEmpty(query.Name)) { distributorquery = distributorquery.Where(p => p.Name.ToLower().Contains(query.Name.ToLower()) || p.Distributor_Owner.ToLower().Contains(query.Name.ToLower()) || p.tblRegion.Name.ToLower().Contains(query.Name.ToLower())); } queryResult.Count = distributorquery.Select(Map).OfType<Distributor>().ToList().Count(); distributorquery = distributorquery.OrderBy(p => p.Name).ThenBy(p => p.Cost_Centre_Code); if (query.Skip.HasValue && query.Take.HasValue) distributorquery = distributorquery.Skip(query.Skip.Value).Take(query.Take.Value); queryResult.Data = distributorquery.Select(Map).OfType<Distributor>().ToList(); return queryResult; }
public ActionResult ListProductPricingTiers(Boolean showInactive= false, int page=1, int itemsperpage=10, string srchParam="") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) ViewBag.msg = TempData["msg"]; ViewBag.showInactive = showInactive; ViewBag.srchParam = srchParam; int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex * take; var query = new QueryStandard() { Skip = skip, Take = take, Name = srchParam, ShowInactive = showInactive }; var ls = _productPricingTierViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { _log.ErrorFormat("Error in listing product pricing tier" + ex.Message); _log.InfoFormat("Error in listing product pricing tier " + ex.Message); return View(); } }
public ActionResult ListMarketAudits(bool? showInactive, string srchParam, int page = 1, int itemsperpage = 10) { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; ViewBag.SearchText = srchParam; int currentPageIndex = page < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex*take; var query = new QueryStandard() {ShowInactive = showinactive, Name = srchParam, Skip = skip, Take = take}; var ls = _marketAuditViewmodelbuilder.Query(query); var data = ls.Data; var count = ls.Count; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); }
public ActionResult ListBanks(bool? showInactive, string srchParam = "", int page = 1, int itemsperpage = 10) { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; ViewBag.SearchText = srchParam; var currentPageIndex = page-1 < 0 ? 0 : page-1; var take = itemsperpage; var skip = currentPageIndex * take; var query = new QueryStandard { Name = srchParam, ShowInactive = showinactive, Skip = skip, Take = take }; var ls = _bankViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data.ToList(); return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (DomainValidationException dve) { ValidationSummary.DomainValidationErrors(dve,ModelState); return View(); } catch (Exception ex) { _log.Debug("Failed to list bank" + ex.Message); _log.Error("Failed to list bank" + ex.ToString()); return View(); } }
public ActionResult Index(int page = 1, int itemsperpage = 10, bool showInactive = false, string srchParam = "") { if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } try { ViewBag.srchParam=srchParam; ViewBag.showInactive = showInactive; int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex * take; var query = new QueryStandard { Skip = skip, Take = take,Name=srchParam,ShowInactive=showInactive }; var result = _productBrandRepository.Query(query); var item = result.Data.Cast<ProductBrand>().ToList(); var total = result.Count; var data = item.ToPagedList(currentPageIndex, take, total); return View(data); } catch (Exception ex) { TempData["msg"] = "Error loading Agrimanagr Settings\nDetails:" + ex.Message; } return View(); }
public ActionResult Index(int page = 1, bool showInactive = false, string srchParam = "") { if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } try { var user = (CustomIdentity)this.User.Identity; Guid? supplerid = user != null ? user.SupplierId : (Guid?)null; ViewBag.srchParam = srchParam; ViewBag.showInactive = showInactive; ViewBag.SearchText = srchParam; int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = DistributorWebHelper.GetItemPerPage(); int skip = currentPageIndex * take; var query = new QueryStandard { Skip = skip, Take = take, Name = srchParam, ShowInactive = showInactive, SupplierId = supplerid }; var result = _productRepository.Query(query); var item = MapToViewModel(result.Data.Cast<Product>()); int total = result.Count; var data = item.ToPagedList(currentPageIndex, take, total); return View(data); } catch (Exception ex) { TempData["msg"] = "Error loading products \nDetails:" + ex.Message; } return View(); }
public QueryResult<AdminProductPackagingTypeViewModel> Query(QueryStandard query) { var queryResult = _productPackagingTypeRepository.Query(query); var result = new QueryResult<AdminProductPackagingTypeViewModel>(); result.Count = queryResult.Count; result.Data = queryResult.Data.Select(Map).ToList(); return result; }
public QueryResult<ProductPricingTierViewModel> Query(QueryStandard query) { var queryResult = _productPricingTierRepository.Query(query); var result = new QueryResult<ProductPricingTierViewModel>(); result.Count = queryResult.Count; result.Data = queryResult.Data.Select(Map).ToList(); return result; }
public ActionResult ListSuppliers(bool showInactive = false, int page = 1, int itemsperpage = 10, string srchParam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } ViewBag.srchParam = srchParam; stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; // Format and display the TimeSpan value. string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.TotalMilliseconds); stopWatch.Reset(); _log.InfoFormat("Product Brand\tTime taken to get all product brands" + elapsedTime); _auditLogViewModelBuilder.AddAuditLog(this.User.Identity.Name, "Timestamp", "Product Brand Controller:" + elapsedTime, DateTime.Now); var user = (CustomIdentity) this.User.Identity; Guid? supplierId = user.SupplierId != null ? user.SupplierId : (Guid?) null; ViewBag.srchParam = srchParam; var currentPageIndex = page - 1 < 0 ? 0 : page - 1; var take = itemsperpage; var skip = currentPageIndex * take; var query = new QueryStandard { Name = srchParam, ShowInactive = showinactive, Skip = skip, Take = take, SupplierId = supplierId}; var ls = _supplierViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage,total)); } catch (Exception ex) { ViewBag.msg = ex.Message; return View(); } }
public QueryResult<TerritoryViewModel> Query(QueryStandard query) { var queryResult = _territoryRepository.Query(query); var result = new QueryResult<TerritoryViewModel>(); result.Count = queryResult.Count; result.Data = queryResult.Data.Select(Map).ToList(); return result; }
public QueryResult<CommodityTypeViewModel> Query(QueryStandard query) { var queryResult = _commodityTypeRepository.Query(query); var results = new QueryResult<CommodityTypeViewModel>(); results.Count = queryResult.Count; results.Data = queryResult.Data.Select(Map).ToList(); return results; }
public QueryResult<AssetTypeViewModel> Query(QueryStandard query) { var result = _assetTypeRepository.Query(query); var queryResult = new QueryResult<AssetTypeViewModel>(); queryResult.Data = result.Data.Select(Map).ToList(); queryResult.Count = result.Count; return queryResult; }
public QueryResult<MarketAuditViewModel> Query(QueryStandard q) { var queryResult = _marketAuditRepository.Query(q); var result = new QueryResult<MarketAuditViewModel>(); result.Data = queryResult.Data.Select(Map).ToList(); result.Count = queryResult.Count; return result; }
public ActionResult ListCountry(int page = 1, int itemsperpage = 10, bool showinactive = false, string srchparam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } /* bool showinactive = false;*/ if (showinactive != null) showinactive = (bool)showinactive; ViewBag.srchparam = srchparam; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } //IList<CountryViewModel> country = _countryViewModelBuilder.GetAll(showinactive); //var countries = _countryViewModelBuilder.GetAll(showinactive); //var coutriesPagedList = countries.AsPagination(page ?? 1, pageSize); //var countriesListContainer = new CountryViewModel //{ // countriesPagedList = coutriesPagedList //}; //return View(countriesListContainer); //var ls = _countryViewModelBuilder.GetAll(showinactive); //int currentPageIndex = page.HasValue ? page.Value - 1 : 0; int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex * take; var query = new QueryStandard(); query.ShowInactive = showinactive; query.Skip = skip; query.Take = take; query.Name = srchparam; var ls = _countryViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { _log.Debug("Failed to list country" + ex.Message); _log.Error("Failed to list country" + ex.ToString()); return View(); } }
public QueryResult<TargetPeriodViewModel> Query(QueryStandard query) { var queryResult = _targetPeriodRepository.Query(query); var result = new QueryResult<TargetPeriodViewModel>(); result.Data = queryResult.Data.OfType<TargetPeriod>().Select(Map).ToList(); result.Count = queryResult.Count; return result; }
public QueryResult<OutletTypeViewModel> Query(QueryStandard q) { var queryResult = _outletTypeRepository.QueryResult(q); var result = new QueryResult<OutletTypeViewModel>(); result.Data = queryResult.Data.Select(Map).ToList(); result.Count = queryResult.Count; return result; }
public ActionResult ListAssetStatus(bool? showInactive, string srchParam, int page = 1, int itemsperpage = 10) { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool) showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } ViewBag.SearchText = srchParam; int currentPageIndex = page < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex*take; var query = new QueryStandard() { ShowInactive = showinactive, Name = srchParam, Skip = skip, Take = take }; var ls = _assetStatusViewModelBuilder.Query(query); var data = ls.Data; var count = ls.Count; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); } catch (Exception ex) { _log.Debug("Failed to list asset type" + ex.Message); _log.Error("Failed to list asset type" + ex.ToString()); ViewBag.msg = ex.Message; return View(); } }
public QueryResult<Hub> Query(QueryStandard query) { IQueryable<tblCostCentre> costCentreQuery; //retreave inactive costCentres if (query.ShowInactive) costCentreQuery = _ctx.tblCostCentre.Where( p => p.IM_Status != (int)EntityStatus.Deleted && p.CostCentreType==(int)CostCentreType.Hub).AsQueryable(); else //retreave active costCentres costCentreQuery = _ctx.tblCostCentre.Where( p => p.IM_Status == (int)EntityStatus.Active && p.CostCentreType == (int)CostCentreType.Hub).AsQueryable(); var queryResult = new QueryResult<Hub>(); //excecute search filter if (!string.IsNullOrEmpty(query.Name)) { costCentreQuery = costCentreQuery.Where(p => p.Name.ToLower() .Contains(query.Name.ToLower()) || p.Cost_Centre_Code.ToLower() .Contains(query.Name.ToLower()) || p.tblRegion.Name.ToLower() .Contains(query.Name.ToLower())); } //order costCentreQuery costCentreQuery = costCentreQuery.OrderBy(p => p.Name). ThenBy(p => p.Cost_Centre_Code). ThenBy(p => p.tblRegion.Name); //paging if (query.Skip.HasValue && query.Take.HasValue) costCentreQuery = costCentreQuery.Skip(query.Skip.Value).Take(query.Take.Value); queryResult.Count = costCentreQuery.Count(); queryResult.Data = costCentreQuery.Select(Map).OfType<Hub>().ToList(); return queryResult; }
public ActionResult ListTerritory(Boolean? showInactive, int itemsperpage = 10, int page = 1, string srchParam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; ViewBag.searchText = srchParam; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } int currentPageIndex = page; int take = itemsperpage; int skip = currentPageIndex*take; var query = new QueryStandard() { Name = srchParam, ShowInactive = showinactive, Skip = skip, Take = take }; var ls = _territoryViewModelBuilder.Query(query); var data = ls.Data; var count = ls.Count; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); } catch (Exception ex) { _log.Debug("Failed to list country region" + ex.Message); _log.Error("Failed to list country region" + ex.ToString()); return View(); } }
public ActionResult ListDiscountGroups(bool? showInactive, int page = 1, int itemsperpage = 10, string searchText = "") { try { var user = (CustomIdentity)this.User.Identity; Guid? supplierId = user.SupplierId != null ? user.SupplierId : (Guid?) null; if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } ViewBag.searchParam = searchText; int currentPageIndex = page < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex*take; var query = new QueryStandard() { Name = searchText, Skip = skip, Take = take, SupplierId = supplierId }; var ls = _discountGroupViewModelBuilder.Query(query); var data = ls.Data; var count = ls.Count; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); } catch (Exception ex) { ViewBag.msg = ex.Message; return View(); } }
public ActionResult ListHubs(Boolean? showInactive, int page = 1, int itemsperpage=10, string srchParam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool) showInactive; ViewBag.showInactive = showinactive; ViewBag.srchParam = srchParam; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } // var ls = _hubViewModelBuilder.GetAll(showinactive); int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = itemsperpage ; int skip = take*currentPageIndex; var query = new QueryStandard() { ShowInactive = showinactive, Skip = skip, Take = take, Name = srchParam }; var ls = _hubViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { _log.Debug("Failed to list hubs " + ex.Message); _log.Error("Failed to list hubs" + ex.ToString()); return View(); } }
public ActionResult ListDistributors(bool showInactive = false, int page = 1, int itemsperpage = 10, string srchparam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (Session["msg"] != null) { ViewBag.msg = Session["msg"].ToString(); Session["msg"] = null; } ViewBag.searchParam = srchparam; ViewBag.items = itemsperpage; var currentPageIndex = page - 1 < 0 ? 0 : page - 1; var take = itemsperpage; var skip = currentPageIndex * take; var query = new QueryStandard { Name = srchparam, ShowInactive = showinactive, Skip = skip, Take = take }; var ls = _DistributorViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data.ToList(); return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { _log.Debug("Failed to list distributor" + ex.Message); _log.Error("Failed to list distributor" + ex.ToString()); ViewBag.msg = ex.Message; HQMailerViewModelBuilder hqm = new HQMailerViewModelBuilder(ConfigurationSettings.AppSettings["ServerIP"], ConfigurationSettings.AppSettings["UserName"], ConfigurationSettings.AppSettings["Password"]); hqm.Send(ConfigurationSettings.AppSettings["ServerEmail"], ConfigurationSettings.AppSettings["MailGroup"], "Test", "Distributor listing error:" + ex.Message); return View(); } }
public ActionResult ListSaleValueDiscounts(bool? showInactive, int page = 1, int itemsperpage = 10, string searchText = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; ViewBag.searchParam = searchText; ViewBag.msg = null; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } int currentPageIndex = page < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex*take; var query = new QueryStandard() { Name = searchText, Skip = skip, Take = take }; var ls = _saleValueDiscountViewModelBuilder.Query(query); var data = ls.Data; var count = ls.Count; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); } catch (Exception ex) { ViewBag.msg = ex.Message; return View(); } }
public ActionResult ListContactTypes(bool? showInactive, int page = 1, int itemsperpage = 10, string srchparam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } ViewBag.srchParam = srchparam; int currentPageIndex = page < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex * take; var query = new QueryStandard(); query.ShowInactive = showinactive; query.Skip = skip; query.Take = take; query.Name = srchparam; var result = _contactTypeViewModelBuilder.Query(query); var count = result.Count; var data = result.Data.ToList(); return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); } catch (Exception ex) { _log.Debug("Failed to list contact types" + ex.Message); _log.Error("Failed to list contact types" + ex.ToString()); return View(); } }
public ActionResult ListCompetitors(bool showInactive = false, int page = 1, int itemsperpage = 10, string srchParam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } /* IList<CompetitorViewModel> ls; ls = !string.IsNullOrWhiteSpace(searchText) ? _competitorViewModeBuilder.Search(searchText, showinactive) : _competitorViewModeBuilder.GetAll(showinactive); int currentPageIndex = page.HasValue ? page.Value - 1 : 0;*/ ViewBag.srchParam = srchParam; int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex * take; var query = new QueryStandard() { Skip = skip, Take = take, Name = srchParam, ShowInactive = showInactive }; var ls = _competitorViewModeBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage , total)); } catch (Exception ex) { _log.Debug("Failed to list competitor " + ex.Message); _log.Error("Failed to list competitor " + ex.ToString()); ViewBag.msg = ex.Message; return View(); } }
public ActionResult ListRegion(Boolean? showInactive, int page = 1, int itemsperpage = 10, string srchParam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; ViewBag.srchParam = srchParam; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } //var ls = _regionViewModelBuilder.GetAll(showinactive); //int currentPageIndex = page.HasValue ? page.Value - 1 : 0; int currentPageIndex = page < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex*take; var query = new QueryStandard(); query.ShowInactive = showinactive; query.Skip = skip; query.Take = take; query.Name = srchParam; var ls = _regionViewModelBuilder.Query(query); var count = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count)); } catch (Exception ex) { _log.Debug("Failed to list region" + ex.Message); _log.Error("Failed to list region" + ex.ToString()); return View(); } }
public ActionResult ListTerritory(Boolean? showInactive, int page = 1, int itemsperpage = 10, string srchParam = "") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } /* var ls = _territoryViewModelBuilder.GetAll(showinactive); int currentPageIndex = page.HasValue ? page.Value - 1 : 0; return View(ls.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage)); //return View(ls);*/ ViewBag.srchParam = srchParam; var currentPageIndex = page - 1 < 0 ? 0 : page - 1; var take = itemsperpage; var skip = currentPageIndex * take; var query = new QueryStandard { Name = srchParam, ShowInactive = showinactive, Skip = skip, Take = take }; var ls = _territoryViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { _log.Debug("Failed to list territory" + ex.Message); _log.Error("Failed to list territory" + ex.ToString()); return View(); } }
public ActionResult ListContacts(bool? showInactive, Guid? CostCentre, int? ContactOwner, int itemsperpage = 10, int page = 1, string srchparam = "") { ViewBag.contactOwnerList = AcceptedContactOwnerTypes();// _contactModelViewBuilder.ContactOwner(); ViewBag.contactOwner = null; try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } ViewBag.CostCentre = CostCentre; bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; ViewBag.ContactsFor = "All"; if (TempData["msg"] != null) { ViewBag.msg = TempData["msg"].ToString(); TempData["msg"] = null; } ViewBag.SearchText = srchparam; var currentPageIndex = page - 1 < 0 ? 0 : page - 1; var take = itemsperpage; var skip = currentPageIndex * take; var query = new QueryStandard { Name = srchparam, ShowInactive = showinactive, Skip = skip, Take = take }; var ls = _contactModelViewBuilder.Query(query); var total = ls.Count; var data = ls.Data.ToList(); return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception ex) { ViewBag.msg = ex.Message; var errorContactList = new ContactViewModel(); errorContactList.ErrorText = ex.Message; // return View(errorContactList); return View(); } }
public ActionResult ListProductPackaging(Boolean showInactive=false, int page=1, int itemsperpage=10, string srchParam="") { try { if (itemsperpage != null) { ViewModelBase.ItemsPerPage = itemsperpage; } bool showinactive = false; if (showInactive != null) showinactive = (bool)showInactive; ViewBag.showInactive = showinactive; if (Session["msg"] != null) { ViewBag.msg = Session["msg"].ToString(); Session["msg"] = null; } ViewBag.showInactive = showInactive; ViewBag.srchParam = srchParam; int currentPageIndex = page - 1 < 0 ? 0 : page - 1; int take = itemsperpage; int skip = currentPageIndex * take; var query = new QueryStandard() { Skip = skip, Take = take, Name = srchParam, ShowInactive = showInactive }; var ls = _adminProductPackaginViewModelBuilder.Query(query); var total = ls.Count; var data = ls.Data; return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total)); } catch (Exception exx) { _log.InfoFormat("Failed to load product packaging. error message="+exx.Message); _log.Error("Failed to load product packaging"+exx.Message); _log.Debug("Failed to load product packaging"+exx.Message); _log.Error("Failed to load product packaging"+exx.ToString()); ViewBag.msg = exx.Message; return View(); } }