/// <summary> /// AutoComplete Borrowers Suggestions /// </summary> /// <param>term</param> /// <returns>JsonResult</returns> public JsonResult AutoCompleteBorrowers(string term) { try { BorrowersModel obj = new BorrowersModel(); SearchCriteria sc = new SearchCriteria(); SearchCriteria Count = new SearchCriteria(); Count.Text = string.Empty; sc.Text = term; sc.StartIndex = 0; sc.EndIndex = obj.TotalBorrowers(Count); return(Json(obj.GetAllBorrowers(sc), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logging.Error(ex.Message); return(null); } }
/// <summary> /// Brings The DataBack to Borrowers Table Based on Filter /// </summary> /// <param> Table Parameters</param> /// <param> Search Criteria</param> /// <returns>JqDataTable</returns> private JqDataTable <object[]> SearchInBorrowers(jQueryDataTableParamModel param, string searchCriteria) { try { SearchCriteria criteria = ConvertFromJsonToObject <SearchCriteria>(searchCriteria); int startIndex = 0; if (param.iDisplayStart > 0) { startIndex = param.iDisplayStart + 1; } else { startIndex = param.iDisplayStart; } criteria.StartIndex = startIndex; criteria.EndIndex = param.iDisplayStart + param.iDisplayLength; criteria.SortOrder = param.sSortDir_0; criteria.SortingCol = param.iSortCol_0; if (String.IsNullOrWhiteSpace(criteria.Text)) { criteria.Text = String.Empty; } BorrowersModel obj = new BorrowersModel(); int count = obj.TotalBorrowers(criteria); var data = new List <object[]>(); IList <BorrowersModel> bModels = new List <BorrowersModel>(); bModels = obj.GetAllBorrowers(criteria); foreach (BorrowersModel item in bModels) { var array = new object[3]; array[0] = item.ID; array[1] = item.FirstName; array[2] = item.LastName; data.Add(array); } return(new JqDataTable <object[]> { sEcho = param.sEcho, iTotalRecords = count, iTotalDisplayRecords = count, aaData = data }); } catch (Exception ex) { Logging.Error(ex.Message); return(null); } }