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

📄 dictedit.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.BLL.SystemManage;
using Itsv.Model;
/// <summary>
/// 功能描述
/// </summary>
/// <remarks>
/// 完成人: 
/// 完成时间:
/// </remarks>
public partial class SystemManage_DictEdit : 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"];
                this.lblLaycode.Text = Server.UrlDecode(Request.QueryString["layer"]);
                this.txtparent.Text = lblLaycode.Text;
                this.lblId.Text = Request.QueryString["dictid"];
                if (this.lblId.Text.Trim().Length > 0)
                {
                    this.SetDate(int.Parse(this.lblId.Text));
                }
                else
                {
                    this.ShowMessage("参数错误");
                }
            }

        }

    }
    /// <summary>
    /// 验证数据
    /// </summary>
    /// <returns></returns>
    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;

    }
    /// <summary>
    /// 获取数据
    /// </summary>
    /// <param name="dictid">字典编号</param>
    private void SetDate(int dictid)
    {
        dictionaryBLL dictbll=new dictionaryBLL();
        dictionary dict = dictbll.GetModel(dictid, ref msg);
        if (dict == null)
        {
            this.ShowMessage(msg);
            return;
        }
        this.txtdict_code.Text = dict.dict_code;
        this.txtdict_name.Text = dict.dict_name;
        this.lblParentcode.Text = dict.parent_id.ToString();
        this.ckbInuse.Checked = dict.dict_inuse;
        dict = null;
        dictbll = null;
 
    }
    /// <summary>
    /// 保存数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    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.lblParentcode.Text);
        dict.dict_order = 0;
        dict.dict_inuse = true;
        dict.dict_id = int.Parse(this.lblId.Text); 


        dictionaryBLL dictbll = new dictionaryBLL();
        if (dictbll.Update(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);
    }
    /// <summary>
    /// 返回处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    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 + -