public static Category GetCategoryByID(int CategoryID) { Category category = null; DataTable dtCategories = SQLWrapper.GetDataTable(new SelectQueryData { TableName = "CMN_Categories", FilterCondition = "CategoryID = " + CategoryID.ToString(), OrderBy = "Sequence" }); if (dtCategories.Rows.Count > 0) { category = new Category(); category.CategoryID = Convert.ToInt32(dtCategories.Rows[0]["CategoryID"]); category.CategoryName = dtCategories.Rows[0]["CategoryName"].ToString(); category.ForUser = DALAppUser.GetUserByID(Convert.ToInt32(dtCategories.Rows[0]["UserID"])); category.Sequence = Convert.ToInt32(dtCategories.Rows[0]["Sequence"]); } return category; }
private int getIndexOfCategory(Category category) { int returnData = -1; for (int i = 0; i <= chklstCategory.Items.Count - 1; i++) { Category cat = (Category)chklstCategory.Items[i]; if (cat.CategoryID == category.CategoryID) { returnData = i; break; } } return returnData; }