1910108 chi 열저장방식 변경(필드명으로 저장)
파트리스트 열 순서를 기존 사용 엑셀과 동일하게 정렬 파트리스트 적용부위 납기일 항목 추가 파트리스트 가져오기 메뉴에 적용부위, 납기일 항목 추가 파트리스트 내보내기 기능 - 파일명을 프로젝트 명으로 자동 입력
This commit is contained in:
11914
MailManager/DataSet1.Designer.cs
generated
11914
MailManager/DataSet1.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings />
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings />
|
||||
</DataSetUISetting>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="0" ViewPortY="0" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:MailAuto" ZOrder="3" X="331" Y="120" Height="305" Width="199" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailData" ZOrder="2" X="126" Y="121" Height="305" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailForm" ZOrder="1" X="533" Y="120" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="0" ViewPortY="0" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:MailAuto" ZOrder="3" X="331" Y="120" Height="305" Width="199" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailData" ZOrder="2" X="126" Y="121" Height="305" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailForm" ZOrder="1" X="533" Y="120" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
</DiagramLayout>
|
||||
@@ -1,83 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0D8E0019-909A-4879-9088-B2927509264E}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MailManager</RootNamespace>
|
||||
<AssemblyName>MailManager</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataSet1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="DataSet1.xsc">
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DataSet1.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DataSet1.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="DataSet1.xss">
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0D8E0019-909A-4879-9088-B2927509264E}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MailManager</RootNamespace>
|
||||
<AssemblyName>MailManager</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataSet1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="DataSet1.xsc">
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DataSet1.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DataSet1.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="DataSet1.xss">
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,229 +1,229 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace MailManager
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
||||
static DateTime ChkAutoDate = DateTime.Now.AddDays(-1);
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//먼저 보낼 메일이 있다면 전송을 한다
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
SendMail();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("send error:" + ex.Message);
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
MakeAutoMail();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("MakeAutoMail error:" + ex.Message);
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
static void SendMail()
|
||||
{
|
||||
Console.WriteLine("Check Send Mail Data");
|
||||
var ta = new DataSet1TableAdapters.MailDataTableAdapter();
|
||||
var sendList = ta.GetData(); //발송되지않은 메일목록
|
||||
|
||||
if (sendList.Rows.Count > 0) Console.WriteLine("Found : " + sendList.Rows.Count.ToString());
|
||||
|
||||
foreach (DataSet1.MailDataRow dr in sendList)
|
||||
{
|
||||
//전자메일 검증을 한다.
|
||||
var list_from = getMaillist(dr.fromlist);
|
||||
var list_to = getMaillist(dr.tolist);
|
||||
var list_bcc = getMaillist(dr.bcc);
|
||||
var list_cc = getMaillist(dr.cc);
|
||||
|
||||
|
||||
string sendMsg = "";
|
||||
if (list_from == "")
|
||||
{
|
||||
sendMsg = ("보내는 주소가 없습니다");
|
||||
}
|
||||
else if (dr.subject.Trim() == "")
|
||||
{
|
||||
sendMsg = ("메일 제목이 없습니다");
|
||||
}
|
||||
else if (dr.body.Trim() == "")
|
||||
{
|
||||
sendMsg = ("본문이 없습니다");
|
||||
}
|
||||
else if (list_to == "")
|
||||
{
|
||||
sendMsg = ("받는 주소가 없습니다");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var body = dr.body;
|
||||
body +=
|
||||
"<p>" +
|
||||
"<br />이 메일은 EET 프로그램에서 자동 발신 되었습니다." +
|
||||
"<br />메일이 잘못 전송 되었다면 [<a href='chikyun.kim@amkor.co.kr'>chikyun.kim@amkor.co.kr</a>] 로 문의 주시기 바랍니다" +
|
||||
"</p>";
|
||||
|
||||
|
||||
//전송을 해야 함
|
||||
var mc = new System.Net.Mail.SmtpClient("10.101.10.6");
|
||||
var msg = new System.Net.Mail.MailMessage
|
||||
(list_from,
|
||||
list_to,
|
||||
dr.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);
|
||||
Console.WriteLine("send mail to" + list_to + ",subject=" + dr.subject);
|
||||
sendMsg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
catch (Exception eX)
|
||||
{
|
||||
sendMsg = eX.Message;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine(string.Format("Send Complete index={0},Msg={1}", dr.idx, sendMsg));
|
||||
ta.UpdateSendOK(sendMsg, dr.idx);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void MakeAutoMail()
|
||||
{
|
||||
var ts = DateTime.Now - ChkAutoDate;
|
||||
if (ts.TotalMinutes < 1) return; //10분마다 자동 생성 데이터를 처리한다
|
||||
Console.WriteLine("Check Auto Make Mail");
|
||||
|
||||
var taData = new DataSet1TableAdapters.MailDataTableAdapter();
|
||||
var taList = new DataSet1TableAdapters.MailAutoTableAdapter();
|
||||
var dtList = taList.GetByAutoSend();
|
||||
var dtInsert = new DataSet1.MailDataDataTable();
|
||||
|
||||
//대상
|
||||
Console.WriteLine("Make Auto Send Mail Data (" + dtList.Rows.Count.ToString() + ")");
|
||||
|
||||
foreach (DataSet1.MailAutoRow dr in dtList)
|
||||
{
|
||||
//시간정보가 없는 애들은 처리 하지 않음
|
||||
if (dr.stime.IndexOf(":") == -1) continue;
|
||||
if (dr.sday == null || dr.sday.Length < 2) continue;
|
||||
|
||||
//발신시간을 넘어야 한다
|
||||
var curTime = DateTime.Now.ToString("HH:mm");
|
||||
if (string.Compare(curTime, dr.stime) < 0) continue; //지정된 시간 이전이면 생성 안한다
|
||||
|
||||
//자동생성 구분용 카테고리
|
||||
var cate = string.Format("{0},{1}", dr.sday[0], dr.sday[1]);
|
||||
|
||||
//동륵일
|
||||
var pdate = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
//같은날, 같은 atime aidx pdate 의 같이 있으면 이미 생성된것이므로 추가하지 않는다
|
||||
var existData = taData.FindAutoData(dr.idx, dr.stime, pdate, cate);
|
||||
var PreMakeCount = (int)(existData);
|
||||
if (PreMakeCount > 0) continue;
|
||||
|
||||
//전송간격과 대상
|
||||
if (dr.sday[0] == 1)
|
||||
{
|
||||
//week
|
||||
var bitString = Convert.ToString(dr.sday[1], 2).PadLeft(8, '0').ToArray();
|
||||
var weeknum = (int)(DateTime.Now.DayOfWeek);
|
||||
if (bitString[weeknum + 1] == '0') continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
//month
|
||||
if (dr.sday[1] != DateTime.Now.Day) continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//같은날, 같은 atime aidx pdate 의 같이 있으면 이미 생성된것이므로 추가하지 않는다
|
||||
//생성해야할 자료라면 만들어 준다
|
||||
var newdr = dtInsert.NewMailDataRow();
|
||||
newdr.pdate = pdate;// DateTime.Now.ToString("yyyy-MM-dd");
|
||||
newdr.gcode = dr.gcode;
|
||||
newdr.fromlist = dr.fromlist;
|
||||
newdr.tolist = dr.tolist;
|
||||
newdr.bcc = dr.bcc;
|
||||
newdr.cate = cate;// string.Format("{0},{1}", dr.sday[0], dr.sday[1]); //cate에 해당 자료를 기록한다.
|
||||
newdr.cc = dr.cc;
|
||||
newdr.subject = dr.subject;
|
||||
newdr.body = dr.body;
|
||||
newdr.aidx = dr.idx;
|
||||
newdr.atime = dr.stime;
|
||||
newdr.wuid = "MANAGER";
|
||||
newdr.wdate = DateTime.Now;
|
||||
dtInsert.AddMailDataRow(newdr);
|
||||
try
|
||||
{
|
||||
taData.Update(newdr);
|
||||
Console.WriteLine("auto make : " + newdr.tolist + ",subject=" + newdr.subject);
|
||||
}
|
||||
catch (Exception eX)
|
||||
{
|
||||
Console.WriteLine("auto make error : " + eX.Message);
|
||||
}
|
||||
}
|
||||
ChkAutoDate = DateTime.Now;
|
||||
}
|
||||
|
||||
static string getMaillist(string org)
|
||||
{
|
||||
org = org.Replace(";", ",").Replace(":", ",");
|
||||
string list_to = "";
|
||||
foreach (var item in org.Split(','))
|
||||
{
|
||||
if (item.Trim() != "")
|
||||
{
|
||||
var atindex = item.IndexOf("@");
|
||||
if (atindex != -1)
|
||||
{
|
||||
var dotindex = item.IndexOf(".", atindex + 1);
|
||||
if (dotindex != -1)
|
||||
{
|
||||
//정상이므로 추가한다.
|
||||
if (list_to != "") list_to += ",";
|
||||
list_to += item.Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list_to;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace MailManager
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
||||
static DateTime ChkAutoDate = DateTime.Now.AddDays(-1);
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//먼저 보낼 메일이 있다면 전송을 한다
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
SendMail();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("send error:" + ex.Message);
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
MakeAutoMail();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("MakeAutoMail error:" + ex.Message);
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
static void SendMail()
|
||||
{
|
||||
Console.WriteLine("Check Send Mail Data");
|
||||
var ta = new DataSet1TableAdapters.MailDataTableAdapter();
|
||||
var sendList = ta.GetData(); //발송되지않은 메일목록
|
||||
|
||||
if (sendList.Rows.Count > 0) Console.WriteLine("Found : " + sendList.Rows.Count.ToString());
|
||||
|
||||
foreach (DataSet1.MailDataRow dr in sendList)
|
||||
{
|
||||
//전자메일 검증을 한다.
|
||||
var list_from = getMaillist(dr.fromlist);
|
||||
var list_to = getMaillist(dr.tolist);
|
||||
var list_bcc = getMaillist(dr.bcc);
|
||||
var list_cc = getMaillist(dr.cc);
|
||||
|
||||
|
||||
string sendMsg = "";
|
||||
if (list_from == "")
|
||||
{
|
||||
sendMsg = ("보내는 주소가 없습니다");
|
||||
}
|
||||
else if (dr.subject.Trim() == "")
|
||||
{
|
||||
sendMsg = ("메일 제목이 없습니다");
|
||||
}
|
||||
else if (dr.body.Trim() == "")
|
||||
{
|
||||
sendMsg = ("본문이 없습니다");
|
||||
}
|
||||
else if (list_to == "")
|
||||
{
|
||||
sendMsg = ("받는 주소가 없습니다");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var body = dr.body;
|
||||
body +=
|
||||
"<p>" +
|
||||
"<br />이 메일은 EET 프로그램에서 자동 발신 되었습니다." +
|
||||
"<br />메일이 잘못 전송 되었다면 [<a href='chikyun.kim@amkor.co.kr'>chikyun.kim@amkor.co.kr</a>] 로 문의 주시기 바랍니다" +
|
||||
"</p>";
|
||||
|
||||
|
||||
//전송을 해야 함
|
||||
var mc = new System.Net.Mail.SmtpClient("10.101.10.6");
|
||||
var msg = new System.Net.Mail.MailMessage
|
||||
(list_from,
|
||||
list_to,
|
||||
dr.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);
|
||||
Console.WriteLine("send mail to" + list_to + ",subject=" + dr.subject);
|
||||
sendMsg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
catch (Exception eX)
|
||||
{
|
||||
sendMsg = eX.Message;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine(string.Format("Send Complete index={0},Msg={1}", dr.idx, sendMsg));
|
||||
ta.UpdateSendOK(sendMsg, dr.idx);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void MakeAutoMail()
|
||||
{
|
||||
var ts = DateTime.Now - ChkAutoDate;
|
||||
if (ts.TotalMinutes < 1) return; //10분마다 자동 생성 데이터를 처리한다
|
||||
Console.WriteLine("Check Auto Make Mail");
|
||||
|
||||
var taData = new DataSet1TableAdapters.MailDataTableAdapter();
|
||||
var taList = new DataSet1TableAdapters.MailAutoTableAdapter();
|
||||
var dtList = taList.GetByAutoSend();
|
||||
var dtInsert = new DataSet1.MailDataDataTable();
|
||||
|
||||
//대상
|
||||
Console.WriteLine("Make Auto Send Mail Data (" + dtList.Rows.Count.ToString() + ")");
|
||||
|
||||
foreach (DataSet1.MailAutoRow dr in dtList)
|
||||
{
|
||||
//시간정보가 없는 애들은 처리 하지 않음
|
||||
if (dr.stime.IndexOf(":") == -1) continue;
|
||||
if (dr.sday == null || dr.sday.Length < 2) continue;
|
||||
|
||||
//발신시간을 넘어야 한다
|
||||
var curTime = DateTime.Now.ToString("HH:mm");
|
||||
if (string.Compare(curTime, dr.stime) < 0) continue; //지정된 시간 이전이면 생성 안한다
|
||||
|
||||
//자동생성 구분용 카테고리
|
||||
var cate = string.Format("{0},{1}", dr.sday[0], dr.sday[1]);
|
||||
|
||||
//동륵일
|
||||
var pdate = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
//같은날, 같은 atime aidx pdate 의 같이 있으면 이미 생성된것이므로 추가하지 않는다
|
||||
var existData = taData.FindAutoData(dr.idx, dr.stime, pdate, cate);
|
||||
var PreMakeCount = (int)(existData);
|
||||
if (PreMakeCount > 0) continue;
|
||||
|
||||
//전송간격과 대상
|
||||
if (dr.sday[0] == 1)
|
||||
{
|
||||
//week
|
||||
var bitString = Convert.ToString(dr.sday[1], 2).PadLeft(8, '0').ToArray();
|
||||
var weeknum = (int)(DateTime.Now.DayOfWeek);
|
||||
if (bitString[weeknum + 1] == '0') continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
//month
|
||||
if (dr.sday[1] != DateTime.Now.Day) continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//같은날, 같은 atime aidx pdate 의 같이 있으면 이미 생성된것이므로 추가하지 않는다
|
||||
//생성해야할 자료라면 만들어 준다
|
||||
var newdr = dtInsert.NewMailDataRow();
|
||||
newdr.pdate = pdate;// DateTime.Now.ToString("yyyy-MM-dd");
|
||||
newdr.gcode = dr.gcode;
|
||||
newdr.fromlist = dr.fromlist;
|
||||
newdr.tolist = dr.tolist;
|
||||
newdr.bcc = dr.bcc;
|
||||
newdr.cate = cate;// string.Format("{0},{1}", dr.sday[0], dr.sday[1]); //cate에 해당 자료를 기록한다.
|
||||
newdr.cc = dr.cc;
|
||||
newdr.subject = dr.subject;
|
||||
newdr.body = dr.body;
|
||||
newdr.aidx = dr.idx;
|
||||
newdr.atime = dr.stime;
|
||||
newdr.wuid = "MANAGER";
|
||||
newdr.wdate = DateTime.Now;
|
||||
dtInsert.AddMailDataRow(newdr);
|
||||
try
|
||||
{
|
||||
taData.Update(newdr);
|
||||
Console.WriteLine("auto make : " + newdr.tolist + ",subject=" + newdr.subject);
|
||||
}
|
||||
catch (Exception eX)
|
||||
{
|
||||
Console.WriteLine("auto make error : " + eX.Message);
|
||||
}
|
||||
}
|
||||
ChkAutoDate = DateTime.Now;
|
||||
}
|
||||
|
||||
static string getMaillist(string org)
|
||||
{
|
||||
org = org.Replace(";", ",").Replace(":", ",");
|
||||
string list_to = "";
|
||||
foreach (var item in org.Split(','))
|
||||
{
|
||||
if (item.Trim() != "")
|
||||
{
|
||||
var atindex = item.IndexOf("@");
|
||||
if (atindex != -1)
|
||||
{
|
||||
var dotindex = item.IndexOf(".", atindex + 1);
|
||||
if (dotindex != -1)
|
||||
{
|
||||
//정상이므로 추가한다.
|
||||
if (list_to != "") list_to += ",";
|
||||
list_to += item.Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list_to;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("MailManager")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MailManager")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("ba61bd46-8ea2-46c9-a4ec-7adf2feb75b0")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("19.10.01.1400")]
|
||||
[assembly: AssemblyFileVersion("19.10.01.1400")]
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("MailManager")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MailManager")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("ba61bd46-8ea2-46c9-a4ec-7adf2feb75b0")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("19.10.01.1400")]
|
||||
[assembly: AssemblyFileVersion("19.10.01.1400")]
|
||||
|
||||
96
MailManager/Properties/Settings.Designer.cs
generated
96
MailManager/Properties/Settings.Designer.cs
generated
@@ -1,48 +1,48 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MailManager.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=ee" +
|
||||
"user;Password=EEmicro123!")]
|
||||
public string gwcs {
|
||||
get {
|
||||
return ((string)(this["gwcs"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=ee" +
|
||||
"user;Password=EEmicro123!")]
|
||||
public string CS {
|
||||
get {
|
||||
return ((string)(this["CS"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MailManager.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=ee" +
|
||||
"user;Password=EEmicro123!")]
|
||||
public string gwcs {
|
||||
get {
|
||||
return ((string)(this["gwcs"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=ee" +
|
||||
"user;Password=EEmicro123!")]
|
||||
public string CS {
|
||||
get {
|
||||
return ((string)(this["CS"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MailManager.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="gwcs" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</ConnectionString>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</Value>
|
||||
</Setting>
|
||||
<Setting Name="CS" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MailManager.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="gwcs" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</ConnectionString>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</Value>
|
||||
</Setting>
|
||||
<Setting Name="CS" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="MailManager.Properties.Settings.gwcs" connectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!" />
|
||||
<add name="MailManager.Properties.Settings.CS" connectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="MailManager.Properties.Settings.gwcs" connectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!" />
|
||||
<add name="MailManager.Properties.Settings.CS" connectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=EEmicro123!"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user