public static List<FieldCategory> GetMasterCategorys(params string[] categoryType) { string strWhere = ""; foreach (string ct in categoryType) { if (strWhere != "") { strWhere += " OR "; } strWhere += String.Format("CategoryType='{0}'", ct); } string strSql = string.Format("SELECT * FROM SYS_FieldCategory WHERE ParentID = 0 AND ({0}) ORDER BY Sort", strWhere); DataTable dt = DbHelperSQL.Query(strSql).Tables[0]; List<FieldCategory> list = new List<FieldCategory>(); foreach (DataRow dr in dt.Rows) { FieldCategory fc = new FieldCategory(); fc.FillCategory(dr); list.Add(fc); } return list; }
public static List<FieldCategory> GetCategoryByName(string categoryNames) { string strSql = string.Format("SELECT * FROM SYS_FieldCategory WHERE CategoryName IN({0}) ORDER BY Sort", "'" + categoryNames.Replace(",", "','") + "'"); DataTable dt = DbHelperSQL.Query(strSql).Tables[0]; List<FieldCategory> list = new List<FieldCategory>(); foreach (DataRow dr in dt.Rows) { FieldCategory fc = new FieldCategory(); fc.FillCategory(dr); list.Add(fc); } return list; }
public static List<FieldCategory> GetChildCategories(FieldCategory category) { List<FieldCategory> childCategories = new List<FieldCategory>(); string strSql = "SELECT * FROM SYS_FieldCategory WHERE ParentID = @ParentID ORDER BY Sort"; DataTable dt = SqlText.ExecuteDataset(strSql, "@ParentID", category.ID).Tables[0]; foreach (DataRow dr in dt.Rows) { FieldCategory fc = new FieldCategory(); fc.FillCategory(dr); childCategories.Add(fc); } return childCategories; }
public static List<FieldCategory> GetAllCategorys() { string strSql = "SELECT * FROM SYS_FieldCategory ORDER BY Sort"; DataTable dt = DbHelperSQL.Query(strSql).Tables[0]; List<FieldCategory> list = new List<FieldCategory>(); foreach (DataRow dr in dt.Rows) { FieldCategory fc = new FieldCategory(); fc.FillCategory(dr); list.Add(fc); } return list; }