예제 #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        model.CategoryName     = KillSqlIn.Form_ReplaceByString(Request.Form["txtTitle"], 200);
        model.Sort             = Convert.ToInt32(KillSqlIn.Form_ReplaceByNumber(Request.Form["txtSort"], 4));
        model.AddedUserId      = Convert.ToInt32(_userId);
        model.AddedDate        = Convert.ToDateTime(this.txtAddDate.Text);
        model.ParentCategoryId = Convert.ToInt32(this.ddlParentCategory.SelectedValue);
        model.Type             = 0;//0:文章  1:新闻

        //string BackUrl = "CategoryTree.aspx";

        if (_ACid != "0")
        {
            model.CategoryId = Convert.ToInt32(_ACid);
            bll.Update(model);
            ClientScript.RegisterStartupScript(this.GetType(), "js", "<script>alert('修改成功!');layer_close_refresh();</script>");
            //JSUtility.AlertAndRedirect("修改成功!", BackUrl);

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (" + _ACid + ")";
            //string function = "修改";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
        else
        {
            model.AddedDate = DateTime.Now;
            int id = bll.Add(model);
            bll.UpdateCategoryPermission(id.ToString());
            JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (select top 1 CategoryId from T_Category order by CategoryId desc)";
            //string function = "添加";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
    }