/// <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 imgread_Click(object sender, ImageClickEventArgs e) { CheckBox box = null; ImageButton imgbtn = null; EtNet_Models.InformationNotice model = null; int id = 0; int len = this.rptinformation.Controls.Count; for (int i = 0; i < len; i++) { box = this.rptinformation.Controls[i].Controls[1] as CheckBox; imgbtn = this.rptinformation.Controls[i].Controls[7] as ImageButton; if (box != null && imgbtn != null) { if (box.Checked && imgbtn.CommandArgument != "") { id = int.Parse(imgbtn.CommandArgument.ToString()); model = EtNet_BLL.InformationNoticeManager.GetModel(id); if (model != null) { model.remind = "否"; EtNet_BLL.InformationNoticeManager.Update(model); } } } } LoadInformationNoticeData(); }
/// <summary> /// 发送消息 /// </summary> private void SendInformation(int jobflowid, string[] list) { EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jobflowid); EtNet_Models.Information informodel = null; if (model != null) { informodel = new EtNet_Models.Information(); informodel.sortid = 2; 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; for (int j = 0; j < list.Length; j++) { infnotic = new EtNet_Models.InformationNotice(); infnotic.informationid = maxid; infnotic.recipientid = int.Parse(list[j].ToString()); infnotic.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(infnotic); } } } }
///<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 bool Update(EtNet_Models.InformationNotice model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update InformationNotice set "); strSql.Append(" informationid = @informationid , "); strSql.Append(" recipientid = @recipientid, "); strSql.Append(" remind = @remind"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@informationid", SqlDbType.Int, 4), new SqlParameter("@recipientid", SqlDbType.Int, 4), new SqlParameter("@remind", SqlDbType.VarChar, 10) }; parameters[0].Value = model.id; parameters[1].Value = model.informationid; parameters[2].Value = model.recipientid; parameters[3].Value = model.remind; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public static EtNet_Models.InformationNotice GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" from InformationNotice "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.InformationNotice model = new EtNet_Models.InformationNotice(); DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters); if (tbl.Rows.Count > 0) { model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.informationid = int.Parse(tbl.Rows[0]["informationid"].ToString()); model.recipientid = int.Parse(tbl.Rows[0]["recipientid"].ToString()); model.remind = tbl.Rows[0]["remind"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 创建消息通知 /// </summary> /// <param name="infoid">消息的id值</param> /// <param name="acceptid">接受人员的id值</param> public void CreateInfoNotice(int infoid, int acceptid) { EtNet_Models.InformationNotice model = new EtNet_Models.InformationNotice(); model.informationid = infoid; model.recipientid = acceptid; model.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(model); }
/// <summary> /// 设置消息不再提醒,参数niticeid是消息通知的id值 /// </summary> private void ModifyRemind(int noticeid) { EtNet_Models.InformationNotice model = EtNet_BLL.InformationNoticeManager.GetModel(noticeid); if (model != null) { model.remind = "否"; EtNet_BLL.InformationNoticeManager.Update(model); } }
/// <summary> /// 提醒修改 /// </summary> private void RemindInformationNotice() { if (Request.QueryString["infoid"] != null) { int id = int.Parse(Request.QueryString["infoid"]); EtNet_Models.InformationNotice model = EtNet_BLL.InformationNoticeManager.GetModel(id); model.remind = "否"; EtNet_BLL.InformationNoticeManager.Update(model); } }
/// <summary> /// 创建收信人通知列表 /// </summary> private void CreateInformationNotice(string peoplelist, int informationid) { string strsql = " id in(" + peoplelist + ")"; DataTable tbl = EtNet_BLL.LoginInfoManager.getList(strsql); EtNet_Models.InformationNotice model = null; for (int i = 0; i < tbl.Rows.Count; i++) { model = new EtNet_Models.InformationNotice(); model.informationid = informationid; model.recipientid = int.Parse(tbl.Rows[i]["id"].ToString()); model.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(model); } }
/// <summary> /// 取消提醒 /// </summary> /// <param name="id">消息通知id值</param> private void canelremind(int id) { EtNet_Models.InformationNotice model = EtNet_BLL.InformationNoticeManager.GetModel(id); if (model != null) { model.remind = "否"; if (EtNet_BLL.InformationNoticeManager.Update(model)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "remind", "<script>alert('提醒取消成功')</script>", false); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "remind", "<script>alert('提醒取消失败')</script>", false); } } }
///<summary> ///发送消息 ///</summary> ///<param name="id">公告的id值</param> ///<param name="sort">公告的分类</param> ///<param name="title">公告的标题</param> ///<param name="departlist">部门列表</param> ///<param name="isnew">是否是新公告</param> private void SendInformation(int id, int sort, string title, string departlist, bool isnew) { string strsql = ""; DataTable tbl = null; if (sort == 1) { //公司公告 tbl = EtNet_BLL.LoginInfoManager.getList(""); } else { strsql = " departid in(select departid from DepartmentInfo where departid in(" + departlist + "))"; tbl = EtNet_BLL.LoginInfoManager.getList(strsql); } EtNet_Models.Information model = new EtNet_Models.Information(); model.associationid = id; model.createtime = DateTime.Now; model.sendtime = model.createtime; model.founderid = ((EtNet_Models.LoginInfo)Session["login"]).Id; model.sortid = 8; if (isnew) { model.contents = "你有一个新公告可以查看,该公告的名称为:'" + title + "'"; } else { model.contents = "公告的名称为:'" + title + "'已修改,请注意查看"; } 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 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> public static bool Update(EtNet_Models.InformationNotice model) { return(EtNet_DAL.InformationNoticeService.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.InformationNotice model) { return(EtNet_DAL.InformationNoticeService.Add(model)); }