프로젝트

일반

사용자정보

개정판 cf1cc862

IDcf1cc86209f30c6cca4ed6ad8249fe7539cc5421
상위 1305c420
하위 d21e9c15

김태성이(가) 3년 이상 전에 추가함

licensing 수정

Change-Id: I3bffa280e0205be1031c133bf4716929fcbd7c54

차이점 보기:

KCOM_API/MarkusService.svc.cs
1
using System;
1
using KCOMDataModel.DataModel;
2
using System;
2 3
using System.Collections.Generic;
4
using System.Configuration;
3 5
using System.Linq;
4 6
using System.Runtime.Serialization;
5 7
using System.ServiceModel;
......
13 15
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
14 16
    public class MarkusService : System.Web.Services.WebService
15 17
    {
16
        [WebInvoke(Method = "POST", UriTemplate = "GetAdjustList", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
18
        [WebGet(UriTemplate = "AddMember?UserId={UserId}&Name={Name}&Company={Company}&Department={Department}&Position={Position}&email={email}", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
17 19
        [OperationContract]
18
        public Item GetAdjustList(string projectNo, string DocumentId)
20
        public AddMemberResults AddMember(string UserId,string Name, string Company, string Department,string Position,string email)
19 21
        {
20
            return GetTestData();
22
            AddMemberResults results = new AddMemberResults(false,null);
23

  
24
            try
25
            {
26
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
27
                using (CIEntities _ci = new CIEntities(sCIConnString))
28
                {
29
                    if (_ci.MEMBER.Count(x => x.ID == UserId) == 0)
30
                    {
31
                        _ci.AddToMEMBER(new MEMBER
32
                        {
33
                            ID = UserId,
34
                            NAME = Name,
35
                            COMPANY = Company,
36
                            DEPARTMENT = Department,
37
                            POSITION = Position,
38
                            EMAIL_ADDRESS = email,
39
                            MODIFIED_DATETIME = DateTime.Now,
40
                            CREATE_DATETIME = DateTime.Now
41
                        });
42

  
43
                        _ci.SaveChanges();
44

  
45
                        results.IsSuccess = true;
46
                    }
47
                    else
48
                    {
49
                        results.Message = "User already exists.";
50
                    }
51
                }
52
            }
53
            catch (Exception ex)
54
            {
55
                results.Message = "system Error";
56
            }
57
            finally
58
            {
59

  
60
            }
61

  
62
            return results;
21 63
        }
22 64

  
23
        [WebInvoke(Method = "POST", UriTemplate = "GetAdjustCommantList", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
65
        [WebInvoke(UriTemplate = "GetMembers",Method ="POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
24 66
        [OperationContract]
25
        public Item GetAdjustCommantList(string projectNo, string DocumentId)
67
        public GetMembersResults GetMembers()
26 68
        {
27
            return GetTestData();
28
        }
69
            GetMembersResults results = new GetMembersResults();
29 70

  
30
        //[WebInvoke(Method = "POST", UriTemplate = "GetAdjustCommantList", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
31
        //[OperationContract]
32
        //public Item GetAdjustCommantList(string projectNo, string DocumentId)
33
        //{
34
        //    return GetTestData();
35
        //}
36

  
37
        private Item GetTestData()
38
        {
39
            return new Item
71
            try
40 72
            {
41
                ProjectNo = "111111",
42
                DocumentID = Guid.NewGuid().ToString(),
43
                aId = Guid.NewGuid().ToString(),
44
                Condition = true.ToString(),
45
                mdId = Guid.NewGuid().ToString(),
46
                rId = Guid.NewGuid().ToString(),
47
                mrComments = new List<Commant>
73
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
74
                using (CIEntities _ci = new CIEntities(sCIConnString))
48 75
                {
49
                    new Commant{comment = "test",created = "Test" ,createdBy ="ff",createdByName = "test",modified = "aa",modifiedBy = "test",modifiedByName = "aa",id ="aa"},
50
                    new Commant{comment = "test",created = "Test" ,createdBy ="ff",createdByName = "test",modified = "aa",modifiedBy = "test",modifiedByName = "aa",id ="aa"},
51
                    new Commant{comment = "test",created = "Test" ,createdBy ="ff",createdByName = "test",modified = "aa",modifiedBy = "test",modifiedByName = "aa",id ="aa"},
52
                    new Commant{comment = "test",created = "Test" ,createdBy ="ff",createdByName = "test",modified = "aa",modifiedBy = "test",modifiedByName = "aa",id ="aa"}
76
                    if (_ci.MEMBER.Count() > 0)
77
                    {
78
                        results.Members = _ci.MEMBER.Select(m => new Member
79
                        {
80
                            ID = m.ID,
81
                            NAME = m.NAME,
82
                            COMPANY = m.COMPANY,
83
                            DEPARTMENT = m.DEPARTMENT,
84
                            POSITION = m.POSITION,
85
                            EMAIL_ADDRESS = m.EMAIL_ADDRESS
86
                        }).ToArray();
87
                    }
53 88
                }
89
            }
90
            catch (Exception ex)
91
            {
92
            }
93
            finally
94
            {
54 95

  
55
            };
56
        }
96
            }
57 97

  
98
            return results;
99
        }
58 100
    }
59 101
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)