public override DTO.MaterialTypeMng.SearchFormData GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.MaterialTypeMng.SearchFormData data = new DTO.MaterialTypeMng.SearchFormData(); data.Data = new List <DTO.MaterialTypeMng.MaterialTypeSearchResult>(); totalRows = 0; string MaterialTypeUD = null; string MaterialTypeNM = null; if (filters.ContainsKey("MaterialTypeUD") && !string.IsNullOrEmpty(filters["MaterialTypeUD"].ToString())) { MaterialTypeUD = filters["MaterialTypeUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("MaterialTypeNM") && !string.IsNullOrEmpty(filters["MaterialTypeNM"].ToString())) { MaterialTypeNM = filters["MaterialTypeNM"].ToString().Replace("'", "''"); } //try to get data try { using (MaterialTypeMngEntities context = CreateContext()) { totalRows = context.MaterialTypeMng_function_SearchMaterialType(MaterialTypeUD, MaterialTypeNM, orderBy, orderDirection).Count(); var result = context.MaterialTypeMng_function_SearchMaterialType(MaterialTypeUD, MaterialTypeNM, orderBy, orderDirection); data.Data = converter.DB2DTO_MaterialTypeSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }