public bool UpdateThreadCate(AuthUser operatorUser, int cateID, string cateName, bool enable, int sortOrder, IEnumerable <int> enableModelIDs) { if (AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_ThreadCate) == false) { ThrowError(new NoPermissionManageThreadCateError()); return(false); } if (string.IsNullOrEmpty(cateName)) { ThrowError(new EmptyThreadCateNameError("cateName")); return(false); } if (StringUtil.GetByteCount(cateName) > threadCateNameMaxLength) { ThrowError(new InvalidThreadCateNameLengthError("cateName", cateName, threadCateNameMaxLength)); return(false); } int result = ThreadCateDao.Instance.UpdateThreadCate(cateID, cateName, enable, sortOrder); if (result > 0) { allThreadCates = null; EnableModels(operatorUser, cateID, enableModelIDs); } else { ThrowError(new ThreadCateNotExistsError(cateID)); return(false); } return(true); }
public bool CreateThreadCate(AuthUser operatorUser, string cateName, bool enable, int sortOrder) { if (AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_ThreadCate) == false) { ThrowError(new NoPermissionManageThreadCateError()); return(false); } if (string.IsNullOrEmpty(cateName)) { ThrowError(new EmptyThreadCateNameError("cateName")); return(false); } if (StringUtil.GetByteCount(cateName) > threadCateNameMaxLength) { ThrowError(new InvalidThreadCateNameLengthError("cateName", cateName, threadCateNameMaxLength)); return(false); } bool success = ThreadCateDao.Instance.CreateThreadCate(cateName, enable, sortOrder); if (success) { allThreadCates = null; models = null; } return(success); }
public ThreadCateCollection GetAllCates() { if (allThreadCates == null) { allThreadCates = ThreadCateDao.Instance.GetAllCates(); } return(allThreadCates); }
protected void Page_Load(object sender, EventArgs e) { if (_Request.IsClick("save")) { Save(); } CateList = ThreadCateBO.Instance.GetAllCates(); TotalCount = CateList.Count; }
public bool UpdateThreadCates(AuthUser operatorUser, IEnumerable <int> cateIDs, IEnumerable <bool> enables, IEnumerable <int> sortOrders) { if (AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_ThreadCate) == false) { ThrowError(new NoPermissionManageThreadCateError()); return(false); } bool success = ThreadCateDao.Instance.UpdateThreadCates(cateIDs, enables, sortOrders); if (success) { allThreadCates = null; } return(success); }
public bool DeleteThreadCates(AuthUser operatorUser, IEnumerable <int> cateIDs) { if (AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_ThreadCate) == false) { ThrowError(new NoPermissionManageThreadCateError()); return(false); } if (ValidateUtil.HasItems <int>(cateIDs) == false) { return(true); } bool success = ThreadCateDao.Instance.DeleteThreadCates(cateIDs); if (success) { allThreadCates = null; } return(success); }