예제 #1
0
 /// <summary>
 /// 发送消息
 /// </summary>
 private void SendInformation(int jobflowid, string[] list)
 {
     PJOAModels.JobFlow     model      = PJOABLL.JobFlowManager.GetModel(jobflowid);
     PJOAModels.Information informodel = null;
     if (model != null)
     {
         informodel               = new PJOAModels.Information();
         informodel.sortid        = 5;
         informodel.associationid = jobflowid;
         informodel.contents      = "审核编号为" + model.cname + "的单据";
         informodel.createtime    = DateTime.Now;
         informodel.sendtime      = DateTime.Now;
         informodel.founderid     = ((PJOAModels.LoginInfo)Session["login"]).Id;
         if (PJOABLL.InformationManager.Add(informodel))
         {
             int maxid = PJOABLL.InformationManager.GetMaxId();
             PJOAModels.InformationNotice infnotic = null;
             for (int j = 0; j < list.Length; j++)
             {
                 infnotic = new PJOAModels.InformationNotice();
                 infnotic.informationid = maxid;
                 infnotic.recipientid   = int.Parse(list[j].ToString());
                 infnotic.remind        = "是";
                 PJOABLL.InformationNoticeManager.Add(infnotic);
             }
         }
     }
 }
예제 #2
0
 /// <summary>
 /// 发送消息
 /// </summary>
 /// <param name="straud">审核单据编号及意见</param>
 /// <param name="jobflowid">工作流id值</param>
 public void SendInfo(string straud, int jobflowid)
 {
     PJOAModels.JobFlow model = PJOABLL.JobFlowManager.GetModel(jobflowid);
     if (model != null)
     {
         int infoid = CreateInfo(straud);
         CreateInfoNotice(infoid, model.founderid);
     }
 }
예제 #3
0
        /// <summary>
        /// 提交数据
        /// </summary>
        private void Submit()
        {
            string[] strfile = FileUp(Request.Files);
            if (strfile[0] != "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "jobflow", "<script>alert('提交申请失败原因:" + strfile[0] + "!');</script>", false);
            }
            else
            {
                //创建工作流
                this.lblnumbers.Text = Numbers(); //动态生成编号
                PJOAModels.JobFlow jobmodel = new PJOAModels.JobFlow();
                jobmodel.cname       = this.lblnumbers.Text;
                jobmodel.attachment  = (strfile[6] == "1" ? strfile[6] : "~/UploadFile/Job/defaultfile.txt");
                jobmodel.sort        = "04";
                jobmodel.auditsort   = "";
                jobmodel.auditstatus = "01";
                jobmodel.createtime  = DateTime.Now;                                //默认是当前时间
                jobmodel.endtime     = DateTime.Now;
                jobmodel.founderid   = ((PJOAModels.LoginInfo)Session["login"]).Id; //登录人员的id号
                jobmodel.savestatus  = "已提交";
                jobmodel.txt         = "";
                jobmodel.ruleid      = int.Parse(this.ddlapprovalrole.SelectedValue);
                //PJOABLL.JobFlowManager.Add(jobmodel);
                //int maxid = PJOABLL.JobFlowManager.Maxid();
                int maxid = PJOABLL.JobFlowManager.AddAndGetId(jobmodel);


                if (strfile[6] == "1")
                {
                    CreateJobFlowFile(strfile, maxid);
                }

                PJOAModels.ApplySeal model = new PJOAModels.ApplySeal();
                model.applydate       = DateTime.Now;
                model.borrowstarttime = Convert.ToDateTime(this.iptstartdate.Value);
                model.borrowsendtime  = Convert.ToDateTime(this.iptenddate.Value);
                model.jobflowid       = maxid;
                model.applicantid     = ((PJOAModels.LoginInfo)Session["login"]).Id; //登录人员的id号
                model.sort            = int.Parse(this.ddlsealsort.SelectedValue);
                model.remark          = Server.UrlDecode(this.iptremark.Value);
                model.txt             = ""; //审批人员填写的字段


                if (PJOABLL.ApplySealManager.Add(model))
                {
                    string stafflist = PJOABLL.ApprovalRuleManager.GetModel(int.Parse(this.ddlapprovalrole.SelectedValue)).idgourp.ToString();
                    CreateApproval(ddlauditsort.SelectedValue, stafflist, maxid);

                    SendInformation(maxid, stafflist.Split(','));

                    Response.Redirect("ShowSealForm.aspx");
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 保存数据
        /// </summary>
        private void Save()
        {
            string[] strfile = FileUp(Request.Files);
            if (strfile[0] != "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "jobflow", "<script>alert('草稿保存失败原因:" + strfile[0] + "!');</script>", false);
            }
            else
            {
                //创建工作流
                this.lblnumbers.Text = Numbers(); //动态生成编号
                PJOAModels.JobFlow jobmodel = new PJOAModels.JobFlow();
                jobmodel.cname       = this.lblnumbers.Text;
                jobmodel.attachment  = (strfile[6] == "1" ? strfile[6] : "~/UploadFile/Job/defaultfile.txt");
                jobmodel.sort        = "04";                                        //公章申请的编号
                jobmodel.auditsort   = "";
                jobmodel.auditstatus = "01";                                        //未开始
                jobmodel.createtime  = DateTime.Now;                                //默认是当前时间
                jobmodel.endtime     = DateTime.Now;
                jobmodel.founderid   = ((PJOAModels.LoginInfo)Session["login"]).Id; //登录人员的id号
                jobmodel.savestatus  = "草稿";
                jobmodel.txt         = "";                                          //保留字段
                //未选审核规则字段值为“1”
                jobmodel.ruleid = (this.ddlapprovalrole.SelectedIndex == 0) ? 1 : int.Parse(this.ddlapprovalrole.SelectedValue);

                // PJOABLL.JobFlowManager.Add(jobmodel);
                // int maxid = PJOABLL.JobFlowManager.Maxid();

                int maxid = PJOABLL.JobFlowManager.AddAndGetId(jobmodel);

                if (strfile[6] == "1")
                {
                    CreateJobFlowFile(strfile, maxid); //保存文件的路径到数据库中
                }

                PJOAModels.ApplySeal model = new PJOAModels.ApplySeal();

                model.applydate       = DateTime.Now;
                model.borrowstarttime = Convert.ToDateTime(this.iptstartdate.Value);
                model.borrowsendtime  = Convert.ToDateTime(this.iptenddate.Value);
                model.applicantid     = ((PJOAModels.LoginInfo)Session["login"]).Id; //登录人员的id号
                model.jobflowid       = maxid;
                model.remark          = Server.UrlDecode(this.iptremark.Value);      //公章的详细情况
                model.sort            = int.Parse(this.ddlsealsort.SelectedValue);
                model.txt             = "";                                          //审批人员填写的字段

                if (PJOABLL.ApplySealManager.Add(model))
                {
                    Response.Redirect("ShowSealForm.aspx");
                }
            }
        }
예제 #5
0
        /// <summary>
        /// 拒绝审核
        /// </summary>
        private void Refuse()
        {
            int    jobflowid   = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id
            string comparedata = " reviewerid=" + ((PJOAModels.LoginInfo)Session["login"]).Id + " AND jobflowid=" + jobflowid.ToString();

            if (PJOABLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0)
            {
                //该工作流被收回或删除导致审批提交失败
                Response.Redirect("../AuditError.aspx?error=0");
            }
            else if (PJOABLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || PJOABLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04")
            {
                //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过
                Response.Redirect("../AuditError.aspx?error=1");
            }

            else
            {
                string    ruletxt = ""; //审核的分类
                DataTable tbl     = PJOABLL.ViewBLL.ViewApplySealManager.getlist(jobflowid);
                if (tbl.Rows.Count == 1)
                {
                    ruletxt = tbl.Rows[0]["rulesort"].ToString();
                    //修改公章申请单
                    PJOAModels.ApplySeal model = new PJOAModels.ApplySeal();
                    model.applicantid     = int.Parse(tbl.Rows[0]["applicantid"].ToString());
                    model.applydate       = DateTime.Parse(tbl.Rows[0]["applydate"].ToString());
                    model.borrowsendtime  = DateTime.Parse(tbl.Rows[0]["borrowsendtime"].ToString());
                    model.borrowstarttime = DateTime.Parse(tbl.Rows[0]["borrowstarttime"].ToString());
                    model.id        = int.Parse(tbl.Rows[0]["id"].ToString());
                    model.jobflowid = int.Parse(tbl.Rows[0]["jobflowid"].ToString());
                    model.remark    = tbl.Rows[0]["remark"].ToString();
                    model.sort      = int.Parse(tbl.Rows[0]["sealsort"].ToString());
                    model.txt       = tbl.Rows[0]["sealtxt"].ToString() + ((PJOAModels.LoginInfo)Session["login"]).Cname + "的审核意见:" + Server.UrlDecode(this.treacomment.Value.Trim()) + "|";
                    PJOABLL.ApplySealManager.Update(model);

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

                    auditmodel              = new PJOAModels.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());
                    PJOABLL.AuditJobFlowManager.Update(auditmodel);

                    PJOAModels.JobFlow jobflowmodel = new PJOAModels.JobFlow();
                    jobflowmodel = PJOABLL.JobFlowManager.GetModel(jobflowid);

                    //依据不同的审核类型进行操作
                    switch (ruletxt)
                    {
                    case "单审":
                    case "会签":
                        jobflowmodel.endtime     = DateTime.Now;
                        jobflowmodel.auditstatus = "03";     //工作流的审核状态为“被拒绝”
                        PJOABLL.JobFlowManager.Update(jobflowmodel);

                        break;

                    case "选审":
                        string    st     = " jobflowid=" + jobflowid.ToString();
                        DataTable tbla   = PJOABLL.AuditJobFlowManager.GetList(st);
                        bool      refuse = true;

                        for (int j = 0; j < tbla.Rows.Count; j++)
                        {
                            if (tbla.Rows[j]["auditoperat"].ToString() != "拒绝")
                            {
                                refuse = false;     //还有其他审核人员未审
                                break;
                            }
                        }
                        if (refuse)
                        {
                            jobflowmodel.endtime     = DateTime.Now;
                            jobflowmodel.auditstatus = "03";     // 工作流的审核状态为被拒绝
                            PJOABLL.JobFlowManager.Update(jobflowmodel);
                        }
                        else
                        {
                            jobflowmodel.auditstatus = "02";     // 工作流的审核状态为进行中
                            PJOABLL.JobFlowManager.Update(jobflowmodel);
                        }

                        break;
                    }

                    string strad = "拒绝编号为" + jobflowmodel.cname + "的单据申请";
                    SendInfo(strad, jobflowmodel.id);
                    Response.Redirect("../AuditJobFlow.aspx");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false);
                }
            }
        }
예제 #6
0
        protected void rptsealform_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "edit":
                int jobflowid            = int.Parse(e.CommandArgument.ToString());
                PJOAModels.JobFlow model = PJOABLL.JobFlowManager.GetModel(jobflowid);
                if (model != null && model.savestatus == "草稿")
                {
                    Response.Redirect("ModifySealForm.aspx?id=" + e.CommandArgument.ToString());
                }
                else
                {
                    LoadSealFormData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "edit", "<script>alert('不能修改该公章申请单!')</script>", false);
                }

                break;

            case "search":
                Response.Redirect("SearchSealForm.aspx?id=" + e.CommandArgument.ToString());
                break;

            case "del":

                int jfid = int.Parse(e.CommandArgument.ToString());
                PJOAModels.JobFlow jfmodel = PJOABLL.JobFlowManager.GetModel(jfid);

                if (jfmodel == null || jfmodel.auditstatus != "01")
                {
                    LoadSealFormData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('删除失败,已删除或审核员已审核!')</script>", false);
                }
                else
                {
                    string strSql = " jobflowid = " + e.CommandArgument.ToString();
                    PJOABLL.AuditJobFlowManager.Delete(strSql);

                    int id = int.Parse(PJOABLL.ApplySealManager.GetList(strSql).Rows[0]["id"].ToString());

                    PJOABLL.ApplySealManager.Delete(id);

                    DelFile(Convert.ToInt32(e.CommandArgument.ToString()));     //删除上传的附件
                    PJOABLL.JobFlowFileManager.Delete(Convert.ToInt32(e.CommandArgument.ToString()));
                    //删除工作流
                    PJOABLL.JobFlowManager.Delete(Convert.ToInt32(e.CommandArgument.ToString()));
                    LoadSealFormData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('删除成功!')</script>", false);
                }
                break;



            case "refresh":
                int refreshjfid = int.Parse(e.CommandArgument.ToString());

                PJOAModels.JobFlow refreshmodel = PJOABLL.JobFlowManager.GetModel(refreshjfid);
                if (refreshmodel != null && (refreshmodel.auditstatus == "01" || refreshmodel.auditstatus == "03"))
                {
                    string strfresh = " jobflowid = " + e.CommandArgument.ToString();
                    PJOABLL.AuditJobFlowManager.Delete(strfresh);     //删除审核人员的数据,公章申请单回到草稿状态
                    refreshmodel.savestatus  = "草稿";
                    refreshmodel.auditstatus = "01";


                    string strname = refreshmodel.cname;     //公章申请单编号
                    if (PJOABLL.JobFlowManager.Update(refreshmodel))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回单据号为" + strname + "的公章申请单!')</script>", false);
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "retwo", "<script>alert('该公章申请单不能回收,原因可能审核人员在审核或审核已通过!')</script>", false);
                }

                LoadSealFormData();
                break;
            }
        }
예제 #7
0
        /// <summary>
        /// 保存方法
        /// </summary>
        private void Save()
        {
            if (IsCanModifyUp())
            {
                string[] strfile = FileUp(Request.Files);
                if (strfile[0] != "")
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "jobflow", "<script>alert('草稿保存失败原因:" + strfile[0] + "!');</script>", false);
                }
                else
                {
                    PJOAModels.JobFlow jobmodel = new PJOAModels.JobFlow();
                    jobmodel.cname       = this.lblnumbers.Text;
                    jobmodel.sort        = "04";
                    jobmodel.auditsort   = "";
                    jobmodel.auditstatus = "01";
                    jobmodel.createtime  = DateTime.Now;                                //默认是当前时间
                    jobmodel.endtime     = DateTime.Now;
                    jobmodel.founderid   = ((PJOAModels.LoginInfo)Session["login"]).Id; //登录人员的id号
                    jobmodel.savestatus  = "草稿";
                    jobmodel.txt         = "";
                    jobmodel.id          = int.Parse(Request.QueryString["id"].ToString());
                    //未选审核规则字段值为“1”
                    jobmodel.ruleid = (this.ddlapprovalrole.SelectedIndex == 0) ? 1 : int.Parse(this.ddlapprovalrole.SelectedValue);

                    //判断是否有附件
                    if (strfile[6] == "1")
                    {
                        jobmodel.attachment = "1";
                        CreateJobFlowFile(strfile, int.Parse(Request.QueryString["id"].ToString()));
                    }
                    else
                    {
                        bool hasflie = SerchFile(int.Parse(Request.QueryString["id"].ToString()));
                        if (hasflie)
                        {
                            jobmodel.attachment = "1";
                        }
                        else
                        {
                            jobmodel.attachment = "~/UploadFile/Job/defaultfile.txt";
                        }
                    }

                    PJOABLL.JobFlowManager.Update(jobmodel);

                    PJOAModels.ApplySeal model = new PJOAModels.ApplySeal();
                    model.applicantid     = ((PJOAModels.LoginInfo)Session["login"]).Id;
                    model.applydate       = DateTime.Now;
                    model.borrowstarttime = Convert.ToDateTime(this.iptstartdate.Value);
                    model.borrowsendtime  = Convert.ToDateTime(this.iptenddate.Value);
                    model.jobflowid       = int.Parse(Request.QueryString["id"].ToString());
                    model.id        = int.Parse(Session["GZDId"].ToString());
                    model.jobflowid = int.Parse(Request.QueryString["id"].ToString());
                    model.remark    = Server.UrlDecode(this.iptremark.Value);
                    model.sort      = int.Parse(this.ddlsealsort.SelectedValue);
                    model.txt       = ""; //审批人员填写的字段

                    if (PJOABLL.ApplySealManager.Update(model))
                    {
                        Response.Redirect("ShowSealForm.aspx");
                    }
                }
            }
            else
            {
                Response.Redirect("../Error.aspx?error=2");
            }
        }