Exemplo n.º 1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        #region//备用变量声明
        string  gotoUrl = "../../OK.aspx?p=0";
        int     re      = 0;
        string  msg     = "新增记录";
        HR_DEPT valObj  = new HR_DEPT();
        #endregion

        valObj.DEPT_NAME = txtDeptName.Value;

        //树结构操作
        if (keyid != "")
        {
            valObj.P_DEPT_ID = wucSelDept1.DEPT_ID;
            valObj.DEPT_ID   = keyid;
            re = DeptHelper.EditDept(valObj);// BLLTable<HR_DEPT>.Factory(conn).Update(valObj, HR_DEPT.Attribute.DEPT_ID);
        }

        #region//执行结果处理
        if (re > 0)
        {
            if (Request["tree"] != null)
            {
                StringBuilder sb = new StringBuilder("");
                if (Request["toEdit"] == null)
                {
                    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.reShowSubNodes(true);location.href='" + gotoUrl + "';", false);
                }
                else
                {
                    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.reShowSubNodes(true);location.href='" + gotoUrl + "';", false);
                }
            }
            else
            {
                ScriptHelper.AlertAndGo(Page, msg + "成功!", gotoUrl);
            }
        }
        else
        {
            ScriptHelper.AlertAndGo(Page, msg + "失败!", gotoUrl);
        }
        #endregion
    }
Exemplo n.º 2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        #region//备用变量声明
        string gotoUrl = "../../OK.aspx?p=0";
        if (pid != "")
        {
            gotoUrl += "&PID=" + pid;
        }
        int     re     = 0;
        string  msg    = "新增记录";
        HR_DEPT valObj = new HR_DEPT();
        #endregion

        #region//实例对象赋值
        valObj.DEPT_NAME = txtDeptName.Value;
        valObj.SORT_NO   = Convert.ToInt32(txtSortNum.Value);
        valObj.ORG_ID    = wucSelORG1.ORG_ID;

        if (txtSNAME.Value != "")
        {
            valObj.SNAME = Convert.ToString(txtSNAME.Value);
        }


        if (txtRNAME.Value != "")
        {
            valObj.RNAME = Convert.ToString(txtRNAME.Value);
        }

        if (txtEXP1.Value != "")
        {
            valObj.EXP1 = Convert.ToString(txtEXP1.Value);
        }


        if (txtEXP2.Value != "")
        {
            valObj.EXP2 = Convert.ToString(txtEXP2.Value);
        }


        if (txtEXP3.Value != "")
        {
            valObj.EXP3 = Convert.ToString(txtEXP3.Value);
        }
        #endregion


        #region//执行修改或新增
        if (keyid != "")
        {
            valObj.P_DEPT_ID = wucSelDept1.DEPT_ID;
            valObj.DEPT_ID   = keyid;
            re = DeptHelper.EditDept(valObj);// BLLTable<HR_DEPT>.Factory(conn).Update(valObj, HR_DEPT.Attribute.DEPT_ID);
        }
        else
        {
            if (ntype == "org")
            {
                valObj.P_DEPT_ID = "0";
            }
            else
            {
                valObj.P_DEPT_ID = pid;
            }
            keyid = DeptHelper.AddDept(valObj, valObj.P_DEPT_ID);
            re    = keyid != "" ? 1 : 0;
        }
        #endregion

        #region//执行结果处理
        if (re > 0)
        {
            if (Request["tree"] != null)
            {
                StringBuilder sb = new StringBuilder("{");
                sb.Append("rid:'").Append(pid).Append("',id:'");
                sb.Append(keyid).Append("',pid:'").Append(pid).Append("',no:").Append(valObj.SORT_NO).Append(",sc:1,name:'");
                sb.Append(valObj.DEPT_NAME).Append("',ntype:'dept'}");
                if (Request["toEdit"] == null)
                {
                    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.addSubNodeForOprPage(\"" + sb.ToString() + "\");location.replace('" + gotoUrl + "');", false);
                }
                else
                {
                    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.editNodeForOprPage(\"" + sb.ToString() + "\");location.replace('" + gotoUrl + "');", false);
                }
            }
            else
            {
                ScriptHelper.AlertAndGo(Page, msg + "成功!", gotoUrl);
            }
        }
        else
        {
            ScriptHelper.AlertAndGo(Page, msg + "失败!", gotoUrl);
        }
        #endregion
    }