업무일지 테이블 연결 -

프로젝트 주간업무내용 편집창 연결 작업
This commit is contained in:
chikyun.kim
2019-03-11 23:18:47 +09:00
parent 9853bed403
commit 417e02a171
26 changed files with 2261 additions and 1922 deletions

View File

@@ -27,7 +27,7 @@ namespace FPJ0000
dsPRJTableAdapters.ProjectsTableAdapter taproj = new dsPRJTableAdapters.ProjectsTableAdapter();
dsPRJTableAdapters.ProjectsMailListTableAdapter tamail = new dsPRJTableAdapters.ProjectsMailListTableAdapter();
dsMailTableAdapters.MailFormTableAdapter taform = new dsMailTableAdapters.MailFormTableAdapter();
dsPRJTableAdapters.ProjectsHistoryTableAdapter taHist = new dsPRJTableAdapters.ProjectsHistoryTableAdapter();
// dsPRJTableAdapters.ProjectsHistoryTableAdapter taHist = new dsPRJTableAdapters.ProjectsHistoryTableAdapter();
var mailformDt = taform.GetData("PM");
dsMail.MailFormRow drForm = null;
@@ -42,17 +42,25 @@ namespace FPJ0000
string updateHistory = "<ul>";
var dtHIst = taHist.GetbySendMail(pidx);
int histCnt = 0;
if (dtHIst != null)
{
foreach (dsPRJ.ProjectsHistoryRow drhist in dtHIst.Rows)
{
if (drhist.remark.Trim() == "") continue;
updateHistory += "<li>drhist.remark</li>";
histCnt += 1;
updateHistory += "<li>["+drhist.pdate + "] " + drhist.remark + "</li>";
}
}
updateHistory += "</ul>";
if(histCnt < 1)
{
FCOMMON.Util.MsgE("프로젝트:" + pidx.ToString() + "의 변경사항이 존재하지 않습니다.");
continue;
}
var newdr = this.dsMail.MailData.NewMailDataRow();
newdr.project = pidx;
newdr.wuid = FCOMMON.info.Login.no;
newdr.wdate = DateTime.Now;
newdr.cate = "PM";
@@ -265,12 +273,31 @@ namespace FPJ0000
this.Validate();
this.bs.EndEdit();
//아웃룩에서 데이터를 표시한다.
var drv = this.bs.Current as DataRowView;
if (drv == null) return;
var dr = drv.Row as dsMail.MailDataRow;
//이 데이터로 발송된 메일이 있는지 체크한다.
dsMailTableAdapters.MailDataTableAdapter taMailData = new dsMailTableAdapters.MailDataTableAdapter();
var dtPreData = taMailData.GetbyProject(dr.project);
if (dtPreData != null && dtPreData.Rows.Count > 0)
{
var predataOne = dtPreData.Rows[0] as dsMail.MailDataRow;
var dlgexist = FCOMMON.Util.MsgQ("해당 프로젝트는 " + predataOne.pdate + "에 메일이 발송된 기록이 있습니다.\n\n" +
"Prject:" + predataOne.subject + "\n\n" +
"To:" + predataOne.tolist + "\n" +
"CC:" + predataOne.cc + "\n\n" +
"그래도 메일을 보내시겠습니까?");
if (dlgexist != System.Windows.Forms.DialogResult.Yes) return;
}
var dlg = FCOMMON.Util.MsgQ("프로젝트의 알림 메일을 전송 하시겠습니까?\n\n" +
dr.subject + "\n\n" +
"To:" + dr.tolist + "\n" +
"CC:" + dr.cc + "\n" +
"BCC:" + dr.bcc);
if (dlg != System.Windows.Forms.DialogResult.Yes) return;
Outlook.Application outlookApplication = new Outlook.Application();
@@ -281,11 +308,19 @@ namespace FPJ0000
newMail.CC = dr.cc;// tbCC.Text.Trim();
newMail.BCC = dr.bcc; // tbBCC.Text.Trim();
// newMail.BodyFormat = OlBodyFormat.olFormatHTML;
newMail.HTMLBody = dr.body; //
newMail.HTMLBody = dr.body + newMail.HTMLBody; //
newMail.Send();
FCOMMON.Util.MsgI("메일이 전송되었습니다.\n\n전송된 메일은 아웃룩의 보낸편지함 혹은 그룹웨어의 보낸편지함에서 확인할 수 있습니다.");
try
{
this.taHist.UpdateMailSend(dr.project);
}
catch (Exception ex)
{
FCOMMON.Util.MsgE("MailSend Update Error\n\n" + ex.Message);
}
try
{
this.ta.Update(dr);
@@ -293,7 +328,7 @@ namespace FPJ0000
}
catch (Exception ex)
{
FCOMMON.Util.MsgE("전송 오류\n\n" + ex.Message);
FCOMMON.Util.MsgE("전송 결과 저장 오류\n\n" + ex.Message);
}
}
@@ -304,7 +339,7 @@ namespace FPJ0000
private void toolStripButton3_Click(object sender, EventArgs e)
{
string msg = bs.Count.ToString() + "건의 메일을 일괄 전송 하시겠습니까?\n" +
string msg = bs.Count.ToString() + "건의 메일을 일괄 전송 하시겠습니까?\n\n" +
"전송은 아웃룩을 통해서 진행되므로 아웃룩이 보낼수 있는 상태인지 확인하시기 바랍니다";
var dlg = FCOMMON.Util.MsgQ(msg);
if (dlg != System.Windows.Forms.DialogResult.Yes) return;
@@ -324,27 +359,53 @@ namespace FPJ0000
FCOMMON.Util.MsgE("받을 주소가 없어서 진행하지 않습니다\n" + dr.subject);
continue;
}
//이 데이터로 발송된 메일이 있는지 체크한다.
dsMailTableAdapters.MailDataTableAdapter taMailData = new dsMailTableAdapters.MailDataTableAdapter();
var dtPreData = taMailData.GetbyProject(dr.project);
if (dtPreData != null && dtPreData.Rows.Count > 0)
{
var predataOne = dtPreData.Rows[0] as dsMail.MailDataRow;
var dlgexist = FCOMMON.Util.MsgQ("해당 프로젝트는 " + predataOne.pdate + "에 메일이 발송된 기록이 있습니다.\n\n" +
"Prject:" + predataOne.subject + "\n\n" +
"To:" + predataOne.tolist + "\n" +
"CC:" + predataOne.cc + "\n\n" +
"그래도 메일을 보내시겠습니까?");
if (dlgexist != System.Windows.Forms.DialogResult.Yes) continue;
}
var newMail = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
newMail.Display();
newMail.Subject = dr.subject;
newMail.To = dr.tolist;// to;
newMail.CC = dr.cc;// tbCC.Text.Trim();
newMail.BCC = dr.bcc;// tbBCC.Text.Trim();
// newMail.BodyFormat = OlBodyFormat.olFormatHTML;
newMail.HTMLBody = dr.body + newMail.HTMLBody; //
newMail.Send();
cntSend += 1;
try
{
this.taHist.UpdateMailSend(dr.project);
}
catch (Exception ex)
{
FCOMMON.Util.MsgE("MailSend Update Error\n\n" + ex.Message);
}
try
{
var newMail = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
newMail.Display();
newMail.Subject = dr.subject;
newMail.To = dr.tolist;// to;
newMail.CC = dr.cc;// tbCC.Text.Trim();
newMail.BCC = dr.bcc;// tbBCC.Text.Trim();
// newMail.BodyFormat = OlBodyFormat.olFormatHTML;
newMail.HTMLBody = dr.body; //
newMail.Send();
cntSend += 1;
dr.EndEdit();
ta.Update(dr);
dr.AcceptChanges();
}
catch (Exception ex)
{
FCOMMON.Util.MsgE("메일 전송 오류\n\n"+ex.Message);
FCOMMON.Util.MsgE("메일 전송 오류\n\n" + ex.Message);
}
}
FCOMMON.Util.MsgI(cntSend.ToString() + " 건의 메일이 전송되었습니다.\n\n전송된 메일은 아웃룩의 보낸편지함 혹은 그룹웨어의 보낸편지함에서 확인할 수 있습니다.");
@@ -369,9 +430,9 @@ namespace FPJ0000
newMail.CC = dr.cc;// tbCC.Text.Trim();
newMail.BCC = dr.bcc; // tbBCC.Text.Trim();
// newMail.BodyFormat = OlBodyFormat.olFormatHTML;
newMail.HTMLBody = dr.body; //
newMail.HTMLBody = dr.body + newMail.HTMLBody; //
}
catch(Exception ex)
catch (Exception ex)
{
util.MsgE("전송실패\n\n" + ex.Message + "\n\n" +
"아웃룩의 설정이 정상인지 확인하세요");