markus / MarkupToPDF / Common / GetUserSign.cs @ eb5cdefc
이력 | 보기 | 이력해설 | 다운로드 (2.67 KB)
1 |
using KCOMDataModel.Common; |
---|---|
2 |
using KCOMDataModel.DataModel; |
3 |
using System; |
4 |
using System.Collections.Generic; |
5 |
using System.IO; |
6 |
using System.Linq; |
7 |
using System.Net; |
8 |
using System.Runtime.InteropServices; |
9 |
using System.ServiceModel; |
10 |
using System.Text; |
11 |
|
12 |
namespace MarkupToPDF.Common |
13 |
{ |
14 |
public class GetUserSign |
15 |
{ |
16 |
/// |
17 |
/// <summary> |
18 |
/// 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 |
|
30 |
/// <summary> |
31 |
/// get signature of given user of given project |
32 |
/// </summary> |
33 |
/// <param name="UserID"></param> |
34 |
/// <param name="ProjectNo"></param> |
35 |
/// <returns></returns> |
36 |
public static string GetSign(string UserID, string ProjectNo) |
37 |
{ |
38 |
BasicHttpBinding _binding; |
39 |
EndpointAddress _EndPoint; |
40 |
|
41 |
_binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); |
42 |
_binding.MaxBufferSize = 2147483647; |
43 |
_binding.MaxReceivedMessageSize = 2147483647; |
44 |
_binding.OpenTimeout = new TimeSpan(0, 1, 0); |
45 |
_binding.ReceiveTimeout = new TimeSpan(0, 10, 0); |
46 |
_binding.CloseTimeout = new TimeSpan(0, 5, 0); |
47 |
_binding.SendTimeout = new TimeSpan(0, 5, 0); |
48 |
_binding.TextEncoding = System.Text.Encoding.UTF8; |
49 |
_binding.TransferMode = TransferMode.Buffered; |
50 |
|
51 |
string localdomain = CommonLib.Common.GetConfigString("HOST_DOMAIN", "DOMAIN", ""); |
52 |
var ipaddress = CommonLib.DNSHelper.GetDnsAdress(); |
53 |
bool isExternal = false; |
54 |
try |
55 |
{ |
56 |
var hostName = Dns.GetHostEntry(ipaddress).HostName; |
57 |
|
58 |
if (!hostName.EndsWith(localdomain)) |
59 |
{ |
60 |
// 외부 사용자 |
61 |
isExternal = true; |
62 |
} |
63 |
} |
64 |
catch (Exception ex) |
65 |
{ |
66 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
67 |
} |
68 |
string sBaseServiceURL = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
69 |
//CommonLib.Common.GetConfigString("BaseClientAddress", "URL", ""); |
70 |
|
71 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", sBaseServiceURL)); |
72 |
|
73 |
markus_api.ServiceDeepViewClient client = new markus_api.ServiceDeepViewClient(_binding, _EndPoint); |
74 |
var _sign = client.GetSignData(ProjectNo, UserID); |
75 |
|
76 |
return _sign; |
77 |
} |
78 |
} |
79 |
} |