Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public ThreadCateCollection GetAllCates()
        {
            if (allThreadCates == null)
            {
                allThreadCates = ThreadCateDao.Instance.GetAllCates();
            }

            return(allThreadCates);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("save"))
            {
                Save();
            }

            CateList = ThreadCateBO.Instance.GetAllCates();
            TotalCount = CateList.Count;
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("save"))
            {
                Save();
            }

            CateList   = ThreadCateBO.Instance.GetAllCates();
            TotalCount = CateList.Count;
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }