protected void btnAdd_Click(object sender, EventArgs e)
    {
        PManageDepartData model = new PManageDepartData();
        PManageDepartBB manageDepartBB = new PManageDepartBB();
        try
        {
            if (this.State == "1")
            {
                //�û�����һ����Ӷ��������
                manageDepartBB.AddRecord(Convert.ToInt32(this.empId.Value), Convert.ToInt32(this.roleId.SelectedValue), this.departId.Value);
            }
            else if (this.State == "2")
            {
                model = manageDepartBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                manageDepartBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            manageDepartBB.Dispose();
        }

        Response.Redirect("PManageDepartList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.BindList();
            if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
            {
                this.IdValue = Convert.ToInt32(Request.Params["id"]);
            }
            if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty)
            {
                this.State = Request.Params["state"].ToString();
                switch (this.State)
                {
                    case "1":   //add
                        this.btnConsultDept.Attributes.Add("onclick", "javascript:ConsultDepartment('departId','departNm','',1,3);");
                        break;
                    case "2":   //update
                        //���ؿؼ�
                        this.btnConsultDept.Attributes.Add("onclick", "javascript:ConsultDepartment('departId','departNm','',0,3);");

                        PManageDepartBB manageDepartBB = new PManageDepartBB();
                        PManageDepartData manageDepartData = new PManageDepartData();
                        try
                        {
                            manageDepartData = manageDepartBB.GetModel(this.IdValue);

                            this.ShowInfo(this.IdValue);
                        }
                        finally
                        {
                            manageDepartBB.Dispose();
                        }
                        break;
                    default:
                        break;
                }
            }
        }
    }