프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Controller / Controllers / MarkusInfoController.cs @ d8bd4799

이력 | 보기 | 이력해설 | 다운로드 (3.81 KB)

1 c112c3c3 taeseongkim
using ID2.Manager.Dapper.Repository;
2
using ID2.Manager.Data.Models;
3
using Newtonsoft.Json;
4
using System;
5
using System.Collections.Generic;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
10
namespace ID2.Manager.Controller.Controllers
11
{
12
    public class MarkusInfoController : BaseController
13
    {
14 c7f3eb42 taeseongkim
        //public IEnumerable<MarkupText> GetMarkupData(IEnumerable<string> ProjectNoList, IEnumerable<string> DocumentNoList)
15
        //{
16
        //    IEnumerable<MarkupText> result = null;
17 0b008ea6 taeseongkim
18 c7f3eb42 taeseongkim
        //    using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
19
        //    {
20
        //        result = rep.GetMarkupText(ProjectNoList, DocumentNoList);
21
        //    }
22 0b008ea6 taeseongkim
23 c7f3eb42 taeseongkim
        //    return result;
24
        //}
25 c112c3c3 taeseongkim
26 753a1c26 taeseongkim
        public bool SetProperties(IEnumerable<string> ProjectNoList)
27
        {
28
            bool result = false;
29
30
            try
31
            {
32
                using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
33
                {
34
                    foreach (var ProjectNo in ProjectNoList)
35
                    {
36
                        rep.InsertProperties(ProjectNo);
37
                    }
38
                    result = true;
39
                }
40
41
            }
42
            catch (Exception)
43
            {
44
                throw;
45
            }
46
47
            return result;
48
        }
49
50 45322477 taeseongkim
        public int GetConvertDoc(string ProjectNo, string DOCUMENT_ID)
51
        {
52
            int result = -1;
53
54
            try
55
            {
56
                using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
57
                {
58
                    result = rep.GetConvertDoc(ProjectNo, DOCUMENT_ID);
59
                }
60
61
            }
62
            catch (Exception)
63
            {
64
                throw;
65
            }
66
67
            return result;
68
        }
69
70 c112c3c3 taeseongkim
        public bool SetMarkusInfo(List<Documents> docList)
71
        {
72
            bool result = false;
73
            
74 fe57f64a yoush97
            using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
75 c112c3c3 taeseongkim
            {
76
                foreach (var item in docList)
77
                {
78
                    try
79
                    {
80 6c3bdda6 yoush97
                        result = rep.Insert(item.RefProjectCode, item.DocumentNo);
81 c112c3c3 taeseongkim
82
                        if (!result)
83
                        {
84
                            throw new Exception($"Insert Item Error.");
85
                        }
86
                    }
87
                    catch (Exception ex)
88
                    {
89
                        result = false;
90
                        this.Exception = new Exception($"{JsonConvert.SerializeObject(item)}",ex);
91
                        break;
92
                    }
93
                }
94
            }
95
96
            return result;
97
        }
98 5b086e44 taeseongkim
99
        public bool SetMembers(IEnumerable<UserInfo> users)
100
        {
101
            bool result = false;
102
103
            try
104
            {
105
                using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
106
                {
107
                    foreach (var user in users)
108
                    {
109
                        rep.InsertOrUpdateUsers(new Dapper.Entities.MEMBER
110
                        {
111
                            ID = user.ID,
112
                            NAME = user.Name,
113
                            DEPARTMENT = "SAMSUNG ELEC",
114
                            POSITION = user.Role,
115
                            EMAIL_ADDRESS = user.ID,
116
                            PASSWORD = "",
117
                            COMPANY = "SAMSUNG ELEC",
118
                            CREATE_DATETIME = DateTime.Now,
119
                            MODIFIED_DATETIME = DateTime.Now,
120
                            ISLICENSE = 1
121
                        });
122
                    }
123
124
                    result = true;
125
                }
126
            }
127
            catch (Exception)
128
            {
129
                throw;
130
            }
131
132
            return result;
133
        }
134 c112c3c3 taeseongkim
    }
135
}
클립보드 이미지 추가 (최대 크기: 500 MB)