개정판 c112c3c3
issue #00000 MarkusInfoController 추가
ID2.Manager/ID2.Manager.Controller/Controllers/BaseController.cs | ||
---|---|---|
10 | 10 |
{ |
11 | 11 |
public class BaseController |
12 | 12 |
{ |
13 |
public Exception Exception; |
|
14 |
|
|
13 | 15 |
public string _DbConnectionStr = string.Empty; |
14 | 16 |
|
15 | 17 |
public BaseController() |
ID2.Manager/ID2.Manager.Controller/Controllers/MarkusInfoController.cs | ||
---|---|---|
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 |
|
|
15 |
public bool SetMarkusInfo(List<Documents> docList) |
|
16 |
{ |
|
17 |
bool result = false; |
|
18 |
|
|
19 |
using (MarkusRepository rep = new MarkusRepository(this._DbConnectionStr)) |
|
20 |
{ |
|
21 |
foreach (var item in docList) |
|
22 |
{ |
|
23 |
try |
|
24 |
{ |
|
25 |
result = rep.Insert(item.Place, item.DocumentNo); |
|
26 |
|
|
27 |
if (!result) |
|
28 |
{ |
|
29 |
throw new Exception($"Insert Item Error."); |
|
30 |
} |
|
31 |
} |
|
32 |
catch (Exception ex) |
|
33 |
{ |
|
34 |
result = false; |
|
35 |
this.Exception = new Exception($"{JsonConvert.SerializeObject(item)}",ex); |
|
36 |
break; |
|
37 |
} |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
return result; |
|
42 |
} |
|
43 |
} |
|
44 |
} |
ID2.Manager/ID2.Manager.Controller/ID2.Manager.Controller.csproj | ||
---|---|---|
44 | 44 |
<ItemGroup> |
45 | 45 |
<Compile Include="Controllers\BaseController.cs" /> |
46 | 46 |
<Compile Include="Controllers\DocumentController.cs" /> |
47 |
<Compile Include="Controllers\MarkusInfoController.cs" /> |
|
47 | 48 |
<Compile Include="Controllers\UserController.cs" /> |
48 | 49 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
49 | 50 |
</ItemGroup> |
... | ... | |
57 | 58 |
<Name>ID2.Manager.Data</Name> |
58 | 59 |
</ProjectReference> |
59 | 60 |
</ItemGroup> |
61 |
<ItemGroup> |
|
62 |
<PackageReference Include="Newtonsoft.Json"> |
|
63 |
<Version>13.0.3</Version> |
|
64 |
</PackageReference> |
|
65 |
</ItemGroup> |
|
60 | 66 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
61 | 67 |
</Project> |
ID2.Manager/ID2.Manager.Dapper/Repository/BaseRepository.cs | ||
---|---|---|
126 | 126 |
return this._DbConnection.Execute(query, param, dbTran); |
127 | 127 |
} |
128 | 128 |
|
129 |
|
|
130 |
public int Execute(string SQL, SqlMapper.IDynamicParameters parameters, IDbTransaction transaction, CommandType commandType) |
|
131 |
{ |
|
132 |
if (_DbConnection.State != System.Data.ConnectionState.Open) |
|
133 |
{ |
|
134 |
_DbConnection.Open(); |
|
135 |
} |
|
136 |
|
|
137 |
|
|
138 |
return _DbConnection.Execute(SQL, parameters, transaction, commandType: commandType); |
|
139 |
} |
|
140 |
|
|
129 | 141 |
public async Task<int> ExecuteAsync(string query, object param, IDbTransaction dbTran) |
130 | 142 |
{ |
131 | 143 |
if (this._DbConnection.State != ConnectionState.Open) |
ID2.Manager/ID2.Manager.Dapper/Repository/MarkusRepository.cs | ||
---|---|---|
14 | 14 |
{ |
15 | 15 |
public MarkusRepository(string connectionStr) : base(connectionStr) { } |
16 | 16 |
|
17 |
public async Task<bool> InsertAsync(string ProjectNo,string Name)
|
|
17 |
public bool Insert(string ProjectNo,string Name)
|
|
18 | 18 |
{ |
19 | 19 |
bool result = false; |
20 | 20 |
|
21 |
var convertDocID = await CreateConvertDocAsync(ProjectNo, Name, Name);
|
|
21 |
var convertDocID = CreateConvertDoc(ProjectNo, Name, Name);
|
|
22 | 22 |
|
23 | 23 |
if (convertDocID != null) |
24 | 24 |
{ |
25 | 25 |
|
26 |
var docInfoID = await CreateDocInfoAsync(convertDocID, 1);
|
|
26 |
var docInfoID = CreateDocInfo(convertDocID, 1);
|
|
27 | 27 |
|
28 |
var docPageResult = await CreateDocPageAsync(new[]{
|
|
28 |
var docPageResult = CreateDocPage(new[]{
|
|
29 | 29 |
new DocPage { |
30 | 30 |
page_angle = 0, |
31 | 31 |
page_width = "9600", |
... | ... | |
34 | 34 |
|
35 | 35 |
} }); |
36 | 36 |
|
37 |
var documentItemID = await CreateOrUPdateDocItemAsync(
|
|
37 |
var documentItemID = CreateOrUPdateDocItem(
|
|
38 | 38 |
new DOCUMENTITEM |
39 | 39 |
{ |
40 | 40 |
REVISION = "0", |
... | ... | |
62 | 62 |
/// <param name="DOCUMENT_URL"></param> |
63 | 63 |
/// <param name="DOCUMENT_ID"></param> |
64 | 64 |
/// <returns></returns> |
65 |
public async Task<string> CreateConvertDocAsync(string PROJECT_NO, string DOCUMENT_URL, string DOCUMENT_ID)
|
|
65 |
public string CreateConvertDoc(string PROJECT_NO, string DOCUMENT_URL, string DOCUMENT_ID)
|
|
66 | 66 |
{ |
67 | 67 |
string result = null; |
68 | 68 |
try |
... | ... | |
75 | 75 |
parameters.Add("@document_id", value: DOCUMENT_ID); |
76 | 76 |
parameters.Add("@newid", direction: ParameterDirection.Output); |
77 | 77 |
|
78 |
await base.ExecuteAsync("convert_insert_convertdoc", parameters, transaction: tran, commandType: CommandType.StoredProcedure);
|
|
78 |
base.Execute("convert_insert_convertdoc", parameters, transaction: tran, commandType: CommandType.StoredProcedure);
|
|
79 | 79 |
|
80 | 80 |
tran.Commit(); |
81 | 81 |
|
... | ... | |
94 | 94 |
/// </summary> |
95 | 95 |
/// <param name="documentItem"></param> |
96 | 96 |
/// <returns>Create or Update id</returns> |
97 |
public async Task<string> CreateOrUPdateDocItemAsync(DOCUMENTITEM documentItem)
|
|
97 |
public string CreateOrUPdateDocItem(DOCUMENTITEM documentItem)
|
|
98 | 98 |
{ |
99 | 99 |
string result = null; |
100 | 100 |
|
... | ... | |
113 | 113 |
parameter.Add("@group_no", documentItem.GROUP_NO); |
114 | 114 |
parameter.Add("@newid", direction: ParameterDirection.Output); |
115 | 115 |
|
116 |
await base.ExecuteAsync("convert_insert_documentitem", parameter, tran, commandType: CommandType.StoredProcedure);
|
|
116 |
base.Execute("convert_insert_documentitem", parameter, tran, commandType: CommandType.StoredProcedure);
|
|
117 | 117 |
|
118 | 118 |
tran.Commit(); |
119 | 119 |
|
... | ... | |
130 | 130 |
/// <param name="convertDocID"></param> |
131 | 131 |
/// <param name="PageCount"></param> |
132 | 132 |
/// <returns></returns> |
133 |
public async Task<string> CreateDocInfoAsync(string convertDocID, int PageCount)
|
|
133 |
public string CreateDocInfo(string convertDocID, int PageCount)
|
|
134 | 134 |
{ |
135 | 135 |
string result = ""; |
136 | 136 |
var tran = BeginTransaction(); |
... | ... | |
142 | 142 |
parameters.Add("@errorcode", dbType: DbType.Int32, direction: ParameterDirection.Output); |
143 | 143 |
parameters.Add("@error", dbType: DbType.String, direction: ParameterDirection.Output, size: 500); |
144 | 144 |
|
145 |
await base.ExecuteAsync("convert_insert_docinfo", parameters, tran, commandType: CommandType.StoredProcedure);
|
|
145 |
base.Execute("convert_insert_docinfo", parameters, tran, commandType: CommandType.StoredProcedure);
|
|
146 | 146 |
|
147 | 147 |
var errorCode = parameters.Get<int>("errorcode"); |
148 | 148 |
var error = parameters.Get<string>("error"); |
... | ... | |
163 | 163 |
} |
164 | 164 |
|
165 | 165 |
|
166 |
public async Task<bool> CreateDocPageAsync(IEnumerable<DocPage> docPages)
|
|
166 |
public bool CreateDocPage(IEnumerable<DocPage> docPages)
|
|
167 | 167 |
{ |
168 | 168 |
bool result = false; |
169 | 169 |
|
... | ... | |
175 | 175 |
|
176 | 176 |
parameter.AddTable("DOCPAGES", "TYPE_INSERT_DOCPAGE", docPages); |
177 | 177 |
|
178 |
var id = await base.ExecuteAsync("CONVERT_INSERT_DOCPAGE", parameter, tran, commandType: CommandType.StoredProcedure);
|
|
178 |
var id = base.Execute("CONVERT_INSERT_DOCPAGE", parameter, tran, commandType: CommandType.StoredProcedure);
|
|
179 | 179 |
|
180 | 180 |
tran.Commit(); |
181 | 181 |
|
ID2.Manager/ID2.Manager/Classes/MarkusUriCreate.cs | ||
---|---|---|
1 |
using Newtonsoft.Json; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Threading.Tasks; |
|
7 |
|
|
8 |
namespace ID2.Manager.Classes |
|
9 |
{ |
|
10 |
public static class MarkusUriCreate |
|
11 |
{ |
|
12 |
public static string Get(string ProjectNo,string Name,string userID) |
|
13 |
{ |
|
14 |
return "kcom://" + CreateMarkusParam(ProjectNo, Name,userID,false, false,true); |
|
15 |
} |
|
16 |
|
|
17 |
public static string CreateMarkusParam(string projectNo, string documentID, string userID, bool partner, bool createfinal, bool newcomment) |
|
18 |
{ |
|
19 |
OpenProperties viewInfo = new OpenProperties(); |
|
20 |
|
|
21 |
viewInfo.DocumentItemID = documentID; |
|
22 |
viewInfo.ProjectNO = projectNo; |
|
23 |
viewInfo.UserID = userID; |
|
24 |
viewInfo.bPartner = partner; |
|
25 |
viewInfo.CreateFinalPDFPermission = createfinal; |
|
26 |
viewInfo.NewCommentPermission = newcomment; |
|
27 |
|
|
28 |
return ParamEncoding(JsonConvert.SerializeObject(viewInfo)); |
|
29 |
|
|
30 |
} |
|
31 |
public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null) |
|
32 |
{ |
|
33 |
|
|
34 |
if (oEncoding == null) |
|
35 |
oEncoding = System.Text.Encoding.UTF8; |
|
36 |
|
|
37 |
return Convert.ToBase64String(oEncoding.GetBytes(EncodingText)); |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
} |
|
42 |
} |
ID2.Manager/ID2.Manager/Classes/OpenProperties.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.Classes |
|
8 |
{ |
|
9 |
public class OpenProperties |
|
10 |
{ |
|
11 |
public string DocumentItemID { get; set; } |
|
12 |
public bool bPartner { get; set; } |
|
13 |
public bool CreateFinalPDFPermission { get; set; } |
|
14 |
public bool NewCommentPermission { get; set; } |
|
15 |
public string ProjectNO { get; set; } |
|
16 |
public string UserID { get; set; } |
|
17 |
public int Mode { get; set; } |
|
18 |
} |
|
19 |
} |
ID2.Manager/ID2.Manager/ID2.Manager.csproj | ||
---|---|---|
48 | 48 |
</ItemGroup> |
49 | 49 |
<ItemGroup> |
50 | 50 |
<Compile Include="Classes\BaseWorker.cs" /> |
51 |
<Compile Include="Classes\MarkusUriCreate.cs" /> |
|
52 |
<Compile Include="Classes\OpenProperties.cs" /> |
|
51 | 53 |
<Compile Include="Controls\AutoCADViewer.cs"> |
52 | 54 |
<SubType>UserControl</SubType> |
53 | 55 |
</Compile> |
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
178 | 178 |
MessageBox.Show($"{e.Column.Name} 실행"); |
179 | 179 |
break; |
180 | 180 |
case "MarkupLink": |
181 |
if (e.Row.DataBoundItem is Documents doc) |
|
182 |
{ |
|
183 |
if (!string.IsNullOrWhiteSpace(doc.Place) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(doc.PersonInCharge)) |
|
184 |
{ |
|
185 |
MarkusUriCreate.Get(doc.Place, doc.DocumentNo, doc.PersonInCharge); |
|
186 |
} |
|
187 |
} |
|
188 |
|
|
181 | 189 |
MessageBox.Show($"{e.Column.Name} 실행"); |
182 | 190 |
break; |
183 | 191 |
case "AVEVALink": |
... | ... | |
626 | 634 |
if (result) |
627 | 635 |
{ |
628 | 636 |
RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
637 |
|
|
638 |
bool markusResult = new MarkusInfoController().SetMarkusInfo(setDocuments); |
|
639 |
|
|
629 | 640 |
this.GetDocList(); |
630 | 641 |
} |
631 | 642 |
else |
내보내기 Unified diff