업무일지 메일서비스 .. 이메일 주소가 없는 사람 메일 발송하게 함

This commit is contained in:
chi
2022-05-24 08:50:23 +09:00
parent 7dce07e4a5
commit 7055b18b0b
2 changed files with 47 additions and 6 deletions

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("22.05.21.2240")]
[assembly: AssemblyFileVersion("22.05.21.2240")]
[assembly: AssemblyVersion("22.05.24.0850")]
[assembly: AssemblyFileVersion("22.05.24.0850")]

View File

@@ -137,15 +137,19 @@ namespace JobReportMailService
var dtMailData = new DataSet1.MailDataDataTable();
var dtDateList = new DataSet1.JobReportDateListDataTable();
taMailForm.Fill(dtMailForm);
var gcodelist = dtMailForm.GroupBy(t => t.gcode).Select(t => t.Key).ToList();
gcodelist = new List<string>();
//gcodelist.Add("EETK5");
var gcodelist = dtMailForm.GroupBy(t => t.gcode).ToList();
foreach (var gcodedata in gcodelist)
{
//메일양식이 지정되어있는지 체크
var vGcode = gcodedata.Key;
var vGcode = gcodedata;
if (string.IsNullOrEmpty(vGcode)) continue;
//if (vGcode.Contains("K5") == false) continue;
@@ -169,6 +173,8 @@ namespace JobReportMailService
continue;
}
List<string> NoMailList = new List<string>();
NoMailList.Add($"그룹\t사번\t성명\t경고일");
//대상 사용자 목록을 추출한다;
var users = taJobReportUserList.GetData(vGcode);
@@ -265,6 +271,7 @@ namespace JobReportMailService
}
else if (string.IsNullOrEmpty(userinfo.email))
{
NoMailList.Add($"{vGcode}\t{uid.Key}\t{uid.Value}\t{WarnList.Count}");
addmsg($"[{vGcode}] {uid.Value}({uid.Key}) 의 메일 정보가 존재하지 않습니다");
}
else
@@ -361,16 +368,48 @@ namespace JobReportMailService
}
//첫줄은 제목이므로 2줄이상 있어야 한다
if (NoMailList.Count > 1)
{
using (var dt = new DataSet1.MailDataDataTable())
{
var newdr = dt.NewMailDataRow();
newdr.gcode = "EET1P";
newdr.cate = "ERR";
newdr.subject = $"[GW] {vGcode} - 업무일지 담당자 이메일 경고";
newdr.fromlist = "chikyun.kim@amkor.co.kr";
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.body = string.Join("<br/>", NoMailList.ToList());
newdr.wuid = "dev";
newdr.wdate = DateTime.Now;
newdr.EndEdit();
dt.AddMailDataRow(newdr);
var cnt = taMailData.Update(dt);
if (cnt == 1)
{
addmsg($"업무일지 메일없는 대상자 생성 완료(day)");
System.Threading.Thread.Sleep(10000);
}
}
}
System.Threading.Thread.Sleep(500);
}
dtMailForm.Dispose();
dtMailData.Dispose();
dtDateList.Dispose();
taMailForm.Dispose();// = new DataSet1TableAdapters.MailFormTableAdapter();
taMailData.Dispose();// = new DataSet1TableAdapters.MailDataTableAdapter();
taJobReportUserList.Dispose();// = new DataSet1TableAdapters.vJobReportUserListTableAdapter();
@@ -378,6 +417,8 @@ namespace JobReportMailService
taHolidayList.Dispose();// = new DataSet1TableAdapters.HolidayLIstTableAdapter();
taGroupUser.Dispose();// = new DataSet1TableAdapters.vGroupUserTableAdapter();
taJobReportDateList.Dispose();
}
private void toolStripButton1_Click(object sender, EventArgs e)