업무일지 등록시 메일 알림 기능 추가

This commit is contained in:
chi
2023-04-11 12:06:04 +09:00
parent b6f5351878
commit 90db05a366
22 changed files with 551 additions and 348 deletions

View File

@@ -68,6 +68,7 @@
this.tbProject = new System.Windows.Forms.ComboBox();
this.richTextBoxEx1 = new RichTextBoxEx.RichTextBoxEx();
this.panel1 = new System.Windows.Forms.Panel();
this.tbProjectIndex = new System.Windows.Forms.Button();
this.grpkisul = new System.Windows.Forms.GroupBox();
this.cmb_kisuldiv = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
@@ -78,7 +79,8 @@
this.tbTag = new System.Windows.Forms.TextBox();
this.ta = new FPJ0000.dsPRJTableAdapters.JobReportTableAdapter();
this.tam = new FPJ0000.dsPRJTableAdapters.TableAdapterManager();
this.tbProjectIndex = new System.Windows.Forms.Button();
this.chkManagerAlert = new System.Windows.Forms.CheckBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
hrsLabel = new System.Windows.Forms.Label();
typeLabel = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
@@ -273,7 +275,7 @@
this.lbotReason});
this.statusStrip1.Location = new System.Drawing.Point(0, 675);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(969, 22);
this.statusStrip1.Size = new System.Drawing.Size(984, 22);
this.statusStrip1.TabIndex = 28;
this.statusStrip1.Text = "statusStrip1";
//
@@ -416,7 +418,7 @@
// chkAutoAdd
//
this.chkAutoAdd.AutoSize = true;
this.chkAutoAdd.Location = new System.Drawing.Point(432, 103);
this.chkAutoAdd.Location = new System.Drawing.Point(73, 181);
this.chkAutoAdd.Name = "chkAutoAdd";
this.chkAutoAdd.Size = new System.Drawing.Size(176, 16);
this.chkAutoAdd.TabIndex = 26;
@@ -446,17 +448,18 @@
this.richTextBoxEx1.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
this.richTextBoxEx1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBoxEx1.FilePath = "";
this.richTextBoxEx1.Location = new System.Drawing.Point(0, 177);
this.richTextBoxEx1.Location = new System.Drawing.Point(0, 205);
this.richTextBoxEx1.Name = "richTextBoxEx1";
this.richTextBoxEx1.Rtf = resources.GetString("richTextBoxEx1.Rtf");
this.richTextBoxEx1.SetColorWithFont = true;
this.richTextBoxEx1.ShowToolStrip = true;
this.richTextBoxEx1.Size = new System.Drawing.Size(969, 477);
this.richTextBoxEx1.Size = new System.Drawing.Size(984, 449);
this.richTextBoxEx1.TabIndex = 58;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200)))));
this.panel1.Controls.Add(this.chkManagerAlert);
this.panel1.Controls.Add(this.tbProjectIndex);
this.panel1.Controls.Add(this.grpkisul);
this.panel1.Controls.Add(this.dateTimePicker2);
@@ -490,9 +493,19 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(969, 177);
this.panel1.Size = new System.Drawing.Size(984, 205);
this.panel1.TabIndex = 0;
//
// tbProjectIndex
//
this.tbProjectIndex.Location = new System.Drawing.Point(754, 58);
this.tbProjectIndex.Name = "tbProjectIndex";
this.tbProjectIndex.Size = new System.Drawing.Size(68, 23);
this.tbProjectIndex.TabIndex = 25;
this.tbProjectIndex.Text = "--";
this.tbProjectIndex.UseVisualStyleBackColor = true;
this.tbProjectIndex.Click += new System.EventHandler(this.tbProjectIndex_Click);
//
// grpkisul
//
this.grpkisul.Controls.Add(label10);
@@ -573,7 +586,7 @@
this.tbTag.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tbTag.Location = new System.Drawing.Point(0, 654);
this.tbTag.Name = "tbTag";
this.tbTag.Size = new System.Drawing.Size(969, 21);
this.tbTag.Size = new System.Drawing.Size(984, 21);
this.tbTag.TabIndex = 60;
this.tbTag.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
@@ -602,21 +615,22 @@
this.tam.SPMasterTableAdapter = null;
this.tam.UpdateOrder = FPJ0000.dsPRJTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete;
//
// tbProjectIndex
// chkManagerAlert
//
this.tbProjectIndex.Location = new System.Drawing.Point(754, 58);
this.tbProjectIndex.Name = "tbProjectIndex";
this.tbProjectIndex.Size = new System.Drawing.Size(68, 23);
this.tbProjectIndex.TabIndex = 25;
this.tbProjectIndex.Text = "--";
this.tbProjectIndex.UseVisualStyleBackColor = true;
this.tbProjectIndex.Click += new System.EventHandler(this.tbProjectIndex_Click);
this.chkManagerAlert.AutoSize = true;
this.chkManagerAlert.Location = new System.Drawing.Point(265, 181);
this.chkManagerAlert.Name = "chkManagerAlert";
this.chkManagerAlert.Size = new System.Drawing.Size(116, 16);
this.chkManagerAlert.TabIndex = 30;
this.chkManagerAlert.Text = "관리자 메일 알림";
this.toolTip1.SetToolTip(this.chkManagerAlert, "체크시 업무일지 내용을 관리자에게 메일로 전송합니다.\r\n메일양식에 MA 항목이 등록되어있어야 합니다");
this.chkManagerAlert.UseVisualStyleBackColor = true;
//
// fJobReport_Add
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(969, 697);
this.ClientSize = new System.Drawing.Size(984, 697);
this.Controls.Add(this.richTextBoxEx1);
this.Controls.Add(this.tbTag);
this.Controls.Add(this.panel1);
@@ -677,5 +691,7 @@
private System.Windows.Forms.ToolStripStatusLabel lbOt2;
private System.Windows.Forms.ToolStripStatusLabel lbotReason;
private System.Windows.Forms.Button tbProjectIndex;
private System.Windows.Forms.CheckBox chkManagerAlert;
private System.Windows.Forms.ToolTip toolTip1;
}
}

View File

@@ -604,9 +604,69 @@ namespace FPJ0000.JobReport_
this.dr.description = richTextBoxEx1.Text;
this.dr.description2 = richTextBoxEx1.Rtf; // ef.DocumentText;// richTextBox1.Rtf;
this.bs.EndEdit();
if(chkManagerAlert.Checked)
{
var dlg = FCOMMON.Util.MsgQ("관리자 메일을 전송할까요?\n업무일지 작성 내용이 전달 됩니다");
if(dlg == DialogResult.Yes)
{
var db = new EEEntities();
var mf = db.MailForm.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.cate == "MA").FirstOrDefault();
if (mf != null)
{
try
{
var mbody = new MailData();
mbody.tolist = maildataupdate(mf.tolist);
mbody.bcc = maildataupdate(mf.bcc);
mbody.cc = maildataupdate(mf.cc);
mbody.project = dr.pidx;
mbody.gcode = FCOMMON.info.Login.gcode;
mbody.cate = mf.cate;
mbody.fromlist = "gw@amkor.co.kr";
mbody.pdate = DateTime.Now.ToShortDateString();
mbody.subject = maildataupdate(mf.subject);
mbody.body = maildataupdate(mf.body);
mbody.wuid = FCOMMON.info.Login.no;
mbody.wdate = DateTime.Now;
db.MailData.Add(mbody);
db.SaveChanges();
}
catch (Exception ex)
{
FCOMMON.Util.MsgE("업무일지 알림 메일 전송 실패" + ex.Message);
}
}
else FCOMMON.Util.MsgE("관리자메일양식 MA가 등록되지 않았습니다. 메일 양식을 확인하세요");
}
}
DialogResult = System.Windows.Forms.DialogResult.OK;
}
string maildataupdate(string org)
{
if (string.IsNullOrEmpty(org)) return string.Empty;
org = org.Replace("{pname}", tbProject.Text);
org = org.Replace("{pidx}", tbProjectIndex.Text);
org = org.Replace("{sdate}", dtPdate.Value.ToShortDateString());
org = org.Replace("{edate}", dtPdate.Value.ToShortDateString());
org = org.Replace("{pdate}", dtPdate.Value.ToShortDateString());
org = org.Replace("{DATE}", dtPdate.Value.ToShortDateString());
org = org.Replace("{NAME}", cmbUser.Text);
org = org.Replace("{HR}", tbHrs.Text);
org = org.Replace("{OT}", tbOt.Text);
org = org.Replace("{PROJECT}", tbProject.Text);
org = org.Replace("{REMARK}", richTextBoxEx1.Text);
org = org.Replace("{SENDER}",FCOMMON.info.Login.email);
return org;
}
private void cmbType_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbType.Text.Trim() != "" &&

View File

@@ -162,12 +162,6 @@
<metadata name="bs.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>100, 17</value>
</metadata>
<metadata name="bs.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>100, 17</value>
</metadata>
<metadata name="dsPRJ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dsPRJ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
@@ -181,6 +175,9 @@
}
</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>416, 17</value>
</metadata>
<metadata name="ta.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>164, 17</value>
</metadata>