프로젝트

일반

사용자정보

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

hytos / ID2.Manager / ID2.Manager.Controller / Controllers / MarkusInfoController.cs @ 7a9c6a5b

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

1
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
        //public IEnumerable<MarkupText> GetMarkupData(IEnumerable<string> ProjectNoList, IEnumerable<string> DocumentNoList)
15
        //{
16
        //    IEnumerable<MarkupText> result = null;
17

    
18
        //    using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
19
        //    {
20
        //        result = rep.GetMarkupText(ProjectNoList, DocumentNoList);
21
        //    }
22

    
23
        //    return result;
24
        //}
25

    
26
        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
        public bool SetMarkusInfo(List<Documents> docList)
51
        {
52
            bool result = false;
53
            
54
            using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
55
            {
56
                foreach (var item in docList)
57
                {
58
                    try
59
                    {
60
                        result = rep.Insert(item.RefProjectCode, item.DocumentNo);
61

    
62
                        if (!result)
63
                        {
64
                            throw new Exception($"Insert Item Error.");
65
                        }
66
                    }
67
                    catch (Exception ex)
68
                    {
69
                        result = false;
70
                        this.Exception = new Exception($"{JsonConvert.SerializeObject(item)}",ex);
71
                        break;
72
                    }
73
                }
74
            }
75

    
76
            return result;
77
        }
78

    
79
        public bool SetMembers(IEnumerable<UserInfo> users)
80
        {
81
            bool result = false;
82

    
83
            try
84
            {
85
                using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
86
                {
87
                    foreach (var user in users)
88
                    {
89
                        rep.InsertOrUpdateUsers(new Dapper.Entities.MEMBER
90
                        {
91
                            ID = user.ID,
92
                            NAME = user.Name,
93
                            DEPARTMENT = "SAMSUNG ELEC",
94
                            POSITION = user.Role,
95
                            EMAIL_ADDRESS = user.ID,
96
                            PASSWORD = "",
97
                            COMPANY = "SAMSUNG ELEC",
98
                            CREATE_DATETIME = DateTime.Now,
99
                            MODIFIED_DATETIME = DateTime.Now,
100
                            ISLICENSE = 1
101
                        });
102
                    }
103

    
104
                    result = true;
105
                }
106
            }
107
            catch (Exception)
108
            {
109
                throw;
110
            }
111

    
112
            return result;
113
        }
114
    }
115
}
클립보드 이미지 추가 (최대 크기: 500 MB)