예제 #1
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");
                }
            }
        }
예제 #2
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");
                }
            }
        }
예제 #3
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);
                }
            }
        }
예제 #4
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");
            }
        }