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

📄 qibaaaaa.b

📁 人事管理系统
💻 B
字号:
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 PersonManage_BranchManage : System.Web.UI.Page
{
    public static int id=0;
    BLL.BranchInfoManager branchInfoManager = new BLL.BranchInfoManager();
    protected void Page_Load(object sender, EventArgs e)
    {
        string tittleName = Request.QueryString["tittleName"].ToString();
        if (!Page.IsClientScriptBlockRegistered("basescript"))
            Page.RegisterClientScriptBlock("basescript", registerscript(tittleName)); 

        if (!IsPostBack)
        {
            GridView1.DataSource = branchInfoManager.GetAllModels();
            GridView1.DataBind();
        }
    }
    public string registerscript(string tittle)
    {

        string clientscript = string.Format(@"   
               <script   language=""javascript"">
        window.parent.document.all.lblTittlename.innerText='{0}';
        window.parent.document.all.lblTittle.innerText='{1}';
                 </script>", tittle, tittle);
        return clientscript;
    }   
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        MODEL.BranchInfo b = new MODEL.BranchInfo();
        b.BranchName = TextBox1.Text.Trim();
        b.BranchShortName = TextBox2.Text.Trim();
        branchInfoManager.AddModel(b);
        Response.Redirect("BranchManage.aspx?tittleName=机构管理");
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "cur=this.style.backgroundColor;this.style.backgroundColor='#ff9900'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=cur");

            //ImageButton Ibtn = (ImageButton)e.Row.FindControl("mbtnDelete");
            //Ibtn.Attributes.Add("onclick", "return confirm('确认要删除吗?');");
        }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        BLL.BranchInfoManager branchInfoManager = new BLL.BranchInfoManager();
        MODEL.BranchInfo b = new MODEL.BranchInfo();
        String name = e.CommandName;

        id = Convert.ToInt32(e.CommandArgument);
        if (name == "De")
        {

            branchInfoManager.DeleteModelById(id);

            Response.Redirect("BranchManage.aspx?tittleName=机构管理");
        }
        if (name == "Ed")
        {
            b = branchInfoManager.GetModelById(id);
            TextBox1.Text = b.BranchName;
            TextBox2.Text = b.BranchShortName;
        }
    }

    /// <summary>
    /// 修改保存事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnBaocunxiugai_Click(object sender, EventArgs e)
    {
        MODEL.BranchInfo branchname = new MODEL.BranchInfo();
        branchname.BranchId = id;
        branchname.BranchName = TextBox1.Text.Trim();
        branchname.BranchShortName = TextBox2.Text.Trim();
        branchInfoManager.UpdateModel(branchname);
        Response.Redirect("BranchManage.aspx?tittleName=机构管理");
    }
}

⌨️ 快捷键说明

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