개정판 a4a166e2
issue #0000
해당 프로젝트 Group 의 Document 만 ID2와 Sync되도록 수정
Change-Id: I7a737c6fee0e93a93cd33ab7b810b89992796225
ID2.Manager/ID2.Manager.Controller/Controllers/DocumentController.cs | ||
---|---|---|
16 | 16 |
|
17 | 17 |
public DocumentController(ID2ProjectInfo id2Info) : base(id2Info) { } |
18 | 18 |
|
19 |
public IEnumerable<Documents> GetAllDocuments() |
|
19 |
public IEnumerable<Documents> GetAllDocuments(string projectGroupID)
|
|
20 | 20 |
{ |
21 | 21 |
try |
22 | 22 |
{ |
23 | 23 |
using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR)) |
24 | 24 |
{ |
25 |
return rep.GetAllDocuments(); |
|
25 |
return rep.GetAllDocuments(projectGroupID);
|
|
26 | 26 |
} |
27 | 27 |
} |
28 | 28 |
catch (Exception ex) |
... | ... | |
200 | 200 |
} |
201 | 201 |
} |
202 | 202 |
|
203 |
public bool SetID2Sync(List<ID2ProjectInfo> id2Infos, string userId) |
|
203 |
public bool SetID2Sync(string projectGroupID, List<ID2ProjectInfo> id2Infos, string userId)
|
|
204 | 204 |
{ |
205 | 205 |
bool isSuccess = false; |
206 | 206 |
|
207 | 207 |
try |
208 | 208 |
{ |
209 |
IEnumerable<Documents> docs = this.GetAllDocuments(); |
|
209 |
IEnumerable<Documents> docs = this.GetAllDocuments(projectGroupID);
|
|
210 | 210 |
List<ID2Drawings> id2docs = null; |
211 | 211 |
|
212 | 212 |
if (id2Infos.Any()) |
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs | ||
---|---|---|
16 | 16 |
{ |
17 | 17 |
public DocumentRepository(string connectionStr) : base(connectionStr) { } |
18 | 18 |
|
19 |
public IEnumerable<Documents> GetAllDocuments() |
|
19 |
public IEnumerable<Documents> GetAllDocuments(string projectGroupID)
|
|
20 | 20 |
{ |
21 |
var dynamicParameters = new DynamicParameters(); |
|
22 |
StringBuilder sbWhere = new StringBuilder(); |
|
23 |
var parameters = new Dictionary<string, object>(); |
|
24 |
if (!string.IsNullOrEmpty(projectGroupID)) |
|
25 |
{ |
|
26 |
sbWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID=@RefGroupID) "); |
|
27 |
parameters.Add("RefGroupID", projectGroupID); |
|
28 |
} |
|
29 |
|
|
21 | 30 |
try |
22 | 31 |
{ |
23 | 32 |
string query = $@" |
24 | 33 |
select doc.* |
25 | 34 |
from dbo.Documents doc |
26 |
where doc.IsDeleted=0 |
|
35 |
where doc.IsDeleted=0 {sbWhere}
|
|
27 | 36 |
order by doc.Seq;"; |
28 |
return Query<Documents>(query); |
|
37 |
|
|
38 |
if (parameters.Count > 0) |
|
39 |
{ |
|
40 |
dynamicParameters.AddDynamicParams(parameters); |
|
41 |
} |
|
42 |
|
|
43 |
return Query<Documents>(query, dynamicParameters); |
|
29 | 44 |
} |
30 | 45 |
catch (Exception ex) |
31 | 46 |
{ |
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
1460 | 1460 |
{ |
1461 | 1461 |
var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList(); |
1462 | 1462 |
|
1463 |
bool result = new DocumentController().SetID2Sync(id2Prjs, informations.ActiveUser.ID); |
|
1463 |
bool result = new DocumentController().SetID2Sync(informations.ActiveProject.ProjectID, id2Prjs, informations.ActiveUser.ID);
|
|
1464 | 1464 |
|
1465 | 1465 |
if (result) |
1466 | 1466 |
{ |
내보내기 Unified diff