예제 #1
0
    private int Decision(int result)
    {
        string          decisionComment = tbx_DecisionComment.Text.Trim() == "" ? "已阅" : tbx_DecisionComment.Text.Trim();
        EWF_Task_JobBLL job             = new EWF_Task_JobBLL((int)ViewState["CurrentJobID"]);
        int             ret             = 0;

        if (result != 1)
        {
            ret = job.Decision((int)ViewState["DecisionID"], (int)Session["UserID"], result, decisionComment);
        }
        else
        {
            decisionComment += "<br/>------" + Session["UserRealName"].ToString() + " 于 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "批注意见-----<br/>";
            ret              = job.SaveDecisionComment((int)ViewState["DecisionID"], (int)Session["UserID"], decisionComment);
        }

        #region 通知任务发起人
        if (cbx_NotifyInitiator.Checked || result == 4)
        {
            string remark = "审批时间:<b><font color=blue>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</font></b> ";
            remark += "审批人:<b><font color=blue>" + Session["UserRealName"].ToString() + "</font></b> ";

            if (ViewState["PrincipalStaff"] != null)
            {
                remark += " <b><font color=red>授权人:" + ViewState["PrincipalStaff"].ToString() + "</font></b> ";
            }

            switch (result)
            {
            case 1:
                remark += " 审批结果:<b><font color=blue>暂挂审批</font></b>";
                break;

            case 2:
                remark += " 审批结果:<b><font color=blue>审批通过</font></b>";
                break;

            case 3:
                remark += " 审批结果:<b><font color=blue>审批不通过</font></b>";
                break;

            case 4:
                remark += " 审批结果:<b><font color=blue>审批待处理</font></b>";
                break;

            default:
                break;
            }
            remark += " 审批意见:<b><font color=blue>" + decisionComment + "</font></b><br/> ";

            EWF_TaskBLL taskbll = new EWF_TaskBLL(job.Model.Task);

            string _content = "<b><font color=blue>工作流处理通知!</font></b><br/>";
            _content += "工作流:<font color=blue>" + lbl_AppName.Text + "</font><br/>";
            _content += "主题:<font color=blue>" + lbl_Title.Text + "</font><br/><br/>";
            _content += decisionComment;

            _content += "<br/><a href='" + this.ResolveUrl("~/SubModule/EWF/TaskDetail.aspx?TaskID=" + job.Model.Task.ToString()) + "' target='_blank'><font color=blue>点击查看工作流详细情况</font></a><br/>";

            DataTable _users = new Org_StaffBLL(taskbll.Model.Initiator).GetUserList();
            foreach (DataRow dr_user in _users.Rows)
            {
                SendSM(dr_user["UserName"].ToString(), _content);
            }
        }
        #endregion

        return(ret);
    }