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

📄 adddepart.aspx.cs

📁 商机管理系统
💻 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;

public partial class depart_users_adddepart : System.Web.UI.Page
{
    DataSet_sjglxt.departDataTable dbtable = new DataSet_sjglxt.departDataTable();
    DataSet_sjglxtTableAdapters.departTableAdapter depart_Control = new DataSet_sjglxtTableAdapters.departTableAdapter();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["did"] != null)
            {
                HiddenField1.Value = Request.QueryString["did"];
            }
            else
            {
                return;
            }
            if (Request.QueryString["edit"] == "1")
            {
                dbtable.Clear();
                depart_Control.FillByDid(dbtable, HiddenField1.Value);
                Tb_Name.Text = dbtable.Rows[0].ItemArray[3].ToString();
                HiddenField1.Value = dbtable.Rows[0].ItemArray[2].ToString();
            }
        }
    }
    protected void Btn_Apply_Click(object sender, EventArgs e)
    {
        if (Tb_Name.Text == null || Tb_Name.Text == "")
        {
            ClientScript.RegisterStartupScript(e.GetType(),"", "<script>alert('请输入组织名称!')</script>");
            return;
        }
        if (Request.QueryString["edit"] == "1")
        {
            depart_Control.UpdatebyDid(Tb_Name.Text, "在用", HiddenField1.Value);
            ClientScript.RegisterStartupScript(e.GetType(), "", "<script>window.opener.location.href=window.opener.location.href;window.close();</script>");
        }
        else
        {
            int newdepartidint = newdepartid();
            depart_Control.Insert1(newdepartidint.ToString(), HiddenField1.Value, Tb_Name.Text, "在用");
            ClientScript.RegisterStartupScript(e.GetType(), "", "<script>window.opener.location.href=window.opener.location.href;window.close();</script>");
        }
    }

    public int newdepartid()
    {
        string newdepartidstr;
        int newdepartidint;
        dbtable.Clear();
        depart_Control.orderbydepart(dbtable);
        newdepartidstr = dbtable.Rows[dbtable.Rows.Count - 1].ItemArray[1].ToString();
        newdepartidint = Convert.ToInt32(newdepartidstr) + 1;
        return newdepartidint;
    }

    protected void Btn_Cancel_Click(object sender, EventArgs e)
    {
        ClientScript.RegisterStartupScript(e.GetType(), "", "<script>window.close();</script>");
    }
}

⌨️ 快捷键说明

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