markus / MarkupToPDF / Common / GetUserSign.cs @ e52385b9
이력 | 보기 | 이력해설 | 다운로드 (2.45 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.Runtime.InteropServices; |
8 |
using System.ServiceModel; |
9 |
using System.Text; |
10 |
|
11 |
namespace MarkupToPDF.Common |
12 |
{ |
13 |
public class GetUserSign |
14 |
{ |
15 |
public BasicHttpBinding _binding; |
16 |
public EndpointAddress _EndPoint; |
17 |
/// <summary> |
18 |
/// get signature of given user of given project |
19 |
/// </summary> |
20 |
/// <param name="UserID"></param> |
21 |
/// <param name="ProjectNo"></param> |
22 |
/// <returns></returns> |
23 |
/// |
24 |
/// <summary> |
25 |
/// Application Data Folder |
26 |
/// </summary> |
27 |
/// |
28 |
public static string AppDataFolder |
29 |
{ |
30 |
get |
31 |
{ |
32 |
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MARKUS"); |
33 |
} |
34 |
} |
35 |
|
36 |
[DllImport("kernel32")] |
37 |
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); |
38 |
|
39 |
public string GetSign(string UserID, string ProjectNo) |
40 |
{ |
41 |
|
42 |
_binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); |
43 |
_binding.MaxBufferSize = 2147483647; |
44 |
_binding.MaxReceivedMessageSize = 2147483647; |
45 |
_binding.OpenTimeout = new TimeSpan(0, 1, 0); |
46 |
_binding.ReceiveTimeout = new TimeSpan(0, 10, 0); |
47 |
_binding.CloseTimeout = new TimeSpan(0, 5, 0); |
48 |
_binding.SendTimeout = new TimeSpan(0, 5, 0); |
49 |
_binding.TextEncoding = System.Text.Encoding.UTF8; |
50 |
_binding.TransferMode = TransferMode.Buffered; |
51 |
|
52 |
StringBuilder BaseClientAddress = new StringBuilder(512); |
53 |
GetPrivateProfileString("BaseClientAddress", "URL", "(NONE)", BaseClientAddress, 512, Path.Combine(AppDataFolder, "FinalService.ini")); |
54 |
|
55 |
//string sBaseServiceURL = global::MarkupToPDF.Properties.Settings.Default.BaseClientAddress; |
56 |
string sBaseServiceURL = BaseClientAddress.ToString(); |
57 |
|
58 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", sBaseServiceURL)); |
59 |
|
60 |
markus_api.ServiceDeepViewClient client = new markus_api.ServiceDeepViewClient(_binding, _EndPoint); |
61 |
var _sign = client.GetSignData(ProjectNo, UserID); |
62 |
|
63 |
return _sign; |
64 |
} |
65 |
} |
66 |
} |