⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dictadd.aspx.cs

📁 CRM管理系统 CRM管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Itsv.Model;
using Itsv.BLL.SystemManage;
public partial class SystemManage_DictAdd : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!this.IsPostBack)
        {
            this.CheckUserState();
            if (Request.QueryString["parentcode"] != null)
            {
                this.lblParentcode.Text = Request.QueryString["parentcode"];
                if (!IsInt(this.lblParentcode.Text))
                {
                    this.ShowMessage("参数错误");
                    return;
                }
                this.txtdict_code.Text = this.lblParentcode.Text;

                this.lblLaycode.Text = Server.UrlDecode(Request.QueryString["layer"]);
                this.txtparent.Text = lblLaycode.Text;

            }

        }

    }
    /// <summary>
    /// 得到字典编号
    /// </summary>
    /// <param name="dictid"></param>
    /// <returns></returns>
    private string GetParentCode(int dictid)
    {
        if (dictid == 0)
        {
            return dictid.ToString();
        }

        dictionaryBLL dicbll = new dictionaryBLL();
        dictionary dict= dicbll.GetModel(dictid, ref msg);
        dicbll = null;
        if (dict != null)
        {
            return dict.dict_code;
        }
        else
        {
            this.ShowMessage(msg);
            return "0";
        }
    }
    private bool CheckData()
    {
        this.msg = string.Empty;
        if (this.txtdict_code.Text.Trim().Length <= 0)
            this.msg += "字典编号不能为空\\r\\n";
        if (this.txtdict_name.Text.Trim().Length <= 0)
            this.msg += "字典名称不能为空\\r\\n";
        if (this.msg == string.Empty)
            return true;
        return false;

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (!this.CheckData())
        {
            this.ShowMessage(this.msg);
            return;
        }
        dictionary dict = new dictionary();
        dict.dict_code = this.txtdict_code.Text;
        dict.dict_name = this.txtdict_name.Text;
        dict.parent_id = int.Parse(this.txtdict_code.Text);
        dict.dict_order = 0;
        dict.dict_inuse = true;

        
        dictionaryBLL dictbll = new dictionaryBLL();
        if (dictbll.Add(dict, ref msg))
        {
            this.WriteUserAction("添加字典:"+dict.dict_name);
            Response.Redirect("Dictmanage.aspx?parentcode=" + lblParentcode.Text + "&layer=" + Server.UrlEncode(lblLaycode.Text) + "&action=2");
        }
        else
            this.ShowMessage(this.msg);
    }
    protected void btnReturn_Click(object sender, EventArgs e)
    {
        Response.Redirect("Dictmanage.aspx?parentcode=" + lblParentcode.Text + "&layer=" + Server.UrlEncode(lblLaycode.Text) + "&action=2");

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -