示例#1
0
    protected void InitInfo()
    {
        categoryId = CECRequest.GetQueryInt("categoryid", 0);
        Action     = CECRequest.GetQueryString("action");

        if (Action == "del")
        {
            bool isDelete = ArticleCategoryManage.DeleteCategory(categoryId);
            if (!isDelete)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "DelError", "alert('该分类可能有字分类,请先删掉子分类!');window.location.href='categorylist.aspx';", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "DeleSuccess", "alert('删除成功!');window.location.href='categorylist.aspx';", true);
            }
            return;
        }

        this.ddlcategoryList.BuildTree(ArticleCategoryManage.GetArticleCategoryTable(), "CategoryName", "CategoryId");
        this.ddlcategoryList.SelectedValue = categoryId.ToString();
        if (Action.ToLower() == "edit")
        {
            categoryInfo = ArticleCategoryManage.GetArticleCategoryInfo(categoryId);
            this.ddlcategoryList.SelectedValue = categoryInfo.ParentId.ToString();
        }
    }
示例#2
0
    void InitInfo()
    {
        this.ddlcategoryList.BuildTree(ArticleCategoryManage.GetArticleCategoryTable(), "CategoryName", "CategoryId");

        categoryId = CECRequest.GetQueryInt("CategoryId", 0);
        this.ddlcategoryList.SelectedValue = this.SqlDataSource_rptList.SelectParameters[0].DefaultValue = categoryId.ToString();
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Action.ToLower() == "edit")
            {
                if (categoryId > 0)
                {
                    this.txtName.Text            = categoryInfo.CategoryName;
                    this.txtSort.Text            = categoryInfo.Sort.ToString();
                    this.ddlcategoryList.Enabled = false;
                }
            }



            DataTable dt = ArticleCategoryManage.GetArticleCategoryTable();
            ViewState["dt"] = dt;

            if (dt.Rows.Count > 0)
            {
                AddTree(0, dt.Select("Layer=0 AND [ParentId]=0"), "");
                str  = "<script type=\"text/javascript\">\r\n  var obj = [" + str;
                str  = str.Substring(0, str.Length - 3);
                str += "];\r\n var newtree = new tree(\"newtree\",obj,\"reSetTree\");";
                str += "</script>";
            }
            ShowTreeLabel.Text = str;
        }
    }
示例#4
0
    void btnSave_Click(object sender, EventArgs e)
    {
        if (Action.ToLower() == "edit")
        {
            categoryInfo = new ArticleCategoryInfo();
            categoryInfo.CategoryName = txtName.Text;
            categoryInfo.Sort         = Convert.ToInt32(txtSort.Text);
            categoryInfo.CategoryId   = categoryId;
            ArticleCategoryManage.UpdateArticleCategory(categoryInfo);
        }
        else
        {
            if (this.ddlcategoryList.SelectedValue != "0")
            {
                int _id = Utils.StrToInt(this.ddlcategoryList.SelectedValue, 0);
                categoryInfo = ArticleCategoryManage.GetArticleCategoryInfo(_id);
                if (categoryInfo != null)
                {
                    string parentIdList = string.Empty;
                    if (categoryInfo.ParentIdList == "0")
                    {
                        parentIdList = categoryInfo.CategoryId.ToString();
                    }
                    else
                    {
                        parentIdList = categoryInfo.ParentIdList + "," + categoryInfo.CategoryId;
                    }
                    int       maxOrder = 0;
                    DataTable dt       = ArticleCategoryManage.GetSubCategoryListTable(_id);
                    if (dt.Rows.Count > 0)
                    {
                        maxOrder = TypeConverter.ObjectToInt(dt.Compute("Max(Sort)", ""));
                    }
                    else
                    {
                        maxOrder = categoryInfo.Sort;
                    }

                    InsertCategory(_id, categoryInfo.Layer + 1, parentIdList, 0, maxOrder);
                    ArticleCategoryManage.UpdateSubCategoryCount(_id);
                }
            }
            else
            {
                int maxdisplayorder = TypeConverter.ObjectToInt(ArticleCategoryManage.GetArticleCategoryTable().Compute("Max(Sort)", "")) + 1;
                InsertCategory(0, 0, "0", 0, maxdisplayorder);
            }
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "SaveSuccess", "alert('添加成功!');window.location.href='categorylist.aspx';", true);
    }
示例#5
0
    void InitInfo()
    {
        articleId  = CECRequest.GetQueryInt("articleid", 0);
        action     = CECRequest.GetQueryString("action");
        categoryId = CECRequest.GetQueryInt("categoryid", 0);

        if (action.ToLower() == "del")
        {
            ArticleManage.Delete(articleId);
            Response.Redirect("articlelist.aspx");
            return;
        }

        this.PublishDate.SelectedDate = DateTime.Now;
        this.ddlcategoryList.BuildTree(ArticleCategoryManage.GetArticleCategoryTable(), "CategoryName", "CategoryId");
        this.ddlcategoryList.SelectedValue = categoryId.ToString();
    }