using BP.DA;
using BP.En;
namespace BP.WF.DTS
{
///
/// 升级ccflow6 要执行的调度
///
public class UpdatePort_EmpSigantureSta : Method
{
///
/// 不带有参数的方法
///
public UpdatePort_EmpSigantureSta()
{
this.Title = "同步用户签名状态(如果是在/DataUser/Siganture 有图片签名,就设置当前人员为图片签名状态.)";
this.Help = "执行更新Port_Emp数据表的SignType字段.";
}
///
/// 设置执行变量
///
///
public override void Init()
{
}
///
/// 当前的操纵员是否可以执行这个方法
///
public override bool IsCanDo
{
get
{
if (BP.Web.WebUser.No.Equals("admin")==true)
return true;
else
return false;
}
}
///
/// 执行
///
/// 返回执行结果
public override object Do()
{
string path = BP.Difference.SystemConfig.PathOfDataUser + "Siganture";
string[] files = System.IO.Directory.GetFiles(path);
//清空设置为图片签名的记录.
string sql = "UPDATE Port_Emp SET SignType=0 WHERE SignType=1";
DBAccess.RunSQL(sql);
//遍历文件名.
foreach (string file in files)
{
string userName = file.Substring(file.LastIndexOf('\\') + 1);
userName = userName.Substring(0, userName.LastIndexOf('.'));
sql = "UPDATE Port_Emp SET SignType=1 WHERE No='" + userName + "'";
DBAccess.RunSQL(sql);
}
return "执行完成,[" + files.Length + "]笔数据.";
}
}
}