예제 #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        SYS_USER ucond = new SYS_USER();

        ucond.USER_NAME = "test";
        ucond.PASS      = StringHelperExd.StringToMD5("123456");
        SYS_USER val = BLLTable <SYS_USER> .Factory(conn).GetRowData(new SYS_USER(), ucond);

        if (val != null)
        {
            PowerHelper.SetCurLoginUser(val);
            if (Request["ckPass"] == null)
            {
                if (Request["preUrl"] != null)
                {
                    Response.Redirect(Request["preUrl"]);
                }
                else
                {
                    Response.Redirect("Index.aspx");
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 'yes';}else{window.returnValue = 'yes';};window.close();", true);
            }
        }
        else
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "用户名或密码错误!请重新输入。");
        }
    }
예제 #2
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (txtPass.Value == "" || txtPassRe.Value == "" || txtPassOld.Value == "")
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "旧密码,新密码,重复输入密码都不能为空。");
            return;
        }

        if (txtPass.Value != txtPassRe.Value)
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "两次密码输入不一样!请重新输入。");
            return;
        }
        SYS_USER ucond = new SYS_USER();

        ucond.USER_NAME = txtName.Text;
        ucond.PASS      = StringHelperExd.StringToMD5(txtPassOld.Value);
        SYS_USER val = BLLTable <SYS_USER> .Factory(conn).GetRowData(new SYS_USER(), ucond);

        if (val != null)
        {
            //PowerHelper.SetCurLoginUser(val);
            SYS_USER uuuPass = new SYS_USER();
            uuuPass.PASS = StringHelperExd.StringToMD5(txtPass.Value);
            BLLTable <SYS_USER> .Factory(conn).Update(SYS_USER.Attribute.USER_ID, val.USER_ID, SYS_USER.Attribute.PASS, StringHelperExd.StringToMD5(txtPass.Value));

            if (Request["ckPass"] == null)
            {
                if (Request["preUrl"] != null)
                {
                    Response.Redirect(Request["preUrl"]);
                }
                else
                {
                    AgileFrame.Core.ScriptHelper.Alert(Page, "修改成功!");
                    Response.Write("<script language='javascript'>window.close();</script>");
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 'yes';}else{window.returnValue = 'yes';};window.close();", true);
            }
        }
        else
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "旧密码错误!请重新输入。");
        }
    }
예제 #3
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (password.Value == "" || username.Value == "")
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "用户名和密码不能为空。");
            return;
        }

        SYS_USER ucond = new SYS_USER();

        ucond.USER_NAME = username.Value;
        ucond.PASS      = StringHelperExd.StringToMD5(password.Value);
        SYS_USER val = BLLTable <SYS_USER> .Factory(conn).GetRowData(new SYS_USER(), ucond);

        if (val != null)
        {
            bool tostaff = PowerHelper.SetCurLoginUser(val);
            if (tostaff == true)
            {
                if (Request["ckPass"] == null)
                {
                    if (Request["preUrl"] != null)
                    {
                        Response.Redirect(Request["preUrl"]);
                    }
                    else
                    {
                        Response.Redirect("Index.aspx");
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 'yes';}else{window.returnValue = 'yes';};window.close();", true);
                }
            }
            else
            {
                AgileFrame.Core.ScriptHelper.Alert(Page, "您的用户未与员工信息关联,请联系管理员处理。");
            }
        }
        else
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "用户名或密码错误!请重新输入。");
        }
    }
예제 #4
0
    protected void btnSysInit_Click(object sender, EventArgs e)
    {
        if (password.Value == "" || username.Value == "")
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "授权号和密码不能为空。");
            return;
        }
        if (password.Value != "chintchint")
        {
            AgileFrame.Core.ScriptHelper.Alert(Page, "授权号和密码错误。");
            return;
        }
        SYS_USER ucond = new SYS_USER();

        ucond.USER_NAME = "sys";
        SYS_USER val = BLLTable <SYS_USER> .Factory(conn).GetRowData(new SYS_USER(), ucond);

        if (val == null || val.IsNull())
        {
            ucond.PASS      = StringHelperExd.StringToMD5("123456");
            ucond.USER_TYPE = "1";
            ucond.USE_FLAG  = "1";
            ucond._ADDTIME  = DateTime.Now;
            ucond._EDITTIME = DateTime.Now;
            ucond._EMAIL    = "*****@*****.**";
            int ret1 = BLLTable <SYS_USER> .Factory(conn).Insert(ucond, SYS_USER.Attribute.USER_ID);

            AgileFrame.Core.ScriptHelper.Alert(this, "插入超级管理员sys账户成功");
        }
        else
        {
            ucond.PASS      = StringHelperExd.StringToMD5("123456");
            ucond.USER_TYPE = "1";
            ucond.USE_FLAG  = "1";
            ucond._ADDTIME  = DateTime.Now;
            ucond._EDITTIME = DateTime.Now;
            ucond._EMAIL    = "*****@*****.**";
            int ret1 = BLLTable <SYS_USER> .Factory(conn).Update(ucond, SYS_USER.Attribute.USER_ID);

            AgileFrame.Core.ScriptHelper.Alert(this, "超级管理员sys账户已存在,并重新进行了密码初始化");
        }
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        if (!string.IsNullOrEmpty(Request["DEL_RECID"]))
        {
            int recid = int.Parse(Request["DEL_RECID"]);

            WF_FORMBASE objVal = BLLTable <WF_FORMBASE> .Factory(conn).GetRowData(WF_FORMBASE.Attribute.RECID, recid);

            WFRecordInfo recObj = new WFRecordInfo(objVal, true);
            if (objVal != null)
            {
                int wfid = objVal.WFID;
                // Dictionary<string, FormField> dicObj = WFRecord.GetFormFieldDicByRecID(wfid, recid);
                if (objVal.STATUS == "0")
                {
                    recObj.DeleteByRecID(wfid, recid);
                    if (preUrl == "")
                    {
                        preUrl = "FormList.aspx?WFID=" + wfid + "&Mine=" + StringHelperExd.GetRandomCode(6);
                    }
                    else
                    {
                        if (preUrl.IndexOf("&r=") != -1)
                        {
                            preUrl = preUrl.Replace("&r=", "&r=" + StringHelperExd.GetRandomCode(3));
                        }
                        else
                        {
                            if (preUrl.IndexOf("?") != -1)
                            {
                                preUrl += "&r=" + StringHelperExd.GetRandomCode(6);
                            }
                            else
                            {
                                preUrl += "?r=" + StringHelperExd.GetRandomCode(6);
                            }
                        }
                    }
                    Response.Redirect(preUrl);
                    //ScriptHelper.AlertAndGo(Page, "删除成功!", preUrl);
                }
                else
                {
                    if (userBase.UserType == "1")
                    {
                        recObj.DeleteByRecID(wfid, recid);
                        if (preUrl == "")
                        {
                            preUrl = "FormList.aspx?WFID=" + wfid + "&Mine=" + StringHelperExd.GetRandomCode(6);
                        }
                        else
                        {
                            if (preUrl.IndexOf("&r=") != -1)
                            {
                                preUrl = preUrl.Replace("&r=", "&r=" + StringHelperExd.GetRandomCode(3));
                            }
                            else
                            {
                                if (preUrl.IndexOf("?") != -1)
                                {
                                    preUrl += "&r=" + StringHelperExd.GetRandomCode(6);
                                }
                                else
                                {
                                    preUrl += "?r=" + StringHelperExd.GetRandomCode(6);
                                }
                            }
                        }
                        Response.Redirect(preUrl);
                        //ScriptHelper.AlertAndGo(Page, "删除成功!", preUrl);
                    }
                    else
                    {
                        Response.Write("<h3>已经在审批中,不能删除!<a href='" + preUrl + "'>返回</a></h3>");
                    }
                }
            }
            else
            {
                ScriptHelper.AlertAndGo(Page, "该记录不存在或已被删除!", preUrl);
            }
        }

        #endregion

        if (Request["GetRECNO"] != null)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Write(WFRecordInfo.GetRECNO(Request["DEPT_ID"]));
            Response.End();
        }
        if (Request["showlog"] != null)
        {
            #region
            WF_CHECK_LOG ccc = new WF_CHECK_LOG();
            ccc.WFID    = int.Parse(Request["WFID"]);
            ccc.PROCID  = int.Parse(Request["PROCID"]);
            ccc.STEP_ID = int.Parse(Request["StepID"]);
            ccc.RECID   = int.Parse(Request["RECID"]);
            WF_CHECK_LOG log = BLLTable <WF_CHECK_LOG> .Factory(conn).GetRowData(ccc);

            if (log != null)
            {
                try
                {
                    StringBuilder sb = new StringBuilder();
                    string[]      a  = StringHelper.GetStringArray(log.RESULTS, '|');
                    string[]      b  = StringHelper.GetStringArray(log.CHECKERS, '|');
                    string[]      c  = StringHelper.GetStringArray(log.CHECK_TIMES, '|');
                    string[]      d  = null;
                    string[]      f  = null;
                    if (!string.IsNullOrEmpty(log.NOTES))
                    {
                        d = StringHelper.GetStringArray(log.NOTES, '|');
                    }
                    if (!string.IsNullOrEmpty(log.ANNEX_FILE))
                    {
                        f = StringHelper.GetStringArray(log.ANNEX_FILE, '|');
                    }
                    for (int i = 0; i < a.Length; i++)
                    {
                        string mbr = "", entrust = "";

                        if (b[i].IndexOf(":") >= 0)
                        {
                            mbr     = b[i].Split(':')[0];
                            entrust = b[i].Split(':')[1];
                        }
                        else
                        {
                            mbr = b[i];
                        }
                        sb.Append("<div class='l-row'><p><span>" + mbr + "</span><b>" + WFEnum.GetLogResult(a[i]) + "</b>");
                        sb.Append("<span>" + entrust + "</span>");
                        sb.Append("<label>" + c[i] + "</label></p>");
                        if (d != null && d.Length > i)
                        {
                            sb.Append("<p>" + d[i] + "</p>");
                        }
                        else
                        {
                            sb.Append("<p>无</p>");
                        }
                        if (f != null)
                        {
                            if (!string.IsNullOrEmpty(f[i]))
                            {
                                sb.Append("<p>附件:");
                                string[] lstAnnex = f[i].Split(',');
                                foreach (string strAnnex in lstAnnex)
                                {
                                    sb.Append("<a href='" + WebHelper.GetAppPath() + strAnnex + "' target='_blank'>" + strAnnex.Substring(strAnnex.LastIndexOf("/") + 1) + "</a></br>");
                                }
                                sb.Append("</p>");
                            }
                        }
                        sb.Append("</div>");
                    }
                    Response.Write(sb.ToString());
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
            else
            {
                Response.Write("<div class='l-row'><p>无审批记录</p></div>");
            }

            #endregion
        }

        if (Request["selVal"] != null)
        {
            //获取父下拉框选中的ITEM_ID
            V_TF_F_COLUMN_ITEM objVC = new V_TF_F_COLUMN_ITEM();
            objVC.COLUMN_ID = Convert.ToInt32(Request["Pcolumnid"]);
            objVC.VALUE     = Request["selVal"];

            V_TF_F_COLUMN_ITEM objI = BLLTable <V_TF_F_COLUMN_ITEM> .GetRowData(objVC);

            //获取子下拉框的内容项
            if (objI != null)
            {
                V_TF_F_COLUMN_ITEM objV = new V_TF_F_COLUMN_ITEM();
                objV.Distinct = true;
                objV.VALUE    = "";
                objV.TEXT     = "";

                objVC           = new V_TF_F_COLUMN_ITEM();
                objVC.COLUMN_ID = Convert.ToInt32(Request["columnid"]);
                objVC.DROP_REAL = Convert.ToString(objI.ITEM_ID);

                List <V_TF_F_COLUMN_ITEM> lstv = BLLTable <V_TF_F_COLUMN_ITEM> .Select(objV, objVC);

                if (lstv.Count > 0)
                {
                    Response.Write("{\"list\":" + JsonUtil.getJsonStr <V_TF_F_COLUMN_ITEM>(lstv) + ",\"first\":\"" + lstv[0].ITEM_ID + "\"}");
                }
                else
                {
                    Response.Write("{\"list\":\"\",\"first\":\"\"}");
                }
            }
        }

        Response.End();
    }
예제 #6
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();

            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;

            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);
            }
            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();
            }
            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
                {
                    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;
        }
    }
예제 #7
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (ViewState["txtUSER_NAME"] == null || ViewState["txtUSER_NAME"].ToString() != txtUSER_NAME.Value)
        {
            SYS_USER hadCond = new SYS_USER();
            hadCond.USER_NAME = txtUSER_NAME.Value;
            if (BLLTable<SYS_USER>.Exists(hadCond))
            {
                litWarn.Text = "此用户已经存在,请重新输入!或换个名称。";
                return;
            }
        }
        try
        {
            SYS_USER valObj = new SYS_USER();


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


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


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


            if (txtEMAIL.Value != "")
                valObj.EMAIL = Convert.ToString(txtEMAIL.Value);


            if (txtLOGIN_IPS.Value != "")
                valObj.LOGIN_IPS = Convert.ToString(txtLOGIN_IPS.Value);
            #region   wk(用户新增字段)
            //if (txtUSER_QQ.Value != "")
                valObj.USER_QQ = Convert.ToString(txtUSER_QQ.Value);

            if (txtUSER_Taobao.Value != "")
                valObj.USER_Taobao = Convert.ToString(txtUSER_Taobao.Value);

            if (txtIS_FeiQ_Remind.Checked != true)
                valObj.IS_FeiQ_Remind = Convert.ToBoolean(txtIS_FeiQ_Remind.Checked);

            if (txtIS_EMAIL_Remind.Checked != true)
                valObj.IS_EMAIL_Remind = Convert.ToBoolean(txtIS_EMAIL_Remind.Checked);

            if (txtIS_Taobao_Remind.Checked != true)
                valObj.IS_Taobao_Remind = Convert.ToBoolean(txtIS_Taobao_Remind.Checked);

            if (txtIS_QQ_Remind.Checked != true)
                valObj.IS_QQ_Remind = Convert.ToBoolean(txtIS_QQ_Remind.Checked);

            if (txtSTATE_FLAG.Value != "")
                valObj.USE_FLAG = Convert.ToString(txtSTATE_FLAG.Value);
            #endregion

            if (txtUSER_TYPE.Value != "")
                valObj.USER_TYPE = Convert.ToString(txtUSER_TYPE.Value);
            else
                valObj.USER_TYPE = "1";

            valObj.STAFF_ID = wucSelStaff1.Staff_ID;

            valObj.REAL_NAME = wucSelStaff1.Staff_NAME;
            if (keyid != "")
            {
                valObj.EDITTIME = DateTime.Now;
                valObj.USER_ID = Convert.ToInt32(keyid);
                count = BLLTable<SYS_USER>.Factory(conn).Update(valObj, SYS_USER.Attribute.USER_ID);
            }
            else
            {
                valObj.EDITTIME = DateTime.Now;
                valObj.ADDTIME = DateTime.Now;
                count = BLLTable<SYS_USER>.Factory(conn).Insert(valObj, SYS_USER.Attribute.USER_ID);
                keyid = valObj.USER_ID.ToString();

            }            

            if (count > 0)
            {
                BLLTable<HR_STAFF>.Factory(conn).Update(HR_STAFF.Attribute.STAFF_ID, wucSelStaff1.Staff_ID, HR_STAFF.Attribute.USER_ID, keyid);

                BLLTable<SYS_USERROLE>.Factory(conn).Delete(SYS_USERROLE.Attribute.USER_ID, keyid);//先删除角色用户关联
                string[] roles = StringHelper.GetStringArray(hidSelReals.Value, ',');//再根据当前选择的角色写入关联表
                if (roles != null)
                {
                    for (int i = 0; i < roles.Length; i++)
                    {
                        SYS_USERROLE ur = new SYS_USERROLE();
                        ur.ROLE_ID = int.Parse(roles[i]);
                        ur.USER_ID = int.Parse(keyid);
                        BLLTable<SYS_USERROLE>.Factory(conn).Insert(ur);
                    }
                }

                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)
                    {
                        if (lstCol[i] == SYS_USER.Attribute.ADDTIME)
                        {
                            continue;
                        }
                        if (lstCol[i] == SYS_USER.Attribute.EDITTIME)
                        {
                            val = Convert.ToDateTime(val).ToString("yyyy-MM-dd");
                        }
                        sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'");
                    }
                }
                sbData.Append("})");
                Button btn = (Button)sender;
                if (btn.ID == "btnOK")
                {
                    if (ViewState["hadSave"] == null)
                    {
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true);
                    }
                }
                else
                {
                    txtUSER_NAME.Value = "";
                    txtPASS.Value = "";
                    txtEMAIL.Value = "";
                    txtLOGIN_IPS.Value = "";
                    txtSTATE_FLAG.Value = "";
                    txtUSER_TYPE.Value = "";
                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "parent.addNewToList(\"" + sbData.ToString() + "\");", true);
                    ViewState["hadSave"] = 1;
                }
            }
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
예제 #8
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string gotoUrl = "WF_STEPManage.aspx";

        if (Request["preUrl"] != null)
        {
            gotoUrl = Request["preUrl"];
        }
        else
        {
            gotoUrl = "../ok.aspx";
        }
        int           Num = Convert.ToInt32(Request["hidCondNum"]);
        StringBuilder sb  = new StringBuilder();

        for (int i = 1; i <= Num; i++)
        {
            if (!string.IsNullOrEmpty(Request["txtCond_" + i.ToString()]))
            {
                string conddata = Request["txtCond_" + i.ToString()];
                if (sb.Length > 0)
                {
                    sb.Append("|");
                }
                sb.Append(conddata);
            }
        }
        //if (Request["open"] == null)
        //{
        if (Request["setPathCond"] != null)//设置路径条件
        {
            WF_STEPATH_TPL cond = new WF_STEPATH_TPL();
            cond.STEP_ID = int.Parse(Request["StepID"]);
            cond.NEXT_ID = int.Parse(Request["NextID"]);

            WF_STEPATH_TPL upStep = new WF_STEPATH_TPL();
            upStep.CONDITION = sb.ToString();
            if (upStep.CONDITION.Length > 1)
            {
                upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
            }
            else
            {
                upStep.FORMULAR = "";
            }
            BLLTable <WF_STEPATH_TPL> .Factory(conn).Update(upStep, cond);
        }
        if (from == "1")//显示步骤条件--无用
        {
            WF_STEP_TPL upStep = new WF_STEP_TPL();
            upStep.STEP_ID   = keyid;
            upStep.CONDITION = sb.ToString();
            if (upStep.CONDITION.Length > 1)
            {
                upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
            }
            else
            {
                upStep.FORMULAR = "";
            }
            BLLTable <WF_STEP_TPL> .Factory(conn).Update(upStep, WF_STEP_TPL.Attribute.STEP_ID);
        }
        else if (from == "2")//普通路径条件
        {
            WF_STEPATH_TPL cond = new WF_STEPATH_TPL();
            cond.STEP_ID   = keyid;
            cond.NEXT_ID   = int.Parse(Request["NextID"]);
            cond.PATH_TYPE = int.Parse(Request["PATH_TYPE"]);
            WF_STEPATH_TPL upStep = new WF_STEPATH_TPL();
            upStep.CONDITION = sb.ToString();
            if (upStep.CONDITION.Length > 1)
            {
                upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
            }
            else
            {
                upStep.FORMULAR = "";
            }
            BLLTable <WF_STEPATH_TPL> .Factory(conn).Update(upStep, cond);
        }
        else if (from == "3")//审核人条件设置
        {
            WF_CHECKER_TPL upCh = new WF_CHECKER_TPL();
            upCh.CHECKER_ID = keyid;
            upCh.CONDITION  = sb.ToString();
            if (upCh.CONDITION.Length > 1)
            {
                upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
            }
            else
            {
                upCh.FORMULAR = "";
            }
            BLLTable <WF_CHECKER_TPL> .Factory(conn).Update(upCh, WF_CHECKER_TPL.Attribute.CHECKER_ID);
        }
        else if (from == "4")//选择过程条件
        {
            WF_PROCESS_TPL upSet = new WF_PROCESS_TPL();
            upSet.PROCID    = keyid;
            upSet.CONDITION = sb.ToString();
            if (upSet.CONDITION.Length > 1)
            {
                upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
            }
            else
            {
                upSet.FORMULAR = "";
            }
            BLLTable <WF_PROCESS_TPL> .Factory(conn).Update(upSet, WF_PROCESS_TPL.Attribute.PROCID);
        }
        else if (from == "5")//通知人条件设置
        {
            WF_NOTIFIER_TPL upCh = new WF_NOTIFIER_TPL();
            upCh.NOTIFIER_ID = keyid;
            upCh.CONDITION   = sb.ToString();
            if (upCh.CONDITION.Length > 1)
            {
                upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
            }
            else
            {
                upCh.FORMULAR = "";
            }
            BLLTable <WF_NOTIFIER_TPL> .Factory(conn).Update(upCh, WF_NOTIFIER_TPL.Attribute.NOTIFIER_ID);
        }
        //else if (from == "6")
        //{
        //    WF_STEPState upSet = new WF_STEPState();
        //    upSet.StateID = keyid;
        //    upSet.CONDITION = sb.ToString();
        //    if (upSet.CONDITION.Length > 1)
        //    {
        //        upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim();
        //    }
        //    else
        //    {
        //        upSet.FORMULAR = "";
        //    }
        //    BLLTable<WF_STEPState>.Factory(conn).Update(upSet);
        //}

        if (Request["setpSetting"] != null)
        {
            //Response.Write(Request.Url.AbsoluteUri);
            string randStr = StringHelperExd.GetRandomCode(6);
            string url     = Request.Url.AbsoluteUri;
            if (url.IndexOf("&r=") != -1)
            {
                Regex reg = new Regex(@"&r=\w+");
                url = reg.Replace(url, "&r=" + randStr);
            }
            else
            {
                url += "&r=" + randStr;
            }
            //Response.Write(url);
            //ScriptHelper.AlertAndGo(Page, "条件保存成功!", url);
            ScriptHelper.Alert(Page, "条件保存成功!");
            //Response.Redirect(Request.Url.AbsoluteUri);
        }
        else
        {
            AgileFrame.Core.ScriptHelper.ResponseScript(Page, "if (window.opener){window.opener.returnValue = \"ok\";}else{window.returnValue = \"ok\";}window.close();", true);
        }
        //Response.Redirect(gotoUrl);
        //}
        //else//打开条件配制窗口,无论是修改还是新增条件,都只需要返回条件和公式即可
        //{
        //    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "window.returnValue=\"" + sb.ToString() + "`" + txtGongShi.Value.Trim() + "\";window.close();", false);
        //}
    }
예제 #9
0
    private string InsertUser()
    {
        string loginname = Common.GetReqStrValue("loginname");
        string pwd       = Common.GetReqStrValue("pwd");
        string name      = Common.GetReqStrValue("name");
        string coname    = Common.GetReqStrValue("coname");
        string phone     = Common.GetReqStrValue("phone");
        int    checknum  = Common.GetReqIntValue("checknum");
        string email     = Common.GetReqStrValue("email");


        if (Common.GetReqStrValue("hidFlag").Equals("0"))
        {
            SYS_CHECKNUM condobj = new SYS_CHECKNUM();
            condobj.CHECKNUM = checknum;
            condobj.PHONE    = phone;
            if (!BLLTable <SYS_CHECKNUM> .Exists(condobj))
            {
                return("-1");
            }
        }

        SYS_TEMPUSER objval = new SYS_TEMPUSER();

        objval.NAME = loginname;
        SYS_USER objvalUser = new SYS_USER();

        objvalUser.USER_NAME = loginname;
        if (BLLTable <SYS_TEMPUSER> .Exists(objval) || BLLTable <SYS_USER> .Exists(objvalUser))
        {
            return("-2");
        }

        //事务处理
        using (Transaction t = new Transaction("conn"))
        {
            objvalUser           = new SYS_USER();
            objvalUser.USER_NAME = loginname;
            objvalUser.PASS      = StringHelperExd.StringToMD5(pwd);
            objvalUser.USER_TYPE = "4";
            objvalUser.REAL_NAME = name;
            objvalUser.STAFF_ID  = 21;

            int intRet = BLLTable <SYS_USER> .Factory(t).Insert(objvalUser, SYS_USER.Attribute.USER_ID);

            if (intRet == -1)
            {
                t.RollBack();
            }

            string sql = "  insert into SYS_USER_MDLPOWER_DIC select " + objvalUser.USER_ID + ",PAGE_URL,DIC_ID from SYS_USER_MDLPOWER_DIC where user_id =1";

            intRet = BLLTable <SYS_USER> .Factory(t).ExecSQL(sql, System.Data.CommandType.Text);

            if (intRet == -1)
            {
                t.RollBack();
            }

            objval           = new SYS_TEMPUSER();
            objval.LOGINNAME = loginname;
            objval.PWD       = pwd;
            objval.NAME      = name;
            objval.CONAME    = coname;
            objval.PHONE     = phone;
            objval.IP        = GetIP();
            objval.USER_ID   = objvalUser.USER_ID;
            objval.EMAIL     = email;

            intRet = BLLTable <SYS_TEMPUSER> .Factory(t).Insert(objval, SYS_TEMPUSER.Attribute.ID);

            if (intRet == -1)
            {
                t.RollBack();
            }

            intRet = BLLTable <SYS_CHECKNUM> .Factory(t).Delete(SYS_CHECKNUM.Attribute.PHONE, phone);

            if (intRet == -1)
            {
                t.RollBack();
            }

            t.Commit();
        }

        return("0");
    }
예제 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["UpPageCols"] != null)
        {
            string[] cols    = StringHelperExd.GetStringArray(Request["UpPageCols"], ',');
            string[] names   = StringHelperExd.GetStringArray(Microsoft.JScript.GlobalObject.unescape(Request["colnames"]), ',');
            string   pageurl = Request["PageUrl"];//hr/manage.aspx?dptid=1


            if (!string.IsNullOrEmpty(pageurl))
            {
                SYS_MODULE mdl = new ModuleHelper(conn).GetModuleByPageUrl(pageurl.ToLower());
                if (mdl != null)
                {
                    pageurl = mdl.PAGE_URL;
                    List <SYS_PAGE_TBFIND_COLS> lst = BLLTable <SYS_PAGE_TBFIND_COLS> .Factory(conn).Select(SYS_PAGE_TBFIND_COLS.Attribute.PAGE_URL, pageurl);

                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    if (lst.Count > 0)
                    {
                        for (int i = 0; i < lst.Count; i++)
                        {
                            if (!dic.ContainsKey(lst[i].COL_NAME))
                            {
                                dic.Add(lst[i].COL_NAME, lst[i].TB_SHOW + "," + lst[i].FIND_SHOW);
                            }
                        }
                    }
                    BLLTable <SYS_PAGE_TBFIND_COLS> .Factory(conn).Delete(SYS_PAGE_TBFIND_COLS.Attribute.PAGE_URL, pageurl);

                    SYS_PAGE_TBFIND_COLS valObj = new SYS_PAGE_TBFIND_COLS();
                    int colNameNullCount        = 0;
                    for (int i = 0; i < cols.Length; i++)
                    {
                        valObj.PAGE_URL  = pageurl;
                        valObj.FOR_TYPE  = 0;//
                        valObj.COL_NAME  = cols[i].Replace("[", "").Replace("]", "");
                        valObj.SHOW_NAME = names[i];
                        if (string.IsNullOrEmpty(valObj.COL_NAME.Trim()))
                        {
                            colNameNullCount++;
                            continue;
                        }
                        else if (string.IsNullOrEmpty(valObj.SHOW_NAME.Trim()))
                        {
                            colNameNullCount++;
                            continue;
                        }
                        valObj.TB_SHOW   = 1; //
                        valObj.FIND_SHOW = 1; //
                        if (dic.ContainsKey(cols[i]))
                        {
                            string[] aaa = dic[cols[i]].Split(',');
                            valObj.TB_SHOW   = decimal.Parse(aaa[0]); //
                            valObj.FIND_SHOW = decimal.Parse(aaa[1]); //
                        }
                        BLLTable <SYS_PAGE_TBFIND_COLS> .Factory(conn).Insert(valObj, SYS_PAGE_TBFIND_COLS.Attribute.P_COLID);
                    }
                    Response.Write("上传成功!" + (colNameNullCount > 0 ? ("发现列名为空字段:" + colNameNullCount + "个!") : ""));
                }
                else
                {
                    Response.Write("获取不到对应模块!");
                }
            }
            else
            {
                Response.Write("缺少页面参数值!");
            }
        }
        else
        {
            string     btnType = Request["btnType"];
            string     dicCode = Request["dicCode"];
            string     btnName = Request["btnName"];
            string     pageDir = Request["pageDir"].ToLower();//hr/manage.aspx?dptid=1
            SYS_MODULE mdl     = new ModuleHelper(conn).GetModuleByPageUrl(pageDir);
            if (mdl != null)
            {
                pageDir = mdl.PAGE_URL;
                SYS_MDLPOWER_DIC valObj  = new SYS_MDLPOWER_DIC();
                SYS_MDLPOWER_DIC condDic = new SYS_MDLPOWER_DIC();
                condDic.PAGE_URL = pageDir;
                condDic.DIC_NAME = btnName;
                condDic.DIC_CODE = dicCode;

                valObj.PAGE_URL  = pageDir;
                valObj.DIC_NAME  = btnName;
                valObj.CTRL_TYPE = btnType;
                valObj.DIC_CODE  = dicCode;
                valObj.DEAL_TYPE = EnumInfo.OprCtrlDealType.Disabled.ToString("d");
                int re = 0;
                if (BLLTable <SYS_MDLPOWER_DIC> .Exists(condDic))
                {
                    re = BLLTable <SYS_MDLPOWER_DIC> .Factory(conn).Update(valObj, condDic);
                }
                else
                {
                    re = BLLTable <SYS_MDLPOWER_DIC> .Factory(conn).Insert(valObj, SYS_MDLPOWER_DIC.Attribute.DIC_ID);
                }

                Response.Write(re.ToString());
            }
            else
            {
                Response.Write("0");
            }
        }
        Response.End();
    }