개정판 6d463d71
issue #000 upload service add
Change-Id: I19cbabcee3675035f39dc4691a6e9933f752cc69
FinalService/KCOM_FinalService/KCOM_FinalService.sln | ||
---|---|---|
13 | 13 |
EndProject |
14 | 14 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkupToPDF", "MarkupToPDF\MarkupToPDF.csproj", "{A714BD67-8AAC-4ED8-8ECF-7853C3549A68}" |
15 | 15 |
EndProject |
16 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UploadFinal", "UploadFinal\UploadFinal.csproj", "{9CF3737A-E04D-4A55-924E-C88725DFBEC7}" |
|
17 |
EndProject |
|
16 | 18 |
Global |
17 | 19 |
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
18 | 20 |
Debug|Any CPU = Debug|Any CPU |
... | ... | |
61 | 63 |
{A714BD67-8AAC-4ED8-8ECF-7853C3549A68}.Release|Any CPU.Build.0 = Release|Any CPU |
62 | 64 |
{A714BD67-8AAC-4ED8-8ECF-7853C3549A68}.Release|x64.ActiveCfg = Release|x64 |
63 | 65 |
{A714BD67-8AAC-4ED8-8ECF-7853C3549A68}.Release|x64.Build.0 = Release|x64 |
66 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
67 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
68 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x64.ActiveCfg = Debug|Any CPU |
|
69 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x64.Build.0 = Debug|Any CPU |
|
70 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
71 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Release|Any CPU.Build.0 = Release|Any CPU |
|
72 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Release|x64.ActiveCfg = Release|Any CPU |
|
73 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Release|x64.Build.0 = Release|Any CPU |
|
64 | 74 |
EndGlobalSection |
65 | 75 |
GlobalSection(SolutionProperties) = preSolution |
66 | 76 |
HideSolutionNode = FALSE |
FinalService/KCOM_FinalService/KCOM_FinalService/KCOM_FinalService.csproj | ||
---|---|---|
74 | 74 |
<Project>{a714bd67-8aac-4ed8-8ecf-7853c3549a68}</Project> |
75 | 75 |
<Name>MarkupToPDF</Name> |
76 | 76 |
</ProjectReference> |
77 |
<ProjectReference Include="..\UploadFinal\UploadFinal.csproj"> |
|
78 |
<Project>{9cf3737a-e04d-4a55-924e-c88725dfbec7}</Project> |
|
79 |
<Name>UploadFinal</Name> |
|
80 |
</ProjectReference> |
|
77 | 81 |
</ItemGroup> |
78 | 82 |
<ItemGroup> |
79 | 83 |
<None Include="app.config" /> |
FinalService/KCOM_FinalService/KCOM_FinalService/Remoting/RemFinalPDFStation.cs | ||
---|---|---|
207 | 207 |
|
208 | 208 |
try |
209 | 209 |
{ |
210 |
///TODO: 저장할 폴더 위치를 configuration으로 빼주세요 |
|
211 |
string saveFolder = String.Format(Properties.Settings.Default.saveFileFolder, _item.PROJECT_NO, Convert.ToInt32(_item.DOCUMENT_ID) / 100, _item.DOCUMENT_ID); |
|
212 |
if (!System.IO.Directory.Exists(saveFolder)) |
|
210 |
string soapurl = string.Empty; |
|
211 |
using (KCOMDataModel.DataModel.KCOMEntities _systemEntity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
213 | 212 |
{ |
214 |
System.IO.Directory.CreateDirectory(saveFolder); |
|
213 |
var item = _systemEntity.PROPERTIES.Where(data => data.TYPE == "UpLoadServiceUrl").FirstOrDefault(); |
|
214 |
soapurl = item.VALUE; |
|
215 | 215 |
} |
216 |
|
|
217 |
this._Log.Write(String.Format("saveFolder : {0}", saveFolder) + DateTime.Now); |
|
218 |
System.IO.File.Copy(e.FinalPDFPath, saveFolder + e.OriginPDFName, true); |
|
219 |
|
|
220 |
using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(_item.PROJECT_NO).ToString())) |
|
216 |
if(!string.IsNullOrEmpty(soapurl)) |
|
221 | 217 |
{ |
222 |
var item = _entity.DOCUMENT_ITEM.Where(d => d.DOCUMENT_ID == _item.DOCUMENT_ID).FirstOrDefault(); |
|
223 |
///TODO: RESULT FILE 경로 위치를 configuration으로 빼주세요 |
|
224 |
item.RESULT_FILE = String.Format(Properties.Settings.Default.resultFileFolder, _item.PROJECT_NO, Convert.ToInt32(_item.DOCUMENT_ID) / 100, _item.DOCUMENT_ID, e.OriginPDFName); |
|
225 |
//@"http://cloud.devdoftech.co.kr:5977/FinalPDF/{0}_app/VPCS_DOCLIB/{1}/{2}/ToVendor/{3}" |
|
226 |
sendReqLog("RESULT_FILE_PATH", item.RESULT_FILE); |
|
227 |
_entity.SaveChanges(); |
|
228 |
SetFinalState(_item.ID, FinalStatus.Success); |
|
218 |
//Legacy IF |
|
219 |
KeyValuePair<bool, string> result = UploadFinal.UploadFinal.UploadFinalPDF(e.FinalPDFPath.Replace(@"\\172.20.121.220\comment3\finalPDF\", ""), e.OriginPDFName, e.FinalPDF, soapurl); |
|
220 |
if (result.Key) |
|
221 |
{ |
|
222 |
SetFinalState(_item.ID, FinalStatus.Success); |
|
223 |
} |
|
224 |
else |
|
225 |
{ |
|
226 |
SetFinalState(_item.ID, FinalStatus.Error); |
|
227 |
_Log.Write("Upload error .." + e.FinalPDFPath + ",pdfname:" + e.OriginPDFName); |
|
228 |
} |
|
229 | 229 |
_Thread.Remove(_T.First()); |
230 | 230 |
} |
231 |
else |
|
232 |
{ |
|
233 |
///TODO: 저장할 폴더 위치를 configuration으로 빼주세요 |
|
234 |
string saveFolder = String.Format(Properties.Settings.Default.saveFileFolder, _item.PROJECT_NO, Convert.ToInt32(_item.DOCUMENT_ID) / 100, _item.DOCUMENT_ID); |
|
235 |
if (!System.IO.Directory.Exists(saveFolder)) |
|
236 |
{ |
|
237 |
System.IO.Directory.CreateDirectory(saveFolder); |
|
238 |
} |
|
239 |
|
|
240 |
this._Log.Write(String.Format("saveFolder : {0}", saveFolder) + DateTime.Now); |
|
241 |
System.IO.File.Copy(e.FinalPDFPath, saveFolder + e.OriginPDFName, true); |
|
242 |
|
|
243 |
using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(_item.PROJECT_NO).ToString())) |
|
244 |
{ |
|
245 |
var item = _entity.DOCUMENT_ITEM.Where(d => d.DOCUMENT_ID == _item.DOCUMENT_ID).FirstOrDefault(); |
|
246 |
///TODO: RESULT FILE 경로 위치를 configuration으로 빼주세요 |
|
247 |
item.RESULT_FILE = String.Format(Properties.Settings.Default.resultFileFolder, _item.PROJECT_NO, Convert.ToInt32(_item.DOCUMENT_ID) / 100, _item.DOCUMENT_ID, e.OriginPDFName); |
|
248 |
//@"http://cloud.devdoftech.co.kr:5977/FinalPDF/{0}_app/VPCS_DOCLIB/{1}/{2}/ToVendor/{3}" |
|
249 |
sendReqLog("RESULT_FILE_PATH", item.RESULT_FILE); |
|
250 |
_entity.SaveChanges(); |
|
251 |
SetFinalState(_item.ID, FinalStatus.Success); |
|
252 |
_Thread.Remove(_T.First()); |
|
253 |
} |
|
254 |
} |
|
231 | 255 |
} |
232 | 256 |
catch (Exception ex) |
233 | 257 |
{ |
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.csproj | ||
---|---|---|
78 | 78 |
<Reference Include="Microsoft.CSharp" /> |
79 | 79 |
<Reference Include="System.Data" /> |
80 | 80 |
<Reference Include="System.Xml" /> |
81 |
<Reference Include="Telerik.Windows.Controls, Version=2017.3.1018.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" /> |
|
82 |
<Reference Include="Telerik.Windows.Zip, Version=2017.2.607.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL"> |
|
81 |
<Reference Include="Telerik.Windows.Zip, Version=2019.1.215.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL"> |
|
83 | 82 |
<SpecificVersion>False</SpecificVersion> |
84 |
<HintPath>..\..\..\..\..\..\Program Files (x86)\Telerik\UI for WPF R2 2017\Binaries\WPF45\Telerik.Windows.Zip.dll</HintPath>
|
|
83 |
<HintPath>..\..\..\lib\RCWPF\2019.1.220.40\Telerik.Windows.Zip.dll</HintPath>
|
|
85 | 84 |
</Reference> |
86 | 85 |
<Reference Include="WindowsBase" /> |
87 | 86 |
</ItemGroup> |
FinalService/KCOM_FinalService/MarkupToPDF/Serialize/Core/JsonSerializerHelper.cs | ||
---|---|---|
9 | 9 |
using System.Windows.Media.Animation; |
10 | 10 |
using System.Windows.Shapes; |
11 | 11 |
using System.IO; |
12 |
using Telerik.Windows.Zip; |
|
12 |
|
|
13 | 13 |
using System.Runtime.Serialization.Json; |
14 | 14 |
using System.Text; |
15 | 15 |
using System.IO.Compression; |
16 |
using Telerik.Windows.Zip; |
|
16 | 17 |
|
17 | 18 |
namespace MarkupToPDF.Serialize.Core |
18 | 19 |
{ |
FinalService/KCOM_FinalService/UploadFinal/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")] |
|
9 |
[assembly: AssemblyDescription("")] |
|
10 |
[assembly: AssemblyConfiguration("")] |
|
11 |
[assembly: AssemblyCompany("")] |
|
12 |
[assembly: AssemblyProduct("UploadFinal")] |
|
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.1")] |
|
36 |
[assembly: AssemblyFileVersion("1.6.0.1")] |
FinalService/KCOM_FinalService/UploadFinal/UploadFinal.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="4.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>{9CF3737A-E04D-4A55-924E-C88725DFBEC7}</ProjectGuid> |
|
9 |
<OutputType>Library</OutputType> |
|
10 |
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
11 |
<RootNamespace>UploadFinal</RootNamespace> |
|
12 |
<AssemblyName>UploadFinal</AssemblyName> |
|
13 |
<TargetFrameworkVersion>v4.0</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 |
</PropertyGroup> |
|
27 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
28 |
<DebugType>pdbonly</DebugType> |
|
29 |
<Optimize>true</Optimize> |
|
30 |
<OutputPath>bin\Release\</OutputPath> |
|
31 |
<DefineConstants>TRACE</DefineConstants> |
|
32 |
<ErrorReport>prompt</ErrorReport> |
|
33 |
<WarningLevel>4</WarningLevel> |
|
34 |
</PropertyGroup> |
|
35 |
<ItemGroup> |
|
36 |
<Reference Include="System" /> |
|
37 |
<Reference Include="System.Core" /> |
|
38 |
<Reference Include="System.Data.Entity" /> |
|
39 |
<Reference Include="System.Runtime.Serialization" /> |
|
40 |
<Reference Include="System.ServiceModel" /> |
|
41 |
<Reference Include="System.Web" /> |
|
42 |
<Reference Include="System.Xml.Linq" /> |
|
43 |
<Reference Include="System.Data.DataSetExtensions" /> |
|
44 |
<Reference Include="Microsoft.CSharp" /> |
|
45 |
<Reference Include="System.Data" /> |
|
46 |
<Reference Include="System.Xml" /> |
|
47 |
</ItemGroup> |
|
48 |
<ItemGroup> |
|
49 |
<Compile Include="UploadPDF.cs" /> |
|
50 |
<None Include="app.config" /> |
|
51 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
52 |
</ItemGroup> |
|
53 |
<ItemGroup> |
|
54 |
<ProjectReference Include="..\KCOMDataModel\KCOMDataModel.csproj"> |
|
55 |
<Project>{629dc8cd-d458-47ef-8f02-cd12c7001c3e}</Project> |
|
56 |
<Name>KCOMDataModel</Name> |
|
57 |
</ProjectReference> |
|
58 |
<ProjectReference Include="..\MarkupToPDF\MarkupToPDF.csproj"> |
|
59 |
<Project>{a714bd67-8aac-4ed8-8ecf-7853c3549a68}</Project> |
|
60 |
<Name>MarkupToPDF</Name> |
|
61 |
</ProjectReference> |
|
62 |
</ItemGroup> |
|
63 |
<ItemGroup> |
|
64 |
<WCFMetadata Include="Service References\" /> |
|
65 |
</ItemGroup> |
|
66 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
67 |
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|
68 |
Other similar extension points exist, see Microsoft.Common.targets. |
|
69 |
<Target Name="BeforeBuild"> |
|
70 |
</Target> |
|
71 |
<Target Name="AfterBuild"> |
|
72 |
</Target> |
|
73 |
--> |
|
74 |
</Project> |
FinalService/KCOM_FinalService/UploadFinal/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 |
namespace UploadFinal |
|
14 |
{ |
|
15 |
public class UploadFinal |
|
16 |
{ |
|
17 |
|
|
18 |
public static KeyValuePair<bool, string> UploadFinalPDF(string PdfFilePath, string OriginFileName, FINAL_PDF FinalPDF, string UploadServiceUrl) |
|
19 |
{ |
|
20 |
string _vendorItemId = null; |
|
21 |
string _objid = null; |
|
22 |
string _SharepointItemID = null; |
|
23 |
string _slipNO = null; |
|
24 |
bool _ResultFlag = false; |
|
25 |
string _ResultMsg = ""; |
|
26 |
|
|
27 |
try |
|
28 |
{ |
|
29 |
string docurl = string.Empty; |
|
30 |
|
|
31 |
using (CIEntities dc = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString())) |
|
32 |
{ |
|
33 |
var _docInfoList = dc.DOCINFO.Where(doc => doc.ID == FinalPDF.DOCINFO_ID); |
|
34 |
|
|
35 |
if (_docInfoList.Count() > 0) |
|
36 |
_SharepointItemID = _docInfoList.First().DOCUMENT_ID; |
|
37 |
|
|
38 |
var _vendoritems = dc.DOCUMENT_ITEM.Where(item => item.DOCUMENT_ID == _SharepointItemID); |
|
39 |
|
|
40 |
if (_vendoritems.Count() > 0) |
|
41 |
{ |
|
42 |
_objid = _vendoritems.First().ID; |
|
43 |
_slipNO = _vendoritems.First().GROUP_NO; |
|
44 |
docurl = _vendoritems.First().ORIGINAL_FILE; |
|
45 |
} |
|
46 |
} |
|
47 |
|
|
48 |
//EnsemblePlusWebService.DLMWebServiceClient client = new EnsemblePlusWebService.DLMWebServiceClient(); |
|
49 |
//var result = client.fnFinalPDFCheckInService(FinalPDF.PROJECT_NO, _objid, _slipNO, PdfFilePath); |
|
50 |
|
|
51 |
WebClient webClient = new WebClient(); |
|
52 |
string data = string.Empty; |
|
53 |
if (docurl.ToUpper().Contains("VPCS_DOCLIB")) |
|
54 |
{ |
|
55 |
string connectionString = "data source=ESB-DB;Initial Catalog=markus;uid=ProjectPortalDBConn;password=ProjectPortalDBConn"; |
|
56 |
SqlConnection sqlConn = new SqlConnection(connectionString); |
|
57 |
SqlCommand sqlComm = new SqlCommand(); |
|
58 |
sqlComm.Connection = sqlConn; |
|
59 |
sqlComm.CommandText = string.Format("SELECT [DBConnectString] FROM [PortalEV].[dbo].[Setting] where [ProjectNumber] = '{0}'", FinalPDF.PROJECT_NO); |
|
60 |
string ciconnectionStr = string.Empty; |
|
61 |
|
|
62 |
sqlConn.Open(); |
|
63 |
using (SqlDataReader SqlRs = sqlComm.ExecuteReader()) |
|
64 |
{ |
|
65 |
|
|
66 |
while (SqlRs.Read()) |
|
67 |
{ |
|
68 |
ciconnectionStr = SqlRs[0].ToString(); |
|
69 |
} |
|
70 |
} |
|
71 |
sqlConn.Close(); |
|
72 |
sqlConn = new SqlConnection(ciconnectionStr); |
|
73 |
sqlComm.Connection = sqlConn; |
|
74 |
sqlComm.CommandText = string.Format("SELECT [vendor_item_id] FROM [vendor_item] where [sharepoint_itemid] = '{0}'", _objid); |
|
75 |
sqlConn.Open(); |
|
76 |
using (SqlDataReader SqlRs = sqlComm.ExecuteReader()) |
|
77 |
{ |
|
78 |
|
|
79 |
while (SqlRs.Read()) |
|
80 |
{ |
|
81 |
_objid = SqlRs[0].ToString(); |
|
82 |
} |
|
83 |
} |
|
84 |
sqlConn.Close(); |
|
85 |
UploadServiceUrl = "http://esb-vpcs-new.daelimplant.com/ProjectPortal/UserControls/DaelimCI2/FinalPDFUpload/UploadVpcsFile.asmx"; |
|
86 |
|
|
87 |
data = "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\" ><soap12:Body><UploadFinalPDF xmlns=\"http://FinalPDFUpload\">" |
|
88 |
+ "<ProjectNo>" + FinalPDF.PROJECT_NO + "</ProjectNo>" |
|
89 |
+ "<VendorItemID>" + _objid + "</VendorItemID>" |
|
90 |
+ "<SlipNumber>" + _slipNO + "</SlipNumber>" |
|
91 |
+ "<filePath>" + @"\\172.20.121.220\comment3\finalPDF\" + PdfFilePath + "</filePath>" |
|
92 |
+ "<OriginFileName>" + OriginFileName + "</OriginFileName></UploadFinalPDF></soap12:Body></soap12:Envelope>"; |
|
93 |
|
|
94 |
//WriteLog(data); |
|
95 |
webClient.Headers.Add(HttpRequestHeader.ContentType, "application/soap+xml; charset=utf-8"); |
|
96 |
webClient.Headers.Add("SOAPAction", "http://FinalPDFUpload/UploadFinalPDF"); |
|
97 |
string _result = webClient.UploadString(new Uri(UploadServiceUrl), data); |
|
98 |
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(_result)); |
|
99 |
|
|
100 |
while (reader.Read()) |
|
101 |
{ |
|
102 |
switch (reader.NodeType) |
|
103 |
{ |
|
104 |
case XmlNodeType.Element: |
|
105 |
if (reader.Name == "Seccess") |
|
106 |
{ |
|
107 |
reader.Read(); |
|
108 |
|
|
109 |
if (!string.IsNullOrWhiteSpace(reader.Value)) |
|
110 |
_ResultFlag = Convert.ToBoolean(reader.Value); |
|
111 |
} |
|
112 |
|
|
113 |
if (reader.Name == "Message") |
|
114 |
{ |
|
115 |
reader.Read(); |
|
116 |
|
|
117 |
if (!string.IsNullOrWhiteSpace(reader.Value)) |
|
118 |
_ResultMsg = reader.Value; |
|
119 |
} |
|
120 |
|
|
121 |
if (reader.Name == "FinalPDFUrl") |
|
122 |
{ |
|
123 |
reader.Read(); |
|
124 |
|
|
125 |
if (!string.IsNullOrWhiteSpace(reader.Value)) |
|
126 |
_ResultMsg = reader.Value; |
|
127 |
} |
|
128 |
|
|
129 |
break; |
|
130 |
} |
|
131 |
} |
|
132 |
return new KeyValuePair<bool, string>(_ResultFlag, _ResultMsg); |
|
133 |
} |
|
134 |
else |
|
135 |
{ |
|
136 |
data = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ens=\"http://EnsemblePlus.Webservice\"> <soapenv:Header/> <soapenv:Body> <ens:fnFinalPDFCheckInService>" |
|
137 |
+ "<ens:ProjectNo>" + FinalPDF.PROJECT_NO + "</ens:ProjectNo>" |
|
138 |
+ "<ens:ObjectId>" + _objid + "</ens:ObjectId>" |
|
139 |
+ "<ens:SlipNumber>" + _slipNO + "</ens:SlipNumber>" |
|
140 |
+ "<ens:filePath>" + PdfFilePath + "</ens:filePath>" |
|
141 |
+ "<ens:OriginalFileName>" + OriginFileName + "</ens:OriginalFileName>" |
|
142 |
+ "</ens:fnFinalPDFCheckInService> </soapenv:Body></soapenv:Envelope>"; |
|
143 |
|
|
144 |
webClient.Headers.Add(HttpRequestHeader.ContentType, "text/xml"); |
|
145 |
webClient.Headers.Add("SOAPAction", "http://EnsemblePlus.Webservice"); |
|
146 |
|
|
147 |
var result = webClient.UploadString(new Uri(UploadServiceUrl), data); |
|
148 |
XmlDocument xmlDoc = new XmlDocument(); |
|
149 |
xmlDoc.LoadXml(result); |
|
150 |
XmlNodeList list = xmlDoc.GetElementsByTagName("fnFinalPDFCheckInServiceReturn"); |
|
151 |
if (list.Count > 0) |
|
152 |
{ |
|
153 |
if (list[0].InnerText == "Success") |
|
154 |
{ |
|
155 |
return new KeyValuePair<bool, string>(true, "Success"); |
|
156 |
} |
|
157 |
else |
|
158 |
{ |
|
159 |
return new KeyValuePair<bool, string>(false, "Fail"); |
|
160 |
} |
|
161 |
} |
|
162 |
else |
|
163 |
{ |
|
164 |
return new KeyValuePair<bool, string>(false, "Not Completed"); |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
} |
|
172 |
catch (Exception ex) |
|
173 |
{ |
|
174 |
return new KeyValuePair<bool, string>(false, ex.Message); |
|
175 |
} |
|
176 |
|
|
177 |
//return new KeyValuePair<bool, string>(_ResultFlag,_ResultMsg); |
|
178 |
} |
|
179 |
|
|
180 |
static void webClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) |
|
181 |
{ |
|
182 |
Console.WriteLine("UploadStringCompleted: {0}", e.Result); |
|
183 |
} |
|
184 |
public static void SendOnMessage(string subject, string content) |
|
185 |
{ |
|
186 |
|
|
187 |
//MailMessage mail = new MailMessage(); |
|
188 |
//mail.From = new MailAddress("h2011357@daelim.co.kr", "시스템관리자", System.Text.Encoding.UTF8); |
|
189 |
//mail.To.Add("h2011357@daelim.co.kr"); |
|
190 |
//mail.Subject = subject; |
|
191 |
//mail.Body = content; |
|
192 |
//mail.BodyEncoding = System.Text.Encoding.UTF8;//한글이 안깨지기 위해서 사용 |
|
193 |
//mail.SubjectEncoding = System.Text.Encoding.UTF8;//한글이 안깨지기 위해서 사용 |
|
194 |
|
|
195 |
//SmtpClient SmtpServer = new SmtpClient("any.daelim.co.kr"); |
|
196 |
//SmtpServer.Send(mail); // 메일 발송 |
|
197 |
//mail.Dispose(); |
|
198 |
} |
|
199 |
public static void WriteLog(string strLog) |
|
200 |
{ |
|
201 |
StreamWriter log; |
|
202 |
FileStream fileStream = null; |
|
203 |
DirectoryInfo logDirInfo = null; |
|
204 |
FileInfo logFileInfo; |
|
205 |
|
|
206 |
string logFilePath = "C:\\Logs\\"; |
|
207 |
logFilePath = logFilePath + "Log-" + System.DateTime.Today.ToString("MM-dd-yyyy") + "." + "txt"; |
|
208 |
logFileInfo = new FileInfo(logFilePath); |
|
209 |
logDirInfo = new DirectoryInfo(logFileInfo.DirectoryName); |
|
210 |
if (!logDirInfo.Exists) logDirInfo.Create(); |
|
211 |
if (!logFileInfo.Exists) |
|
212 |
{ |
|
213 |
fileStream = logFileInfo.Create(); |
|
214 |
} |
|
215 |
else |
|
216 |
{ |
|
217 |
fileStream = new FileStream(logFilePath, FileMode.Append); |
|
218 |
} |
|
219 |
log = new StreamWriter(fileStream); |
|
220 |
log.WriteLine(strLog); |
|
221 |
log.Close(); |
|
222 |
} |
|
223 |
} |
|
224 |
} |
FinalService/KCOM_FinalService/UploadFinal/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.0"/></startup></configuration> |
내보내기 Unified diff