protected void btnOK_Click(object sender, EventArgs e)
    {
        if (ViewState["txtSNAME"] == null || ViewState["txtSNAME"].ToString() != txtSNAME.Value)
        {
            HR_STAFF hadCond = new HR_STAFF();
            hadCond.SNAME = txtSNAME.Value;
            if (BLLTable<HR_STAFF>.Exists(hadCond))
            {
                litWarn.Text = "��Ա���Ѿ����ڣ����������룡�򻻸���ơ�";
                return;
            }
        }
        try
        {
            HR_STAFF valObj = new HR_STAFF();

            HR_DEPT_STAFF valdeps = new HR_DEPT_STAFF();

            if (txtSTAFF_ID.Value != "")
                valObj.STAFF_ID = Convert.ToDecimal(txtSTAFF_ID.Value);

            valObj.STAFF_NO = txtSTAFF_NO.Value;

            valObj.STAFF_NAME = Convert.ToString(txtNAME.Value);

            valObj.DEPT_ID = wucSelDept1.DEPT_ID;
            valdeps.DEPT_ID = wucSelDept1.DEPT_ID;

            HR_DEPT dept = BLLTable<HR_DEPT>.Factory(conn).GetRowData(HR_DEPT.Attribute.DEPT_ID, valObj.DEPT_ID);

            valObj.ORG_ID = dept.ORG_ID;

            valObj.GENDER = Convert.ToString(txtGENDER.Value);

            valObj.PHOTO = Convert.ToString(txtPHOTO.Value);

            valObj.POS_NAME = Convert.ToString(txtPOS_NAME.Value);

            valObj.STATION_CODE = wucSelStation1.STATION_ID;// Convert.ToString(txtSTATION_CODE.Value);

            valObj.WORK_TYPE_CODE = Convert.ToString(txtWORK_TYPE_CODE.Value);

            valObj.TECH_LEVEL_CODE = Convert.ToString(txtTECH_LEVEL_CODE.Value);

            valObj.YMD = txtYMD.Value;

            valObj.MOBILE = Convert.ToString(txtMOBILE.Value);

            valObj.OFFICE_TEL = Convert.ToString(txtOFFICE_TEL.Value);

            valObj.CERT_FLAG = Convert.ToString(txtCERT_FLAG.Value);

            valObj.FIXED_FLAG = Convert.ToString(txtFIXED_FLAG.Value);

            valObj.ON_POS_FLAG = Convert.ToString(txtON_POS_FLAG.Value);

            valObj.PROFESSION_CODE = Convert.ToString(txtPROFESSION_CODE.Value);

            valObj.PROFESSION_BGN_DATE = Convert.ToDateTime(txtPROFESSION_BGN_DATE.Value);

            valObj.JOIN_DATE = Convert.ToDateTime(txtJOIN_DATE.Value);

            valObj.POLITICAL_STATUS_CODE = Convert.ToString(txtPOLITICAL_STATUS_CODE.Value);

            valObj.TITLE_CODE = Convert.ToString(txtTITLE_CODE.Value);

            valObj.STATUS_CODE = Convert.ToString(txtSTATUS_CODE.Value);

            valObj.ADDR = Convert.ToString(txtADDR.Value);

            valObj.EMAIL = Convert.ToString(txtEMAIL.Value);

            valObj.NATION = Convert.ToString(txtNATION.Value);

            valObj.NATIVE_PLACE = Convert.ToString(txtNATIVE_PLACE.Value);

            valObj.POST_NO = Convert.ToString(txtPOST_NO.Value);

            valObj.DEGREE_CODE = Convert.ToString(txtDEGREE_CODE.Value);

            valObj.GRAD_SCHOOL = Convert.ToString(txtGRAD_SCHOOL.Value);

            valObj.GRAD_DATE = Convert.ToDateTime(txtGRAD_DATE.Value);
            valObj.MAJOR = Convert.ToString(txtMAJOR.Value);
            valObj.REMARK = Convert.ToString(txtREMARK.Value);

            if (txtUSER_ID.Value != "")
                valObj.USER_ID = Convert.ToDecimal(txtUSER_ID.Value);

            valObj.SNAME = Convert.ToString(txtSNAME.Value);
            valObj.RNAME = Convert.ToString(txtRNAME.Value);
            valObj.EXP1 = Convert.ToString(txtEXP1.Value);
            valObj.EXP2 = Convert.ToString(txtEXP2.Value);
            valObj.EXP3 = Convert.ToString(txtEXP3.Value);

            if (keyid != "")
            {
                valObj.STAFF_ID = Convert.ToDecimal(keyid);

                count = StaffHelper.EditStaff(valObj);// BLLTable<HR_STAFF>.Factory(conn).Update(valObj, HR_STAFF.Attribute.STAFF_ID);

                valdeps.STAFF_ID = Convert.ToDecimal(keyid);
                //���²���Ա����ϵ
                HR_DEPT_STAFF conds = new HR_DEPT_STAFF();
                conds.STAFF_ID = Convert.ToInt32(keyid);
                conds.DEPT_ID = hidDEPT_ID.Value;
                if (BLLTable<HR_DEPT_STAFF>.Exists(conds))
                {
                    BLLTable<HR_DEPT_STAFF>.Update(valdeps, conds);
                }
                else
                {
                    BLLTable<HR_DEPT_STAFF>.Insert(valdeps);
                }
            }
            else
            {

                keyid = StaffHelper.AddStaff(valObj, pid);
                count = keyid != "" ? 1 : 0;
                //count = BLLTable<HR_STAFF>.Factory(conn).Insert(valObj, HR_STAFF.Attribute.STAFF_ID);
                //keyid = valObj.STAFF_ID.ToString();
                //��Ӳ���Ա����ϵ
                valdeps.STAFF_ID = Convert.ToDecimal(keyid);
                BLLTable<HR_DEPT_STAFF>.Insert(valdeps);
            }
            if (count > 0)
            {

                SYS_USER user = BLLTable<SYS_USER>.Factory(conn).GetRowData(SYS_USER.Attribute.STAFF_ID, valObj.STAFF_ID);
                if (user != null && user.IsNotNull())
                {
                    if (txtUSER_NAME.Value != "")
                        user.USER_NAME = Convert.ToString(txtUSER_NAME.Value);

                    if (txtPASS.Value != "")
                        user.PASS = StringHelperExd.StringToMD5(txtPASS.Value);

                    user.EDITTIME = DateTime.Now;

                    int count2 = BLLTable<SYS_USER>.Factory(conn).Update(user, SYS_USER.Attribute.USER_ID);
                }
                else
                {
                    SYS_USER hadCond = new SYS_USER();
                    hadCond.USER_NAME = txtUSER_NAME.Value;
                    if (BLLTable<SYS_USER>.Exists(hadCond))
                    {
                        litWarn.Text = "���û����Ѿ����ڣ����������룡�򻻸����ơ�";
                        return;
                    }

                    user = new SYS_USER();

                    if (txtUSER_NAME.Value != "")
                        user.USER_NAME = Convert.ToString(txtUSER_NAME.Value);

                    if (txtPASS.Value != "")
                        user.PASS = Convert.ToString(txtPASS.Value);
                    else
                        user.PASS =StringHelperExd.StringToMD5("123456");

                    user.STAFF_ID = valObj.STAFF_ID;
                    user.USER_TYPE = EnumInfo.SYS_UserType.Common.ToString("d");
                    user.USE_FLAG = "1";
                    user.EDITTIME = DateTime.Now;
                    user.ADDTIME = DateTime.Now;
                    user.REAL_NAME = valObj.STAFF_NAME;
                    user.RNAME = user.USER_NAME;
                    user.SNAME = user.USER_NAME;
                    int count2 = BLLTable<SYS_USER>.Factory(conn).Insert(user, SYS_USER.Attribute.USER_ID);
                }

                //StringBuilder sbData = new StringBuilder("({valObj:''");
                //List<AttributeItem> lstCol = valObj.af_AttributeItemList;
                //for (int i = 0; i < lstCol.Count; i++)
                //{
                //    object val = valObj.GetValue(lstCol[i]);
                //    if (val != null)
                //    {
                //        sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'");
                //    }
                //}
                //sbData.Append("})");
                string re = "re";
                if (pid != "") {
                    //re = "STAFFManage.aspx?PID="+pid;
                }
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = '" + re + "';}else{window.returnValue = '" + re + "';}window.close();", true);
            }
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
Exemple #2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (ViewState["txtSNAME"] == null || ViewState["txtSNAME"].ToString() != txtSNAME.Value)
        {
            HR_STAFF hadCond = new HR_STAFF();
            hadCond.SNAME = txtSNAME.Value;
            if (BLLTable <HR_STAFF> .Exists(hadCond))
            {
                litWarn.Text = "此员工已经存在,请重新输入!或换个简称。";
                return;
            }
        }
        try
        {
            HR_STAFF valObj = new HR_STAFF();

            HR_DEPT_STAFF valdeps = new HR_DEPT_STAFF();

            if (txtSTAFF_ID.Value != "")
            {
                valObj.STAFF_ID = Convert.ToDecimal(txtSTAFF_ID.Value);
            }

            valObj.STAFF_NO = txtSTAFF_NO.Value;


            valObj.STAFF_NAME = Convert.ToString(txtNAME.Value);


            valObj.DEPT_ID  = wucSelDept1.DEPT_ID;
            valdeps.DEPT_ID = wucSelDept1.DEPT_ID;

            HR_DEPT dept = BLLTable <HR_DEPT> .Factory(conn).GetRowData(HR_DEPT.Attribute.DEPT_ID, valObj.DEPT_ID);

            valObj.ORG_ID = dept.ORG_ID;

            valObj.GENDER = Convert.ToString(txtGENDER.Value);


            valObj.PHOTO = Convert.ToString(txtPHOTO.Value);


            valObj.POS_NAME = Convert.ToString(txtPOS_NAME.Value);


            valObj.STATION_CODE = wucSelStation1.STATION_ID;// Convert.ToString(txtSTATION_CODE.Value);


            valObj.WORK_TYPE_CODE = Convert.ToString(txtWORK_TYPE_CODE.Value);


            valObj.TECH_LEVEL_CODE = Convert.ToString(txtTECH_LEVEL_CODE.Value);


            valObj.YMD = txtYMD.Value;


            valObj.MOBILE = Convert.ToString(txtMOBILE.Value);


            valObj.OFFICE_TEL = Convert.ToString(txtOFFICE_TEL.Value);


            valObj.CERT_FLAG = Convert.ToString(txtCERT_FLAG.Value);


            valObj.FIXED_FLAG = Convert.ToString(txtFIXED_FLAG.Value);


            valObj.ON_POS_FLAG = Convert.ToString(txtON_POS_FLAG.Value);


            valObj.PROFESSION_CODE = Convert.ToString(txtPROFESSION_CODE.Value);

            valObj.PROFESSION_BGN_DATE = Convert.ToDateTime(txtPROFESSION_BGN_DATE.Value);

            valObj.JOIN_DATE = Convert.ToDateTime(txtJOIN_DATE.Value);


            valObj.POLITICAL_STATUS_CODE = Convert.ToString(txtPOLITICAL_STATUS_CODE.Value);


            valObj.TITLE_CODE = Convert.ToString(txtTITLE_CODE.Value);


            valObj.STATUS_CODE = Convert.ToString(txtSTATUS_CODE.Value);

            valObj.ADDR = Convert.ToString(txtADDR.Value);

            valObj.EMAIL = Convert.ToString(txtEMAIL.Value);

            valObj.NATION = Convert.ToString(txtNATION.Value);


            valObj.NATIVE_PLACE = Convert.ToString(txtNATIVE_PLACE.Value);

            valObj.POST_NO = Convert.ToString(txtPOST_NO.Value);

            valObj.DEGREE_CODE = Convert.ToString(txtDEGREE_CODE.Value);

            valObj.GRAD_SCHOOL = Convert.ToString(txtGRAD_SCHOOL.Value);

            valObj.GRAD_DATE = Convert.ToDateTime(txtGRAD_DATE.Value);
            valObj.MAJOR     = Convert.ToString(txtMAJOR.Value);
            valObj.REMARK    = Convert.ToString(txtREMARK.Value);


            if (txtUSER_ID.Value != "")
            {
                valObj.USER_ID = Convert.ToDecimal(txtUSER_ID.Value);
            }

            valObj.SNAME = Convert.ToString(txtSNAME.Value);
            valObj.RNAME = Convert.ToString(txtRNAME.Value);
            valObj.EXP1  = Convert.ToString(txtEXP1.Value);
            valObj.EXP2  = Convert.ToString(txtEXP2.Value);
            valObj.EXP3  = Convert.ToString(txtEXP3.Value);


            if (keyid != "")
            {
                valObj.STAFF_ID = Convert.ToDecimal(keyid);

                count = StaffHelper.EditStaff(valObj);// BLLTable<HR_STAFF>.Factory(conn).Update(valObj, HR_STAFF.Attribute.STAFF_ID);

                valdeps.STAFF_ID = Convert.ToDecimal(keyid);
                //更新部门员工关系
                HR_DEPT_STAFF conds = new HR_DEPT_STAFF();
                conds.STAFF_ID = Convert.ToInt32(keyid);
                conds.DEPT_ID  = hidDEPT_ID.Value;
                if (BLLTable <HR_DEPT_STAFF> .Exists(conds))
                {
                    BLLTable <HR_DEPT_STAFF> .Update(valdeps, conds);
                }
                else
                {
                    BLLTable <HR_DEPT_STAFF> .Insert(valdeps);
                }
            }
            else
            {
                keyid = StaffHelper.AddStaff(valObj, pid);
                count = keyid != "" ? 1 : 0;
                //count = BLLTable<HR_STAFF>.Factory(conn).Insert(valObj, HR_STAFF.Attribute.STAFF_ID);
                //keyid = valObj.STAFF_ID.ToString();
                //添加部门员工关系
                valdeps.STAFF_ID = Convert.ToDecimal(keyid);
                BLLTable <HR_DEPT_STAFF> .Insert(valdeps);
            }
            if (count > 0)
            {
                SYS_USER user = BLLTable <SYS_USER> .Factory(conn).GetRowData(SYS_USER.Attribute.STAFF_ID, valObj.STAFF_ID);

                if (user != null && user.IsNotNull())
                {
                    if (txtUSER_NAME.Value != "")
                    {
                        user.USER_NAME = Convert.ToString(txtUSER_NAME.Value);
                    }

                    if (txtPASS.Value != "")
                    {
                        user.PASS = StringHelperExd.StringToMD5(txtPASS.Value);
                    }

                    user.EDITTIME = DateTime.Now;

                    int count2 = BLLTable <SYS_USER> .Factory(conn).Update(user, SYS_USER.Attribute.USER_ID);
                }
                else
                {
                    SYS_USER hadCond = new SYS_USER();
                    hadCond.USER_NAME = txtUSER_NAME.Value;
                    if (BLLTable <SYS_USER> .Exists(hadCond))
                    {
                        litWarn.Text = "此用户名已经存在,请重新输入!或换个名称。";
                        return;
                    }

                    user = new SYS_USER();

                    if (txtUSER_NAME.Value != "")
                    {
                        user.USER_NAME = Convert.ToString(txtUSER_NAME.Value);
                    }

                    if (txtPASS.Value != "")
                    {
                        user.PASS = Convert.ToString(txtPASS.Value);
                    }
                    else
                    {
                        user.PASS = StringHelperExd.StringToMD5("123456");
                    }

                    user.STAFF_ID  = valObj.STAFF_ID;
                    user.USER_TYPE = EnumInfo.SYS_UserType.Common.ToString("d");
                    user.USE_FLAG  = "1";
                    user.EDITTIME  = DateTime.Now;
                    user.ADDTIME   = DateTime.Now;
                    user.REAL_NAME = valObj.STAFF_NAME;
                    user.RNAME     = user.USER_NAME;
                    user.SNAME     = user.USER_NAME;
                    int count2 = BLLTable <SYS_USER> .Factory(conn).Insert(user, SYS_USER.Attribute.USER_ID);
                }

                //StringBuilder sbData = new StringBuilder("({valObj:''");
                //List<AttributeItem> lstCol = valObj.af_AttributeItemList;
                //for (int i = 0; i < lstCol.Count; i++)
                //{
                //    object val = valObj.GetValue(lstCol[i]);
                //    if (val != null)
                //    {
                //        sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'");
                //    }
                //}
                //sbData.Append("})");
                string re = "re";
                if (pid != "")
                {
                    //re = "STAFFManage.aspx?PID="+pid;
                }
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = '" + re + "';}else{window.returnValue = '" + re + "';}window.close();", true);
            }
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
Exemple #3
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        WFOBJECT_BLL wfobj = new WFOBJECT_BLL(wf_obj_id);
        Button       btn   = (Button)sender;//当前单击的按钮
        //WFINFO_EXD wfExd = new WFINFO_EXD(wfid,0);
        WFRecordInfo recInfo = new WFRecordInfo(wf_obj_id, recid);

        //FORM_BLL wform = wfobj.FORM_BLL;

        WF_FORMBASE valObj = new WF_FORMBASE();

        //WF_FORMDETAIL formDetail = null;
        #region                        //通用基本信息赋值
        valObj.RECNO = txtRECNO.Value; //单号唯一

        if (txtDEPT_ID.DEPT_ID != "")
        {
            valObj.DEPT_ID = Convert.ToString(txtDEPT_ID.DEPT_ID);

            HR_DEPT dept = BLLTable <HR_DEPT> .Factory(conn).GetRowData(HR_DEPT.Attribute.DEPT_ID, valObj.DEPT_ID);

            HR_ORG org = BLLTable <HR_ORG> .Factory(conn).GetRowData(HR_ORG.Attribute.ORG_ID, dept.ORG_ID);

            valObj.ORG_ID    = org.ORG_ID;
            valObj.ORG_NAME  = org.ORG_NAME;
            valObj.DEPT_NAME = dept.DEPT_NAME;
        }

        if (txtSTAFF_ID.Staff_ID > 0)
        {
            valObj.STAFF_ID   = txtSTAFF_ID.Staff_ID;
            valObj.STAFF_NAME = txtSTAFF_ID.Staff_NAME;
        }

        if (txtCSTAFF_ID.Value != "")
        {
            valObj.CSTAFF_ID  = Convert.ToDecimal(txtCSTAFF_ID.Value);
            valObj.CDEPT_ID   = txtCDEPT_ID.Value;
            valObj.CDEPT_NAME = txtCDEPT_NAME.Value;

            HR_DEPT_STAFF cond = new HR_DEPT_STAFF();
            cond.STAFF_ID = valObj.CSTAFF_ID;
            Relation reldep = new Relation(HR_DEPT_STAFF.Attribute.DEPT_ID, HR_DEPT.Attribute.DEPT_ID);
            Relation relorg = new Relation(HR_ORG.Attribute.ORG_ID, HR_DEPT.Attribute.ORG_ID);

            List <Relation> lstrel = new List <Relation>();
            lstrel.Add(reldep);
            lstrel.Add(relorg);

            List <ITableImplement> lstcond = new List <ITableImplement>();
            lstcond.Add(cond);

            List <HR_ORG> lstOrg = BLLTable <HR_ORG> .Select(new HR_ORG(), lstrel, null, lstcond);

            if (lstOrg.Count > 0)
            {
                valObj.CORG_ID   = lstOrg[0].ORG_ID;
                valObj.CORG_NAME = lstOrg[0].ORG_NAME;
            }
        }
        if (txtCSTAFF_NAME.Value != "")
        {
            valObj.CSTAFF_NAME = Convert.ToString(txtCSTAFF_NAME.Value);
        }
        valObj.EDITIME    = DateTime.Now;
        valObj.NOTE       = txtNOTE.Value;
        valObj.ANNEX_FILE = UpFilesBfSubmit1.GetUpFilesString();

        //if (hadDetail)//若有明细表单,创建明细表单通用信息对象并赋值
        //{
        //    formDetail = new WF_FORMDETAIL();
        //    formDetail.DEPT_ID = valObj.DEPT_ID;
        //    formDetail.DEPT_NAME = valObj.DEPT_NAME;
        //    formDetail.STAFF_ID = valObj.STAFF_ID;
        //    formDetail.STAFF_NAME = valObj.STAFF_NAME;
        //    formDetail.STATUS = "0";
        //    formDetail.DETAIL_NO = "0";
        //}
        #endregion
        if (recid > 0)
        {
            #region//编辑单据信息

            valObj.RECID       = recid;
            valObj.WFID        = wf_obj_id;
            valObj.FORM_PRI_ID = recInfo.Base.FORM_PRI_ID; //扩展表修改必须使用此字段的值。*********

            count = wfobj.UpdateRecord(valObj);            //【2】通用单据信息赋值,与配置扩展信息同时保存到数据库。
            if (count < 0)
            {
                litWarn.Text = "保存基本信息失败。";//【2】保存信息失败,提示。。
                return;
            }
            if (hadDetail && hidDetailRows.Value != "")
            {
                int rows = int.Parse(hidDetailRows.Value);//【3】判断是否有明细信息,若有,保存明细信息到数据库。
                //formDetail.RECID = recid;
                wfobj.UpdateDetail(valObj, rows);
            }

            //jinsj  获取页面静态代码
            WFOBJECT_BLL wfbll  = new WFOBJECT_BLL(wf_obj_id, recid);
            WFRecordInfo recObj = new WFRecordInfo(valObj, true);
            WF_FORMBASE  objUp  = new WF_FORMBASE();
            objUp.RECID     = recid;
            objUp.HTML_TEXT = wfbll.FORM_BLL.WF_HtmlShowForm(recObj);
            BLLTable <WF_FORMBASE> .Factory(conn).Update(objUp, WF_FORMBASE.Attribute.RECID);

            if (btn.ID.IndexOf("btnOK") != -1)//重新提交单据,进入审批流程
            {
                backUrl = WebHelper.GetAppPath() + "WF/Checkers.aspx?Submit=1&WFID=" + wf_obj_id + "&PROCID=" + 0 + "&RECID=" + recid;
            }
            Response.Redirect(backUrl);

            #endregion
        }
        else
        {
            #region//新建单据
            valObj.ADDTIME    = DateTime.Now;
            valObj.RECNAME    = "[" + userBase.StaffName + "]" + wfcname + valObj.ADDTIME.ToString("yyyyMMddHHmm");
            valObj.WFID       = wf_obj_id;
            valObj.PROCID     = 0;
            valObj.CHECK_INFO = "";
            valObj.CHECKERS   = "";
            valObj.STATUS     = WFEnum.RecStatus.Submit.ToString("d");
            //AgileFrame.Orm.PersistenceLayer.DAL.Base.Runtime_PersistenceLayer.RefreshRuntime_PersistenceLayer();
            count = wfobj.InsertRecord(valObj);//【1】通用单据信息赋值,与配置扩展信息同时保存到数据库
            if (count <= 0)
            {
                litWarn.Text = "单据信息保存失败,请联系管理员。";//【1】保存信息失败,提示
                return;
            }
            recid = valObj.RECID;
            if (hadDetail && hidDetailRows.Value != "")//【2】判断是否有明细信息,若有,保存明细信息到数据库。
            {
                int rows = int.Parse(hidDetailRows.Value);
                //formDetail.RECID = recid;
                wfobj.InsertDetail(valObj, rows);
            }

            //jinsj  获取页面静态代码
            WFOBJECT_BLL wfbll  = new WFOBJECT_BLL(wf_obj_id, recid);
            WFRecordInfo recObj = new WFRecordInfo(valObj, true);
            WF_FORMBASE  objUp  = new WF_FORMBASE();
            objUp.RECID     = recid;
            objUp.HTML_TEXT = wfbll.FORM_BLL.WF_HtmlShowForm(recObj);
            BLLTable <WF_FORMBASE> .Factory(conn).Update(objUp, WF_FORMBASE.Attribute.RECID);

            if (btn.ID.IndexOf("btnOK") != -1)
            {
                string err = "";
                //bool ck = wfobj.WF_CheckStepChecker(recid, out err);
                bool ck = true;
                if (ck == false)
                {
                    ScriptHelper.AlertAndGo(Page, err + " 无法提交。", "FormList.aspx?mine=1&WFID=" + wf_obj_id);
                }
                else
                {
                    string chckerUrl = WebHelper.GetAppPath() + "WF/Checkers.aspx?Submit=1&WFID=" + wf_obj_id + "&RECID=" + recid;
                    Response.Redirect(chckerUrl, false);//【6】转到审批人选择页面
                }
            }
            else
            {
                if (recid > 0)
                {
                    Response.Redirect(backUrl);//【3】跳转到原来的页面。
                }
                else
                {
                    AgileFrame.Core.ScriptHelper.Alert(Page, "保存失败!");
                }
            }
            #endregion
        }
    }
Exemple #4
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        WFOBJECT_BLL wfobj = new WFOBJECT_BLL(wf_obj_id);
        Button btn = (Button)sender;//��ǰ�����İ�ť
        //WFINFO_EXD wfExd = new WFINFO_EXD(wfid,0);
        WFRecordInfo recInfo = new WFRecordInfo(wf_obj_id,recid);

        //FORM_BLL wform = wfobj.FORM_BLL;

        WF_FORMBASE valObj = new WF_FORMBASE();
        //WF_FORMDETAIL formDetail = null;
        #region//ͨ�û�����Ϣ��ֵ
        valObj.RECNO = txtRECNO.Value;//����Ψһ

        if (txtDEPT_ID.DEPT_ID != "")
        {
            valObj.DEPT_ID = Convert.ToString(txtDEPT_ID.DEPT_ID);

            HR_DEPT dept = BLLTable<HR_DEPT>.Factory(conn).GetRowData(HR_DEPT.Attribute.DEPT_ID, valObj.DEPT_ID);
            HR_ORG org = BLLTable<HR_ORG>.Factory(conn).GetRowData(HR_ORG.Attribute.ORG_ID, dept.ORG_ID);
            valObj.ORG_ID = org.ORG_ID;
            valObj.ORG_NAME = org.ORG_NAME;
            valObj.DEPT_NAME = dept.DEPT_NAME;
        }

        if (txtSTAFF_ID.Staff_ID > 0)
        {
            valObj.STAFF_ID = txtSTAFF_ID.Staff_ID;
            valObj.STAFF_NAME = txtSTAFF_ID.Staff_NAME;
        }

        if (txtCSTAFF_ID.Value != "")
        {
            valObj.CSTAFF_ID = Convert.ToDecimal(txtCSTAFF_ID.Value);
            valObj.CDEPT_ID = txtCDEPT_ID.Value;
            valObj.CDEPT_NAME = txtCDEPT_NAME.Value;

            HR_DEPT_STAFF cond = new HR_DEPT_STAFF();
            cond.STAFF_ID = valObj.CSTAFF_ID;
            Relation reldep = new Relation(HR_DEPT_STAFF.Attribute.DEPT_ID, HR_DEPT.Attribute.DEPT_ID);
            Relation relorg = new Relation(HR_ORG.Attribute.ORG_ID, HR_DEPT.Attribute.ORG_ID);

            List<Relation> lstrel = new List<Relation>();
            lstrel.Add(reldep);
            lstrel.Add(relorg);

            List<ITableImplement> lstcond = new List<ITableImplement>();
            lstcond.Add(cond);

            List<HR_ORG> lstOrg = BLLTable<HR_ORG>.Select(new HR_ORG(), lstrel, null, lstcond);

            if (lstOrg.Count > 0)
            {
                valObj.CORG_ID = lstOrg[0].ORG_ID;
                valObj.CORG_NAME = lstOrg[0].ORG_NAME;
            }

        }
        if (txtCSTAFF_NAME.Value != "")
        {
            valObj.CSTAFF_NAME = Convert.ToString(txtCSTAFF_NAME.Value);
        }
        valObj.EDITIME = DateTime.Now;
        valObj.NOTE = txtNOTE.Value;
        valObj.ANNEX_FILE = UpFilesBfSubmit1.GetUpFilesString();

        //if (hadDetail)//������ϸ�����������ϸ���ͨ����Ϣ���󲢸�ֵ
        //{
        //    formDetail = new WF_FORMDETAIL();
        //    formDetail.DEPT_ID = valObj.DEPT_ID;
        //    formDetail.DEPT_NAME = valObj.DEPT_NAME;
        //    formDetail.STAFF_ID = valObj.STAFF_ID;
        //    formDetail.STAFF_NAME = valObj.STAFF_NAME;
        //    formDetail.STATUS = "0";
        //    formDetail.DETAIL_NO = "0";
        //}
        #endregion
        if (recid > 0)
        {
            #region//�༭������Ϣ

            valObj.RECID = recid;
            valObj.WFID = wf_obj_id;
            valObj.FORM_PRI_ID = recInfo.Base.FORM_PRI_ID;//��չ���޸ı���ʹ�ô��ֶε�ֵ��*********

            count = wfobj.UpdateRecord(valObj);//��2��ͨ�õ�����Ϣ��ֵ����������չ��Ϣͬʱ���浽���ݿ⡣
            if (count < 0)
            {
                litWarn.Text = "���������Ϣʧ�ܡ�";//��2��������Ϣʧ�ܣ���ʾ����
                return;
            }
            if (hadDetail && hidDetailRows.Value != "")
            {
                int rows = int.Parse(hidDetailRows.Value);//��3���ж��Ƿ�����ϸ��Ϣ�����У�������ϸ��Ϣ�����ݿ⡣
                //formDetail.RECID = recid;
                wfobj.UpdateDetail(valObj, rows);
            }

            //jinsj  ��ȡҳ�澲̬����
            WFOBJECT_BLL wfbll = new WFOBJECT_BLL(wf_obj_id, recid);
            WFRecordInfo recObj = new WFRecordInfo(valObj, true);
            WF_FORMBASE objUp = new WF_FORMBASE();
            objUp.RECID = recid;
            objUp.HTML_TEXT = wfbll.FORM_BLL.WF_HtmlShowForm(recObj);
            BLLTable<WF_FORMBASE>.Factory(conn).Update(objUp, WF_FORMBASE.Attribute.RECID);

            if (btn.ID.IndexOf("btnOK") != -1)//�����ύ���ݣ�������������
            {
                backUrl = WebHelper.GetAppPath() + "WF/Checkers.aspx?Submit=1&WFID=" + wf_obj_id + "&PROCID=" + 0 + "&RECID=" + recid;
            }
            Response.Redirect(backUrl);

            #endregion
        }
        else
        {
            #region//�½�����
            valObj.ADDTIME = DateTime.Now;
            valObj.RECNAME = "[" + userBase.StaffName + "]" + wfcname + valObj.ADDTIME.ToString("yyyyMMddHHmm");
            valObj.WFID = wf_obj_id;
            valObj.PROCID = 0;
            valObj.CHECK_INFO = "";
            valObj.CHECKERS = "";
            valObj.STATUS = WFEnum.RecStatus.Submit.ToString("d");
            //AgileFrame.Orm.PersistenceLayer.DAL.Base.Runtime_PersistenceLayer.RefreshRuntime_PersistenceLayer();
            count = wfobj.InsertRecord(valObj);//��1��ͨ�õ�����Ϣ��ֵ����������չ��Ϣͬʱ���浽���ݿ�
            if (count <= 0)
            {
                litWarn.Text = "������Ϣ����ʧ�ܣ�����ϵ����Ա��";//��1��������Ϣʧ�ܣ���ʾ
                return;
            }
            recid = valObj.RECID;
            if (hadDetail && hidDetailRows.Value != "")//��2���ж��Ƿ�����ϸ��Ϣ�����У�������ϸ��Ϣ�����ݿ⡣
            {
                int rows = int.Parse(hidDetailRows.Value);
                //formDetail.RECID = recid;
                wfobj.InsertDetail(valObj, rows);
            }

            //jinsj  ��ȡҳ�澲̬����
            WFOBJECT_BLL wfbll = new WFOBJECT_BLL(wf_obj_id, recid);
            WFRecordInfo recObj = new WFRecordInfo(valObj, true);
            WF_FORMBASE objUp = new WF_FORMBASE();
            objUp.RECID = recid;
            objUp.HTML_TEXT = wfbll.FORM_BLL.WF_HtmlShowForm(recObj);
            BLLTable<WF_FORMBASE>.Factory(conn).Update(objUp, WF_FORMBASE.Attribute.RECID);

            if (btn.ID.IndexOf("btnOK") != -1)
            {
                string err = "";
                //bool ck = wfobj.WF_CheckStepChecker(recid, out err);
                bool ck = true;
                if (ck == false)
                {
                    ScriptHelper.AlertAndGo(Page, err + " �޷��ύ��", "FormList.aspx?mine=1&WFID=" + wf_obj_id);
                }
                else
                {
                    string chckerUrl = WebHelper.GetAppPath() + "WF/Checkers.aspx?Submit=1&WFID=" + wf_obj_id + "&RECID=" + recid;
                    Response.Redirect(chckerUrl, false);//��6��ת��������ѡ��ҳ��
                }
            }
            else
            {
                if (recid > 0)
                {
                    Response.Redirect(backUrl);//��3����ת��ԭ����ҳ�档
                }
                else
                {
                    AgileFrame.Core.ScriptHelper.Alert(Page, "����ʧ�ܣ�");
                }
            }
            #endregion
        }
    }