markus / MarkupToPDF / Common / GetUserSign.cs @ 5c3caba6
이력 | 보기 | 이력해설 | 다운로드 (4.79 KB)
1 | 787a4489 | KangIngu | using KCOMDataModel.Common; |
---|---|---|---|
2 | using KCOMDataModel.DataModel; |
||
3 | using System; |
||
4 | using System.Collections.Generic; |
||
5 | using System.IO; |
||
6 | using System.Linq; |
||
7 | eb5cdefc | djkim | using System.Net; |
8 | e52385b9 | ljiyeon | using System.Runtime.InteropServices; |
9 | 2aac9b2b | djkim | using System.ServiceModel; |
10 | 787a4489 | KangIngu | using System.Text; |
11 | |||
12 | namespace MarkupToPDF.Common |
||
13 | { |
||
14 | public class GetUserSign |
||
15 | { |
||
16 | e52385b9 | ljiyeon | /// |
17 | c247e6b4 | humkyung | /// <summary> |
18 | e52385b9 | ljiyeon | /// Application Data Folder |
19 | /// </summary> |
||
20 | /// |
||
21 | public static string AppDataFolder |
||
22 | { |
||
23 | get |
||
24 | { |
||
25 | return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MARKUS"); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | 5928384e | djkim | |
30 | 5529d2a2 | humkyung | /// <summary> |
31 | c247e6b4 | humkyung | /// get signature of given user of given project |
32 | /// </summary> |
||
33 | /// <param name="UserID"></param> |
||
34 | /// <param name="ProjectNo"></param> |
||
35 | /// <returns></returns> |
||
36 | cdfb57ff | taeseongkim | public static string GetSign(string UserID, string ProjectNo,bool isExternal= false) |
37 | 787a4489 | KangIngu | { |
38 | 6843ac13 | taeseongkim | string sBaseServiceURL = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
39 | |||
40 | System.ServiceModel.Channels.Binding binding; |
||
41 | 661b7416 | humkyung | EndpointAddress _EndPoint; |
42 | |||
43 | 6843ac13 | taeseongkim | Uri serviceUri = new Uri(sBaseServiceURL); |
44 | |||
45 | if (serviceUri.Scheme == Uri.UriSchemeHttp) |
||
46 | { |
||
47 | var _basichttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); |
||
48 | _basichttpbinding.MaxBufferSize = 2147483647; |
||
49 | _basichttpbinding.MaxReceivedMessageSize = 2147483647; |
||
50 | _basichttpbinding.OpenTimeout = new TimeSpan(0, 1, 0); |
||
51 | _basichttpbinding.ReceiveTimeout = new TimeSpan(0, 10, 0); |
||
52 | _basichttpbinding.CloseTimeout = new TimeSpan(0, 5, 0); |
||
53 | _basichttpbinding.SendTimeout = new TimeSpan(0, 5, 0); |
||
54 | _basichttpbinding.TextEncoding = System.Text.Encoding.UTF8; |
||
55 | _basichttpbinding.TransferMode = TransferMode.Buffered; |
||
56 | |||
57 | binding = _basichttpbinding; |
||
58 | } |
||
59 | else |
||
60 | { |
||
61 | var customBinding = new System.ServiceModel.Channels.CustomBinding() |
||
62 | { |
||
63 | OpenTimeout = new TimeSpan(0, 30, 0), |
||
64 | ReceiveTimeout = new TimeSpan(0, 30, 0), |
||
65 | CloseTimeout = new TimeSpan(0, 30, 0), |
||
66 | SendTimeout = new TimeSpan(0, 30, 0), |
||
67 | }; |
||
68 | var httpTranport = new System.ServiceModel.Channels.HttpsTransportBindingElement |
||
69 | { |
||
70 | MaxBufferPoolSize = Int32.MaxValue, |
||
71 | MaxBufferSize = Int32.MaxValue, |
||
72 | MaxReceivedMessageSize = Int32.MaxValue, |
||
73 | RequestInitializationTimeout = new TimeSpan(0, 30, 0), |
||
74 | }; |
||
75 | |||
76 | customBinding.CreateBindingElements(); |
||
77 | |||
78 | var reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement(); |
||
79 | |||
80 | var encoding = new System.ServiceModel.Channels.TextMessageEncodingBindingElement |
||
81 | { |
||
82 | MaxReadPoolSize = Int32.MaxValue, |
||
83 | MaxWritePoolSize = Int32.MaxValue, |
||
84 | MessageVersion = System.ServiceModel.Channels.MessageVersion.Soap12WSAddressing10, |
||
85 | WriteEncoding = System.Text.Encoding.UTF8, |
||
86 | ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas |
||
87 | { |
||
88 | MaxArrayLength = Int32.MaxValue, |
||
89 | MaxBytesPerRead = Int32.MaxValue, |
||
90 | MaxDepth = Int32.MaxValue, |
||
91 | MaxNameTableCharCount = Int32.MaxValue, |
||
92 | MaxStringContentLength = Int32.MaxValue |
||
93 | } |
||
94 | }; |
||
95 | customBinding.Elements.Add(reliableSession); |
||
96 | customBinding.Elements.Add(httpTranport); |
||
97 | |||
98 | binding = customBinding; |
||
99 | } |
||
100 | |||
101 | 7405922f | djkim | string localdomain = CommonLib.Common.GetConfigString("HOST_DOMAIN", "DOMAIN", ""); |
102 | |||
103 | 366f00c2 | taeseongkim | var hostEntry = CommonLib.DNSHelper.GetHostEntryTask(); |
104 | 7405922f | djkim | |
105 | if (hostEntry == null) |
||
106 | { |
||
107 | System.Diagnostics.Debug.WriteLine("(hostEntry == null"); |
||
108 | isExternal = true; |
||
109 | } |
||
110 | else if (!hostEntry.HostName.EndsWith(localdomain)) |
||
111 | { |
||
112 | // 외부 사용자 |
||
113 | isExternal = true; |
||
114 | } |
||
115 | eb5cdefc | djkim | //CommonLib.Common.GetConfigString("BaseClientAddress", "URL", ""); |
116 | c247e6b4 | humkyung | |
117 | 2aac9b2b | djkim | _EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", sBaseServiceURL)); |
118 | |||
119 | 6843ac13 | taeseongkim | markus_api.ServiceDeepViewClient client = new markus_api.ServiceDeepViewClient(binding, _EndPoint); |
120 | 2aac9b2b | djkim | var _sign = client.GetSignData(ProjectNo, UserID); |
121 | |||
122 | return _sign; |
||
123 | 787a4489 | KangIngu | } |
124 | } |
||
125 | 5529d2a2 | humkyung | } |