chore: 首次簽入 Thinkyu ASP.NET 專案

- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
2026-09-10 09:42:37 +08:00
commit 577060bc78
2496 changed files with 501389 additions and 0 deletions
+136
View File
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Timers;
using System.Net.Mail;
using System.Data;
using Wellan.Data;
using System.Text;
using System.IO;
/// <summary>
/// 定時發送郵件
///
/// 1. 代理人代理前一天發送郵件通知
/// </summary>
public class MailTask
{
private Timer timer1;
private static MailTask instance = null;
private MailTask()
{
timer1 = new Timer();
timer1.Interval = 1000;
timer1.AutoReset = true;
timer1.Elapsed += Timer1_Elapsed;
}
private void Timer1_Elapsed(object sender, ElapsedEventArgs e)
{
var nowTime = DateTime.UtcNow.AddHours(8).ToString("HHmmss");
// 每日定時工作
if (nowTime == "000000")
{
();
}
// 每小時定時工作
if (nowTime.EndsWith("0000"))
{
}
// 每分鐘定時工作
if (nowTime.EndsWith("00"))
{
}
}
private static void EnsureInstance()
{
if (instance == null)
instance = new MailTask();
}
public static bool Enabled
{
get
{
EnsureInstance();
return instance.timer1.Enabled;
}
set
{
EnsureInstance();
instance.timer1.Enabled = value;
}
}
private void ()
{
RparDAC dao = new RparDAC();
var notofyList = dao.(DateTime.UtcNow.AddHours(8).Date.AddDays(1));
// RPPYN 年度接單編號
// RPREN 單號
// RPNUM 差假員工編號
// BPNME 差假員工姓名
// BPEML 差假員工電郵
// RPTYP 差假類別代碼
// BSSCR 差假類別名稱
// RPAGT 代理人姓名
// RPAGM 代理人電郵
// RPRDT 差假開始日期
// RPRTM 差假開始時間
// RPEDT 差假結束日期
// RPETM 差假結束時間
foreach (DataRow r in notofyList.Rows)
{
var = WDAC.GetStringValue(r["RPREN"]);
var = WDAC.GetStringValue(r["RPTYP"]);
switch (.Substring(0, 1))
{
// 請假
case RPAR_TYPE.T0_請假:
= "請假";
break;
// 差旅
case RPAR_TYPE.T3_出差:
= "差旅";
break;
default:
return;
}
MailMessage mm = new MailMessage();
mm.Subject = String.Format("{1}代理提醒 [單號:{0}]", , );
mm.To.Add(new MailAddress(WDAC.GetStringValue(r["RPAGM"])));
mm.BodyEncoding = Encoding.UTF8;
mm.IsBodyHtml = true;
mm.Body = File.ReadAllText(HttpContext.Current.Server.MapPath("~/Template/代理人提醒.html"))
.Replace("{類別}", )
.Replace("{單號}", )
.Replace("{差勤人}", WDAC.GetStringValue(r["BPNME"]))
.Replace("{事由}", == "請假" ? WDAC.GetStringValue(r["RPRSN"]) : WDAC.GetStringValue(r["RPDOC"]))
.Replace("{起日}", String.Format("{0:yyyy-MM-dd}", r["RPRDT"]))
.Replace("{起時}", String.Format("{0}", r["RPRTM"]))
.Replace("{迄日}", String.Format("{0:yyyy-MM-dd}", r["RPEDT"]))
.Replace("{迄時}", String.Format("{0}", r["RPETM"]))
;
// 發送郵件
try
{
Wellan.Service.WMailSender.GetInstance().Send(mm, string.Format("代理提醒 單號:{0}", ));
}
catch
{ }
}
}
}