Beispiel #1
0
        /// <summary>
        /// 回收
        /// </summary>
        /// <param name="jfid"></param>
        private void Refresh(int jfid)
        {
            EtNet_Models.JobFlow refreshmodel = EtNet_BLL.JobFlowManager.GetModel(jfid);
            if (refreshmodel != null && (refreshmodel.auditstatus == "01" || refreshmodel.auditstatus == "03"))
            {
                string strfresh = " jobflowid = " + jfid;
                EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核人员的数据,请假单回到草稿状态
                refreshmodel.savestatus  = "草稿";
                refreshmodel.auditstatus = "01";
                refreshmodel.txt         = "";

                string    sqlpolicy           = " isVerify =" + jfid.ToString();
                DataTable tblpolicy           = EtNet_BLL.To_PolicyManager.GetList(1, sqlpolicy, "id");
                EtNet_Models.To_Policy policy = EtNet_BLL.To_PolicyManager.getTo_PolicyById(int.Parse(tblpolicy.Rows[0]["id"].ToString()));
                policy.Txt = "";
                EtNet_BLL.To_PolicyManager.updateTo_Policy(policy);

                if (EtNet_BLL.JobFlowManager.Update(refreshmodel))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回')</script>", false);
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "retwo", "<script>alert('回收失败,原因可能审核人员在审核或审核已通过!')</script>", false);
            }
        }
        //通过审核
        protected void imgbtnpass_Click(object sender, ImageClickEventArgs e)
        {
            int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id

            EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"];

            string comparedata = " reviewerid=" + login.Id + " AND jobflowid=" + jobflowid.ToString();

            if (AuditJobFlowManager.GetList(comparedata).Rows.Count == 0)
            {
                //该工作流被收回或删除导致审批提交失败
                Response.Redirect("../Job/AuditJobFlow.aspx");
            }
            else if (JobFlowManager.GetModel(jobflowid).auditstatus == "03" || JobFlowManager.GetModel(jobflowid).auditstatus == "04")
            {
                //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过
                Response.Redirect("../Job/AuditJobFlow.aspx");
            }
            else
            {
                JobFlow      jobflow = JobFlowManager.GetModel(jobflowid);
                ApprovalRule rule    = ApprovalRuleManager.GetModel(jobflow.ruleid);
                string       ruletxt = rule.sort; //审核的分类

                //修改当前审核人的记录
                AuditJobFlow auditmodel   = null;
                string       auditstr     = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((LoginInfo)Session["login"]).Id;
                DataTable    audittbl     = AuditJobFlowManager.GetList(auditstr);             // 查找到当前审核人员的记录
                int          num          = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号
                string       mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();       //当前审核人是不是最终审核人

                auditmodel              = new AuditJobFlow();
                auditmodel.auditoperat  = "通过";
                auditmodel.audittime    = DateTime.Now;
                auditmodel.id           = int.Parse(audittbl.Rows[0]["id"].ToString());
                auditmodel.jobflowid    = int.Parse(audittbl.Rows[0]["jobflowid"].ToString());
                auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();
                auditmodel.nowreviewer  = "P"; //能查找到工作流记录,但不能进行审核操作
                auditmodel.numbers      = int.Parse(audittbl.Rows[0]["numbers"].ToString());
                auditmodel.operatstatus = "已审批";
                auditmodel.reviewerid   = int.Parse(audittbl.Rows[0]["reviewerid"].ToString());
                auditmodel.opiniontxt   = Server.UrlDecode(this.treatxt.Value.Trim());
                AuditJobFlowManager.Update(auditmodel);



                //依据不同的审核类型进行操作
                switch (ruletxt)
                {
                case "单审":
                    if (mainreviewer != "T")
                    {
                        auditmodel = new AuditJobFlow();     //设置下一个审核人的数据记录
                        string    nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString();
                        DataTable nextaudittbl = AuditJobFlowManager.GetList(nextauditstr);
                        auditmodel.auditoperat  = nextaudittbl.Rows[0]["auditoperat"].ToString();
                        auditmodel.audittime    = DateTime.Parse(nextaudittbl.Rows[0]["audittime"].ToString());
                        auditmodel.id           = int.Parse(nextaudittbl.Rows[0]["id"].ToString());
                        auditmodel.jobflowid    = int.Parse(nextaudittbl.Rows[0]["jobflowid"].ToString());
                        auditmodel.mainreviewer = nextaudittbl.Rows[0]["mainreviewer"].ToString();
                        auditmodel.nowreviewer  = "T";    //设置其为审核人员
                        auditmodel.numbers      = int.Parse(nextaudittbl.Rows[0]["numbers"].ToString());
                        auditmodel.operatstatus = nextaudittbl.Rows[0]["operatstatus"].ToString();
                        auditmodel.reviewerid   = int.Parse(nextaudittbl.Rows[0]["reviewerid"].ToString());
                        auditmodel.opiniontxt   = nextaudittbl.Rows[0]["opiniontxt"].ToString();
                        AuditJobFlowManager.Update(auditmodel);
                        jobflow.auditstatus = "02";     //工作流的审核状态为“进行中”
                        JobFlowManager.Update(jobflow);
                    }
                    else
                    {
                        jobflow.endtime     = DateTime.Now;
                        jobflow.auditstatus = "04";     //工作流的审核状态为“已通过”
                        JobFlowManager.Update(jobflow);
                    }
                    break;

                case "选审":

                    jobflow.endtime     = DateTime.Now;
                    jobflow.auditstatus = "04";     //工作流的审核状态为“已通过”
                    JobFlowManager.Update(jobflow);
                    break;

                case "会审":
                    bool      pass        = true;
                    string    strsql      = " jobflowid=" + jobflowid.ToString();
                    DataTable auditjobtbl = AuditJobFlowManager.GetList(strsql);
                    for (int i = 0; i < auditjobtbl.Rows.Count; i++)
                    {
                        if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过")
                        {
                            pass = false;     //说明还有其他审核人员未开始审核
                            break;
                        }
                    }

                    if (pass)
                    {
                        jobflow.endtime     = DateTime.Now;
                        jobflow.auditstatus = "04";     //工作流的状审核状态为“已通过”
                        JobFlowManager.Update(jobflow);
                    }
                    else
                    {
                        jobflow.auditstatus = "02";     //工作流的状审核状态为“进行中”
                        JobFlowManager.Update(jobflow);
                    }
                    break;
                }

                string    sqlpolicy           = " isVerify =" + jobflowid.ToString();
                DataTable tblpolicy           = EtNet_BLL.To_PolicyManager.GetList(1, sqlpolicy, "id");
                EtNet_Models.To_Policy policy = EtNet_BLL.To_PolicyManager.getTo_PolicyById(int.Parse(tblpolicy.Rows[0]["id"].ToString()));
                if (policy.Txt == "")
                {
                    policy.Txt = login.Cname + "的审批意见:" + Server.UrlDecode(this.treatxt.Value.Trim());
                }
                else
                {
                    policy.Txt = policy.Txt + "|" + login.Cname + "的审批意见:" + Server.UrlDecode(this.treatxt.Value.Trim());
                }
                EtNet_BLL.To_PolicyManager.updateTo_Policy(policy);

                SendMessage("【" + login.Cname + "】通过审批");
                SendNextAudit(jobflowid);
                Response.Redirect("../Job/AuditJobFlow.aspx");
            }
        }