Beispiel #1
0
 private void DoApprove(int State, string remark)
 {
     foreach (GridViewRow gr in gv_List.Rows)
     {
         if (((CheckBox)gr.FindControl("chk_ID")).Checked)
         {
             int taskid = (int)gv_List.DataKeys[gr.RowIndex][0];
             if (taskid > 0)
             {
                 int jobid = EWF_TaskBLL.StaffCanApproveTask(taskid, (int)Session["UserID"]);
                 if (jobid > 0)
                 {
                     EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                     if (job != null)
                     {
                         int decisionid = job.StaffCanDecide((int)Session["UserID"]);
                         if (decisionid > 0)
                         {
                             if (State == 2)
                             {
                                 job.Decision(decisionid, (int)Session["UserID"], 2, "汇总单批量审批通过!");         //2:审批已通过
                             }
                             else
                             {
                                 job.Decision(decisionid, (int)Session["UserID"], 3, "汇总单批量审批不通过!");       //3:审批不通过
                             }
                         }
                     }
                 }
             }
         }
     }
     BindGrid();
     MessageBox.Show(this, "审批成功!");
 }
    protected void DoApprove(bool ApproveFlag)
    {
        #region 仅查看待我审批的工资申请单
        string taskids = "";
        if (ddl_State.SelectedValue == "1")
        {
            taskids = GetNeedMeApproveTaskIDs();

            if (taskids == "")
            {
                MessageBox.Show(this, "对不起,没有需要待您审批的费用申请单!");
                return;
            }
        }
        #endregion
        string[] TaskIDs = taskids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);



        foreach (string taskid in TaskIDs)
        {
            int             jobid = EWF_TaskBLL.StaffCanApproveTask(int.Parse(taskid), (int)Session["UserID"]);
            EWF_Task_JobBLL job   = new EWF_Task_JobBLL(jobid);
            if (job.Model != null)
            {
                int decision = job.StaffCanDecide((int)Session["UserID"]);
                if (decision > 0)
                {
                    if (ApproveFlag)
                    {
                        job.Decision(decision, (int)Session["UserID"], 2, "汇总单批量审批通过!");       //2:审批已通过
                    }
                    else
                    {
                        job.Decision(decision, (int)Session["UserID"], 3, "汇总单批量未能审批通过!");    //3:审批未通过
                    }
                }
            }
        }

        BindGrid();
        MessageBox.Show(this, ApproveFlag ? "审批成功!" : "已成功将选择区域的申请单,设为批复未通过!");
        return;
    }
Beispiel #3
0
 private int DoApproveTask(int TaskID, int DessionResult, string DessionComment)
 {
     if (TaskID > 0)
     {
         int jobid = EWF_TaskBLL.StaffCanApproveTask(TaskID, (int)Session["UserID"]);
         if (jobid > 0)
         {
             EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
             if (job != null)
             {
                 int decisionid = job.StaffCanDecide((int)Session["UserID"]);
                 if (decisionid > 0)
                 {
                     return(job.Decision(decisionid, (int)Session["UserID"], DessionResult, DessionComment));
                 }
             }
         }
     }
     return(-1);
 }
Beispiel #4
0
    private void Approve(int state)
    {
        int userid = (int)Session["UserID"];

        foreach (GridViewRow row in gv_List.Rows)
        {
            Object cbx = row.FindControl("chk_ID");
            if (cbx != null && ((CheckBox)cbx).Checked)
            {
                Object tbx    = row.FindControl("tbx_Remark");
                string Remark = "";
                if (tbx != null && !string.IsNullOrEmpty(((TextBox)tbx).Text))
                {
                    Remark = ((TextBox)tbx).Text;
                }
                else
                {
                    Remark = state == 2 ? "汇总单批量审批通过!" : "汇总单批量审批不通过!";
                }
                int            contractid = (int)gv_List.DataKeys[row.RowIndex]["ID"];
                CM_ContractBLL con        = new CM_ContractBLL(contractid);
                int            taskid     = con.Model.ApproveTask;
                if (taskid > 0)
                {
                    int jobid = EWF_TaskBLL.StaffCanApproveTask(taskid, userid);
                    if (jobid > 0)
                    {
                        EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                        if (job != null)
                        {
                            int decisionid = job.StaffCanDecide(userid);
                            if (decisionid > 0)
                            {
                                job.Decision(decisionid, userid, state, Remark);
                            }
                        }
                    }
                }
            }
        }
    }
Beispiel #5
0
    protected int DoApprove(bool ApproveFlag)
    {
        int counts = 0;

        foreach (GridViewRow row in gv_DetailList.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                CheckBox cbx = row.FindControl("cb_Selected") as CheckBox;
                if (cbx.Checked)
                {
                    int taskid = (int)gv_DetailList.DataKeys[row.RowIndex]["FNA_FeeApply_ApproveTask"];
                    int jobid  = EWF_TaskBLL.StaffCanApproveTask(taskid, (int)Session["UserID"]);
                    if (jobid > 0)
                    {
                        EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                        if (job != null)
                        {
                            int decisionid = job.StaffCanDecide((int)Session["UserID"]);
                            if (decisionid > 0)
                            {
                                if (ApproveFlag)
                                {
                                    job.Decision(decisionid, (int)Session["UserID"], 2, "汇总单批量审批通过!");       //2:审批已通过
                                }
                                else
                                {
                                    job.Decision(decisionid, (int)Session["UserID"], 3, "汇总单批量审批不通过!");       //3:审批不通过
                                }
                                counts++;
                            }
                        }
                    }
                }
            }
        }
        return(counts);
    }
Beispiel #6
0
    protected int DoApprove(int OrganizeCity, bool ApproveFlag)
    {
        int       month     = int.Parse(ddl_Month.SelectedValue);
        int       state     = 1;    //待我审批
        int       RTChannel = 0;    //所有渠道
        DataTable dtSummary = FNA_FeeApplyBLL.GetRTChannelDiaplayFee
                                  (month, OrganizeCity, state, int.Parse(Session["UserID"].ToString()), RTChannel);

        int counts = 0;

        if (dtSummary != null)
        {
            string TaskColumnName = "";
            foreach (DataColumn c in dtSummary.Columns)
            {
                if (c.ColumnName.EndsWith("→审批工作流"))
                {
                    TaskColumnName = c.ColumnName;
                    break;
                }
            }
            if (TaskColumnName == "")
            {
                MessageBox.Show(this, "未找到列名[审批工作流]的数据列!");
                return(-1);
            }

            IList <int> TaskIDs = new List <int>();
            foreach (DataRow row in dtSummary.Rows)
            {
                int taskid = (int)row[TaskColumnName];
                if (TaskIDs.Contains(taskid))
                {
                    continue;
                }

                TaskIDs.Add(taskid);

                int jobid = EWF_TaskBLL.StaffCanApproveTask(taskid, (int)Session["UserID"]);
                if (jobid > 0)
                {
                    EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                    if (job != null)
                    {
                        int decisionid = job.StaffCanDecide((int)Session["UserID"]);
                        if (decisionid > 0)
                        {
                            if (ApproveFlag)
                            {
                                job.Decision(decisionid, (int)Session["UserID"], 2, "汇总单批量审批通过!");       //2:审批已通过
                            }
                            else
                            {
                                job.Decision(decisionid, (int)Session["UserID"], 3, "汇总单批量审批不通过!");       //3:审批不通过
                            }
                            counts++;
                        }
                    }
                }
            }
        }

        return(counts);
    }
Beispiel #7
0
    //绑定开始环节详细信息
    private void BindTaskInfo()
    {
        EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]);

        #region 如果任务在待审批状态,且正好是待当前人审批,则直接切换到审批页面
        if (task.Model.Status == 3)
        {
            int job = EWF_TaskBLL.StaffCanApproveTask(task.Model.ID, (int)Session["UserID"]);
            if (job > 0)
            {
                Response.Redirect("Recipient.aspx?CurrentJobID=" + job.ToString() + "&TaskID=" + task.Model.ID.ToString());
            }
        }
        #endregion

        EWF_Flow_App app = new EWF_Flow_AppBLL(task.Model.App).Model;

        #region 绑定流程信息
        lbl_ID.Text      = task.Model.ID.ToString();
        lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName;
        lbl_AppName.Text = app.Name;

        lbl_Applyer_Position.Text = new Org_PositionBLL(new Org_StaffBLL(task.Model.Initiator).Model.Position).Model.Name;

        lbl_Title.Text = task.Model.Title;
        lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name;

        lb_StartTime.Text = task.Model.StartTime.ToString();
        if (task.Model.EndTime != new DateTime(1900, 1, 1))
        {
            lb_EndTime.Text = task.Model.EndTime.ToString();
        }
        else
        {
            lb_EndTime.Text = "未结束";
        }

        lt_Remark.Text = task.Model.Remark;

        #region 绑定流程当前环节信息
        if (task.Model.Status < 5)
        {
            IList <EWF_Task_Job> jobs = EWF_Task_JobBLL.GetModelList("Task=" + task.Model.ID.ToString() + " ORDER BY StartTime DESC");
            if (jobs.Count > 0)
            {
                EWF_Flow_Process process = new EWF_Flow_ProcessBLL(jobs[0].CurrentProcess).Model;
                if (process != null)
                {
                    lb_CurrentJobInfo.Text = process.Name;
                    if (process.Type == 3)
                    {
                        lb_CurrentJobInfo.Text += " 等待审批人:";
                        foreach (EWF_Task_JobDecision decision in EWF_Task_JobDecisionBLL.GetModelList("Job=" + jobs[0].ID.ToString()))
                        {
                            MCSFramework.Model.Org_Staff staff = new Org_StaffBLL(decision.RecipientStaff).Model;
                            if (staff != null)
                            {
                                lb_CurrentJobInfo.Text += staff.RealName + "   ";
                            }
                        }
                    }
                }
            }
        }
        else
        {
            tr_CurrentProcessInfo.Visible = false;
        }
        #endregion

        #endregion

        #region 控制流程状态
        if (task.Model.Initiator == (int)Session["UserID"])
        {
            //只有流程发起的本人,才可控制流程状态

            if (task.Model.Status == 6)
            {
                MessageBox.Show(this, "您的流程因故停止流转,请尽快联系系统管理员排查原因,或点击“继续执行”按钮以重新启动流程的流转!");
                bt_Restart.Visible = true;
            }

            if (task.Model.Status == 4)
            {
                MessageBox.Show(this, "您的流程被最后一审批人设为了待处理状态,请补充相关信息附件后,或点击“继续执行”按钮以重新启动流程的流转!");
                bt_Restart.Visible = true;
            }

            if (task.Model.Status == 1)
            {
                MessageBox.Show(this, "您的流程还没正式发起申请,请尽快点击“确定发起”按钮以发起流程!");
                btn_Start.Visible = true;
            }

            if (task.Model.Status != 5)
            {
                //未完成
                if (app.RelateBusiness == "N")
                {
                    bt_Cancel.Visible = true;
                }
                tr_UploadAtt.Visible = true;
            }
        }
        #endregion

        #region 显示申请详细信息IFrame
        //显示申请详细信息IFrame
        if (!string.IsNullOrEmpty(task.Model.RelateURL))
        {
            hyl_RelateURL.NavigateUrl = task.Model.RelateURL;
            tr_RelateUrl.Visible      = true;
            string url = this.ResolveClientUrl(task.Model.RelateURL);
            if (url.IndexOf('?') >= 0)
            {
                url += "&ViewFramework=False";
            }
            else
            {
                url += "?ViewFramework=False";
            }
            frame_relateurl.Attributes.Add("src", url);
        }
        else
        {
            tr_RelateUrl.Visible  = false;
            hyl_RelateURL.Visible = false;
        }
        #endregion


        //Bind the dataobject info
        pl_dataobjectinfo.BindData(task.Model.DataObjectValues);
        if (task.Model.Status > 1)
        {
            pl_dataobjectinfo.SetPanelEnable(false);

            TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null;
            if (tbx_ReMark != null)
            {
                tbx_ReMark.Enabled  = true;
                tbx_ReMark.ReadOnly = true;
            }
        }

        //绑定环节列表
        gv_List_JobList.BindGrid <EWF_Task_Job>(task.GetJobList());
    }
    protected void gv_List_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName != "Approved" && e.CommandName != "UnApproved")
        {
            BindGrid();
            return;
        }
        #region 仅查看待我审批的费用申请单
        string taskids = "";
        if (ddl_State.SelectedValue == "1")
        {
            taskids = GetNeedMeApproveTaskIDs();

            if (taskids == "")
            {
                MessageBox.Show(this, "对不起,没有需要待您审批的费用申请单!");
                return;
            }
        }
        #endregion
        string[] TaskIDs = taskids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

        int    organizecity = int.Parse(e.CommandArgument.ToString());
        string condition    = " FNA_FeeWriteOff.State = 2 ";

        #region 组织明细记录的查询条件
        //管理片区及所有下属管理片区
        if (organizecity != 1)
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(organizecity);
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += organizecity.ToString();

            condition += " AND FNA_FeeWriteOff.OrganizeCity IN (" + orgcitys + ")";
        }

        //会计月条件
        condition += " AND FNA_FeeWriteOff.AccountMonth = " + ddl_Month.SelectedValue;

        #endregion
        if (e.CommandName == "Approved")
        {
            IList <FNA_FeeWriteOff> lists = FNA_FeeWriteOffBLL.GetModelList(condition);
            foreach (FNA_FeeWriteOff fee in lists)
            {
                if (TaskIDs.Contains(fee.ApproveTask.ToString()))
                {
                    int             jobid = EWF_TaskBLL.StaffCanApproveTask(fee.ApproveTask, (int)Session["UserID"]);
                    EWF_Task_JobBLL job   = new EWF_Task_JobBLL(jobid);
                    if (job.Model != null)
                    {
                        int decision = job.StaffCanDecide((int)Session["UserID"]);
                        if (decision > 0)
                        {
                            job.Decision(decision, (int)Session["UserID"], 2, "汇总单批量审批通过!");       //2:审批已通过
                        }
                    }
                }
            }

            BindGrid();
            MessageBox.Show(this, "审批成功!");
        }
        else if (e.CommandName == "UnApproved")
        {
            IList <FNA_FeeWriteOff> lists = FNA_FeeWriteOffBLL.GetModelList(condition);
            foreach (FNA_FeeWriteOff fee in lists)
            {
                if (TaskIDs.Contains(fee.ApproveTask.ToString()))
                {
                    int             jobid = EWF_TaskBLL.StaffCanApproveTask(fee.ApproveTask, (int)Session["UserID"]);
                    EWF_Task_JobBLL job   = new EWF_Task_JobBLL(jobid);
                    if (job.Model != null)
                    {
                        int decision = job.StaffCanDecide((int)Session["UserID"]);
                        if (decision > 0)
                        {
                            job.Decision(decision, (int)Session["UserID"], 3, "汇总单批量未能审批通过!");    //3:审批未通过
                        }
                    }
                }
            }


            BindGrid();
            MessageBox.Show(this, "已成功将选择区域的申请单,设为批复未通过!");
        }
    }
Beispiel #9
0
    protected void gv_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        #region 仅查看待我审批的费用申请单
        string taskids = "";
        if (ddl_State.SelectedValue == "1")
        {
            taskids = GetNeedMeApproveTaskIDs();

            if (taskids == "")
            {
                MessageBox.Show(this, "对不起,没有需要待您审批的费用申请单!");
                return;
            }
        }
        #endregion
        string[] TaskIDs = taskids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

        int    organizecity = (int)gv_List.DataKeys[e.RowIndex]["ID"];
        string condition    = " FNA_FeeApply.State = 2 ";

        #region 组织明细记录的查询条件
        //管理片区及所有下属管理片区
        if (organizecity != 1)
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(organizecity);
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += organizecity.ToString();

            condition += " AND FNA_FeeApply.OrganizeCity IN (" + orgcitys + ")";
        }

        //会计月条件
        condition += " AND FNA_FeeApply.AccountMonth = " + ddl_Month.SelectedValue;

        //费用类型
        if (ddl_FeeType.SelectedValue != "0")
        {
            condition += " AND FNA_FeeApply.FeeType = " + ddl_FeeType.SelectedValue;
        }
        #endregion

        IList <FNA_FeeApply> lists = FNA_FeeApplyBLL.GetModelList(condition);
        foreach (FNA_FeeApply fee in lists)
        {
            if (TaskIDs.Contains(fee.ApproveTask.ToString()))
            {
                int             jobid = EWF_TaskBLL.StaffCanApproveTask(fee.ApproveTask, (int)Session["UserID"]);
                EWF_Task_JobBLL job   = new EWF_Task_JobBLL(jobid);
                if (job.Model != null)
                {
                    int decision = job.StaffCanDecide((int)Session["UserID"]);
                    if (decision > 0)
                    {
                        job.Decision(decision, (int)Session["UserID"], 3, "汇总单批量未能审批通过!");    //3:审批未通过
                    }
                }
            }
        }


        BindGrid();
        MessageBox.Show(this, "已成功将选择区域的申请单,设为批复未通过!");
    }
Beispiel #10
0
 protected string StaffCanApproveTask(string TaskID)
 {
     return(EWF_TaskBLL.StaffCanApproveTask(int.Parse(TaskID), (int)Session["UserID"]).ToString());
 }
Beispiel #11
0
    protected void DoApprove(bool ApproveFlag)
    {
        #region 仅查看待我审批的工资申请单
        string taskids = "";
        if (ddl_State.SelectedValue == "1")
        {
            taskids = GetNeedMeApproveTaskIDs();

            if (taskids == "")
            {
                MessageBox.Show(this, "对不起,没有需要待您审批的费用申请单!");
                return;
            }
        }
        #endregion
        string[] TaskIDs = taskids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

        int    organizecity = int.Parse(tr_OrganizeCity.SelectValue);
        string condition    = " PM_Salary.State = 2 ";

        #region 组织明细记录的查询条件
        //管理片区及所有下属管理片区
        if (organizecity != 1)
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(organizecity);
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += organizecity.ToString();

            condition += " AND PM_Salary.OrganizeCity IN (" + orgcitys + ")";
        }

        if (ddl_SalaryClassify.SelectedValue != "0")
        {
            condition += "AND MCS_SYS.dbo.UF_Spilt2('MCS_Promotor.dbo.PM_Salary',PM_Salary.ExtPropertys,'PMClassfiy')=" + ddl_SalaryClassify.SelectedValue;
        }
        //会计月条件
        condition += " AND PM_Salary.AccountMonth = " + ddl_Month.SelectedValue;

        IList <PM_Salary> lists = PM_SalaryBLL.GetModelList(condition);
        #endregion

        foreach (PM_Salary salary in lists)
        {
            if (TaskIDs.Contains(salary["TaskID"]))
            {
                int             jobid = EWF_TaskBLL.StaffCanApproveTask(int.Parse(salary["TaskID"]), (int)Session["UserID"]);
                EWF_Task_JobBLL job   = new EWF_Task_JobBLL(jobid);
                if (job.Model != null)
                {
                    int decision = job.StaffCanDecide((int)Session["UserID"]);
                    if (decision > 0)
                    {
                        if (ApproveFlag)
                        {
                            job.Decision(decision, (int)Session["UserID"], 2, "汇总单批量审批通过!");       //2:审批已通过
                        }
                        else
                        {
                            job.Decision(decision, (int)Session["UserID"], 3, "汇总单批量未能审批通过!");    //3:审批未通过
                        }
                    }
                }
            }
        }

        BindGrid();
        MessageBox.Show(this, ApproveFlag ? "审批成功!" : "已成功将选择区域的申请单,设为批复未通过!");
        return;
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        int ApproveCount = 0, UnApproveCount = 0, errcount = 0;

        if (txt_UnApproveContractID.Text.Trim() != "")
        {
            string[] UnApproveID = Regex.Split(txt_UnApproveContractID.Text.Trim(), "\r\n", RegexOptions.IgnoreCase);

            if (txt_ApproveContractID.Text.Trim() != "")
            {
                string[] ApproveID = Regex.Split(txt_ApproveContractID.Text.Trim(), "\r\n", RegexOptions.IgnoreCase);
                foreach (string contractid in UnApproveID)
                {
                    if (ApproveID.Contains(contractid))
                    {
                        MessageBox.Show(this, "ID为【" + contractid + "】的返利协议同时出现在了【审批通过】与【审批不通过】编辑框中!");
                        return;
                    }
                }
            }
        }
        if (txt_ApproveContractID.Text.Trim() != "")
        {
            string[]       ApproveID = Regex.Split(txt_ApproveContractID.Text.Trim(), "\r\n", RegexOptions.IgnoreCase);
            CM_ContractBLL _bll;
            StringBuilder  approvebuild = new StringBuilder("");

            for (int i = 0; i < ApproveID.Length; i++)
            {
                int ContractID;
                if (!ApproveID[i].Trim().Equals("") && int.TryParse(ApproveID[i].Trim(), out ContractID))
                {
                    _bll = new CM_ContractBLL(ContractID);
                    if (_bll.Model != null)
                    {
                        int jobid = EWF_TaskBLL.StaffCanApproveTask(_bll.Model.ApproveTask, 7394);
                        if (jobid > 0)
                        {
                            EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                            if (job != null)
                            {
                                int decisionid = job.StaffCanDecide(7394);
                                if (decisionid > 0)
                                {
                                    ApproveCount++;
                                    job.Decision(decisionid, (int)Session["UserID"], 2, "批量审批通过!");       //2:审批已通过
                                    approvebuild.Append("ID为【" + ContractID.ToString() + "】的返利协议审批通过  ");
                                }
                            }
                        }
                        else
                        {
                            approvebuild.Append("<span style='color: Red'>ID为【" + ContractID.ToString() + "】的返利协议未到客服确认环节   </span>");
                            errcount++;
                        }
                    }
                    else
                    {
                        approvebuild.Append("<span style='color: Red'>ID为【" + ContractID.ToString() + "】的返利协议未能在系统中找到  </span> ");
                        errcount++;
                    }
                }
                else if (!ApproveID[i].Trim().Equals("") && !int.TryParse(ApproveID[i].Trim(), out ContractID))
                {
                    approvebuild.Append("<span style='color: Red'>【" + ContractID.ToString() + "】不是一个有效的返利协议ID  </span> ");
                    errcount++;
                }
                if (i % 5 == 0 && i != 0)
                {
                    approvebuild.Append("<br/>");
                }
            }
            lb_ApproveErrorInfo.Text = approvebuild.ToString();
        }
        if (txt_UnApproveContractID.Text.Trim() != "")
        {
            string[]       UnApproveID = Regex.Split(txt_UnApproveContractID.Text.Trim(), "\r\n", RegexOptions.IgnoreCase);
            CM_ContractBLL _bll;
            StringBuilder  unapprovebuild = new StringBuilder("");
            for (int i = 0; i < UnApproveID.Length; i++)
            {
                int ContractID;
                if (!UnApproveID[i].Trim().Equals("") && int.TryParse(UnApproveID[i].Trim(), out ContractID))
                {
                    _bll = new CM_ContractBLL(ContractID);
                    if (_bll.Model != null)
                    {
                        int jobid = EWF_TaskBLL.StaffCanApproveTask(_bll.Model.ApproveTask, 7394);
                        if (jobid > 0)
                        {
                            EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                            if (job != null)
                            {
                                int decisionid = job.StaffCanDecide(7394);
                                if (decisionid > 0)
                                {
                                    UnApproveCount++;
                                    job.Decision(decisionid, (int)Session["UserID"], 3, "批量审批不通过!");       //3:审批不通过
                                    unapprovebuild.Append("ID为【" + ContractID.ToString() + "】的返利协议审批未通过  ");
                                }
                            }
                        }
                        else
                        {
                            unapprovebuild.Append("<span style='color: Red'>ID为【" + ContractID.ToString() + "】的返利协议未到客服确认环节  </span>");
                            errcount++;
                        }
                    }
                    else
                    {
                        errcount++;
                        unapprovebuild.Append("<span style='color: Red'>ID为【" + ContractID.ToString() + "】的返利协议未能在系统中找到  </span>");
                    }
                }
                else if (!UnApproveID[i].Trim().Equals("") && !int.TryParse(UnApproveID[i].Trim(), out ContractID))
                {
                    unapprovebuild.Append("<span style='color: Red'>【" + ContractID.ToString() + "】不是一个有效的返利协议ID  </span>");
                    errcount++;
                }
                if (i % 5 == 0 && i != 0)
                {
                    unapprovebuild.Append("<br/>");
                }
            }
            lb_UnApproveErrorInfo.Text = unapprovebuild.ToString();
        }

        MessageBox.Show(this, "审批通过协议个数:" + ApproveCount.ToString() + @"\n审批未通过协议个数:" + UnApproveCount.ToString() +
                        @"\n未能导入协议个数:" + errcount.ToString());
        return;
    }