private static List<SelectListItem> GetCategorySelectList(long selfID, long categorySelectedID = 0, long parentCategoryID = 0, bool isParent = false) { iCategoryInfoDataProvider = new CategoryInfoDataProvider(); List<SelectListItem> categorySelectList = new List<SelectListItem>(); categorySelectList.Add(new SelectListItem { Text = UntityContent.DropDwonListEmptyName, Value = "0" }); if (isParent) { List<CategoryInfo> CategoryInfos = iCategoryInfoDataProvider.GetParentCategoryList().ToList(); foreach (var item in CategoryInfos) { InsertSelectListItem(categorySelectList, item, 0); } } else if (parentCategoryID > 0) { List<CategoryInfo> CategoryInfos = iCategoryInfoDataProvider.GetCategoryListByParentID(parentCategoryID).ToList(); foreach (var item in CategoryInfos) { InsertSelectListItem(categorySelectList, item, 0); List<CategoryInfo> subCategoryInfos = iCategoryInfoDataProvider.GetCategoryListByParentID(item.ID).ToList(); if (subCategoryInfos.Count > 0) { AddSubCategory(categorySelectList, subCategoryInfos, 0); } } } else { List<CategoryInfo> CategoryInfos = iCategoryInfoDataProvider.GetParentCategoryList().ToList(); foreach (var item in CategoryInfos) { InsertSelectListItem(categorySelectList, item, 0); List<CategoryInfo> subCategoryInfos = iCategoryInfoDataProvider.GetCategoryListByParentID(item.ID).ToList(); if (subCategoryInfos.Count > 0) { AddSubCategory(categorySelectList, subCategoryInfos, 0); } } } if (categorySelectedID > 0) { SelectListItem temp = categorySelectList.Where(c => c.Value == categorySelectedID.ToString()).FirstOrDefault(); if (temp != null) { temp.Selected = true; } } if (selfID > 0) { SelectListItem temp = categorySelectList.Where(c => c.Value == selfID.ToString()).FirstOrDefault(); temp.Disabled = true; } return categorySelectList; }
public ChartController() { this.ICategoryInfoDataProvider = new CategoryInfoDataProvider(); this.IBookInfoDataProvider = new BookInfoDataProvider(); }
public static bool ValidateCategory(long selfID, long categoryID) { _IsSubflag = false; iCategoryInfoDataProvider = new CategoryInfoDataProvider(); CategoryInfo category = iCategoryInfoDataProvider.GetCategoryByID(categoryID); if (category != null) { CategoryCheckSearch(category, selfID); } return _IsSubflag; }
public CategoryManageController() { this.ICategoryInfoDataProvider = new CategoryInfoDataProvider(); }