전자실메일양식 통일 및 정리 작업

This commit is contained in:
chi
2024-01-09 14:04:01 +09:00
parent aca27c5484
commit aef0c375ad
134 changed files with 4651 additions and 2343 deletions

View File

@@ -6,14 +6,8 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using util = FCOMMON.Util;
using NetOffice;
using Outlook = NetOffice.OutlookApi;
using NetOffice.OutlookApi.Enums;
using FEQ0000.Purchase;
using FCOMMON;
using NetOffice.OfficeApi;
using System.Web.Services.Protocols;
using System.Diagnostics;
using FarPoint.Win.Spread.CellType;
@@ -34,7 +28,7 @@ namespace FEQ0000
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
Properties.Settings.Default["EEEntities"] = FCOMMON.info.CS;
fn_fpcolsize = util.MakeFilePath(util.CurrentPath, "formSetting", "fp_" + this.Name + ".ini");
fn_fpcolsize = FCOMMON.Util.MakeFilePath(FCOMMON.Util.CurrentPath, "formSetting", "fp_" + this.Name + ".ini");
this.FormClosing += FPurchase_FormClosing;
this.FormClosed += __Closed;
@@ -65,7 +59,7 @@ namespace FEQ0000
else
{
string dt = string.Empty;
if (!util.MakeDateString(input, out dt))
if (!FCOMMON.Util.MakeDateString(input, out dt))
{
FCOMMON.Util.MsgE("입력값이 올바르지 않습니다.");
tb.SelectAll();
@@ -386,7 +380,7 @@ namespace FEQ0000
dr.AcceptChanges();
}
dlg = util.MsgQ("메일 전송을 할까요?");
dlg = FCOMMON.Util.MsgQ("메일 전송을 할까요?");
if (dlg != DialogResult.Yes) return;
@@ -436,89 +430,37 @@ namespace FEQ0000
try
{
Outlook.Application outlookApplication = new Outlook.Application();
var newMail = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
NetOffice.OutlookApi.Application outlookApplication = new NetOffice.OutlookApi.Application();
var newMail = outlookApplication.CreateItem(NetOffice.OutlookApi.Enums.OlItemType.olMailItem) as NetOffice.OutlookApi.MailItem;
newMail.Display();
newMail.Subject = form_subject; // this.tbSubject.Text.Trim(); // dr.title;
newMail.To = string.Join(";", tolist.ToArray());
newMail.CC = string.Join(";", cclist.ToArray());
newMail.BCC = string.Join(";", bcclist.ToArray());
string fn = "";
if (f.chkAttach.Checked)
{
var fi = new System.IO.FileInfo(FCOMMON.Util.CurrentPath + "\\Export\\Purchase_confirmeb_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xls");
if (fi.Directory.Exists == false) fi.Directory.Create();
FCOMMON.Util.savetoexcel(this.dataGridView1, fi.FullName);
fn = fi.FullName;
//FCOMMON.Util.savetoexcel(this.dataGridView1, fi.FullName);
newMail.Attachments.Add(fi.FullName);
//newMail.Attachments.Add(fi.FullName);
}
if (f.chkList.Checked)
{
var rows = this.rows;
var tabledata = UTIL_EQ0000.MakeDataTableToHTML(rows, fn);
//목록을 본문에 추가한다
System.Text.StringBuilder sb = new StringBuilder();
sb.AppendLine("<table border='1' cellspacing='0' cellpadding='1'>");
sb.AppendLine("<thead>");
foreach (DataGridViewColumn col in this.dataGridView1.Columns)
{
if (col.DataPropertyName.ToLower() == "pumqty") continue;
sb.AppendLine($"<td style='text-align:center;background-color: aqua;'>{col.HeaderText}</td>");
}
sb.AppendLine("</thead>");
sb.AppendLine("<tbody>");
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
sb.AppendLine("<tr>");
foreach (DataGridViewColumn col in this.dataGridView1.Columns)
{
if (col.DataPropertyName.ToLower() == "pumqty") continue;
var v = dataGridView1.Rows[i].Cells[col.Index].Value;
string value = "";
if (v != null) value = v.ToString();
if (col.ValueType == typeof(int))
{
var ivalue = (int)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N0}</td>");
}
else if (col.ValueType == typeof(decimal))
{
var ivalue = (decimal)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N0}</td>");
}
else if (col.ValueType == typeof(float))
{
var ivalue = (float)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N1}</td>");
}
else if (col.ValueType == typeof(double))
{
var ivalue = (double)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N1}</td>");
}
else sb.AppendLine($"<td>{getmaxstr(value)}</td>");
}
sb.AppendLine("</tr>");
}
sb.AppendLine("</tbody>");
sb.AppendLine("</table>");
sb.AppendLine($"항목:{this.bs.Count}건,합계금액:{lbSum.Text}");
form_body = form_body.Replace("{body}", sb.ToString());
}
//newMail.BodyFormat = OlBodyFormat.olFormatHTML;
if (fn.isEmpty() == false)
newMail.Attachments.Add(fn);
form_body = form_body.Replace("{body}", tabledata);
newMail.HTMLBody = form_body + newMail.HTMLBody; //
}
catch (Exception ex)
{
util.MsgE("전송실패\n\n" + ex.Message + "\n\n" +
FCOMMON.Util.MsgE("전송실패\n\n" + ex.Message + "\n\n" +
"아웃룩의 설정이 정상인지 확인하세요");
}
}
@@ -527,7 +469,7 @@ namespace FEQ0000
{
var drv = this.bs.Current as dsPurchase.EETGW_PurchaseEBRow;
if (drv == null) return;
var dlg = util.MsgQ("선택된 줄을 제거 할까요?");
var dlg = FCOMMON.Util.MsgQ("선택된 줄을 제거 할까요?");
if (dlg != DialogResult.Yes) return;
this.rows.Remove(drv);
if (rows.Any())