/// <summary> /// 查看提醒的详细 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETTXSXMODEL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int FormID = Int32.Parse(P1); SZHL_TXSX Model = new SZHL_TXSXB().GetEntity(d => d.ID == FormID && d.ComId == UserInfo.QYinfo.ComId); msg.Result = Model; }
/// <summary> /// 查看当月的提醒 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETTXSXDATABY(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strWhere = " TXType='1' and Remark='Manual' and comid=" + UserInfo.QYinfo.ComId + " and type in ('0','1','2','3') "; strWhere += string.Format(" and " + SqlHelp.concat("','+TXUser+','") + " like '%,{0},%' ", UserInfo.User.UserName); if (P1 != "") { strWhere += string.Format(" and Status='{0}' ", P1); } string start = context["start"] != null ? context["start"].ToString() : ""; string end = context["end"] != null ? context["end"].ToString() : ""; if (!string.IsNullOrEmpty(start)) { strWhere += string.Format(" and Date>='{0}' ", start); } if (!string.IsNullOrEmpty(end)) { strWhere += string.Format(" and Date<='{0}' ", end); } DataTable dtList = new SZHL_TXSXB().GetDTByCommand(" select ID,TXContent as title,'' as start,Date,Hour,Minute FROM SZHL_TXSX where " + strWhere + " ORDER BY CRDate "); for (int i = 0; i < dtList.Rows.Count; i++) { dtList.Rows[i]["start"] = dtList.Rows[i]["Date"].ToString() + " " + dtList.Rows[i]["Hour"].ToString() + ":" + dtList.Rows[i]["Minute"].ToString() + ":00"; } msg.Result = dtList; }
/// <summary> /// 对流程待处理人员发送提醒(催办) /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void SENDLCCB(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); var CBResult = new Yan_WF_TIB().GetEntities(d => d.PIID == Id && d.TaskState == 0); foreach (Yan_WF_TI item in CBResult) { SZHL_TXSX MODEL = new SZHL_TXSXB().GetEntity(d => d.TXUser == item.TaskUserID && d.intProcessStanceid == item.PIID); if (MODEL != null) { MODEL.Status = "0"; new SZHL_TXSXB().Update(MODEL); } } }
/// <summary> /// 查看当月的提醒 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETTXSXDATA_BY(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strWhere = " TXType='1' and Remark='Manual' and comid=" + UserInfo.QYinfo.ComId + " and type in ('0','1','2','3') "; //string strQueryUser = context.Request["QUSER"] ?? ""; //if (strQueryUser != "") //{ // if (strQueryUser.IndexOf(',') != -1) // { // strQueryUser = "******"; // } // strWhere += string.Format(" and CRUser in('{0}') ", strQueryUser.ToFormatLike()); //} //else //{ // strWhere += string.Format(" and CRUser='******'", UserInfo.User.UserName); //} strWhere += string.Format(" and ','+TXUser+',' like '%,{0},%' ", UserInfo.User.UserName); if (P1 != "") { strWhere += string.Format(" and Status='{0}' ", P1); } string start = context.Request["start"]; string end = context.Request["end"]; if (!string.IsNullOrEmpty(start)) { strWhere += string.Format(" and [Date]>='{0}' ", start); } if (!string.IsNullOrEmpty(end)) { strWhere += string.Format(" and [Date]<='{0}' ", end); } DataTable dtList = new SZHL_TXSXB().GetDTByCommand(" select ID,left([TXContent],10)+' '+[Hour]+':'+[Minute] as title,[Date]+' '+[Hour]+':'+[Minute]+':00' as start FROM SZHL_TXSX where " + strWhere + " ORDER BY CRDate "); msg.Result = dtList; }
/// <summary> /// 查看当月的提醒 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETTXSXDATA_MONTH(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string start = context.Request["start"]; string end = context.Request["end"]; List <RLView> list = new List <RLView>(); DateTime sd = DateTime.Parse(start + " 00:00:00"); DateTime ed = DateTime.Parse(end + " 23:59:59"); string strWhere = "Remark='Manual' and comid=" + UserInfo.QYinfo.ComId + " and type in ('0','1','2','3') "; strWhere += string.Format(" and ','+TXUser+',' like '%,{0},%' ", UserInfo.User.UserName); var sxs = new SZHL_TXSXB().GetEntities(strWhere); foreach (var model in sxs) { DateTime cd = DateTime.Parse(model.CRDate.Value.ToString("yyyy-MM-dd") + " 00:00:00"); switch (model.TXType) { case "0": //立即发送 { #region 立即发送 DateTime dd = model.CRDate.Value; if (dd >= sd && dd <= ed) { RLView rv = new RLView(); rv.id = model.ID; if (!string.IsNullOrEmpty(model.TXContent)) { rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; //rv.title = rv.title + " " + model.Hour + ":" + model.Minute; rv.title = rv.title + " " + model.CRDate.Value.ToString("HH:mm"); } //rv.start = model.Date + " " + model.Hour + ":" + model.Minute + ":00"; rv.start = model.CRDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); rv.content = model.TXContent; rv.txfs = txfs(model.Type); rv.txms = txms(model); list.Add(rv); } #endregion } break; case "1": //仅一次 { #region 仅一次 DateTime dd = DateTime.Parse(model.Date + " " + model.Hour + ":" + model.Minute + ":00"); if (dd >= sd && dd <= ed) { RLView rv = new RLView(); rv.id = model.ID; if (!string.IsNullOrEmpty(model.TXContent)) { rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; rv.title = rv.title + " " + model.Hour + ":" + model.Minute; } rv.start = model.Date + " " + model.Hour + ":" + model.Minute + ":00"; rv.content = model.TXContent; rv.txfs = txfs(model.Type); rv.txms = txms(model); list.Add(rv); } #endregion } break; case "2": //每个工作日 { #region 每个工作日(单一) //DateTime jzdt = new DateTime(); //if (model.CFType == "2") { jzdt = WorkDate(cd, model.CFCount.Value-1); } //for (DateTime dte = sd; dte <= ed; dte=dte.AddDays(1)) //{ // if (dte >= cd) // { // bool bl = false; // if (model.CFType == "1") // { // bl = true; // } // else if (model.CFType == "2" && dte <= jzdt) // { // bl = true; // } // else if (model.CFType == "3" && dte <= model.CFJZDate.Value ) // { // bl = true; // } // if (bl) // { // if (dte.DayOfWeek == DayOfWeek.Monday // || dte.DayOfWeek == DayOfWeek.Tuesday // || dte.DayOfWeek == DayOfWeek.Wednesday // || dte.DayOfWeek == DayOfWeek.Thursday // || dte.DayOfWeek == DayOfWeek.Friday // ) // { // RLView rv = new RLView(); // rv.id = model.ID; // if (!string.IsNullOrEmpty(model.TXContent)) // { // rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; // rv.title = rv.title + " " + model.Hour + ":" + model.Minute; // } // rv.start = dte.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; // rv.content = model.TXContent; // rv.txfs = txfs(model.Type); // rv.txms = txms(model); // list.Add(rv); // } // } // } //} #endregion #region 每个工作日(连续) DateTime sd1 = new DateTime(); DateTime ed1 = ed; sd1 = sd > cd ? sd : cd; if (model.CFType == "2") { DateTime jzdt = WorkDate(cd, model.CFCount.Value - 1); ed1 = ed < jzdt ? ed : jzdt; } if (model.CFType == "3") { ed1 = ed < model.CFJZDate.Value ? ed : model.CFJZDate.Value; } while (sd1 <= ed1) { int n = -1; switch (sd1.DayOfWeek) { case DayOfWeek.Monday: n = 4; break; case DayOfWeek.Tuesday: n = 3; break; case DayOfWeek.Wednesday: n = 2; break; case DayOfWeek.Thursday: n = 1; break; case DayOfWeek.Friday: n = 0; break; case DayOfWeek.Saturday: sd1 = sd1.AddDays(2); break; case DayOfWeek.Sunday: sd1 = sd1.AddDays(1); break; } if (n != -1) { DateTime ed2 = sd1.AddDays(n); ed2 = ed2 > ed1 ? ed1 : ed2; RLView rv = new RLView(); rv.id = model.ID; if (!string.IsNullOrEmpty(model.TXContent)) { rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; rv.title = rv.title + " " + model.Hour + ":" + model.Minute; } rv.start = sd1.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; rv.end = ed2.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; rv.content = model.TXContent; rv.txfs = txfs(model.Type); rv.txms = txms(model); list.Add(rv); sd1 = ed2.AddDays(3); } } #endregion } break; case "3": //每天 { #region 每天(单一) //for (DateTime dte = sd; dte <= ed; dte = dte.AddDays(1)) //{ // if (dte >= cd) // { // bool bl = false; // if (model.CFType == "1") // { // bl = true; // } // else if (model.CFType == "2" && dte <= cd.AddDays(model.CFCount.Value-1)) // { // bl = true; // } // else if (model.CFType == "3" && dte <= model.CFJZDate.Value) // { // bl = true; // } // if (bl) // { // RLView rv = new RLView(); // rv.id = model.ID; // if (!string.IsNullOrEmpty(model.TXContent)) // { // rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; // rv.title = rv.title + " " + model.Hour + ":" + model.Minute; // } // rv.start = dte.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; // rv.content = model.TXContent; // rv.txfs = txfs(model.Type); // rv.txms = txms(model); // list.Add(rv); // } // } //} #endregion #region 每天(连续) DateTime sd1 = new DateTime(); DateTime ed1 = ed; sd1 = sd > cd ? sd : cd; if (model.CFType == "2") { ed1 = ed < cd.AddDays(model.CFCount.Value - 1) ? ed : cd.AddDays(model.CFCount.Value - 1); } if (model.CFType == "3") { ed1 = ed < model.CFJZDate.Value ? ed : model.CFJZDate.Value; } if (sd1 < ed1) { RLView rv = new RLView(); rv.id = model.ID; if (!string.IsNullOrEmpty(model.TXContent)) { rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; rv.title = rv.title + " " + model.Hour + ":" + model.Minute; } rv.start = sd1.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; rv.end = ed1.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; rv.content = model.TXContent; rv.txfs = txfs(model.Type); rv.txms = txms(model); list.Add(rv); } #endregion } break; case "5": //每月 { #region 每月 DateTime jzdt = new DateTime(); if (model.CFType == "2") { jzdt = MonthDate(cd, "-" + model.Days + " " + model.Hour + ":" + model.Minute + ":00", model.CFCount.Value); } for (DateTime dte = sd; dte <= ed; dte = dte.AddDays(1)) { if (dte >= cd && dte.Day == Int32.Parse(model.Days)) { bool bl = false; if (model.CFType == "1") { bl = true; } else if (model.CFType == "2" && dte <= jzdt) { bl = true; } else if (model.CFType == "3" && dte <= model.CFJZDate.Value) { bl = true; } if (bl) { RLView rv = new RLView(); rv.id = model.ID; if (!string.IsNullOrEmpty(model.TXContent)) { rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; rv.title = rv.title + " " + model.Hour + ":" + model.Minute; } rv.start = dte.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; rv.content = model.TXContent; rv.txfs = txfs(model.Type); rv.txms = txms(model); list.Add(rv); } } } #endregion } break; case "4": //自定义 { #region 自定义 DateTime jzdt = new DateTime(); if (model.CFType == "2") { jzdt = CustomDate(cd, model.Days, model.CFCount.Value); } for (DateTime dte = sd; dte <= ed; dte = dte.AddDays(1)) { if (dte >= cd) { bool bl = false; if (model.CFType == "1") { bl = true; } else if (model.CFType == "2" && dte <= jzdt) { bl = true; } else if (model.CFType == "3" && dte <= model.CFJZDate.Value) { bl = true; } if (bl) { string Days = model.Days; foreach (var d in Days.Split(',')) { if (getWkDays(d) == dte.DayOfWeek) { RLView rv = new RLView(); rv.id = model.ID; if (!string.IsNullOrEmpty(model.TXContent)) { rv.title = model.TXContent.Length > 10 ? model.TXContent.Substring(0, 10) : model.TXContent; rv.title = rv.title + " " + model.Hour + ":" + model.Minute; } rv.start = dte.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"; rv.content = model.TXContent; rv.txfs = txfs(model.Type); rv.txms = txms(model); list.Add(rv); } } } } } #endregion } break; } } msg.Result = list; }
/// <summary> /// 获取提醒事项列表 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETTXSXLIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string userName = UserInfo.User.UserName; string strWhere = " Remark='Manual' and ComId=" + UserInfo.User.ComId; string type = context.Request["lb"] ?? "1"; if (type == "1") { strWhere += string.Format(" And CRUser='******'", userName); } else if (type == "2") { strWhere += string.Format(" And ','+TXUser+',' like '%,{0},%'", userName); } if (P1 == "2") { strWhere += string.Format(" and Status='1' "); } else if (P1 == "1") { strWhere += string.Format(" and Status='0' "); } string strContent = context.Request["Content"] ?? ""; strContent = strContent.TrimEnd(); if (strContent != "") { //strWhere += string.Format(" And ( TXContent like '%{0}%' or TXUser like '%{0}%' )", strContent); strWhere += string.Format(" And ( TXContent like '%{0}%')", strContent); } int DataID = -1; int.TryParse(context.Request["ID"] ?? "-1", out DataID);//记录Id if (DataID != -1) { strWhere += string.Format(" And ID = '{0}'", DataID); } int page = 0; int pagecount = 8; int.TryParse(context.Request["p"] ?? "1", out page); int.TryParse(context.Request["pagecount"] ?? "8", out pagecount);//页数 page = page == 0 ? 1 : page; int total = 0; DataTable dt = new DataTable(); if (P2 == "-1" || P2 == "") { strWhere += " and type in ('0','1','2','3')"; } else { strWhere += " and type ='" + P2 + "'"; } dt = new SZHL_TXSXB().GetDataPager("SZHL_TXSX", "*", pagecount, page, " CRDate desc", strWhere, ref total); dt.Columns.Add("TXMS", Type.GetType("System.Object")); foreach (DataRow dr in dt.Rows) { string html = "", html2 = "", html3 = ""; switch (dr["TXType"].ToString()) { case "0": html2 = "立即发送"; break; case "1": html2 = "仅一次," + dr["Date"] + " " + dr["Hour"] + ":" + dr["Minute"]; break; case "2": html2 = "每个工作日的" + dr["Hour"] + ":" + dr["Minute"]; break; case "3": html2 = "每天的" + dr["Hour"] + ":" + dr["Minute"]; break; case "4": html2 = "每周" + dr["Days"] + "的" + dr["Hour"] + ":" + dr["Minute"]; break; case "5": html2 = "每月" + dr["Days"] + "日的" + dr["Hour"] + ":" + dr["Minute"]; break; } if (!(dr["TXType"].ToString() == "0" || dr["TXType"].ToString() == "1")) { switch (dr["CFType"].ToString()) { case "1": html3 = ",无结束时间"; break; case "2": html3 = "," + dr["CFCount"].ToString() + "次后结束,已经执行" + (string.IsNullOrWhiteSpace(dr["ZXCount"].ToString()) ? "0" : dr["ZXCount"].ToString()) + "次"; break; case "3": html3 = ",结束时间:" + (string.IsNullOrWhiteSpace(dr["CFJZDate"].ToString()) ? "" : dr["CFJZDate"].ToString().Substring(0, 10)); break; } } html = html2 + html3; dr["TXMS"] = html; } msg.Result = dt; msg.Result1 = total; }
public static void AUTOALERT() { lock (islock) { var txLst = new SZHL_TXSXB().GetEntities(p => p.Status == "0"); foreach (var model in txLst) { try { bool canclose = false; //是否结束 bool cansend = false; //是否发送提醒 bool upcount = false; //是否更新次数 switch (model.TXType) { case "0": //立即发送 { cansend = true; canclose = true; upcount = true; } break; case "1": //仅一次 { DateTime sd = DateTime.Parse(model.Date + " " + model.Hour + ":" + model.Minute + ":00"); if (DateTime.Now >= sd) { cansend = true; canclose = true; upcount = true; } } break; case "2": //每个工作日 { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now.DayOfWeek == DayOfWeek.Monday || DateTime.Now.DayOfWeek == DayOfWeek.Tuesday || DateTime.Now.DayOfWeek == DayOfWeek.Wednesday || DateTime.Now.DayOfWeek == DayOfWeek.Thursday || DateTime.Now.DayOfWeek == DayOfWeek.Friday ) && DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))) { upcount = true; } } break; case "3": //每天 { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))) { upcount = true; } } break; case "5": //每月 { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-" + model.Days + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM") != DateTime.Now.ToString("yyyy-MM")))) { upcount = true; } } break; case "4": //自定义 { string Days = model.Days; foreach (var d in Days.Split(',')) { if (getWkDays(d) == DateTime.Now.DayOfWeek) { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))) { upcount = true; } } } } break; } if (upcount) { if (model.CFType == "1") { cansend = true; } else if (model.CFType == "2" && model.CFCount.Value > model.ZXCount) //次数 { cansend = true; if (model.CFCount.Value == model.ZXCount.Value + 1) //到次数,可以结束 { canclose = true; } } else if (model.CFType == "3" && DateTime.Now < model.CFJZDate.Value) { cansend = true; } new SZHL_TXSXB().ExsSql("update SZHL_TXSX set ZXCount=isnull(ZXCount,0)+1,LstSendTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where ID=" + model.ID); } if (cansend) { bool smsg = false; bool swx = false; bool swxapi = false; if (model.Type == "0") //短信和微信 { smsg = true; swx = true; } else if (model.Type == "1") //短信 { smsg = true; } else if (model.Type == "2") //微信 { swx = true; } else if (model.Type == "3") //调接口 { swxapi = true; } if (smsg) //发短信 { foreach (var m in model.TXUser.Split(',')) { object u = new SZHL_TXSXB().ExsSclarSql("select mobphone from JH_Auth_User where UserName='******' and comid='" + model.ComId + "'"); if (u != null) { new SZHL_DXGLB().SendSMS(u.ToString(), model.CRUserRealName + "给您添加了提醒\n" + model.TXContent, model.ComId.Value); } } } if (swx) //发微信 { Article a = new Article(); a.Title = "日程提醒"; a.Description = model.CRUserRealName + "给您添加了提醒\n" + model.TXContent; a.Url = model.ID.ToString(); List <Article> al = new List <Article>(); al.Add(a); JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB().GetUserInfo(model.ComId.Value, model.CRUser); try { new JH_Auth_User_CenterB().SendMsg(UserInfo, model.TXMode, model.TXContent, model.ID.ToString(), model.TXUser, "A", 0, model.ISCS); } catch (Exception) { } WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendTH(al, model.TXMode, model.WXLink, model.TXUser); } if (swxapi) //调接口 { try { Msg_Result Model = new Msg_Result() { Action = model.FunName, ErrorMsg = "" }; // 1.Load(命名空间名称),GetType(命名空间.类名) Type type = Assembly.Load("QJY.API").GetType("QJY.API." + model.APIName + "Manage"); //2.GetMethod(需要调用的方法名称) MethodInfo method = type.GetMethod(model.FunName.ToUpper()); // 3.调用的实例化方法(非静态方法)需要创建类型的一个实例 object obj = Activator.CreateInstance(type); //4.方法需要传入的参数 JObject JsonData = new JObject(); object[] parameters = new object[] { JsonData, Model, JsonConvert.SerializeObject(model), "", null }; method.Invoke(obj, parameters); //TEST } catch (Exception ex) { canclose = true; new JH_Auth_LogB().Insert(new JH_Auth_Log() { LogType = "TXSX", LogContent = ex.ToString(), CRDate = DateTime.Now }); } } } if (canclose) { new SZHL_TXSXB().ExsSql("update SZHL_TXSX set Status='1' where ID=" + model.ID); } } catch (Exception ex) { string ss = ex.Message; } } } }
public static void AUTOALERT() { lock (islock) { var txLst = new SZHL_TXSXB().GetEntities(p => p.Status == "0"); foreach (var model in txLst) { try { bool canclose = false; //是否结束 bool cansend = false; //是否发送提醒 bool upcount = false; //是否更新次数 switch (model.TXType) { case "0": //立即发送 { cansend = true; canclose = true; upcount = true; } break; case "1": //仅一次 { DateTime sd = DateTime.Parse(model.Date + " " + model.Hour + ":" + model.Minute + ":00"); if (DateTime.Now >= sd) { cansend = true; canclose = true; upcount = true; } } break; case "2": //每个工作日 { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now.DayOfWeek == DayOfWeek.Monday || DateTime.Now.DayOfWeek == DayOfWeek.Tuesday || DateTime.Now.DayOfWeek == DayOfWeek.Wednesday || DateTime.Now.DayOfWeek == DayOfWeek.Thursday || DateTime.Now.DayOfWeek == DayOfWeek.Friday ) && DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))) { upcount = true; } } break; case "3": //每天 { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))) { upcount = true; } } break; case "5": //每月 { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-" + model.Days + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM") != DateTime.Now.ToString("yyyy-MM")))) { upcount = true; } } break; case "4": //自定义 { string Days = model.Days; foreach (var d in Days.Split(',')) { if (getWkDays(d) == DateTime.Now.DayOfWeek) { DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00"); if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))) { upcount = true; } } } } break; } if (upcount) { if (model.CFType == "1") { cansend = true; } else if (model.CFType == "2" && model.CFCount.Value > model.ZXCount) //次数 { cansend = true; if (model.CFCount.Value == model.ZXCount.Value + 1) //到次数,可以结束 { canclose = true; } } else if (model.CFType == "3" && DateTime.Now < model.CFJZDate.Value) { cansend = true; } new SZHL_TXSXB().ExsSql("update SZHL_TXSX set ZXCount=isnull(ZXCount,0)+1,LstSendTime=getdate() where ID=" + model.ID); } if (cansend) { bool smsg = false; bool swx = false; bool swxapi = false; if (model.Type == "0") //短信和微信 { smsg = true; swx = true; } else if (model.Type == "1") //短信 { smsg = true; } else if (model.Type == "2") //微信 { swx = true; } else if (model.Type == "3") //调接口 { swxapi = true; } if (smsg) //发短信 { foreach (var m in model.TXUser.Split(',')) { object u = new SZHL_TXSXB().ExsSclarSql("select mobphone from JH_Auth_User where UserName='******' and comid='" + model.ComId + "'"); if (u != null) { CommonHelp.SendSMS(u.ToString(), model.CRUserRealName + "给您添加了提醒\n" + model.TXContent, model.ComId.Value); } } } if (swx) //发微信 { Senparc.Weixin.QY.Entities.Article a = new Senparc.Weixin.QY.Entities.Article(); a.Title = "日程提醒"; a.Description = model.CRUserRealName + "给您添加了提醒\n" + model.TXContent; a.Url = model.ID.ToString(); List <Senparc.Weixin.QY.Entities.Article> al = new List <Senparc.Weixin.QY.Entities.Article>(); al.Add(a); JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB().GetUserInfo(model.ComId.Value, model.CRUser); try { new JH_Auth_User_CenterB().SendMsg(UserInfo, model.TXMode, model.TXContent, model.ID.ToString(), model.TXUser, "A", 0, model.ISCS); } catch (Exception) { } WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendTH(al, model.TXMode, model.WXLink, model.TXUser); } if (swxapi) //调接口 { try { Msg_Result Model = new Msg_Result() { Action = model.FunName, ErrorMsg = "" }; var container = ServiceContainerV.Current().Resolve <IWsService>(model.APIName.ToUpper()); container.ProcessRequest(HttpContext.Current, ref Model, JsonConvert.SerializeObject(model), "", null); if (Model.ErrorMsg == "") { canclose = true; } else { canclose = true; upcount = true; } } catch (Exception ex) { canclose = true; new JH_Auth_LogB().Insert(new JH_Auth_Log() { LogType = "TXSX", LogContent = ex.ToString(), CRDate = DateTime.Now }); } } } if (canclose) { new SZHL_TXSXB().ExsSql("update SZHL_TXSX set Status='1' where ID=" + model.ID); } } catch (Exception ex) { string ss = ex.Message; } } } }