This commit is contained in:
chi
2025-04-18 09:26:39 +09:00
parent 66ef51f814
commit 930e09400d
15 changed files with 282 additions and 206 deletions

View File

@@ -10,6 +10,7 @@ using YARTE.UI.Buttons;
using NetOffice;
using Outlook = NetOffice.OutlookApi;
using NetOffice.OutlookApi.Enums;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
namespace FCM0000
{
@@ -21,19 +22,24 @@ namespace FCM0000
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
PredefinedButtonSets.SetupDefaultButtons(this.tbBody);
this.dsMSSQL.MailData.TableNewRow += MailForm_TableNewRow;
}
void MailForm_TableNewRow(object sender, DataTableNewRowEventArgs e)
{
e.Row["gcode"] = FCOMMON.info.Login.gcode;
e.Row["wuid"] = FCOMMON.info.Login.no;
e.Row["wdate"] = DateTime.Now;
e.Row["cate"] = "NR";
e.Row["pdate"] = DateTime.Now.ToShortDateString();
e.Row["fromlist"] = "gw@amkor.co.kr";
}
private void fMailform_Load(object sender, EventArgs e)
{
EnsureVisibleAndUsableSize();
this.bs.AddNew();
this.bs.AddNew(); //신규메일데이터생성
LoadNRData();
}
@@ -49,8 +55,8 @@ namespace FCM0000
this.tbSubject.Text = drForm.subject;
this.tbBody.Html = drForm.body;
this.tbTo.Text = drForm.tolist;
this.tbBCC.Text = drForm.bcc;
this.tbCC.Text = drForm.cc;
//this.tbBCC.Text = drForm.bcc;
//this.tbCC.Text = drForm.cc;
}
}
@@ -58,10 +64,16 @@ namespace FCM0000
{
this.Validate();
var drv = this.bs.Current as DataRowView;
drv["subject"] = this.tbSubject.Text;
drv["body"] = this.tbBody.Html;
drv.EndEdit();
this.bs.EndEdit();
this.tam.UpdateAll(this.dsMSSQL);
var cnt = this.tam.UpdateAll(this.dsMSSQL);
MessageBox.Show($"{cnt}");
this.bs.AddNew();
tbTo.Text = FCOMMON.info.Login.email;
}
private void toolStripButton1_Click_1(object sender, EventArgs e)
@@ -95,5 +107,39 @@ namespace FCM0000
}
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
//direct send
var list_from = "gw@amkor.co.kr";
var list_to = tbTo.Text;
var subject = tbSubject.Text;
var body = tbBody.Html;
var list_bcc = tbBCC.Text;
var list_cc = tbCC.Text;
//전송을 해야 함
var mc = new System.Net.Mail.SmtpClient(FCOMMON.info.mailserver);
var msg = new System.Net.Mail.MailMessage
(list_from,
list_to,
subject,
body);
if (list_bcc != "") msg.Bcc.Add(list_bcc);
if (list_cc != "") msg.CC.Add(list_cc);
msg.IsBodyHtml = true;
try
{
mc.Send(msg);
MessageBox.Show("ok");
}
catch (Exception eX)
{
MessageBox.Show(eX.Message);
}
}
}
}