public static Ui.DataGrid GetCKInCategoryGridByKeywords(string Keywords, string CategoryType, string orderBy, long startRowIndex, int pageSize) { long totalRows = 0; List <SqlParameter> parameters = new List <SqlParameter>(); List <string> conditions = new List <string>(); conditions.Add("1=1"); if (!string.IsNullOrEmpty(Keywords)) { conditions.Add("([InCategoryName] like @Keywords)"); parameters.Add(new SqlParameter("@Keywords", "%" + Keywords + "%")); } if (!string.IsNullOrEmpty(CategoryType)) { conditions.Add("([CategoryType]=@CategoryType)"); parameters.Add(new SqlParameter("@CategoryType", CategoryType)); } string fieldList = "[CKInCategory].*"; string Statement = " from [CKInCategory] where " + string.Join(" and ", conditions.ToArray()); CKInCategory[] list = new CKInCategory[] { }; list = GetList <CKInCategory>(fieldList, Statement, parameters, orderBy, startRowIndex, pageSize, out totalRows).ToArray(); DataAccess.Ui.DataGrid dg = new Ui.DataGrid(); dg.rows = list; dg.total = totalRows; dg.page = pageSize; return(dg); }
private void SetInfo(Foresight.DataAccess.CKInCategory data) { this.tdInCategoryName.Value = data.InCategoryName; this.tdInCategoryDesc.Value = data.InCategoryDesc; this.tdCategoryType.Value = data.CategoryType; IsSystemAdd = data.IsSystemAdd ? 1 : 0; this.tdPrintLineCount.Value = data.PrintLineCount > 0 ? data.PrintLineCount.ToString() : ""; }