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 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() { SearchCriteria = string.Empty; CurrentPage = 1; FirstItemIndex = 0; TotalRecords = 0; LastItemIndex = 0; SearchResults = new List <Customer_SearchResult>(); AdvSearchCriteria = new AdvSearchCriteria(); }