개정판 3ae68e58
issue #00000 e-tech uploadfinal 추가
Change-Id: I9cbbc248a94f74dbc499afe8f8795c7e0b9c450d
FinalService/KCOM_FinalService/Upload/UploadFinal_ETECH/Properties/AssemblyInfo.cs | ||
---|---|---|
1 |
using System.Reflection; |
|
2 |
using System.Runtime.CompilerServices; |
|
3 |
using System.Runtime.InteropServices; |
|
4 |
|
|
5 |
// General Information about an assembly is controlled through the following |
|
6 |
// set of attributes. Change these attribute values to modify the information |
|
7 |
// associated with an assembly. |
|
8 |
[assembly: AssemblyTitle("UploadFinal ETECH")] |
|
9 |
[assembly: AssemblyDescription("")] |
|
10 |
[assembly: AssemblyConfiguration("")] |
|
11 |
[assembly: AssemblyCompany("")] |
|
12 |
[assembly: AssemblyProduct("UploadFinal ETECH")] |
|
13 |
[assembly: AssemblyCopyright("Copyright © 2012")] |
|
14 |
[assembly: AssemblyTrademark("")] |
|
15 |
[assembly: AssemblyCulture("")] |
|
16 |
|
|
17 |
// Setting ComVisible to false makes the types in this assembly not visible |
|
18 |
// to COM components. If you need to access a type in this assembly from |
|
19 |
// COM, set the ComVisible attribute to true on that type. |
|
20 |
[assembly: ComVisible(false)] |
|
21 |
|
|
22 |
// The following GUID is for the ID of the typelib if this project is exposed to COM |
|
23 |
[assembly: Guid("9cf96b56-8129-4f59-a099-c911f56caaf6")] |
|
24 |
|
|
25 |
// Version information for an assembly consists of the following four values: |
|
26 |
// |
|
27 |
// Major Version |
|
28 |
// Minor Version |
|
29 |
// Build Number |
|
30 |
// Revision |
|
31 |
// |
|
32 |
// You can specify all the values or you can default the Build and Revision Numbers |
|
33 |
// by using the '*' as shown below: |
|
34 |
// [assembly: AssemblyVersion("1.0.*")] |
|
35 |
[assembly: AssemblyVersion("1.6.0.2")] |
|
36 |
[assembly: AssemblyFileVersion("1.6.0.2")] |
|
37 |
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)] |
FinalService/KCOM_FinalService/Upload/UploadFinal_ETECH/UploadFinal_ETECH.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 |
<PropertyGroup> |
|
4 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
5 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
6 |
<ProductVersion>8.0.30703</ProductVersion> |
|
7 |
<SchemaVersion>2.0</SchemaVersion> |
|
8 |
<ProjectGuid>{EE38A009-BD78-42FD-8EC6-6A0EC72DBB3C}</ProjectGuid> |
|
9 |
<OutputType>Library</OutputType> |
|
10 |
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
11 |
<RootNamespace>UploadFinal</RootNamespace> |
|
12 |
<AssemblyName>UploadFinal</AssemblyName> |
|
13 |
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> |
|
14 |
<FileAlignment>512</FileAlignment> |
|
15 |
<TargetFrameworkProfile> |
|
16 |
</TargetFrameworkProfile> |
|
17 |
</PropertyGroup> |
|
18 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
19 |
<DebugSymbols>true</DebugSymbols> |
|
20 |
<DebugType>full</DebugType> |
|
21 |
<Optimize>false</Optimize> |
|
22 |
<OutputPath>bin\Debug\</OutputPath> |
|
23 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
24 |
<ErrorReport>prompt</ErrorReport> |
|
25 |
<WarningLevel>4</WarningLevel> |
|
26 |
<Prefer32Bit>false</Prefer32Bit> |
|
27 |
<PlatformTarget>x64</PlatformTarget> |
|
28 |
</PropertyGroup> |
|
29 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
30 |
<DebugType>pdbonly</DebugType> |
|
31 |
<Optimize>true</Optimize> |
|
32 |
<OutputPath>..\..\..\Setup\FinalService\</OutputPath> |
|
33 |
<DefineConstants>TRACE</DefineConstants> |
|
34 |
<ErrorReport>prompt</ErrorReport> |
|
35 |
<WarningLevel>4</WarningLevel> |
|
36 |
<Prefer32Bit>false</Prefer32Bit> |
|
37 |
</PropertyGroup> |
|
38 |
<PropertyGroup> |
|
39 |
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
40 |
</PropertyGroup> |
|
41 |
<ItemGroup> |
|
42 |
<Reference Include="System" /> |
|
43 |
<Reference Include="System.Core" /> |
|
44 |
<Reference Include="System.Data.Entity" /> |
|
45 |
<Reference Include="System.Runtime.Serialization" /> |
|
46 |
<Reference Include="System.ServiceModel" /> |
|
47 |
<Reference Include="System.Web" /> |
|
48 |
<Reference Include="System.Xml.Linq" /> |
|
49 |
<Reference Include="System.Data.DataSetExtensions" /> |
|
50 |
<Reference Include="Microsoft.CSharp" /> |
|
51 |
<Reference Include="System.Data" /> |
|
52 |
<Reference Include="System.Xml" /> |
|
53 |
</ItemGroup> |
|
54 |
<ItemGroup> |
|
55 |
<Compile Include="UploadPDF.cs" /> |
|
56 |
<None Include="app.config" /> |
|
57 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
58 |
</ItemGroup> |
|
59 |
<ItemGroup> |
|
60 |
<WCFMetadata Include="Service References\" /> |
|
61 |
</ItemGroup> |
|
62 |
<ItemGroup> |
|
63 |
<ProjectReference Include="..\..\CommonLib\CommonLib.csproj"> |
|
64 |
<Project>{ee9aaabc-1678-43a4-878e-cedbb577cf01}</Project> |
|
65 |
<Name>CommonLib</Name> |
|
66 |
</ProjectReference> |
|
67 |
<ProjectReference Include="..\..\KCOMDataModel\KCOMDataModel.csproj"> |
|
68 |
<Project>{629dc8cd-d458-47ef-8f02-cd12c7001c3e}</Project> |
|
69 |
<Name>KCOMDataModel</Name> |
|
70 |
</ProjectReference> |
|
71 |
</ItemGroup> |
|
72 |
<ItemGroup> |
|
73 |
<PackageReference Include="log4net"> |
|
74 |
<Version>2.0.12</Version> |
|
75 |
</PackageReference> |
|
76 |
<PackageReference Include="RestSharp"> |
|
77 |
<Version>106.12.0</Version> |
|
78 |
</PackageReference> |
|
79 |
</ItemGroup> |
|
80 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
81 |
<!-- test |
|
82 |
To modify your build process, add your task inside one of the targets below and uncomment it. |
|
83 |
Other similar extension points exist, see Microsoft.Common.targets. |
|
84 |
<Target Name="BeforeBuild"> |
|
85 |
</Target> |
|
86 |
<Target Name="AfterBuild"> |
|
87 |
</Target> |
|
88 |
--> |
|
89 |
</Project> |
FinalService/KCOM_FinalService/Upload/UploadFinal_ETECH/UploadPDF.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.IO; |
|
6 |
using System.Net; |
|
7 |
using System.Xml; |
|
8 |
using System.Xml.Linq; |
|
9 |
using System.Net.Mail; |
|
10 |
using System.Data.SqlClient; |
|
11 |
using KCOMDataModel.DataModel; |
|
12 |
using KCOMDataModel.Common; |
|
13 |
using log4net; |
|
14 |
using RestSharp; |
|
15 |
|
|
16 |
namespace UploadFinal |
|
17 |
{ |
|
18 |
public class UploadFinal |
|
19 |
{ |
|
20 |
public static ILog Logger = null; |
|
21 |
|
|
22 |
public static KeyValuePair<bool, string> UploadFinalPDF(string PdfFilePath, string OriginFileName, FINAL_PDF FinalPDF, string UploadServiceUrl) |
|
23 |
{ |
|
24 |
KeyValuePair<bool, string> result = new KeyValuePair<bool, string>(false, ""); |
|
25 |
string uri = ""; |
|
26 |
|
|
27 |
Logger = LogManager.GetLogger(typeof(UploadFinal)); |
|
28 |
|
|
29 |
try |
|
30 |
{ |
|
31 |
string docurl = string.Empty; |
|
32 |
//XML escape & 치환 |
|
33 |
OriginFileName = OriginFileName.Replace("&","&"); |
|
34 |
using (CIEntities dc = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString())) |
|
35 |
{ |
|
36 |
var _docitems = dc.DOCUMENT_ITEM.Where(item => item.DOCUMENT_ID == FinalPDF.DOCUMENT_ID && item.PROJECT_NO == FinalPDF.PROJECT_NO); |
|
37 |
|
|
38 |
if (_docitems.Count() > 0) |
|
39 |
{ |
|
40 |
var docItem = _docitems.First(); |
|
41 |
|
|
42 |
uri = $"{UploadServiceUrl}" |
|
43 |
+ $"/servlet/MarkusServlet?method=final&objectid={docItem.DOCUMENT_ID}&file_url={Convert.ToBase64String(Encoding.UTF8.GetBytes(PdfFilePath))}"; |
|
44 |
|
|
45 |
var value = SendData(uri); |
|
46 |
if(string.IsNullOrEmpty(value)) |
|
47 |
{ |
|
48 |
value = (true).ToString(); |
|
49 |
} |
|
50 |
|
|
51 |
result = new KeyValuePair<bool, string>(true, ""); |
|
52 |
//if (value.ToLower() == "sucess") |
|
53 |
//{ |
|
54 |
|
|
55 |
//} |
|
56 |
//else |
|
57 |
//{ |
|
58 |
// throw new Exception("return Value false"); |
|
59 |
//} |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
} |
|
64 |
catch (Exception ex) |
|
65 |
{ |
|
66 |
result = new KeyValuePair<bool, string>(false, ex.Message + " " + uri); |
|
67 |
} |
|
68 |
|
|
69 |
return result; |
|
70 |
} |
|
71 |
|
|
72 |
private static string SendData(string uri) |
|
73 |
{ |
|
74 |
string result = null; |
|
75 |
|
|
76 |
var client = new RestClient(uri); |
|
77 |
client.Timeout = -1; |
|
78 |
var request = new RestRequest(Method.GET); |
|
79 |
var response = client.Get<string>(request); |
|
80 |
|
|
81 |
var values = SimpleJson.DeserializeObject(response.Content); |
|
82 |
|
|
83 |
object value = null; |
|
84 |
|
|
85 |
(values as RestSharp.JsonObject).TryGetValue("resultMsg", out value); |
|
86 |
|
|
87 |
if(value != null) |
|
88 |
{ |
|
89 |
result = value.ToString(); |
|
90 |
} |
|
91 |
|
|
92 |
return result; |
|
93 |
} |
|
94 |
|
|
95 |
static void webClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) |
|
96 |
{ |
|
97 |
Console.WriteLine("UploadStringCompleted: {0}", e.Result); |
|
98 |
} |
|
99 |
public static void SendOnMessage(string subject, string content) |
|
100 |
{ |
|
101 |
|
|
102 |
//MailMessage mail = new MailMessage(); |
|
103 |
//mail.From = new MailAddress("h2011357@daelim.co.kr", "시스템관리자", System.Text.Encoding.UTF8); |
|
104 |
//mail.To.Add("h2011357@daelim.co.kr"); |
|
105 |
//mail.Subject = subject; |
|
106 |
//mail.Body = content; |
|
107 |
//mail.BodyEncoding = System.Text.Encoding.UTF8;//한글이 안깨지기 위해서 사용 |
|
108 |
//mail.SubjectEncoding = System.Text.Encoding.UTF8;//한글이 안깨지기 위해서 사용 |
|
109 |
|
|
110 |
//SmtpClient SmtpServer = new SmtpClient("any.daelim.co.kr"); |
|
111 |
//SmtpServer.Send(mail); // 메일 발송 |
|
112 |
//mail.Dispose(); |
|
113 |
} |
|
114 |
public static void WriteLog(string strLog) |
|
115 |
{ |
|
116 |
StreamWriter log; |
|
117 |
FileStream fileStream = null; |
|
118 |
DirectoryInfo logDirInfo = null; |
|
119 |
FileInfo logFileInfo; |
|
120 |
|
|
121 |
string logFilePath = "C:\\Logs\\"; |
|
122 |
logFilePath = logFilePath + "Log-" + System.DateTime.Today.ToString("MM-dd-yyyy") + "." + "txt"; |
|
123 |
logFileInfo = new FileInfo(logFilePath); |
|
124 |
logDirInfo = new DirectoryInfo(logFileInfo.DirectoryName); |
|
125 |
if (!logDirInfo.Exists) logDirInfo.Create(); |
|
126 |
if (!logFileInfo.Exists) |
|
127 |
{ |
|
128 |
fileStream = logFileInfo.Create(); |
|
129 |
} |
|
130 |
else |
|
131 |
{ |
|
132 |
fileStream = new FileStream(logFilePath, FileMode.Append); |
|
133 |
} |
|
134 |
log = new StreamWriter(fileStream); |
|
135 |
log.WriteLine(strLog); |
|
136 |
log.Close(); |
|
137 |
} |
|
138 |
} |
|
139 |
} |
FinalService/KCOM_FinalService/Upload/UploadFinal_ETECH/app.config | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<configuration> |
|
3 |
<system.serviceModel> |
|
4 |
<bindings/> |
|
5 |
<client/> |
|
6 |
</system.serviceModel> |
|
7 |
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration> |
내보내기 Unified diff