public static List <etblChangeHistory> getRecordForSearchRatePlan(OneFineRateAppUtil.jQueryDataTableParamModel param, out int TotalCount, DateTime dtFrom, DateTime dtTo, int PropId) { using (OneFineRateEntities db = new OneFineRateEntities()) { List <etblChangeHistory> user = new List <etblChangeHistory>(); param.sSearch = param.sSearch == null ? "" : param.sSearch; List <etblChangeHistory> changeLst = new List <etblChangeHistory>(); List <etblChangeHistory> objResult = new List <etblChangeHistory>(); SqlParameter[] MyParam = new SqlParameter[3]; MyParam[0] = new SqlParameter("@dtFrom", dtFrom); MyParam[1] = new SqlParameter("@dtTo", dtTo); MyParam[2] = new SqlParameter("@PropId", PropId); objResult = db.Database.SqlQuery <etblChangeHistory>("uspChangeHistoryPropertyRatePlanMap_H @dtFrom,@dtTo,@PropId ", MyParam).ToList(); var result = objResult.Where(a => a.sItem.ToLower().Contains(param.sSearch.ToLower())).ToList(); //get Total Count for show total records TotalCount = result.Count(); ////implemented paging var lstUser = result.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); foreach (var item in lstUser) { changeLst.Add((etblChangeHistory)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new etblChangeHistory())); } return(changeLst); } }
public static List <etblRankManagement> getRecordForSearch(OneFineRateAppUtil.jQueryDataTableParamModel param, out int TotalCount) { using (OneFineRateEntities db = new OneFineRateEntities()) { List <etblRankManagement> RankManagementList = new List <etblRankManagement>(); param.sSearch = param.sSearch == null ? "" : param.sSearch; var objTblRatePlan = db.Database.SqlQuery <etblRankManagement>("uspGetRankManagement").ToList(); var result = objTblRatePlan.Where(a => (a.sHotelName.ToLower().Contains(param.sSearch.ToLower()))); //get Total Count for show total records TotalCount = result.Count(); //for sorting switch (param.iSortingCols) { case 1: result = param.sortDirection == "asc" ? result.OrderBy(u => u.sHotelName) : result.OrderByDescending(u => u.sHotelName); break; case 5: result = param.sortDirection == "asc" ? result.OrderBy(u => u.iNewRank) : result.OrderByDescending(u => u.iNewRank); break; case 6: result = param.sortDirection == "asc" ? result.OrderBy(u => u.sRateDisparity) : result.OrderByDescending(u => u.sRateDisparity); break; } ////implemented paging var lstUser = result.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); //convert bll entity object to db entity object foreach (var item in lstUser) { RankManagementList.Add((etblRankManagement)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new etblRankManagement())); } foreach (var item in RankManagementList) { if (item.iNewRank == 0) { item.iNewRank = null; } } return(RankManagementList); } }
public static List <etblNegotiationNotification> getRecordForSearch(OneFineRateAppUtil.jQueryDataTableParamModel param, out int TotalCount, int propId) { using (OneFineRateEntities db = new OneFineRateEntities()) { List <etblNegotiationNotification> RatePlanLst = new List <etblNegotiationNotification>(); param.sSearch = param.sSearch == null ? "" : param.sSearch; SqlParameter[] MyParam = new SqlParameter[1]; MyParam[0] = new SqlParameter("@propId", propId); var objTblRatePlan = db.Database.SqlQuery <etblNegotiationNotification>("uspNegotiationNotificationList @propId", MyParam).ToList(); var result = objTblRatePlan.Where(a => a.sRatePlan.ToLower().Contains(param.sSearch.ToLower()) || a.sType.ToLower().Contains(param.sSearch.ToLower())); //get Total Count for show total records TotalCount = result.Count(); //for sorting switch (param.iSortingCols) { case 0: result = param.sortDirection == "asc" ? result.OrderBy(u => u.RecId) : result.OrderByDescending(u => u.RecId); break; case 1: result = param.sortDirection == "asc" ? result.OrderBy(u => u.sRatePlan) : result.OrderByDescending(u => u.sRatePlan); break; case 2: result = param.sortDirection == "asc" ? result.OrderBy(u => u.sValidity) : result.OrderByDescending(u => u.sValidity); break; } ////implemented paging var lstUser = result.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); //convert bll entity object to db entity object foreach (var item in lstUser) { RatePlanLst.Add((etblNegotiationNotification)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new etblNegotiationNotification())); } return(RatePlanLst); } }
//Get list of records public static List <PropertyTaxList> getRecordForSearch(OneFineRateAppUtil.jQueryDataTableParamModel param, int propid, out int TotalCount) { using (OneFineRateEntities db = new OneFineRateEntities()) { List <PropertyTaxList> user = new List <PropertyTaxList>(); SqlParameter[] MyParam = new SqlParameter[7]; MyParam[0] = new SqlParameter("@RoomType", param.sSearch + "%"); MyParam[1] = new SqlParameter("@DisplayLength", param.iDisplayLength); MyParam[2] = new SqlParameter("@DisplayStart", param.iDisplayStart); MyParam[3] = new SqlParameter("@SortDirection", param.sortDirection == "asc" ? "A" : "D"); MyParam[4] = new SqlParameter("@SortBy", param.iSortingCols); MyParam[5] = new SqlParameter("@PropId", propid); MyParam[6] = new SqlParameter("@TotalCount", 0); MyParam[6].Direction = System.Data.ParameterDirection.Output; user = db.Database.SqlQuery <PropertyTaxList>("uspGetPropertyTaxByRoomType @RoomType, @DisplayLength, @DisplayStart, @SortDirection, @SortBy,@PropId, @TotalCount out", MyParam).ToList(); //get Total Count for show total records TotalCount = Convert.ToInt16(MyParam[6].Value); //user.Count(); //TotalCount = user.Count(); return(user); } }