프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / MarkupToPDF / Common / GetUserSign.cs @ f001add7

이력 | 보기 | 이력해설 | 다운로드 (2.43 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
        /// 
16
        /// <summary>
17
        /// Application Data Folder
18
        /// </summary>
19
        /// 
20
        public static string AppDataFolder
21
        {
22
            get
23
            {
24
                return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MARKUS");
25
            }
26
        }
27

    
28
        [DllImport("kernel32")]
29
        private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
30

    
31
	    /// <summary>
32
        /// get signature of given user of given project
33
        /// </summary>
34
        /// <param name="UserID"></param>
35
        /// <param name="ProjectNo"></param>
36
        /// <returns></returns>
37
        public static string GetSign(string UserID, string ProjectNo)
38
        {
39
            BasicHttpBinding _binding;
40
            EndpointAddress _EndPoint;
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, "MARKUS.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
}
클립보드 이미지 추가 (최대 크기: 500 MB)