Beispiel #1
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        ZWL.BLL.ERPNWorkToDo Model = new ZWL.BLL.ERPNWorkToDo();
        Model.WorkName     = this.txtWorkName.Text.Trim();
        Model.WenHao       = this.txtWenHao.Text.Trim();
        Model.FormID       = int.Parse(Request.QueryString["FormID"].ToString());
        Model.WorkFlowID   = int.Parse(Request.QueryString["WorkFlowID"].ToString());
        Model.UserName     = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        Model.TimeStr      = DateTime.Now;
        Model.FormContent  = this.TextBox3.Text;
        Model.FuJianList   = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        Model.ShenPiYiJian = "";
        try
        {
            #region 添加默认审批人检查 Andy 20130925

            //根据选择的节点,绑定人员等信息。
            ZWL.BLL.ERPNWorkFlowNode MyJieDian = new ZWL.BLL.ERPNWorkFlowNode();
            MyJieDian.GetModel(int.Parse(this.DropDownList3.SelectedItem.Value.ToString()));

            if (MyJieDian.SPType == "从默认审批人中选择")
            {
                if (!String.IsNullOrEmpty(MyJieDian.SPDefaultList))
                {
                    ArrayList CurrentSP = new ArrayList(this.TextBox5.Text.Trim().Split(','));
                    ArrayList SPDefault = new ArrayList(MyJieDian.SPDefaultList.Split(','));

                    foreach (string sp in CurrentSP)
                    {
                        if (!SPDefault.Contains(sp))
                        {
                            ZWL.Common.MessageBox.Show(this, "请从默认审批人中选择,默认审批人:" + MyJieDian.SPDefaultList + " !");
                            return;
                        }
                    }
                }
            }
            else if (MyJieDian.SPType == "从默认审批部门中选择")
            {
                string   SqlWhere   = "";
                string[] DefultList = MyJieDian.SPDefaultList.Split(',');
                for (int i = 0; i < DefultList.Length; i++)
                {
                    if (SqlWhere.Trim().Length > 0)
                    {
                        SqlWhere = SqlWhere + " or  " + " ','+Department+',' like '%," + DefultList[i].ToString() + ",%' ";
                    }
                    else
                    {
                        SqlWhere = " ','+Department+',' like '%," + DefultList[i].ToString() + ",%' ";
                    }
                }

                string SPDefaultStr = ZWL.DBUtility.DbHelperSQL.GetStringList("select UserName from ERPUser where " + SqlWhere).Replace("|", ",");

                if (!String.IsNullOrEmpty(SPDefaultStr))
                {
                    ArrayList CurrentSP = new ArrayList(this.TextBox5.Text.Trim().Split(','));
                    ArrayList SPDefault = new ArrayList(SPDefaultStr.Split(','));

                    foreach (string sp in CurrentSP)
                    {
                        if (!SPDefault.Contains(sp))
                        {
                            ZWL.Common.MessageBox.Show(this, "请从默认审批部门中选择,默认审批部门:" + MyJieDian.SPDefaultList + " !");
                            return;
                        }
                    }
                }
            }
            else if (MyJieDian.SPType == "从默认审批角色中选择")
            {
                string   SqlWhere   = "";
                string[] DefultList = MyJieDian.SPDefaultList.Split(',');
                for (int i = 0; i < DefultList.Length; i++)
                {
                    if (SqlWhere.Trim().Length > 0)
                    {
                        SqlWhere = SqlWhere + " or  " + " ','+JiaoSe+',' like '%," + DefultList[i].ToString() + ",%' ";
                    }
                    else
                    {
                        SqlWhere = " ','+JiaoSe+',' like '%," + DefultList[i].ToString() + ",%' ";
                    }
                }

                string SPDefaultStr = ZWL.DBUtility.DbHelperSQL.GetStringList("select UserName from ERPUser where " + SqlWhere).Replace("|", ",");

                if (!String.IsNullOrEmpty(SPDefaultStr))
                {
                    ArrayList CurrentSP = new ArrayList(this.TextBox5.Text.Trim().Split(','));
                    ArrayList SPDefault = new ArrayList(SPDefaultStr.Split(','));

                    foreach (string sp in CurrentSP)
                    {
                        if (!SPDefault.Contains(sp))
                        {
                            ZWL.Common.MessageBox.Show(this, "请从默认审批角色中选择,默认审批角色:" + MyJieDian.SPDefaultList + " !");
                            return;
                        }
                    }
                }
            }
            #endregion

            if (CheckBox1.Checked == true)
            {
                //条件未找到或者没有匹配项时,采用选择好的节点
                Model.JieDianID = int.Parse(this.DropDownList3.SelectedValue.ToString());
                try
                {
                    ///////////根据条件获取下一审批节点信息
                    Model.JieDianID = CheckCondition(this.DropDownList3.SelectedValue.ToString());
                }
                catch
                {
                    Model.JieDianID = int.Parse(this.DropDownList3.SelectedValue.ToString());
                }
            }
            else
            {
                Model.JieDianID = int.Parse(this.DropDownList3.SelectedValue.ToString());
            }
            Model.JieDianName = ZWL.DBUtility.DbHelperSQL.GetSHSL("select NodeName from ERPNWorkFlowNode where ID=" + Model.JieDianID.ToString());
            Model.StateNow    = "正在办理";
        }
        catch
        {
            Model.JieDianName = "结束";
            Model.StateNow    = "强制结束";
        }
        Model.ShenPiUserList = ZWL.Common.PublicMethod.WorkWeiTuoUserList(this.TextBox5.Text.Trim());
        Model.OKUserList     = "默认";
        Model.LateTime       = DateTime.Now.AddHours(double.Parse(ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select top 1 JieShuHours from ERPNWorkFlowNode where ID=" + Model.JieDianID.ToString())));
        int todoid = Model.Add();

        if (Model.StateNow == "正在办理")
        {
            //发送短信
            SendMainAndSms.SendMessage(CHKSMS, CHKMOB, "您有新的工作需要办理!(" + this.txtWorkName.Text + ")", ZWL.Common.PublicMethod.WorkWeiTuoUserList(this.TextBox5.Text.Trim()));
        }
        else
        {
            SendMainAndSms.SendMessage(CHKSMS, CHKMOB, "您的工作已经被强制结束!(" + this.txtWorkName.Text + ")", ZWL.Common.PublicMethod.GetSessionValue("UserName"));
        }

        //Andy 20130925 添加委托人审批记录
        string[] UserArray = this.TextBox5.Text.Trim().Split(',');
        for (int i = 0; i < UserArray.Length; i++)
        {
            if (UserArray[i].ToString().Trim().Length > 0)
            {
                string WeiTuoUser = ZWL.DBUtility.DbHelperSQL.GetSHSL("select top 1 ToUser from ERPNWorkFlowWT where FromUser='******'");
                if (WeiTuoUser.Trim().Length > 0)
                {
                    ZWL.DBUtility.DbHelperSQL.ExecuteSQL("insert into ERPNWorkFlowWTLog(FromUser,ToUser,ToDoid,InTime) values('" + UserArray[i].ToString() + "','" + WeiTuoUser.Trim() + "'," + todoid + ",'" + DateTime.Now.ToString() + "')");
                }
            }
        }

        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新工作信息(" + this.txtWorkName.Text + ")";
        MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "审批工作添加成功!", "NWorkToDo.aspx?FormID=" + Request.QueryString["FormID"].ToString() + "&WorkFlowID=" + Request.QueryString["WorkFlowID"].ToString());
    }
Beispiel #2
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        ZWL.BLL.ERPNWorkToDo Model = new ZWL.BLL.ERPNWorkToDo();
        Model.WorkName     = this.txtWorkName.Text;
        Model.FormID       = int.Parse(Request.QueryString["FormID"].ToString());
        Model.WorkFlowID   = int.Parse(Request.QueryString["WorkFlowID"].ToString());
        Model.UserName     = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        Model.TimeStr      = DateTime.Now;
        Model.FormContent  = this.TextBox3.Text;
        Model.FuJianList   = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        Model.ShenPiYiJian = "";
        try
        {
            if (CheckBox1.Checked == true)
            {
                //条件未找到或者没有匹配项时,采用选择好的节点
                Model.JieDianID = int.Parse(this.DropDownList3.SelectedValue.ToString());
                try
                {
                    ///////////根据条件获取下一审批节点信息
                    Model.JieDianID = CheckCondition(this.DropDownList3.SelectedValue.ToString());
                }
                catch
                {
                    Model.JieDianID = int.Parse(this.DropDownList3.SelectedValue.ToString());
                }
            }
            else
            {
                Model.JieDianID = int.Parse(this.DropDownList3.SelectedValue.ToString());
            }
            Model.JieDianName = ZWL.DBUtility.DbHelperSQL.GetSHSL("select NodeName from ERPNWorkFlowNode where ID=" + Model.JieDianID.ToString());
            Model.StateNow    = "正在办理";
        }
        catch
        {
            Model.JieDianName = "结束";
            Model.StateNow    = "强制结束";
        }
        Model.ShenPiUserList   = ZWL.Common.PublicMethod.WorkWeiTuoUserList(this.TextBox5.Text.Trim());
        Model.ChaoSongUserList = ZWL.Common.PublicMethod.WorkWeiTuoUserList(this.txtChaoSong.Text.Trim());
        Model.OKUserList       = "默认";
        Model.LateTime         = DateTime.Now.AddHours(double.Parse(ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select top 1 JieShuHours from ERPNWorkFlowNode where ID=" + Model.JieDianID.ToString())));
        Model.Add();

        if (Model.StateNow == "正在办理")
        {
            //发送短信
            SendMainAndSms.SendMessage(CHKSMS, CHKMOB, "您有新的工作需要办理!(" + this.txtWorkName.Text + ")", ZWL.Common.PublicMethod.WorkWeiTuoUserList(this.TextBox5.Text.Trim()));
            SendMainAndSms.SendMessage(CHKSMS1, CHKMOB1, "您有新的抄送工作!(" + this.txtWorkName.Text + ")", ZWL.Common.PublicMethod.WorkWeiTuoUserList(this.txtChaoSong.Text.Trim()));
        }
        else
        {
            SendMainAndSms.SendMessage(CHKSMS, CHKMOB, "您的工作已经被强制结束!(" + this.txtWorkName.Text + ")", ZWL.Common.PublicMethod.GetSessionValue("UserName"));
        }

        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新工作信息(" + this.txtWorkName.Text + ")";
        MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "审批工作添加成功!", "NWorkToDo.aspx?FormID=" + Request.QueryString["FormID"].ToString() + "&WorkFlowID=" + Request.QueryString["WorkFlowID"].ToString());
    }