using System;
using System.Data;
using BP.DA;
using BP.En;
namespace BP.WF.DTS
{
///
/// 向预期的工作人员发送提醒消息 的摘要说明
///
public class DTS_SendMsgToWarningWorker : Method
{
///
/// 向预期的工作人员发送提醒消息
///
public DTS_SendMsgToWarningWorker()
{
this.Title = "向预期的工作人员发送提醒消息";
this.Help = "该方法每天的8点自动执行";
}
///
/// 设置执行变量
///
///
public override void Init()
{
//this.Warning = "您确定要执行吗?";
//HisAttrs.AddTBString("P1", null, "原密码", true, false, 0, 10, 10);
//HisAttrs.AddTBString("P2", null, "新密码", true, false, 0, 10, 10);
//HisAttrs.AddTBString("P3", null, "确认", true, false, 0, 10, 10);
}
///
/// 当前的操纵员是否可以执行这个方法
///
public override bool IsCanDo
{
get
{
if (BP.Web.WebUser.IsAdmin == true)
return true;
return false;
}
}
///
/// 执行
///
/// 返回执行结果
public override object Do()
{
/*查找一天预警1次的消息记录,并执行推送。*/
string sql = "SELECT A.WorkID, A.Title, A.FlowName, A.TodoSta, B.FK_Emp, b.EmpName, C.WAlertWay FROM WF_GenerWorkFlow A, WF_GenerWorkerlist B, WF_Node C ";
sql += " WHERE A.WorkID=B.WorkID AND A.FK_Node=C.NodeID AND a.TodoSta=1 AND ( C.WAlertRole=1 OR C.WAlertRole=2 ) ";
DataTable dt = DBAccess.RunSQLReturnTable(sql);
foreach (DataRow dr in dt.Rows)
{
CHAlertWay way = (CHAlertWay)int.Parse(dr["WAlertWay"].ToString()); //提醒方式.
Int64 workid = Int64.Parse(dr["WorkID"].ToString());
string title = dr["Title"].ToString();
string flowName = dr["FlowName"].ToString();
string empNo = dr["FK_Emp"].ToString();
string empName = dr["EmpName"].ToString();
BP.WF.Port.WFEmp emp = new BP.WF.Port.WFEmp(empNo);
if (way == CHAlertWay.ByEmail)
{
string titleMail = "";
string docMail = "";
// BP.WF.Dev2Interface.Port_SendEmail(emp.Email, titleMail, "");
}
if (way == CHAlertWay.BySMS)
{
string titleMail = "";
string docMail = "";
//BP.WF.Dev2Interface.Port_SendMsg(emp.Email, titleMail, "");
}
}
return "执行成功...";
}
}
}