internal Customer_SearchModel GetCustomersList(string searchCriteria, int pageNumber) { var result = new Customer_SearchModel(); result.SearchCriteria = searchCriteria; result.CurrentPage = pageNumber; if (!string.IsNullOrEmpty(searchCriteria)) { //Logging Log.File.Info(Msg.GenerateLogMsg("Finding Customers... Criteria:", searchCriteria)); // get products var list = Repository.GetCustomers(searchCriteria, pageNumber, Settings.Default.JobSearchPageSize, StoreId); // if list empty if ((list != null) && (list.Count > 0)) { result.CurrentPage = pageNumber; result.SearchResults = list; result.FirstItemIndex = list[0].StartElem; result.TotalRecords = list[0].ElemCount; result.LastItemIndex = list[0].LastElem; } } return(result); }
public Customer_SearchModel GetCustomersList(ClientConnect.Customer.AdvSearchCriteria model, int pageNumber) { var result = new Customer_SearchModel(); result.AdvSearchCriteria = model; result.CurrentPage = pageNumber; if (!string.IsNullOrEmpty(model.Surname) || !string.IsNullOrEmpty(model.TelNo) || !string.IsNullOrEmpty(model.Postcode) || !string.IsNullOrEmpty(model.PolicyNumber) || !string.IsNullOrEmpty(model.ClientCustRef) || !string.IsNullOrEmpty(model.Address)) { //Logging Log.File.Info(Msg.GenerateLogMsg("Finding customers:")); var list = Repository.GetCustomers(model.Surname, model.Postcode, model.TelNo, model.PolicyNumber, model.ClientCustRef, model.Address, model.UseAndInWhereCondition.HasValue?model.UseAndInWhereCondition.Value:false, pageNumber, Settings.Default.JobSearchPageSize, StoreId); if ((list != null) && (list.Count > 0)) { result.CurrentPage = pageNumber; result.SearchResults = list; result.FirstItemIndex = list[0].StartElem; result.TotalRecords = list[0].ElemCount; result.LastItemIndex = list[0].LastElem; } } return(result); }
public Customer_SearchModel GetCustomersList(ClientConnect.Customer.AdvSearchCriteria model, int pageNumber) { var result = new Customer_SearchModel(); result.AdvSearchCriteria = model; result.CurrentPage = pageNumber; if (!string.IsNullOrEmpty(model.Surname) || !string.IsNullOrEmpty(model.TelNo) || !string.IsNullOrEmpty(model.Postcode) || !string.IsNullOrEmpty(model.PolicyNumber) || !string.IsNullOrEmpty(model.ClientCustRef) || !string.IsNullOrEmpty(model.Address)) { //Logging Log.File.Info(Msg.GenerateLogMsg("Finding jobs... Criteria:")); // get products var list = Repository.GetCustomers(model.Surname, model.Postcode, model.TelNo, model.PolicyNumber, model.ClientCustRef, model.Address, pageNumber, Settings.Default.JobSearchPageSize, StoreId); // if list empty //if ((list != null) && (list.Count > 0)) //{ // result.CurrentPage = pageNumber; // result.SearchResults = list; // result.FirstItemIndex = list[0].StartElem; // result.TotalRecords = list[0].ElemCount; // result.LastItemIndex = list[0].LastElem; //} } return(result); }
public ActionResult AdvSearch(int?page) { if (page == null) { page = JobService.SessionInfo.PageNumber == 0 ? 1 : JobService.SessionInfo.PageNumber; } customerService.SessionInfo.PageNumber = page ?? 1; Customer_SearchModel modelsession = new Customer_SearchModel(); AdvSearchCriteria AdvSearchCriteria = new AdvSearchCriteria(); AdvSearchCriteria.Postcode = JobService.SessionInfo.Postcode; AdvSearchCriteria.Surname = JobService.SessionInfo.Surname; AdvSearchCriteria.PolicyNumber = JobService.SessionInfo.PolicyNumber; AdvSearchCriteria.ClientCustRef = JobService.SessionInfo.ClientCustRef; AdvSearchCriteria.Address = JobService.SessionInfo.Address; AdvSearchCriteria.TelNo = JobService.SessionInfo.TelNo; modelsession.AdvSearchCriteria = AdvSearchCriteria; // model.SearchCriteria = JobService.SessionInfo.SearchCriteria; //model.CurrentPage = JobService.SessionInfo.PageNumber; var model = customerService.GetCustomersList(modelsession.AdvSearchCriteria, customerService.SessionInfo.PageNumber); if (model.TotalRecords == 1) { // Checking if user push back button on ShowDetails if (JobService.IsBackButtonPressed) { return(View(model)); } return(RedirectToAction("GoToDetails", new { model.SearchResults[0].CustomerId })); } ViewBag.OnePageOfJobs = new StaticPagedList <Customer_SearchResult>(model.SearchResults, customerService.SessionInfo.PageNumber, Settings.Default.JobSearchPageSize, model.TotalRecords); // return RedirectToAction("AdvSearchCriteria", new { model.AdvSearchCriteria, page }); return(View(model)); }