/// <summary> ///加载请假单的数据 /// </summary> private void LoadOriginalData() { int id = int.Parse(Request.QueryString["id"]); DataTable tbl = EtNet_BLL.ViewBLL.ViewApplyLeaveListManager.getOneList(id); if (tbl.Rows.Count == 1) { Session["QJDId"] = tbl.Rows[0]["id"].ToString(); //请假单的值 this.lblnumbers.Text = tbl.Rows[0]["cname"].ToString(); this.lbldepart.Text = tbl.Rows[0]["departcname"].ToString(); this.lblpeople.Text = tbl.Rows[0]["logincname"].ToString(); this.lblapplydate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.radsort.SelectedValue = tbl.Rows[0]["applyleavesort"].ToString(); this.iptstartdate.Value = tbl.Rows[0]["leavestarttime"].ToString(); this.iptenddate.Value = tbl.Rows[0]["leaveendtime"].ToString(); this.iptremark.Value = tbl.Rows[0]["remark"].ToString(); int auditruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString()); if (auditruleid != 1) { EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(auditruleid); string path = model.rolepic; string patha = Server.MapPath(path); this.auditpic.InnerHtml = File.ReadAllText(Server.MapPath(path)); this.ddlauditsort.SelectedValue = model.sort; LoadApprovalRole(); this.ddlapprovalrole.SelectedValue = model.id.ToString(); } } }
/// <summary> ///加载办公用品申请单的数据 /// </summary> private void LoadOriginalData() { int id = int.Parse(Request.QueryString["id"]); //获取工作流的id值 string str = " jobflowid=" + id; DataTable tbl = EtNet_BLL.ViewBLL.ViewApplyOfficeSupplyManager.getList(str); if (tbl.Rows.Count == 1) { this.lblnumbers.Text = tbl.Rows[0]["cname"].ToString(); this.lbldepart.Text = tbl.Rows[0]["departcname"].ToString(); this.lblcanme.Text = tbl.Rows[0]["logincname"].ToString(); this.lblapplydate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.iptremark.Value = tbl.Rows[0]["remark"].ToString(); Session["BGDId"] = tbl.Rows[0]["id"].ToString(); int auditruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString()); if (auditruleid != 1) { EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(auditruleid); string path = model.rolepic; this.auditpic.InnerHtml = File.ReadAllText(Server.MapPath(path)); this.ddlauditsort.SelectedValue = model.sort; LoadApprovalRole(); this.ddlapprovalrole.SelectedValue = model.id.ToString(); } } }
/// <summary> /// 发送消息 /// </summary> private void SendInformation(int jobflowid, int ruleid) { EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); string[] list = rule.idgourp.Split(','); EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jobflowid); EtNet_Models.Information informodel = null; if (model != null) { informodel = new EtNet_Models.Information(); informodel.sortid = 4; informodel.associationid = jobflowid; informodel.contents = "编号为" + model.cname + "的单据需要您审批!"; informodel.createtime = DateTime.Now; informodel.sendtime = DateTime.Now; informodel.founderid = ((EtNet_Models.LoginInfo)Session["login"]).Id; if (EtNet_BLL.InformationManager.Add(informodel)) { int maxid = EtNet_BLL.InformationManager.GetMaxId(); EtNet_Models.InformationNotice infnotic = null; int len = (rule.sort == "单审") ? 1 : list.Length; for (int j = 0; j < len; j++) { infnotic = new EtNet_Models.InformationNotice(); infnotic.informationid = maxid; infnotic.recipientid = int.Parse(list[j].ToString()); infnotic.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(infnotic); } } } }
//保存 protected void imgbtnsave_Click(object sender, ImageClickEventArgs e) { string path = this.iptfile.Value; string stridgroup = ""; EtNet_Models.ApprovalRule model = new EtNet_Models.ApprovalRule(); model.cname = this.iptcname.Value.Trim(); model.jobflowsort = this.seljobflowsort.Value; model.rolepic = path; // 保存文件的路径 model.sort = this.selauditsort.Value; model.departidtxt = this.iptdepartlist.Value; model.departidlist = this.hiddepartlist.Value; model.txt = Server.UrlDecode(this.teratxt.Value); model.id = int.Parse(Request.QueryString["id"]); model.showpattern = Convert.ToInt32(this.selhide.Value); for (int i = 0; i < this.lbtake.Items.Count; i++) { stridgroup += this.lbtake.Items[i].Value + ","; } model.idgourp = stridgroup.Substring(0, stridgroup.Length - 1); if (EtNet_BLL.ApprovalRuleManager.Update(model)) { SaveFile(path); Response.Redirect("SearchAuditRole.aspx"); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('修改失败!')</script>", false); } }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.ApprovalRule model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ApprovalRule set "); strSql.Append(" sort = @sort , "); strSql.Append(" idgourp = @idgourp , "); strSql.Append(" txt = @txt , "); strSql.Append(" jobflowsort = @jobflowsort, "); strSql.Append(" cname = @cname, "); strSql.Append(" rolepic = @rolepic, "); strSql.Append(" departidlist= @departidlist, "); strSql.Append(" departidtxt = @departidtxt,"); strSql.Append(" showpattern = @showpattern"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@sort", SqlDbType.VarChar, 20), new SqlParameter("@idgourp", SqlDbType.VarChar, 100), new SqlParameter("@txt", SqlDbType.VarChar, 40), new SqlParameter("@jobflowsort", SqlDbType.VarChar, 4), new SqlParameter("@cname", SqlDbType.VarChar, 20), new SqlParameter("@rolepic", SqlDbType.VarChar, 500), new SqlParameter("@departidlist", SqlDbType.VarChar, 400), new SqlParameter("@departidtxt", SqlDbType.VarChar, 1000), new SqlParameter("@showpattern", SqlDbType.VarChar, 1000) }; parameters[0].Value = model.id; parameters[1].Value = model.sort; parameters[2].Value = model.idgourp; parameters[3].Value = model.txt; parameters[4].Value = model.jobflowsort; parameters[5].Value = model.cname; parameters[6].Value = model.rolepic; parameters[7].Value = model.departidlist; parameters[8].Value = model.departidtxt; parameters[9].Value = model.showpattern; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 加载审核规则数据 /// </summary> private void LoadAuditRoleData() { int id = int.Parse(Request.QueryString["id"]); EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(id); string[] stridgroup = null; if (model != null) { this.hidlist.Value = ""; this.hidaudit.Value = ""; this.iptcname.Value = model.cname; this.selauditsort.Value = model.sort; this.seljobflowsort.Value = model.jobflowsort; this.iptdepartlist.Value = model.departidtxt; this.hiddepartlist.Value = model.departidlist; this.teratxt.Value = model.txt; this.iptfile.Value = model.rolepic; this.selhide.Value = model.showpattern.ToString(); stridgroup = model.idgourp.Split(','); ListItem list = null; EtNet_Models.LoginInfo loginmodel = null; for (int i = 0; i < stridgroup.Length; i++) { loginmodel = EtNet_BLL.LoginInfoManager.getLoginInfoById(int.Parse(stridgroup[i])); list = new ListItem(); list.Value = stridgroup[i]; list.Text = loginmodel.Cname; this.lbtake.Items.Add(list); } IList <EtNet_Models.LoginInfo> loginlist = EtNet_BLL.LoginInfoManager.getLoginInfoAll(); for (int j = 0; j < loginlist.Count; j++) { for (int len = 0; len < stridgroup.Length; len++) { if (loginlist[j].Id.ToString() == stridgroup[len]) { break; } else if ((len + 1) == stridgroup.Length) { list = new ListItem(); list.Value = loginlist[j].Id.ToString(); list.Text = loginlist[j].Cname; this.lbuntake.Items.Add(list); } else { } } } this.auditpic.InnerHtml = File.ReadAllText(Server.MapPath(model.rolepic)); } }
/// <summary> /// 加载审批流程图 /// </summary> /// <param name="ruleid"></param> public void LoadAuditImg(int ruleid) { EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); if (model != null) { string strpath = Server.MapPath(model.rolepic); if (File.Exists(strpath)) { this.auditpic.InnerHtml = File.ReadAllText(strpath); } } }
/// <summary> /// 依据不同的审核规则查看相应的审核流程图 /// </summary> protected void ddlapprovalrole_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddlapprovalrole.SelectedIndex != 0) { int auditruleid = int.Parse(this.ddlapprovalrole.SelectedValue); EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(auditruleid); if (model != null) { string strpath = model.rolepic; this.auditpic.InnerHtml = File.ReadAllText(Server.MapPath(strpath)); } } string str = Server.UrlDecode(this.iptremark.Value); this.iptremark.Value = str; }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.ApprovalRule model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ApprovalRule("); strSql.Append("sort,idgourp,txt,jobflowsort,cname,rolepic,departidlist,departidtxt,hide,showpattern"); strSql.Append(") values ("); strSql.Append("@sort,@idgourp,@txt,@jobflowsort,@cname,@rolepic,@departidlist,@departidtxt,@hide,@showpattern"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@sort", SqlDbType.VarChar, 20), new SqlParameter("@idgourp", SqlDbType.VarChar, 100), new SqlParameter("@txt", SqlDbType.VarChar, 40), new SqlParameter("@jobflowsort", SqlDbType.VarChar, 4), new SqlParameter("@cname", SqlDbType.VarChar, 20), new SqlParameter("@rolepic", SqlDbType.VarChar, 500), new SqlParameter("@departidlist", SqlDbType.VarChar, 400), new SqlParameter("@departidtxt", SqlDbType.VarChar, 1000), new SqlParameter("@hide", SqlDbType.VarChar, 400), new SqlParameter("@showpattern", SqlDbType.VarChar, 400) }; parameters[0].Value = model.sort; parameters[1].Value = model.idgourp; parameters[2].Value = model.txt; parameters[3].Value = model.jobflowsort; parameters[4].Value = model.cname; parameters[5].Value = model.rolepic; parameters[6].Value = model.departidlist; parameters[7].Value = model.departidtxt; parameters[8].Value = model.hide; parameters[9].Value = model.showpattern; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 发送审批消息给下一个审批人员 /// </summary> public void SendNextAudit(int jfid) { EtNet_Models.LoginInfo login = ((EtNet_Models.LoginInfo)Session["login"]); EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(jfid); if (jfmodel != null) { EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(jfmodel.ruleid); string[] list = rule.idgourp.Split(','); if (rule.sort != "单审" || list.Length == 1) { return; } if (list[list.Length - 1] == login.Id.ToString()) { return; } int recipientid = 0; for (int i = 0; i < list.Length; i++) { if (list[i] == login.Id.ToString() && i != list.Length - 1) { recipientid = int.Parse(list[i + 1]); } } EtNet_Models.Information model = new EtNet_Models.Information(); model.sortid = 9; model.associationid = jfid; model.createtime = DateTime.Now; model.sendtime = DateTime.Now; model.founderid = jfmodel.founderid; model.contents = "名称为" + jfmodel.cname + "的客户需要您审批!";; EtNet_BLL.InformationManager.Add(model); int maxid = EtNet_BLL.InformationManager.GetMaxId(jfmodel.founderid.ToString()); EtNet_Models.InformationNotice infnotic = new EtNet_Models.InformationNotice(); infnotic.informationid = maxid; infnotic.recipientid = recipientid; infnotic.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(infnotic); } }
/// <summary> /// 依据不同的审核规则查看相应的审核流程图 /// </summary> protected void ddlapprovalrole_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddlapprovalrole.SelectedIndex != 0) { int auditruleid = int.Parse(this.ddlapprovalrole.SelectedValue); EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(auditruleid); if (model != null) { string strpath = model.rolepic; this.auditpic.InnerHtml = File.ReadAllText(Server.MapPath(strpath)); } } else { } string str = "<script> $(function(){ $('#iptremark').val(jQuery.changereducestr($('#iptremark').val()));});</script>"; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reducestr", str, false); }
/// <summary> /// 加载审核规则 /// </summary> private void LoadAuditFile(HttpContext context) { string result = ""; int id; int.TryParse(context.Request.Params["flag"], out id); EtNet_Models.ApprovalRule model = EtNet_BLL.ApprovalRuleManager.GetModel(id); if (model != null) { string strpath = context.Server.MapPath(model.rolepic); if (File.Exists(strpath)) { result = File.ReadAllText(strpath); } else { result = ""; } } context.Response.Write(result); }
/// <summary> /// 隐藏公告 /// </summary> /// <param name="id">公告的id值</param> private void VisibleAnnouncement(int id) { string str = ""; EtNet_Models.ApprovalRule approvalRule = EtNet_BLL.ApprovalRuleManager.GetModel(id); if (approvalRule.hide == 2) { approvalRule.hide = 1; str = "显示成功"; } else { approvalRule.hide = 2; str = "隐藏成功"; } if (!EtNet_BLL.ApprovalRuleManager.UpdateHide(approvalRule)) { str = "隐藏或修改失败"; } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "publish", "<script>alert('" + str + "')</script>", false); LoadAuditRoleData(); }
/// <summary> /// 得到一个对象实体 /// </summary> public static EtNet_Models.ApprovalRule GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" from ApprovalRule "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.ApprovalRule model = new EtNet_Models.ApprovalRule(); DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters); if (tbl.Rows.Count > 0) { model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.sort = tbl.Rows[0]["sort"].ToString(); model.idgourp = tbl.Rows[0]["idgourp"].ToString(); model.txt = tbl.Rows[0]["txt"].ToString(); model.jobflowsort = tbl.Rows[0]["jobflowsort"].ToString(); model.cname = tbl.Rows[0]["cname"].ToString(); model.rolepic = tbl.Rows[0]["rolepic"].ToString(); model.departidlist = tbl.Rows[0]["departidlist"].ToString(); model.departidtxt = tbl.Rows[0]["departidtxt"].ToString(); model.hide = Convert.ToInt32(tbl.Rows[0]["hide"].ToString()); model.showpattern = Convert.ToInt32(tbl.Rows[0]["showpattern"].ToString()); return(model); } else { return(null); } }
/// <summary> /// 检测审批规则是否有效 /// </summary> /// <param name="ruleid">审批规则的id值</param> private bool TestRule(string ruleid, ref int checkpid, ref int signpid) { bool result = true; int id = int.Parse(ruleid); EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(id); if (rule == null) { result = false; } else { if (rule.idgourp.IndexOf(',') == -1) { result = false; } else { string[] list = rule.idgourp.Split(','); if (rule.sort == "单审" && list.Length == 2) { checkpid = int.Parse(list[0]); signpid = int.Parse(list[1]); } else { result = false; } } } if (!result) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "rule", "<script>alert('公司公告只能选两级单审')</script>", false); } return(result); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.ApprovalRule model) { return(EtNet_DAL.ApprovalRuleService.Add(model)); }
/// <summary> /// 通过审批的方法 /// </summary> private void Pass() { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id string comparedata = " reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../Job/AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审批方式是选审或会签所以在提交审批时,工作流已由他人审批通过 Response.Redirect("../Job/AuditError.aspx?error=1"); } else { string ruletxt = ""; //审批的分类 string strsql = " jobflowcode=" + jobflowid.ToString(); DataTable tbl = EtNet_BLL.ViewBLL.ViewAnnouncementInfoManager.getList("", strsql); if (tbl.Rows.Count == 1) { int ruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString()); EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); ruletxt = rule.sort; //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id; DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.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.iptcomment.Value.Trim()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": if (mainreviewer != "T") { auditmodel = new EtNet_Models.AuditJobFlow(); //设置下一个审核人的数据记录 string nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString(); DataTable nextaudittbl = EtNet_BLL.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(); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); jobflowmodel.auditstatus = "02"; //工作流的审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; case "选审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); EtNet_BLL.AuditJobFlowManager.UpdateOther(" reviewerid != " + ((EtNet_Models.LoginInfo)Session["login"]).Id + " and jobflowid=" + jobflowid.ToString()); break; case "会审": bool pass = true; string straudit = " jobflowid=" + jobflowid.ToString(); DataTable auditjobtbl = EtNet_BLL.AuditJobFlowManager.GetList(straudit); for (int i = 0; i < auditjobtbl.Rows.Count; i++) { if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过") { pass = false; //说明还有其他审核人员未开始审核 break; } } if (pass) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的状审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; //工作流的状审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; string strad = "标题为" + jobflowmodel.cname + "公告,【" + login.Cname + "】通过审批!"; SendInfo(strad, jobflowmodel.id); SendNextAudit(jobflowmodel.id); //修改公告的审批意见 int announcementid = int.Parse(tbl.Rows[0]["id"].ToString()); EtNet_Models.AnnouncementInfo announcement = EtNet_BLL.AnnouncementInfoManager.GetModel(announcementid); announcement.opiniontxt = announcement.opiniontxt + login.Cname + "的审批意见:" + Server.UrlDecode(this.iptcomment.Value.Trim()) + "|"; if (jobflowmodel.auditstatus == "04") { announcement.statusid = 2; announcement.createtime = DateTime.Now; AnnouncementInformation(announcementid); } EtNet_BLL.AnnouncementInfoManager.Update(announcement); if (HttpContext.Current.Request.QueryString["pageindex"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]); Response.Redirect("../Job/AuditJobFlow.aspx?page=" + page + ""); } else { Response.Redirect("../Job/AuditJobFlow.aspx"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
/// <summary> /// 创建审批序列 /// </summary> ///<param name="ruleid">审核规则id值</param> /// <param name="id">工作流的id号</param> private void CreateApproval(int ruleid, int id) { EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); string stafflist = rule.idgourp; string auditsort = rule.sort; string[] staff = null; int len = 0; //审批人员的个数 EtNet_Models.AuditJobFlow model = null; if (stafflist.IndexOf(",") == -1) { staff = new string[1]; staff[0] = stafflist; len = 1; } else { staff = stafflist.Split(','); len = staff.Length; } switch (auditsort) { case "单审": for (int i = 0; i < staff.Length; i++) { model = new EtNet_Models.AuditJobFlow(); model.auditoperat = "未操作"; model.operatstatus = "未审批"; model.audittime = new DateTime(1900, 1, 1); if (i == 0) { model.nowreviewer = "T"; //第一个审核的人员 } else { model.nowreviewer = "F"; } if ((i + 1) == len) { model.mainreviewer = "T"; //最终审核的人员 } else { model.mainreviewer = "F"; } model.numbers = i + 1; model.jobflowid = id; model.reviewerid = int.Parse(staff[i]); model.opiniontxt = ""; EtNet_BLL.AuditJobFlowManager.Add(model); } break; case "选审": case "会审": for (int i = 0; i < staff.Length; i++) { model = new EtNet_Models.AuditJobFlow(); model.audittime = new DateTime(1900, 1, 1); model.nowreviewer = "T"; model.mainreviewer = "T"; model.numbers = 1; model.jobflowid = id; model.auditoperat = "未操作"; model.operatstatus = "未审批"; model.reviewerid = int.Parse(staff[i]); model.opiniontxt = ""; EtNet_BLL.AuditJobFlowManager.Add(model); } break; } }
/// <summary> /// 拒绝方法 /// </summary> private void Refuse() { 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 (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../Job/AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../Job/AuditError.aspx?error=1"); } else { string ruletxt = ""; //审核的分类 string strsql = " jobflowcode=" + jobflowid.ToString(); DataTable tbl = EtNet_BLL.ViewBLL.ViewCustomerManager.getList("", strsql); if (tbl.Rows.Count == 1) { int ruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString()); EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); ruletxt = rule.sort; //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + login.Id; DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.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.iptcomment.Value.Trim()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": case "会审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; //工作流的审核状态为“被拒绝” EtNet_BLL.JobFlowManager.Update(jobflowmodel); break; case "选审": string st = " jobflowid=" + jobflowid.ToString(); DataTable tbla = EtNet_BLL.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"; // 工作流的审核状态为被拒绝 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; // 工作流的审核状态为进行中 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } string strad = "编号为" + jobflowmodel.cname + "的客户,【" + login.Cname + "】拒绝审批!"; SendInfo(strad, jobflowmodel.id); //修改客户的审核意见 int cusid = int.Parse(tbl.Rows[0]["id"].ToString()); EtNet_Models.Customer cus = EtNet_BLL.CustomerManager.getCustomerById(cusid); cus.Txt = cus.Txt + login.Cname + "的审批意见:" + Server.UrlDecode(this.iptcomment.Value.Trim()) + "|"; EtNet_BLL.CustomerManager.updateCustomer(cus); if (HttpContext.Current.Request.QueryString["pageindex"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]); Response.Redirect("../Job/AuditJobFlow.aspx?page=" + page + ""); } else { Response.Redirect("../Job/AuditJobFlow.aspx"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
/// <summary> /// 更新一条数据(隐藏按钮专用) /// </summary> public static bool UpdateHide(EtNet_Models.ApprovalRule model) { return(EtNet_DAL.ApprovalRuleService.UpdateHide(model)); }