protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["ShowType"] != null &&
                Request.QueryString["OprtType"] != null)
            {
                ShowType = Request.QueryString["ShowType"].Trim().ToString();
                OprtType = Request.QueryString["OprtType"].Trim().ToString();
            }
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            codeRule.CodingType = ConstUtil.CODING_RULE_TYPE_ZERO;
            codeRule.ItemTypeID = ConstUtil.CODING_BASE_ITEM_QUARTER;
            //岗位分类
            ddlQuarterType.TypeFlag       = ConstUtil.CODE_TYPE_HUMAN;
            ddlQuarterType.TypeCode       = ConstUtil.CODE_TYPE_QUARTER;
            ddlQuarterType.IsInsertSelect = true;
            //岗位级别
            ddlQuarterLevel.TypeFlag       = ConstUtil.CODE_TYPE_HUMAN;
            ddlQuarterLevel.TypeCode       = ConstUtil.CODE_TYPE_QUARTER_LEVEL;
            ddlQuarterLevel.IsInsertSelect = true;



            BindTree();
            BindTemplateTree();
        }

        ddlQuarterLevel.Enabled = false;
        ddlQuarterType.Enabled  = false;
        if (Request.QueryString["QuarterID"] != null)
        {
            hidEditFlag.Value = "UPDATE";
            string quterID = Request.QueryString["QuarterID"].ToString();
            if (Request.QueryString["Sign"].ToString() == "1")
            {
                GettEMPLATE(quterID);
            }
            else
            {
                DataTable dtDeptInfo = DeptQuarterBus.GetDeptQuarterInfoWithID(quterID);
                if (dtDeptInfo.Rows.Count > 0)
                {
                    txtDeptID.Value = dtDeptInfo.Rows[0]["DeptID"] == null ? "" : dtDeptInfo.Rows[0]["DeptID"].ToString();

                    txtDisplayCode.Value     = dtDeptInfo.Rows[0]["QuarterNo"] == null ? "" : dtDeptInfo.Rows[0]["QuarterNo"].ToString();
                    txtDisplayCode.Disabled  = true;
                    txtDeptName.Text         = dtDeptInfo.Rows[0]["DeptName"] == null ? "" : dtDeptInfo.Rows[0]["DeptName"].ToString();
                    txtSuperQuarterName.Text = dtDeptInfo.Rows[0]["SuperQuarterName"] == null ? "" : dtDeptInfo.Rows[0]["SuperQuarterName"].ToString(); //上级岗位

                    txtQuarterName.Text = dtDeptInfo.Rows[0]["QuarterName"] == null ? "" : dtDeptInfo.Rows[0]["QuarterName"].ToString();                //岗位名称
                    txtPYShort.Text     = dtDeptInfo.Rows[0]["PYShort"] == null ? "" : dtDeptInfo.Rows[0]["PYShort"].ToString();                        //拼音代码


                    ddlKeyFlag.SelectedValue = dtDeptInfo.Rows[0]["KeyFlag"] == null ? "" : dtDeptInfo.Rows[0]["KeyFlag"].ToString();      //是否关键岗位

                    ddlQuarterType.SelectedValue = dtDeptInfo.Rows[0]["TypeID"] == null ? "" : dtDeptInfo.Rows[0]["TypeID"].ToString();    //岗位分类

                    ddlQuarterLevel.SelectedValue = dtDeptInfo.Rows[0]["LevelID"] == null ? "" : dtDeptInfo.Rows[0]["LevelID"].ToString(); //岗位级别


                    txtDescription.Text         = dtDeptInfo.Rows[0]["Description"] == null ? "" : dtDeptInfo.Rows[0]["Description"].ToString(); //描述信息
                    ddlUsedStatus.SelectedValue = dtDeptInfo.Rows[0]["UsedStatus"] == null ? "" : dtDeptInfo.Rows[0]["UsedStatus"].ToString();   //启用状态

                    string attachment = dtDeptInfo.Rows[0]["Attachment"] == null ? "" : dtDeptInfo.Rows[0]["Attachment"].ToString();             //附件
                    hidaddd.Value = attachment;

                    hfAttachment.Value     = dtDeptInfo.Rows[0]["Attachment"] == null ? "" : dtDeptInfo.Rows[0]["Attachment"].ToString();   //启用状态
                    hfPageAttachment.Value = dtDeptInfo.Rows[0]["Attachment"] == null ? "" : dtDeptInfo.Rows[0]["Attachment"].ToString();   //启用状态
                    txtDuty.Text           = dtDeptInfo.Rows[0]["Duty"] == null ? "" : dtDeptInfo.Rows[0]["Duty"].ToString();               //岗位职责
                    txtDutyRequire.Text    = dtDeptInfo.Rows[0]["DutyRequire"] == null ? "" : dtDeptInfo.Rows[0]["DutyRequire"].ToString(); //任职资格

                    FCKeditor1.Value = dtDeptInfo.Rows[0]["QuterContent"] == null ? "" : dtDeptInfo.Rows[0]["QuterContent"].ToString();     //任职资格


                    DataTable dtSet = DeptQuarterBus.GetQuarterModelSet(txtDeptID.Value, txtDisplayCode.Value);



                    if (dtSet.Rows.Count > 0)
                    {
                        DataTable dtMUbIAO = GetNewDataTable(dtSet, "ModuleID='1001'", "TypeID asc");
                        if (dtMUbIAO.Rows.Count > 0)
                        {
                            chMMubiao.Checked = true;

                            for (int a = 0; a < dtMUbIAO.Rows.Count; a++)
                            {
                                string mubiao = dtMUbIAO.Rows[a]["TypeID"] == null ? "" : dtMUbIAO.Rows[a]["TypeID"].ToString();
                                if (mubiao == "1")
                                {
                                    chMRi.Checked = true;
                                }
                                else if (mubiao == "2")
                                {
                                    chMZhou.Checked = true;
                                }
                                else if (mubiao == "3")
                                {
                                    chMYue.Checked = true;
                                }
                                else if (mubiao == "4")
                                {
                                    chMJi.Checked = true;
                                }
                                else if (mubiao == "5")
                                {
                                    chMNian.Checked = true;
                                }
                            }
                        }
                        else
                        {
                            chMMubiao.Checked = false;
                            chMRi.Checked     = false;
                            chMZhou.Checked   = false;
                            chMYue.Checked    = false;
                            chMJi.Checked     = false;
                            chMNian.Checked   = false;
                        }



                        DataTable dtRenwu = GetNewDataTable(dtSet, "ModuleID='1011'", "TypeID asc");
                        if (dtRenwu.Rows.Count > 0)
                        {
                            chRRenWu.Checked = true;
                            for (int a = 0; a < dtRenwu.Rows.Count; a++)
                            {
                                string mubiao = dtRenwu.Rows[a]["TypeID"] == null ? "" : dtRenwu.Rows[a]["TypeID"].ToString();
                                if (mubiao == "1")
                                {
                                    chRGEren.Checked = true;
                                }
                                else if (mubiao == "2")
                                {
                                    chRZhipai.Checked = true;
                                }
                            }
                        }
                        else
                        {
                            chRGEren.Checked  = false;
                            chRRenWu.Checked  = false;
                            chRZhipai.Checked = false;
                        }



                        DataTable dtrIZHI = GetNewDataTable(dtSet, "ModuleID='1021'", "TypeID asc");
                        if (dtrIZHI.Rows.Count > 0)
                        {
                            chGgongzuo.Checked = true;
                        }
                        else
                        {
                            chGgongzuo.Checked = false;
                        }
                        DataTable dtRICHENG = GetNewDataTable(dtSet, "ModuleID='10411'", "TypeID asc");
                        if (dtRICHENG.Rows.Count > 0)
                        {
                            chCricheng.Checked = true;
                        }
                        else
                        {
                            chCricheng.Checked = false;
                        }
                    }

                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), " ", " <script> readAfter(); </script> ");
                }
            }
        }
    }
    protected void imbEdit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        hidEditFlag.Value = "UPDATE";
        string    quterID    = hidquarterID.Value;
        DataTable dtDeptInfo = DeptQuarterBus.GetDeptQuarterInfoWithID(quterID);

        if (dtDeptInfo.Rows.Count > 0)
        {
            txtDeptID.Value = dtDeptInfo.Rows[0]["DeptID"] == null ? "" : dtDeptInfo.Rows[0]["DeptID"].ToString();

            txtDisplayCode.Value     = dtDeptInfo.Rows[0]["QuarterNo"] == null ? "" : dtDeptInfo.Rows[0]["QuarterNo"].ToString();
            txtDisplayCode.Disabled  = true;
            txtDeptName.Text         = dtDeptInfo.Rows[0]["DeptName"] == null ? "" : dtDeptInfo.Rows[0]["DeptName"].ToString();
            txtSuperQuarterName.Text = dtDeptInfo.Rows[0]["SuperQuarterName"] == null ? "" : dtDeptInfo.Rows[0]["SuperQuarterName"].ToString(); //上级岗位

            txtQuarterName.Text = dtDeptInfo.Rows[0]["QuarterName"] == null ? "" : dtDeptInfo.Rows[0]["QuarterName"].ToString();                //岗位名称
            txtPYShort.Text     = dtDeptInfo.Rows[0]["PYShort"] == null ? "" : dtDeptInfo.Rows[0]["PYShort"].ToString();                        //拼音代码


            ddlKeyFlag.SelectedValue = dtDeptInfo.Rows[0]["KeyFlag"] == null ? "" : dtDeptInfo.Rows[0]["KeyFlag"].ToString();      //是否关键岗位

            ddlQuarterType.SelectedValue = dtDeptInfo.Rows[0]["TypeID"] == null ? "" : dtDeptInfo.Rows[0]["TypeID"].ToString();    //岗位分类

            ddlQuarterLevel.SelectedValue = dtDeptInfo.Rows[0]["LevelID"] == null ? "" : dtDeptInfo.Rows[0]["LevelID"].ToString(); //岗位级别


            txtDescription.Text         = dtDeptInfo.Rows[0]["Description"] == null ? "" : dtDeptInfo.Rows[0]["Description"].ToString(); //描述信息
            ddlUsedStatus.SelectedValue = dtDeptInfo.Rows[0]["UsedStatus"] == null ? "" : dtDeptInfo.Rows[0]["UsedStatus"].ToString();   //启用状态

            string attachment = dtDeptInfo.Rows[0]["Attachment"] == null ? "" : dtDeptInfo.Rows[0]["Attachment"].ToString();             //附件
            hidaddd.Value = attachment;

            hfAttachment.Value = dtDeptInfo.Rows[0]["Attachment"] == null ? "" : dtDeptInfo.Rows[0]["Attachment"].ToString(); //启用状态
            string resumeUrl = hfAttachment.Value;
            int    j         = resumeUrl.LastIndexOf("\\") + 1;
            spanAttachmentName.InnerHtml = resumeUrl.Substring(j, resumeUrl.Length - j);


            hfPageAttachment.Value = dtDeptInfo.Rows[0]["Attachment"] == null ? "" : dtDeptInfo.Rows[0]["Attachment"].ToString();   //启用状态
            txtDuty.Text           = dtDeptInfo.Rows[0]["Duty"] == null ? "" : dtDeptInfo.Rows[0]["Duty"].ToString();               //岗位职责
            txtDutyRequire.Text    = dtDeptInfo.Rows[0]["DutyRequire"] == null ? "" : dtDeptInfo.Rows[0]["DutyRequire"].ToString(); //任职资格

            FCKeditor1.Value = dtDeptInfo.Rows[0]["QuterContent"] == null ? "" : dtDeptInfo.Rows[0]["QuterContent"].ToString();     //任职资格


            DataTable dtSet = DeptQuarterBus.GetQuarterModelSet(txtDeptID.Value, txtDisplayCode.Value);



            if (dtSet.Rows.Count > 0)
            {
                DataTable dtMUbIAO = GetNewDataTable(dtSet, "ModuleID='1001'", "TypeID asc");
                if (dtMUbIAO.Rows.Count > 0)
                {
                    chMMubiao.Checked = true;

                    for (int a = 0; a < dtMUbIAO.Rows.Count; a++)
                    {
                        string mubiao = dtMUbIAO.Rows[a]["TypeID"] == null ? "" : dtMUbIAO.Rows[a]["TypeID"].ToString();
                        if (mubiao == "1")
                        {
                            chMRi.Checked = true;
                        }
                        else if (mubiao == "2")
                        {
                            chMZhou.Checked = true;
                        }
                        else if (mubiao == "3")
                        {
                            chMYue.Checked = true;
                        }
                        else if (mubiao == "4")
                        {
                            chMJi.Checked = true;
                        }
                        else if (mubiao == "5")
                        {
                            chMNian.Checked = true;
                        }
                    }
                }
                else
                {
                    chMMubiao.Checked = false;
                    chMRi.Checked     = false;
                    chMZhou.Checked   = false;
                    chMYue.Checked    = false;
                    chMJi.Checked     = false;
                    chMNian.Checked   = false;
                }



                DataTable dtRenwu = GetNewDataTable(dtSet, "ModuleID='1011'", "TypeID asc");
                if (dtRenwu.Rows.Count > 0)
                {
                    chRRenWu.Checked = true;
                    for (int a = 0; a < dtRenwu.Rows.Count; a++)
                    {
                        string mubiao = dtRenwu.Rows[a]["TypeID"] == null ? "" : dtRenwu.Rows[a]["TypeID"].ToString();
                        if (mubiao == "1")
                        {
                            chRGEren.Checked = true;
                        }
                        else if (mubiao == "2")
                        {
                            chRZhipai.Checked = true;
                        }
                    }
                }
                else
                {
                    chRGEren.Checked  = false;
                    chRRenWu.Checked  = false;
                    chRZhipai.Checked = false;
                }



                DataTable dtrIZHI = GetNewDataTable(dtSet, "ModuleID='1021'", "TypeID asc");
                if (dtrIZHI.Rows.Count > 0)
                {
                    chGgongzuo.Checked = true;
                }
                else
                {
                    chGgongzuo.Checked = false;
                }
                DataTable dtRICHENG = GetNewDataTable(dtSet, "ModuleID='10411'", "TypeID asc");
                if (dtRICHENG.Rows.Count > 0)
                {
                    chCricheng.Checked = true;
                }
                else
                {
                    chCricheng.Checked = false;
                }
            }

            this.Page.ClientScript.RegisterStartupScript(this.GetType(), " ", " <script> readAfter(); </script> ");
        }
    }