프로젝트

일반

사용자정보

개정판 5b086e44

ID5b086e44afbe872fbb9519290b295e160bc735de
상위 7298c115
하위 cfac6784

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

issue #00000 markus user insert 로직 추가

Change-Id: Id93ae38b80f01f5f2c660445ee7f2640dc63855d

차이점 보기:

ID2.Manager/ID2.Manager.Controller/Controllers/MarkusInfoController.cs
51 51

  
52 52
            return result;
53 53
        }
54

  
55
        public bool SetMembers(IEnumerable<UserInfo> users)
56
        {
57
            bool result = false;
58

  
59
            try
60
            {
61
                using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR))
62
                {
63
                    foreach (var user in users)
64
                    {
65
                        rep.InsertOrUpdateUsers(new Dapper.Entities.MEMBER
66
                        {
67
                            ID = user.ID,
68
                            NAME = user.Name,
69
                            DEPARTMENT = "SAMSUNG ELEC",
70
                            POSITION = user.Role,
71
                            EMAIL_ADDRESS = user.ID,
72
                            PASSWORD = "",
73
                            COMPANY = "SAMSUNG ELEC",
74
                            CREATE_DATETIME = DateTime.Now,
75
                            MODIFIED_DATETIME = DateTime.Now,
76
                            ISLICENSE = 1
77
                        });
78
                    }
79

  
80
                    result = true;
81
                }
82
            }
83
            catch (Exception)
84
            {
85
                throw;
86
            }
87

  
88
            return result;
89
        }
54 90
    }
55 91
}
ID2.Manager/ID2.Manager.Dapper/Entities/MEMBER.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6

  
7
namespace ID2.Manager.Dapper.Entities
8
{
9
    public class MEMBER
10
    {
11
       public string ID { get; set; }
12
        public string DEPARTMENT { get; set; }
13
        public string NAME { get; set; }
14
        public string POSITION { get; set; }
15
        public string EMAIL_ADDRESS { get; set; }
16
        public string PASSWORD { get; set; }
17
        public string COMPANY { get; set; }
18
        public DateTime? CREATE_DATETIME { get; set; }
19
        public DateTime? MODIFIED_DATETIME { get; set; }
20
        public int? ISLICENSE { get; set; }
21
    }
22
}
ID2.Manager/ID2.Manager.Dapper/ID2.Manager.Dapper.csproj
65 65
    <Compile Include="Entities\ConvertDoc.cs" />
66 66
    <Compile Include="Entities\DocPage.cs" />
67 67
    <Compile Include="Entities\DOCUMENTITEM.cs" />
68
    <Compile Include="Entities\MEMBER.cs" />
68 69
    <Compile Include="IBaseRepository.cs" />
69 70
    <Compile Include="Properties\AssemblyInfo.cs" />
70 71
    <Compile Include="Repository\BaseRepository.cs" />
ID2.Manager/ID2.Manager.Dapper/Repository/MarkusRepository.cs
44 44
            return result;
45 45
        }
46 46

  
47
        public bool InsertOrUpdateUsers(List<UserInfo> users)
47
        public bool InsertOrUpdateUsers(MEMBER member)
48 48
        {
49 49
            bool result = false;
50 50

  
51 51
            try
52 52
            {
53
                var oMember = GetMEMBER(member.ID);
53 54

  
55
                if(oMember?.Count() > 0)
56
                {
57
                    var tran = BeginTransaction();
58

  
59
                    string SQL = "UPDATE MEMBER" +
60
                        " SET " +
61
                        "DEPARTMENT = @DEPARTMENT" +
62
                        ",NAME = @NAME" +
63
                        ",POSITION = @POSITION" +
64
                        ",EMAIL_ADDRESS = @EMAIL_ADDRESS" +
65
                        ",PASSWORD = @PASSWORD" +
66
                        ",COMPANY = @COMPANY" +
67
                        ",CREATE_DATETIME = @CREATE_DATETIME" +
68
                        ",MODIFIED_DATETIME = @MODIFIED_DATETIME" +
69
                        ",ISLICENSE = @ISLICENSE" +
70
                        "WHERE ID = @ID";
71

  
72

  
73
                    var parameters = new DynamicParameters();
74
                    parameters.Add("@ID", member.ID);
75
                    parameters.Add("@DEPARTMENT", member.DEPARTMENT);
76
                    parameters.Add("@NAME", member.NAME);
77
                    parameters.Add("@POSITION", member.POSITION);
78
                    parameters.Add("@EMAIL_ADDRESS", member.EMAIL_ADDRESS);
79
                    parameters.Add("@PASSWORD", member.PASSWORD);
80
                    parameters.Add("@COMPANY", member.COMPANY);
81
                    parameters.Add("@CREATE_DATETIME", member.CREATE_DATETIME);
82
                    parameters.Add("@MODIFIED_DATETIME", member.MODIFIED_DATETIME);
83
                    parameters.Add("@ISLICENSE", member.ISLICENSE);
84

  
85
                    var rowsAffected = base.Execute(SQL, parameters, tran);
86

  
87

  
88
                    if (rowsAffected < 0)
89
                    {
90
                        result = false;
91
                    }
92
                    else
93
                    {
94
                        tran.Commit();
95
                    }
96
                }
97
                else
98
                {
99
                    var tran = BeginTransaction();
100

  
101
                    string SQL = "INSERT INTO MEMBER (ID,DEPARTMENT,NAME,POSITION,EMAIL_ADDRESS,PASSWORD,COMPANY,CREATE_DATETIME,MODIFIED_DATETIME,ISLICENSE) " +
102
                        "VALUES (@ID,@DEPARTMENT,@NAME,@POSITION,@EMAIL_ADDRESS,@PASSWORD,@COMPANY,@CREATE_DATETIME,@MODIFIED_DATETIME,@ISLICENSE)";
103

  
104

  
105
                    var parameters = new DynamicParameters();
106
                    parameters.Add("@ID", member.ID);
107
                    parameters.Add("@DEPARTMENT", member.DEPARTMENT);
108
                    parameters.Add("@NAME", member.NAME);
109
                    parameters.Add("@POSITION", member.POSITION);
110
                    parameters.Add("@EMAIL_ADDRESS", member.EMAIL_ADDRESS);
111
                    parameters.Add("@PASSWORD", member.PASSWORD);
112
                    parameters.Add("@COMPANY", member.COMPANY);
113
                    parameters.Add("@CREATE_DATETIME", member.CREATE_DATETIME);
114
                    parameters.Add("@MODIFIED_DATETIME", member.MODIFIED_DATETIME);
115
                    parameters.Add("@ISLICENSE", member.ISLICENSE);
116

  
117
                    var rowsAffected = base.Execute(SQL, parameters, tran);
118

  
119

  
120
                    if(rowsAffected < 0)
121
                    {
122
                        result = false;
123
                    }
124
                    else
125
                    {
126
                        tran.Commit();
127
                    }
128
                }
54 129
            }
55 130
            catch (Exception ex)
56 131
            {
57

  
132
                throw new Exception($"userId : {member.ID}",ex);
58 133
            }
59 134

  
60 135
            return result;
61 136
        }
62 137

  
138
        public IEnumerable<MEMBER> GetMEMBER(string id)
139
        {
140
            string SQL = "SELECT * FROM MEMBER WHERE ID = @ID";
141

  
142
            var parameters = new DynamicParameters();
143
            parameters.Add("@ID", id);
144

  
145
            return base.Query<MEMBER>(SQL, parameters);
146
        }
147

  
63 148
        public IEnumerable<ConvertDoc> GetConvertDoc(int status,string ProjectNo)
64 149
        {
65 150
            string SQL = "SELECT * FROM CONVERTER_DOC WHERE STATUS = @STATUS and PROJECT_NO = @PROJECT_NO";
ID2.Manager/ID2.Manager/Log.config
1
<?xml version="1.0" encoding="utf-8"?>
2
<configuration>
3
	<configSections>
4
		<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
5
	</configSections>
6
	<log4net>
7
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
8
      <file type="log4net.Util.PatternString" value="${LOCALAPPDATA}\ID2Manager\.log"/>
9
      <appendToFile value="true" />
10
      <rollingStyle value="Composite" />
11
      <datePattern value="yyyyMMdd" />
12
      <maxSizeRollBackups value="6" />
13
      <preserveLogFileNameExtension value="true"/>
14
      <staticLogFileName value="false" />
15
      <maximumFileSize value="5MB" />
16
      <layout type="log4net.Layout.PatternLayout">
17
        <conversionpattern value="%d [%t] %-5p - %m%n"/>
18
      </layout>
19
    </appender>
20
		<root>
21
			<level value="All" />
22
			<appender-ref ref="RollingFileAppender" />
23
		</root>
24
	</log4net>
25
</configuration>
ID2.Manager/ID2.Manager/Main.cs
1323 1323

  
1324 1324
                    bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
1325 1325

  
1326
                    if (result && markusResult)
1326
                    var users = new UserController().GetAllUserInfo();
1327

  
1328
                    bool markusMembersResult = new MarkusInfoController().SetMembers(users);
1329

  
1330
                    if (result && markusResult && markusMembersResult)
1327 1331
                    {
1328 1332
                        RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1329 1333

  
......
1337 1341
                    {
1338 1342
                        RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1339 1343
                    }
1344
                    else if (!markusMembersResult)
1345
                    {
1346
                        RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1347
                    }
1340 1348
                };
1341 1349
                worker.StartWork();
1342 1350
            }
......
1344 1352

  
1345 1353
        private void RadButtonElementSaveCommand_Click(object sender, EventArgs e)
1346 1354
        {
1347
            this.SetSaved();
1355
            try
1356
            {
1357
                this.SetSaved();
1358
            }
1359
            catch (Exception ex)
1360
            {
1361
                Program.logger.Error(ex);
1362
            }
1348 1363
        }
1349 1364

  
1350 1365
        private void RadButtonElementSave_Click(object sender, EventArgs e)
1351 1366
        {
1352
            this.SetSaved();
1367
            try
1368
            {
1369
                this.SetSaved();
1370
            }
1371
            catch (Exception ex)
1372
            {
1373
                Program.logger.Error(ex);
1374
            }
1353 1375
        }
1354 1376

  
1355 1377
        private void RadButtonElementSync_Click(object sender, EventArgs e)

내보내기 Unified diff

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