You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.7 KiB
78 lines
2.7 KiB
using FangYar.Common;
|
|
using FangYar.Model.OA;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.Web;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// 定时发送提醒信息
|
|
/// </summary>
|
|
public class TaskRemindInfoHandler : IHttpHandler
|
|
{
|
|
int dateDiffer =Convert.ToInt32(ConfigurationManager.AppSettings["DateDiffer"]);
|
|
BLL.OA.OA_TASKREMINDINFO taskRemindInfo = new BLL.OA.OA_TASKREMINDINFO();
|
|
BLL.OA.OA_REMINDMESSAGE remindMsg = new BLL.OA.OA_REMINDMESSAGE();
|
|
|
|
RemindMessageHandler remindMsgHangler = new RemindMessageHandler();
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
context.Response.ContentType = "text/plain";
|
|
var action = context.Request.Params["Action"];
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 轮询任务记录表,发送信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string RollingTaskRemindInfo()
|
|
{
|
|
string startTime = DateTime.Now.ToString();
|
|
string endTime = DateTime.Now.AddMinutes(10).ToString();
|
|
string where = " STATE=0 and LASTREMINDTIME >= date_format('" + startTime + "','%Y-%m-%d %H:%i:%s') and LASTREMINDTIME <= date_format('" + endTime + "','%Y-%m-%d %H:%i:%s')";
|
|
var list = taskRemindInfo.GetModelList(where);
|
|
OA_REMINDMESSAGE entityRemindMsg;
|
|
if (list.Count > 0)
|
|
{
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (TimeFormatter.DateDiffHours(DateTime.Now, list[i].LASTREMINDTIME) > dateDiffer)
|
|
{
|
|
entityRemindMsg = new OA_REMINDMESSAGE();
|
|
entityRemindMsg.CATEGORY = list[i].TASKCATEGORY;
|
|
entityRemindMsg.CONTENT = "";
|
|
entityRemindMsg.CREATEDATE =Convert.ToDateTime(DateTime.Now.ToString("G"));
|
|
entityRemindMsg.ISDELETE = "0";
|
|
entityRemindMsg.MSGTYPE = "";
|
|
entityRemindMsg.PHONE = "";
|
|
entityRemindMsg.RECEIVER = "";
|
|
entityRemindMsg.SENDTIME= Convert.ToDateTime(DateTime.Now.ToString("G"));
|
|
entityRemindMsg.STATE = "0";
|
|
//remindMsg.Add(entityRemindMsg);
|
|
remindMsgHangler.WriteRemindMsg(entityRemindMsg);
|
|
remindMsgHangler.SendShortMsg();
|
|
}
|
|
}
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|