/// <summary> /// 公告送审 /// </summary> /// <param name="id">公告的id值</param> private void SendAuditAnnouncement(int id) { EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model != null) { EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(model.jobflowid); if (jfmodel.savestatus == "已提交") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('已经送审')</script>", false); } else { jfmodel.createtime = DateTime.Now; //默认是当前时间 jfmodel.endtime = DateTime.Now; jfmodel.savestatus = "已提交"; EtNet_BLL.JobFlowManager.Update(jfmodel); CreateApproval(jfmodel.ruleid, jfmodel.id); SendInformation(jfmodel.id, jfmodel.ruleid); model.createtime = DateTime.Now; model.filetime = DateTime.Now; model.printtime = DateTime.Now; model.yearnow = DateTime.Now.Year.ToString(); EtNet_BLL.AnnouncementInfoManager.Update(model); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('送审成功')</script>", false); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('送审失败')</script>", false); } }
/// <summary> /// 发布公告 /// </summary> /// <param name="id">公告的id值</param> private void PublishAnnouncement(int id) { string str = ""; EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model.statusid == 2) { str = "该公告已发布"; } else { model.createtime = DateTime.Now; model.statusid = 2; if (EtNet_BLL.AnnouncementInfoManager.Update(model)) { str = "发布成功"; OperationRecord(model.id); SendInformation(model.id, model.sortid, model.title, model.departlist); } else { str = "发布失败"; } } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "publish", "<script>alert('" + str + "')</script>", false); }
/// <summary> /// 回收公告 /// </summary> /// <param name="id">公告的id值</param> private void RefreshAnnouncement(int id) { string str = ""; string strsql = " id=" + id; strsql += " AND auditstatus in('01','03') "; DataTable tbl = EtNet_BLL.ViewBLL.ViewAnnouncementInfoManager.getList("", strsql); if (tbl.Rows.Count == 0) { str = "<script>alert('回收失败,只有状态是未开始或被拒绝的公告才能回收')</script>"; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "refresh", str, false); } else { int jfid = int.Parse(tbl.Rows[0]["jobflowcode"].ToString()); string strdel = " jobflowid = " + jfid; EtNet_BLL.AuditJobFlowManager.Delete(strdel); EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(jfid); jfmodel.auditstatus = "01"; jfmodel.savestatus = "草稿"; EtNet_BLL.JobFlowManager.Update(jfmodel); EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); model.opiniontxt = ""; EtNet_BLL.AnnouncementInfoManager.Update(model); str = "<script>alert('回收成功')</script>"; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "refresh", str, false); } }
/// <summary> /// 隐藏公告 /// </summary> /// <param name="id">公告的id值</param> private void VisibleAnnouncement(int id) { string str = ""; EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model.visiblecode == 0) { model.visiblecode = 1; model.visibletxt = "可见"; str = "显示成功"; } else { model.visiblecode = 0; model.visibletxt = "不可见"; str = "隐藏成功"; } if (!EtNet_BLL.AnnouncementInfoManager.Update(model)) { str = "隐藏或修改失败"; } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "publish", "<script>alert('" + str + "')</script>", false); }
///<summary> ///发送公告查看消息 ///</summary> ///<param name="id">公告id值</param> private void AnnouncementInformation(int id) { DataTable tbl = EtNet_BLL.LoginInfoManager.getList(""); EtNet_Models.AnnouncementInfo announcement = EtNet_BLL.AnnouncementInfoManager.GetModel(id); EtNet_Models.Information model = new EtNet_Models.Information(); model.associationid = id; model.contents = "你有一个新公告可以查看,该公告的名称为:'" + announcement.title + "'"; model.createtime = DateTime.Now; model.sendtime = model.createtime; model.founderid = announcement.createrid; model.sortid = 8; EtNet_BLL.InformationManager.Add(model); int maxid = EtNet_BLL.InformationManager.GetMaxId(); EtNet_Models.InformationNotice noticemodel = null; for (int i = 0; i < tbl.Rows.Count; i++) { noticemodel = new EtNet_Models.InformationNotice(); noticemodel.informationid = maxid; noticemodel.recipientid = int.Parse(tbl.Rows[i]["id"].ToString()); noticemodel.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(noticemodel); } }
/// <summary> /// 得到一个对象实体 /// </summary> public static EtNet_Models.AnnouncementInfo GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" from AnnouncementInfo "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.AnnouncementInfo model = new EtNet_Models.AnnouncementInfo(); DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters); if (tbl.Rows.Count > 0) { model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.title = tbl.Rows[0]["title"].ToString(); model.statusid = int.Parse(tbl.Rows[0]["statusid"].ToString()); model.sortid = int.Parse(tbl.Rows[0]["sortid"].ToString()); model.period = int.Parse(tbl.Rows[0]["period"].ToString()); model.starttime = DateTime.Parse(tbl.Rows[0]["starttime"].ToString()); model.endtime = DateTime.Parse(tbl.Rows[0]["endtime"].ToString()); model.visiblecode = int.Parse(tbl.Rows[0]["visiblecode"].ToString()); model.visibletxt = tbl.Rows[0]["visibletxt"].ToString(); model.txt = tbl.Rows[0]["txt"].ToString(); model.departlist = tbl.Rows[0]["departlist"].ToString(); model.departtxtlist = tbl.Rows[0]["departtxtlist"].ToString(); model.peoplelist = tbl.Rows[0]["peoplelist"].ToString(); model.createtime = DateTime.Parse(tbl.Rows[0]["createtime"].ToString()); model.createrid = int.Parse(tbl.Rows[0]["createrid"].ToString()); model.firmid = int.Parse(tbl.Rows[0]["firmid"].ToString()); model.yearnow = tbl.Rows[0]["yearnow"].ToString(); model.filenum = tbl.Rows[0]["filenum"].ToString(); model.filetime = DateTime.Parse(tbl.Rows[0]["filetime"].ToString()); model.themeword = tbl.Rows[0]["themeword"].ToString(); model.carboncopy = tbl.Rows[0]["carboncopy"].ToString(); model.carboncopytxt = tbl.Rows[0]["carboncopytxt"].ToString(); model.imgid = int.Parse(tbl.Rows[0]["imgid"].ToString()); model.printtime = DateTime.Parse(tbl.Rows[0]["printtime"].ToString()); model.checkpid = int.Parse(tbl.Rows[0]["checkpid"].ToString()); model.signpid = int.Parse(tbl.Rows[0]["signpid"].ToString()); model.jobflowid = int.Parse(tbl.Rows[0]["jobflowid"].ToString()); model.opiniontxt = tbl.Rows[0]["opiniontxt"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 阅读公告 /// </summary> /// <param name="id">公告的id值</param> private void ReadAnnouncementDetails(int id) { EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model.sortid == 1) { Response.Redirect("AnnouncementReadFirm.aspx?id=" + id); } else { Response.Redirect("AnnouncementRead.aspx?id=" + id); } }
/// <summary> /// 保存 /// </summary> protected void imgbtnsave_Click(object sender, ImageClickEventArgs e) { string[] str = FileUp(Request.Files); if (str[0] != "") { string strerror = "<script> alert('" + str[0] + "');</script>"; this.hidtxt.Value = ""; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "fileup", strerror, false); } else { EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; EtNet_Models.AnnouncementInfo model = new EtNet_Models.AnnouncementInfo(); model.createrid = login.Id; model.createtime = DateTime.Now; model.departlist = this.hiddepartlist.Value; model.departtxtlist = this.iptdepartlist.Value; model.starttime = Convert.ToDateTime(this.iptstart.Value); model.period = int.Parse(this.iptperiod.Value); model.endtime = model.starttime.AddDays(model.period); model.peoplelist = ""; model.sortid = 2; model.statusid = int.Parse(this.ddlstatus.SelectedValue); model.title = this.ipttitle.Value; model.visiblecode = 1; model.visibletxt = "可见"; model.txt = Server.UrlDecode(this.hidtxt.Value); model.opiniontxt = ""; model.carboncopy = ""; model.carboncopytxt = ""; model.checkpid = login.Id; model.filenum = ""; model.filetime = DateTime.Now; model.firmid = 0; model.imgid = 0; model.jobflowid = 0; model.signpid = login.Id; model.themeword = ""; model.yearnow = ""; model.printtime = DateTime.Now; int id = EtNet_BLL.AnnouncementInfoManager.Add(model); CreateFile(str, id); if (model.statusid == 2) { OperationRecord(id); SendInformation(id, model.sortid, model.title, model.departlist); } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('新增成功');window.location='AnnouncementShow.aspx'</script>", false); } }
//保存修改 protected void imgbtnsave_Click(object sender, ImageClickEventArgs e) { string[] str = FileUp(Request.Files); if (str[0] != "") { string strerror = "<script> alert('" + str[0] + "');</script>"; this.hidtxt.Value = ""; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "fileup", strerror, false); } else { int id = int.Parse(Request.Params["id"]); EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); model.createtime = DateTime.Parse(this.lbldatetime.Text); model.departlist = this.hiddepartlist.Value; model.departtxtlist = this.iptdepartlist.Value; model.starttime = Convert.ToDateTime(this.iptstart.Value); model.period = int.Parse(this.iptperiod.Value); model.endtime = model.starttime.AddDays(model.period); model.title = this.ipttitle.Value; model.txt = Server.UrlDecode(this.hidtxt.Value); if (model.statusid == 1) { //原为草稿可进行修改,已发布无需修改 model.statusid = int.Parse(this.ddlstatus.SelectedValue); if (model.statusid == 2) { OperationRecord(model.id, 1); SendInformation(model.id, model.sortid, model.title, model.departlist, true); } } else { OperationRecord(model.id, 2); SendInformation(model.id, model.sortid, model.title, model.departlist, false); } EtNet_BLL.AnnouncementInfoManager.Update(model); CreateFile(str, model.id); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('修改成功');window.location='AnnouncementShow.aspx'</script>", false); } }
/// <summary> /// 链接到项目或公告 /// </summary> /// <param name="associationid">项目或公告的id值</param> public string LinkItem(int sort, int associationid, int informationid) { string strlink = ""; switch (sort) { case 7: //EtNet_Models.ItemInfo info = EtNet_BLL.ItemInfoManager.GetModel(associationid); //if(info !=null) //{ // strlink += "<span style='color:blue;padding-left:10px;'>"; // strlink += " 转到该项目:<a style='color:red;' href='../Items/EditItems.aspx?id=" + info.id; // strlink += "'>【" + info.cname + "】</a></span>"; //} break; case 8: EtNet_Models.AnnouncementInfo announcemrnt = EtNet_BLL.AnnouncementInfoManager.GetModel(associationid); if (announcemrnt != null) { strlink += "<span style='color:blue;padding-left:10px;'>"; strlink += " 转到该公告:<a class='clslink' style='color:red;' "; // strlink += " id='noticeid" + informationid.ToString() + "' "; if (announcemrnt.sortid == 1) { strlink += " href='../Announcement/AnnouncementReadFirm.aspx?id=" + announcemrnt.id; } else { strlink += " href='../Announcement/AnnouncementRead.aspx?id=" + announcemrnt.id; } strlink += "&infoid=" + informationid.ToString(); strlink += "'>【" + announcemrnt.title + "】</a></span>"; } break; } return(strlink); }
/// <summary> /// 加载原有的公告数据 /// </summary> private void LoadAnnouncementData() { int id = int.Parse(Request.Params["id"]); EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model == null) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "laod", "<script>alert('加载失败');window.location='AnnouncementShow.aspx'</script>", false); } else { EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; this.lblcreater.Text = login.Cname; this.hiddepartlist.Value = model.departlist; this.iptdepartlist.Value = model.departtxtlist; this.iptperiod.Value = model.period.ToString(); this.ddlstatus.SelectedValue = model.statusid.ToString(); this.ipttitle.Value = model.title; this.hidtxt.Value = model.txt; if (model.statusid == 1) { //草稿状态 lbldatetime.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.iptstart.Value = DateTime.Now.ToString("yyyy-MM-dd"); } else { //发布状态 lbldatetime.Text = model.createtime.ToString("yyyy-MM-dd"); this.iptstart.Value = model.starttime.ToString("yyyy-MM-dd"); this.ddlstatus.Enabled = false; } LoadFile(); } }
/// <summary> /// 送审 /// </summary> protected void imgbtnaudit_Click(object sender, ImageClickEventArgs e) { string[] str = FileUp(Request.Files); if (str[0] != "") { string strerror = "<script> alert('" + str[0] + "');</script>"; this.hidtxt.Value = Server.UrlDecode(this.hidtxt.Value); this.ddlrule.SelectedIndex = 0; this.iptimgseal.Value = ""; this.hidimgseal.Value = ""; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "fileup", strerror, false); return; } int checkpid = 0; //校对人的id值 int signpid = 0; //签发人的id值 if (TestRule(this.ddlrule.SelectedValue, ref checkpid, ref signpid)) { EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; EtNet_Models.JobFlow jfmodel = new EtNet_Models.JobFlow(); jfmodel.attachment = ""; jfmodel.txt = ""; jfmodel.cname = this.ipttitle.Value; jfmodel.sort = "04"; //公告管理申请 jfmodel.auditsort = ""; jfmodel.auditstatus = "01"; jfmodel.createtime = DateTime.Now; //默认是当前时间 jfmodel.endtime = DateTime.Now; jfmodel.founderid = login.Id; //登录人员的id jfmodel.ruleid = int.Parse(this.ddlrule.SelectedValue); jfmodel.savestatus = "已提交"; int maxid = EtNet_BLL.JobFlowManager.AddAndGetId(jfmodel); //工作流的id值 CreateApproval(jfmodel.ruleid, maxid); SendInformation(maxid, jfmodel.ruleid); EtNet_Models.AnnouncementInfo model = new EtNet_Models.AnnouncementInfo(); model.createrid = login.Id; model.createtime = DateTime.Now; model.departlist = ""; //查看部门的id值,部门公告时有效 model.departtxtlist = ""; //部门公告时有效 model.starttime = DateTime.Parse(this.iptstart.Value); model.period = int.Parse(this.iptperiod.Value); model.endtime = model.starttime.AddDays(model.period); model.peoplelist = ""; //保留字段 model.sortid = 1; model.statusid = 1; model.title = this.ipttitle.Value; model.visiblecode = 1; model.visibletxt = "可见"; model.txt = Server.UrlDecode(this.hidtxt.Value); model.carboncopy = this.hidcarboncopy.Value; model.carboncopytxt = this.iptcarboncopy.Value; model.checkpid = checkpid; model.signpid = signpid; model.filenum = this.iptorder.Value; model.filetime = DateTime.Now; model.firmid = int.Parse(this.ddlfirm.SelectedValue); model.imgid = int.Parse(this.hidimgseal.Value); model.opiniontxt = ""; model.printtime = DateTime.Now; model.themeword = this.iptword.Value; model.yearnow = DateTime.Now.Year.ToString(); model.jobflowid = maxid; int id = EtNet_BLL.AnnouncementInfoManager.Add(model); OperationRecord(id); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ad", "<script> alert('送审成功'); window.location='AnnouncementShowFirm.aspx'</script>", false); } else { this.hidtxt.Value = Server.UrlDecode(this.hidtxt.Value); this.ddlrule.SelectedIndex = 0; this.iptimgseal.Value = ""; this.hidimgseal.Value = ""; } }
protected void rptauditjobflow_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "audit": string[] str = e.CommandArgument.ToString().Split('-'); string rs = ReviewerStatus(str[0], ((EtNet_Models.LoginInfo)Session["login"]).Id); if (rs == "") { //工作流已删除或审核人员已更改 LoadRptjobflowData(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "faudit", "<script>alert('不能进入审批界面,原因可能是该申请已修改或删除!')</script>", false); return; } else if (rs == "F") { LoadRptjobflowData(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "faudit", "<script>alert('不能进入审批界面,原因可能是审批受限制!')</script>", false); } else if (rs == "T") { string strstatus = JobFlowAuditStatus(int.Parse(str[0])); if (strstatus == "03" || strstatus == "04") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "auditR", "<script>alert('该工作流已由他人审批,无需再审!')</script>", false); } else { if (str[1] == "01") { if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Response.Redirect("ReimbursedForm/AuditReimbursedForm.aspx?pageindex=" + page + "&jobflowid=" + str[0]); } else { Response.Redirect("ReimbursedForm/AuditReimbursedForm.aspx?jobflowid=" + str[0]); } } else if (str[1] == "02") { if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Response.Redirect("../Order/AuditOrder.aspx?pageindex=" + page + "&jobflowid=" + str[0]); } else { Response.Redirect("../Order/AuditOrder.aspx?jobflowid=" + str[0]); } } else if (str[1] == "03") { if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Response.Redirect("../CusInfo/AuditCus.aspx?pageindex=" + page + "&jobflowid=" + str[0]); } else { Response.Redirect("../CusInfo/AuditCus.aspx?jobflowid=" + str[0]); } } else if (str[1] == "04") { if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Response.Redirect("../Announcement/AnnouncementAuditFirm.aspx?pageindex=" + page + "&jobflowid=" + str[0]); } else { Response.Redirect("../Announcement/AnnouncementAuditFirm.aspx?jobflowid=" + str[0]); } } else if (str[1] == "05") { if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Response.Redirect("../Financial/AuditPayment.aspx?pageindex=" + page + "&jobflowid=" + str[0]); } else { Response.Redirect("../Financial/AuditPayment.aspx?jobflowid=" + str[0]); } } else { } } } else if (rs == "P") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "auditP", "<script>alert('不能重复审批!')</script>", false); } else { } break; case "search": string[] str2 = e.CommandArgument.ToString().Split('-'); int jfid2 = int.Parse(str2[0]); if (str2[1] == "01") //报销审核的查看 { SearchReimbursement(jfid2); } else if (str2[1] == "02") //定审核的查看 { SearchOrder(jfid2); } else if (str2[1] == "03") //客户审批查看 { SearchCus(jfid2); } else if (str2[1] == "04") //公告审核查看 { SearchAnnoun(jfid2); } else if (str2[1] == "05") //付款申请单查看 { SearchPayment(jfid2); } break; case "refresh": string[] str3 = e.CommandArgument.ToString().Split('-'); int jfid3 = int.Parse(str3[0]); //工作流id EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jfid3); //得到工作流实例 string strfresh = " jobflowid = " + jfid3; EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核数据,将审核状态改为初始状态 model.savestatus = "草稿"; model.auditstatus = "01"; //审核状态改为未开始状态 model.txt = ""; //审核意见置空 if (model.sort == "01") //报销审核 { string id = EtNet_BLL.AusRottenInfoManager.GetList(strfresh).Rows[0]["id"].ToString(); //根据工作流id得到报销单的id值 EtNet_Models.AusRottenInfo rotten = EtNet_BLL.AusRottenInfoManager.GetModel(int.Parse(id)); if (rotten != null) { rotten.txt = ""; //清空审批人员的审批意见 EtNet_BLL.AusRottenInfoManager.Update(rotten); } } else if (model.sort == "02") //订单审核 { } else if (model.sort == "03") //客户审核 { string sqlcus = " jobflowid = " + jfid3; DataTable tblcus = EtNet_BLL.CustomerManager.GetList(1, sqlcus, "id"); EtNet_Models.Customer cus = EtNet_BLL.CustomerManager.getCustomerById(int.Parse(tblcus.Rows[0]["id"].ToString())); if (cus != null) { cus.Txt = ""; EtNet_BLL.CustomerManager.updateCustomer(cus); } } else if (model.sort == "04") //公告审批 { string sqlano = " jobflowid = " + jfid3; DataTable tblano = EtNet_BLL.AnnouncementInfoManager.GetList(1, sqlano, "id"); EtNet_Models.AnnouncementInfo ano = EtNet_BLL.AnnouncementInfoManager.GetModel(int.Parse(tblano.Rows[0]["id"].ToString())); if (ano != null) { ano.txt = ""; EtNet_BLL.AnnouncementInfoManager.Update(ano); } } else if (model.sort == "05") //付款审核 { } if (EtNet_BLL.JobFlowManager.Update(model)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "success", "<script>alert('撤销成功')</script>", false); } break; } }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(EtNet_Models.AnnouncementInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into AnnouncementInfo("); strSql.Append("title,statusid,sortid,period,starttime,endtime,visiblecode,visibletxt,txt,departlist,peoplelist,createtime,createrid,departtxtlist,"); strSql.Append("firmid,yearnow,filenum,filetime,themeword,carboncopy,carboncopytxt,imgid,printtime,checkpid,signpid,jobflowid,opiniontxt"); strSql.Append(") values ("); strSql.Append("@title,@statusid,@sortid,@period,@starttime,@endtime,@visiblecode,@visibletxt,@txt,@departlist,@peoplelist,@createtime,@createrid,@departtxtlist,"); strSql.Append("@firmid,@yearnow,@filenum,@filetime,@themeword,@carboncopy,@carboncopytxt,@imgid,@printtime,@checkpid,@signpid,@jobflowid,@opiniontxt"); strSql.Append(") "); strSql.Append(";select SCOPE_IDENTITY() "); SqlParameter[] parameters = { new SqlParameter("@title", SqlDbType.VarChar, 100), new SqlParameter("@statusid", SqlDbType.Int, 4), new SqlParameter("@sortid", SqlDbType.Int, 4), new SqlParameter("@period", SqlDbType.Int, 4), new SqlParameter("@starttime", SqlDbType.DateTime), new SqlParameter("@endtime", SqlDbType.DateTime), new SqlParameter("@visiblecode", SqlDbType.Int, 4), new SqlParameter("@visibletxt", SqlDbType.VarChar, 10), new SqlParameter("@txt", SqlDbType.Text), new SqlParameter("@departlist", SqlDbType.VarChar, 100), new SqlParameter("@peoplelist", SqlDbType.VarChar, 400), new SqlParameter("@createtime", SqlDbType.DateTime), new SqlParameter("@createrid", SqlDbType.Int, 4), new SqlParameter("@departtxtlist", SqlDbType.VarChar, 200), new SqlParameter("@firmid", SqlDbType.Int, 4), new SqlParameter("@yearnow", SqlDbType.VarChar, 20), new SqlParameter("@filenum", SqlDbType.VarChar, 40), new SqlParameter("@filetime", SqlDbType.DateTime), new SqlParameter("@themeword", SqlDbType.VarChar, 100), new SqlParameter("@carboncopy", SqlDbType.VarChar, 400), new SqlParameter("@carboncopytxt", SqlDbType.VarChar, 1000), new SqlParameter("@imgid", SqlDbType.Int, 4), new SqlParameter("@printtime", SqlDbType.DateTime), new SqlParameter("@checkpid", SqlDbType.Int, 4), new SqlParameter("@signpid", SqlDbType.Int, 4), new SqlParameter("@jobflowid", SqlDbType.Int, 4), new SqlParameter("@opiniontxt", SqlDbType.VarChar, 200) }; parameters[0].Value = model.title; parameters[1].Value = model.statusid; parameters[2].Value = model.sortid; parameters[3].Value = model.period; parameters[4].Value = model.starttime; parameters[5].Value = model.endtime; parameters[6].Value = model.visiblecode; parameters[7].Value = model.visibletxt; parameters[8].Value = model.txt; parameters[9].Value = model.departlist; parameters[10].Value = model.peoplelist; parameters[11].Value = model.createtime; parameters[12].Value = model.createrid; parameters[13].Value = model.departtxtlist; parameters[14].Value = model.firmid; parameters[15].Value = model.yearnow; parameters[16].Value = model.filenum; parameters[17].Value = model.filetime; parameters[18].Value = model.themeword; parameters[19].Value = model.carboncopy; parameters[20].Value = model.carboncopytxt; parameters[21].Value = model.imgid; parameters[22].Value = model.printtime; parameters[23].Value = model.checkpid; parameters[24].Value = model.signpid; parameters[25].Value = model.jobflowid; parameters[26].Value = model.opiniontxt; int result = 0; SqlDataReader rad = EtNet_DAL.DBHelper.ExecuteReader(strSql.ToString(), parameters); if (rad.Read()) { result = Convert.ToInt32(rad[0]); rad.Close(); } return(result); }
//送审 protected void imgbtnaudit_Click(object sender, ImageClickEventArgs e) { string[] str = FileUp(Request.Files); if (str[0] != "") { string strerror = "<script> alert('" + str[0] + "');</script>"; this.hidtxt.Value = Server.UrlDecode(this.hidtxt.Value); this.ddlrule.SelectedIndex = 0; this.auditpic.InnerHtml = ""; LoadFile(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "fileup", strerror, false); return; } int checkpid = 0; //校对人的id值 int signpid = 0; //签发人的id值 if (TestRule(this.ddlrule.SelectedValue, ref checkpid, ref signpid)) { int id = int.Parse(Request.QueryString["id"]); EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model != null) { model.createtime = DateTime.Now; model.title = this.ipttitle.Value; model.starttime = DateTime.Parse(this.iptstart.Value); model.period = int.Parse(this.iptperiod.Value); model.endtime = model.starttime.AddDays(model.period); model.txt = Server.UrlDecode(this.hidtxt.Value); model.carboncopy = this.hidcarboncopy.Value; model.carboncopytxt = this.iptcarboncopy.Value; model.checkpid = checkpid; model.signpid = signpid; model.filenum = this.iptorder.Value; model.filetime = DateTime.Now; model.firmid = int.Parse(this.ddlfirm.SelectedValue); model.imgid = int.Parse(this.hidimgseal.Value); model.printtime = DateTime.Now; model.themeword = this.iptword.Value; model.yearnow = DateTime.Now.Year.ToString(); EtNet_BLL.AnnouncementInfoManager.Update(model); EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(model.jobflowid); jfmodel.cname = this.ipttitle.Value; jfmodel.createtime = DateTime.Now; //默认是当前时间 jfmodel.endtime = DateTime.Now; jfmodel.ruleid = int.Parse(this.ddlrule.SelectedValue); jfmodel.savestatus = "已提交"; EtNet_BLL.JobFlowManager.Update(jfmodel); CreateApproval(jfmodel.ruleid, jfmodel.id); SendInformation(jfmodel.id, jfmodel.ruleid); CreateFile(str, id); OperationRecord(id); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ad", "<script> alert('送审成功'); window.location='AnnouncementShowFirm.aspx'</script>", false); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ad", "<script> alert('送审失败'); window.location='AnnouncementShowFirm.aspx'</script>", false); } } else { this.hidtxt.Value = Server.UrlDecode(this.hidtxt.Value); this.ddlrule.SelectedIndex = 0; this.auditpic.InnerHtml = ""; LoadFile(); } }
/// <summary> /// 增加一条数据,返回id值 /// </summary> public static int Add(EtNet_Models.AnnouncementInfo model) { return(EtNet_DAL.AnnouncementInfoService.Add(model)); }
/// <summary> /// 拒绝审批的方法 /// </summary> private void Refuse() { 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 "单审": 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; } EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; string strad = "标题为" + jobflowmodel.cname + "公告,【" + login.Cname + "】拒绝审批!"; SendInfo(strad, 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()) + "|"; 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> 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> public static bool Update(EtNet_Models.AnnouncementInfo model) { return(EtNet_DAL.AnnouncementInfoService.Update(model)); }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.AnnouncementInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AnnouncementInfo set "); strSql.Append(" title = @title , "); strSql.Append(" statusid = @statusid , "); strSql.Append(" sortid = @sortid , "); strSql.Append(" period = @period , "); strSql.Append(" starttime = @starttime , "); strSql.Append(" endtime = @endtime , "); strSql.Append(" visiblecode = @visiblecode , "); strSql.Append(" visibletxt = @visibletxt , "); strSql.Append(" txt = @txt , "); strSql.Append(" departlist = @departlist , "); strSql.Append(" peoplelist = @peoplelist , "); strSql.Append(" createtime = @createtime , "); strSql.Append(" createrid = @createrid , "); strSql.Append(" departtxtlist = @departtxtlist , "); strSql.Append(" firmid = @firmid,"); strSql.Append(" yearnow=@yearnow,"); strSql.Append(" filenum=@filenum,"); strSql.Append(" filetime=@filetime,"); strSql.Append(" themeword=@themeword,"); strSql.Append(" carboncopy=@carboncopy,"); strSql.Append(" carboncopytxt=@carboncopytxt,"); strSql.Append(" imgid= @imgid,"); strSql.Append(" printtime= @printtime,"); strSql.Append(" checkpid=@checkpid,"); strSql.Append(" signpid=@signpid,"); strSql.Append(" jobflowid=@jobflowid,"); strSql.Append(" opiniontxt=@opiniontxt"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@title", SqlDbType.VarChar, 100), new SqlParameter("@statusid", SqlDbType.Int, 4), new SqlParameter("@sortid", SqlDbType.Int, 4), new SqlParameter("@period", SqlDbType.Int, 4), new SqlParameter("@starttime", SqlDbType.DateTime), new SqlParameter("@endtime", SqlDbType.DateTime), new SqlParameter("@visiblecode", SqlDbType.Int, 4), new SqlParameter("@visibletxt", SqlDbType.VarChar, 10), new SqlParameter("@txt", SqlDbType.Text), new SqlParameter("@departlist", SqlDbType.VarChar, 100), new SqlParameter("@peoplelist", SqlDbType.VarChar, 400), new SqlParameter("@createtime", SqlDbType.DateTime), new SqlParameter("@createrid", SqlDbType.Int, 4), new SqlParameter("@departtxtlist", SqlDbType.VarChar, 200), new SqlParameter("@firmid", SqlDbType.Int, 4), new SqlParameter("@yearnow", SqlDbType.VarChar, 20), new SqlParameter("@filenum", SqlDbType.VarChar, 40), new SqlParameter("@filetime", SqlDbType.DateTime), new SqlParameter("@themeword", SqlDbType.VarChar, 100), new SqlParameter("@carboncopy", SqlDbType.VarChar, 400), new SqlParameter("@carboncopytxt", SqlDbType.VarChar, 1000), new SqlParameter("@imgid", SqlDbType.Int, 4), new SqlParameter("@printtime", SqlDbType.DateTime), new SqlParameter("@checkpid", SqlDbType.Int, 4), new SqlParameter("@signpid", SqlDbType.Int, 4), new SqlParameter("@jobflowid", SqlDbType.Int, 4), new SqlParameter("@opiniontxt", SqlDbType.VarChar, 200) }; parameters[0].Value = model.id; parameters[1].Value = model.title; parameters[2].Value = model.statusid; parameters[3].Value = model.sortid; parameters[4].Value = model.period; parameters[5].Value = model.starttime; parameters[6].Value = model.endtime; parameters[7].Value = model.visiblecode; parameters[8].Value = model.visibletxt; parameters[9].Value = model.txt; parameters[10].Value = model.departlist; parameters[11].Value = model.peoplelist; parameters[12].Value = model.createtime; parameters[13].Value = model.createrid; parameters[14].Value = model.departtxtlist; parameters[15].Value = model.firmid; parameters[16].Value = model.yearnow; parameters[17].Value = model.filenum; parameters[18].Value = model.filetime; parameters[19].Value = model.themeword; parameters[20].Value = model.carboncopy; parameters[21].Value = model.carboncopytxt; parameters[22].Value = model.imgid; parameters[23].Value = model.printtime; parameters[24].Value = model.checkpid; parameters[25].Value = model.signpid; parameters[26].Value = model.jobflowid; parameters[27].Value = model.opiniontxt; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }