개정판 195f079d
issue #0000 DIG project 추가
Change-Id: I4c33372aa9b1e354ad399321f21d13a346a81564
ConvertionWebServiceDefault/Conversion.asmx.cs | ||
---|---|---|
1 |
using IConverterPDF; |
|
1 |
//using IConverterPDF;
|
|
2 | 2 |
using KCOMDataModel.DataModel; |
3 | 3 |
using KCOMDataModel.Common; |
4 | 4 |
using log4net; |
... | ... | |
23 | 23 |
public class Conversion : System.Web.Services.WebService |
24 | 24 |
{ |
25 | 25 |
|
26 |
RemConverterPDFObject remObj = null; |
|
26 |
//RemConverterPDFObject remObj = null;
|
|
27 | 27 |
protected ILog logger = LogManager.GetLogger(typeof(Conversion)); |
28 | 28 |
public Conversion() |
29 | 29 |
{ |
30 |
try |
|
31 |
{ |
|
32 |
System.Runtime.Remoting.Channels.IChannel _ch = ChannelServices.GetChannel("tcp");
|
|
33 |
|
|
34 |
if(_ch == null)
|
|
35 |
{
|
|
36 |
TcpChannel chan = new TcpChannel();
|
|
37 |
ChannelServices.RegisterChannel(chan, false);
|
|
38 |
}
|
|
39 |
// Create an instance of the remote object
|
|
40 |
remObj = (RemConverterPDFObject)Activator.GetObject(typeof(RemConverterPDFObject),
|
|
41 |
Properties.Settings.Default.ConverterRemotingUrl);
|
|
42 |
|
|
43 |
} |
|
44 |
catch (Exception ex) |
|
45 |
{ |
|
46 |
logger.Error("Conversion Web Service Conversion Error", ex); |
|
47 |
SendNotice(ex.ToString()); |
|
48 |
} |
|
30 |
//try
|
|
31 |
//{
|
|
32 |
// //System.Runtime.Remoting.Channels.IChannel _ch = ChannelServices.GetChannel("tcp");
|
|
33 |
|
|
34 |
// //if(_ch == null)
|
|
35 |
// //{
|
|
36 |
// // TcpChannel chan = new TcpChannel();
|
|
37 |
// // ChannelServices.RegisterChannel(chan, false);
|
|
38 |
// //}
|
|
39 |
// //// Create an instance of the remote object
|
|
40 |
// //remObj = (RemConverterPDFObject)Activator.GetObject(typeof(RemConverterPDFObject),
|
|
41 |
// // Properties.Settings.Default.ConverterRemotingUrl);
|
|
42 |
|
|
43 |
//}
|
|
44 |
//catch (Exception ex)
|
|
45 |
//{
|
|
46 |
// logger.Error("Conversion Web Service Conversion Error", ex);
|
|
47 |
// SendNotice(ex.ToString());
|
|
48 |
//}
|
|
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
private void SendNotice(string ex) |
... | ... | |
129 | 129 |
} |
130 | 130 |
return _result; |
131 | 131 |
} |
132 |
|
|
133 | 132 |
private string SendKcom(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url, string ignoreComment) |
134 | 133 |
{ |
135 | 134 |
string result = false.ToString(); |
136 | 135 |
|
137 |
if (remObj == null) |
|
138 |
{ |
|
139 |
result = "Window Service Connection Error"; |
|
140 |
} |
|
141 |
else |
|
142 |
{ |
|
136 |
|
|
143 | 137 |
//string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
144 | 138 |
string _id = shortGuid(); |
145 | 139 |
string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
... | ... | |
183 | 177 |
} |
184 | 178 |
catch (Exception ex) |
185 | 179 |
{ |
186 |
result = "deleteobject error:"+ex.ToString();
|
|
180 |
result = "deleteobject error:" + ex.ToString();
|
|
187 | 181 |
} |
188 |
|
|
189 |
}else |
|
182 |
|
|
183 |
} |
|
184 |
else |
|
190 | 185 |
{ |
191 | 186 |
doc.REVISION = rev_No; |
192 | 187 |
doc.ORIGINAL_FILE = document_Url; |
193 | 188 |
doc.GROUP_NO = group_No; |
194 | 189 |
doc.DOCUMENT_NO = document_No; |
195 | 190 |
doc.DOCUMENT_NAME = document_Name; |
196 |
} |
|
197 |
}else |
|
191 |
} |
|
192 |
} |
|
193 |
else |
|
198 | 194 |
{ |
199 | 195 |
_entity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
200 | 196 |
{ |
... | ... | |
206 | 202 |
ORIGINAL_FILE = document_Url, |
207 | 203 |
DOCUMENT_ID = _doc_id, |
208 | 204 |
PROJECT_NO = prj_No, |
209 |
});
|
|
205 |
}); |
|
210 | 206 |
} |
211 | 207 |
|
212 | 208 |
_entity.SaveChanges(); |
... | ... | |
223 | 219 |
}); |
224 | 220 |
_kcomEntity.SaveChanges(); |
225 | 221 |
} |
226 |
} |
|
227 | 222 |
|
228 |
if (Properties.Settings.Default.MARKUS_V3_PROJECTS.Split(',').Contains(prj_No))
|
|
223 |
try
|
|
229 | 224 |
{ |
230 |
try |
|
231 |
{ |
|
232 |
System.Net.WebClient client = new System.Net.WebClient(); |
|
233 |
var convertResult = client.DownloadString($"{Properties.Settings.Default.MARKUS_V3_ADDRESS}/Rest/ConvertAdd?ProjectNo={prj_No}&ConvertID={_id}"); |
|
225 |
System.Net.WebClient client = new System.Net.WebClient(); |
|
226 |
var convertResult = client.DownloadString($"{Properties.Settings.Default.MARKUS_V3_ADDRESS}/Rest/ConvertAdd?ProjectNo={prj_No}&ConvertID={_id}"); |
|
234 | 227 |
|
235 |
JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings()); |
|
236 |
result = jObject["ConvertAddResult"].ToString(); |
|
237 |
} |
|
238 |
catch (Exception ex) |
|
239 |
{ |
|
240 |
result = $"Markus V3 Connect Error {ex.Message}"; |
|
241 |
} |
|
228 |
JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings()); |
|
229 |
result = jObject["ConvertAddResult"].ToString(); |
|
242 | 230 |
} |
243 |
else
|
|
231 |
catch (Exception ex)
|
|
244 | 232 |
{ |
245 |
var convertResult = remObj.SetConverterPDF(prj_No, _id); |
|
246 |
|
|
247 |
if (convertResult.Exception != null) |
|
248 |
{ |
|
249 |
result = false.ToString(); |
|
250 |
} |
|
251 |
else |
|
252 |
{ |
|
253 |
result = true.ToString(); |
|
254 |
} |
|
233 |
result = $"Markus V3 Connect Error {ex.Message}"; |
|
255 | 234 |
} |
256 |
|
|
257 | 235 |
} |
258 | 236 |
|
259 | 237 |
return result; |
260 | 238 |
} |
261 |
[WebMethod] |
|
262 |
public string ManualConvert(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url) |
|
263 |
{ |
|
264 |
string _result = null; |
|
265 |
try |
|
266 |
{ |
|
267 |
using (KCOMEntities deepViewEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
268 |
{ |
|
269 |
//_result = ConnectStringBuilder.DeepViewConnectionString().ToString(); |
|
270 |
//var _RunProjects = deepViewEntity.RUN_PROJECTS.Where(r => r.PROJECT_NO == projNumber && DateTime.Parse(r.RUN_DATETIME)<= DateTime.Now); |
|
271 |
//var _RunProjects = deepViewEntity.RUN_PROJECTS.Where(r => r.PROJECT_NO == projNumber); |
|
272 |
var _RunProjects = deepViewEntity.RUN_PROJECTS.Where(r => r.PROJECT_NO != null); |
|
239 |
//private string SendKcom(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url, string ignoreComment) |
|
240 |
//{ |
|
241 |
// string result = false.ToString(); |
|
273 | 242 |
|
274 |
if (_RunProjects.Count() > 0) |
|
275 |
{ |
|
276 |
_result = ManualSendKcom(rev_No, document_No, document_Name, group_No, prj_No, document_Id, document_Url); |
|
277 |
} |
|
278 |
else |
|
279 |
{ |
|
280 |
_result = false.ToString(); |
|
281 |
} |
|
282 |
} |
|
283 |
} |
|
284 |
catch (Exception ex) |
|
285 |
{ |
|
286 |
logger.Error("Conversion Web Service ManualConvert Error", ex); |
|
287 |
_result = ex.Message.ToString(); |
|
288 |
SendNotice("Project NO : " + prj_No + "\r\n DocumentUrl : " + document_Url + "\r\n Error" + ex.ToString()); |
|
289 |
} |
|
290 |
return _result; |
|
291 |
} |
|
243 |
// if (remObj == null) |
|
244 |
// { |
|
245 |
// result = "Window Service Connection Error"; |
|
246 |
// } |
|
247 |
// else |
|
248 |
// { |
|
249 |
// //string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
|
250 |
// string _id = shortGuid(); |
|
251 |
// string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
|
252 |
|
|
253 |
// using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("").ToString())) |
|
254 |
// { |
|
255 |
// if (string.IsNullOrEmpty(group_No)) |
|
256 |
// { |
|
257 |
// group_No = "0"; |
|
258 |
// } |
|
259 |
// if (!document_Url.Contains("http%3a%2f%2f")) |
|
260 |
// { |
|
261 |
// document_Url = Base64Decode(document_Url); |
|
262 |
// document_Url = HttpUtility.UrlEncodeUnicode(document_Url); |
|
263 |
// } |
|
264 |
// document_Name = Base64DecodeFromStr(document_Name); |
|
265 |
// var doc = _entity.DOCUMENT_ITEM.Where(d => d.ID == document_Id).FirstOrDefault(); |
|
266 |
// if (doc != null) |
|
267 |
// { |
|
268 |
// if (bool.Parse(ignoreComment)) |
|
269 |
// { |
|
270 |
// try |
|
271 |
// { |
|
272 |
// var docinfo = _entity.DOCINFO.Where(x => x.DOCUMENT_ID == doc.DOCUMENT_ID).FirstOrDefault(); |
|
273 |
// var markupinfos = _entity.MARKUP_INFO.Where(x => x.DOCINFO_ID == docinfo.ID).ToList(); |
|
274 |
// foreach (var markupinfo in markupinfos) |
|
275 |
// { |
|
276 |
// var markupinfoversions = _entity.MARKUP_INFO_VERSION.Where(x => x.MARKUPINFO_ID == markupinfo.ID).ToList(); |
|
277 |
// foreach (var markupinfoversion in markupinfoversions) |
|
278 |
// { |
|
279 |
// var markupdatas = _entity.MARKUP_DATA.Where(x => x.MARKUPINFO_VERSION_ID == markupinfoversion.ID).ToList(); |
|
280 |
// foreach (var markupdata in markupdatas) |
|
281 |
// { |
|
282 |
// _entity.DeleteObject(markupdata); |
|
283 |
// } |
|
284 |
// _entity.DeleteObject(markupinfoversion); |
|
285 |
// } |
|
286 |
// _entity.DeleteObject(markupinfo); |
|
287 |
// } |
|
288 |
// _entity.SaveChanges(); |
|
289 |
// } |
|
290 |
// catch (Exception ex) |
|
291 |
// { |
|
292 |
// result = "deleteobject error:"+ex.ToString(); |
|
293 |
// } |
|
294 |
|
|
295 |
// }else |
|
296 |
// { |
|
297 |
// doc.REVISION = rev_No; |
|
298 |
// doc.ORIGINAL_FILE = document_Url; |
|
299 |
// doc.GROUP_NO = group_No; |
|
300 |
// doc.DOCUMENT_NO = document_No; |
|
301 |
// doc.DOCUMENT_NAME = document_Name; |
|
302 |
// } |
|
303 |
// }else |
|
304 |
// { |
|
305 |
// _entity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
|
306 |
// { |
|
307 |
// ID = document_Id, |
|
308 |
// REVISION = rev_No, |
|
309 |
// DOCUMENT_NO = document_No, |
|
310 |
// DOCUMENT_NAME = document_Name, |
|
311 |
// GROUP_NO = group_No, |
|
312 |
// ORIGINAL_FILE = document_Url, |
|
313 |
// DOCUMENT_ID = _doc_id, |
|
314 |
// PROJECT_NO = prj_No, |
|
315 |
// }); |
|
316 |
// } |
|
317 |
|
|
318 |
// _entity.SaveChanges(); |
|
319 |
|
|
320 |
// using (KCOMEntities _kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
321 |
// { |
|
322 |
// _kcomEntity.AddToCONVERTER_DOC(new CONVERTER_DOC |
|
323 |
// { |
|
324 |
// ID = _id, |
|
325 |
// CREATE_DATETIME = DateTime.Now, |
|
326 |
// DOCUMENT_URL = document_Url, |
|
327 |
// PROJECT_NO = prj_No, |
|
328 |
// DOCUMENT_ID = _doc_id, |
|
329 |
// }); |
|
330 |
// _kcomEntity.SaveChanges(); |
|
331 |
// } |
|
332 |
// } |
|
333 |
|
|
334 |
// if (Properties.Settings.Default.MARKUS_V3_PROJECTS.Split(',').Contains(prj_No)) |
|
335 |
// { |
|
336 |
// try |
|
337 |
// { |
|
338 |
// System.Net.WebClient client = new System.Net.WebClient(); |
|
339 |
// var convertResult = client.DownloadString($"{Properties.Settings.Default.MARKUS_V3_ADDRESS}/Rest/ConvertAdd?ProjectNo={prj_No}&ConvertID={_id}"); |
|
340 |
|
|
341 |
// JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings()); |
|
342 |
// result = jObject["ConvertAddResult"].ToString(); |
|
343 |
// } |
|
344 |
// catch (Exception ex) |
|
345 |
// { |
|
346 |
// result = $"Markus V3 Connect Error {ex.Message}"; |
|
347 |
// } |
|
348 |
// } |
|
349 |
// else |
|
350 |
// { |
|
351 |
// var convertResult = remObj.SetConverterPDF(prj_No, _id); |
|
352 |
|
|
353 |
// if (convertResult.Exception != null) |
|
354 |
// { |
|
355 |
// result = false.ToString(); |
|
356 |
// } |
|
357 |
// else |
|
358 |
// { |
|
359 |
// result = true.ToString(); |
|
360 |
// } |
|
361 |
// } |
|
362 |
|
|
363 |
// } |
|
364 |
|
|
365 |
// return result; |
|
366 |
//} |
|
367 |
//[WebMethod] |
|
368 |
//public string ManualConvert(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url) |
|
369 |
//{ |
|
370 |
// string _result = null; |
|
371 |
// try |
|
372 |
// { |
|
373 |
// using (KCOMEntities deepViewEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
374 |
// { |
|
375 |
// //_result = ConnectStringBuilder.DeepViewConnectionString().ToString(); |
|
376 |
// //var _RunProjects = deepViewEntity.RUN_PROJECTS.Where(r => r.PROJECT_NO == projNumber && DateTime.Parse(r.RUN_DATETIME)<= DateTime.Now); |
|
377 |
// //var _RunProjects = deepViewEntity.RUN_PROJECTS.Where(r => r.PROJECT_NO == projNumber); |
|
378 |
// var _RunProjects = deepViewEntity.RUN_PROJECTS.Where(r => r.PROJECT_NO != null); |
|
379 |
|
|
380 |
// if (_RunProjects.Count() > 0) |
|
381 |
// { |
|
382 |
// _result = ManualSendKcom(rev_No, document_No, document_Name, group_No, prj_No, document_Id, document_Url); |
|
383 |
// } |
|
384 |
// else |
|
385 |
// { |
|
386 |
// _result = false.ToString(); |
|
387 |
// } |
|
388 |
// } |
|
389 |
// } |
|
390 |
// catch (Exception ex) |
|
391 |
// { |
|
392 |
// logger.Error("Conversion Web Service ManualConvert Error", ex); |
|
393 |
// _result = ex.Message.ToString(); |
|
394 |
// SendNotice("Project NO : " + prj_No + "\r\n DocumentUrl : " + document_Url + "\r\n Error" + ex.ToString()); |
|
395 |
// } |
|
396 |
// return _result; |
|
397 |
//} |
|
292 | 398 |
[WebMethod] |
293 | 399 |
public string UpdateUrlEncode(string EnsembleId) |
294 | 400 |
{ |
... | ... | |
536 | 642 |
string _doc_id = ((UInt32)id.GetHashCode()).ToString(); |
537 | 643 |
return _doc_id; |
538 | 644 |
} |
539 |
[WebMethod] |
|
540 |
public string CoverConvert(string prj_No, string _id) |
|
541 |
{ |
|
542 |
string _result = null; |
|
543 |
try |
|
544 |
{ |
|
545 |
SendCoverConvert(prj_No, _id); |
|
546 |
} |
|
547 |
catch (Exception ex) |
|
548 |
{ |
|
549 |
logger.Error("Conversion Web Service CoverConvert Error", ex); |
|
550 |
_result = ex.Message.ToString(); |
|
551 |
} |
|
552 |
return _result; |
|
553 |
} |
|
554 |
private string SendCoverConvert(string prj_No, string _id) |
|
555 |
{ |
|
556 |
if (remObj == null) |
|
557 |
{ |
|
558 |
return "Window Service Connection Error"; |
|
559 |
} |
|
560 |
else |
|
561 |
{ |
|
562 |
var _result = remObj.SetConverterCoverPDF(prj_No, _id); |
|
645 |
//[WebMethod] |
|
646 |
//public string CoverConvert(string prj_No, string _id) |
|
647 |
//{ |
|
648 |
// string _result = null; |
|
649 |
// try |
|
650 |
// { |
|
651 |
// SendCoverConvert(prj_No, _id); |
|
652 |
// } |
|
653 |
// catch (Exception ex) |
|
654 |
// { |
|
655 |
// logger.Error("Conversion Web Service CoverConvert Error", ex); |
|
656 |
// _result = ex.Message.ToString(); |
|
657 |
// } |
|
658 |
// return _result; |
|
659 |
//} |
|
660 |
//private string SendCoverConvert(string prj_No, string _id) |
|
661 |
//{ |
|
662 |
// if (remObj == null) |
|
663 |
// { |
|
664 |
// return "Window Service Connection Error"; |
|
665 |
// } |
|
666 |
// else |
|
667 |
// { |
|
668 |
// var _result = remObj.SetConverterCoverPDF(prj_No, _id); |
|
669 |
|
|
670 |
// if (_result.Exception != null) |
|
671 |
// { |
|
672 |
// return false.ToString(); |
|
673 |
// } |
|
674 |
// else |
|
675 |
// { |
|
676 |
// return true.ToString(); |
|
677 |
// } |
|
678 |
// } |
|
679 |
//} |
|
563 | 680 |
|
564 |
if (_result.Exception != null) |
|
565 |
{ |
|
566 |
return false.ToString(); |
|
567 |
} |
|
568 |
else |
|
569 |
{ |
|
570 |
return true.ToString(); |
|
571 |
} |
|
572 |
} |
|
573 |
} |
|
574 | 681 |
private string SendKcom(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url) |
575 | 682 |
{ |
576 | 683 |
string result = false.ToString(); |
577 | 684 |
|
578 |
if (remObj == null) |
|
579 |
{ |
|
580 |
result = "Window Service Connection Error"; |
|
581 |
} |
|
582 |
else |
|
685 |
//string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
|
686 |
string _id = shortGuid(); |
|
687 |
string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
|
688 |
using (CIEntities _kcomEntity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("").ToString())) |
|
583 | 689 |
{ |
584 |
//string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
|
585 |
string _id = shortGuid(); |
|
586 |
string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
|
587 |
using (CIEntities _kcomEntity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("").ToString())) |
|
690 |
if (string.IsNullOrEmpty(group_No)) |
|
588 | 691 |
{ |
589 |
if (string.IsNullOrEmpty(group_No)) |
|
590 |
{ |
|
591 |
group_No = "0"; |
|
592 |
} |
|
593 |
if (!document_Url.Contains("http%3a%2f%2f")) |
|
594 |
{ |
|
595 |
document_Url = Base64Decode(document_Url); |
|
596 |
document_Url = System.Net.WebUtility.UrlEncode(document_Url); |
|
597 |
} |
|
598 |
document_Name = Base64DecodeFromStr(document_Name); |
|
599 |
|
|
600 |
var doc = _kcomEntity.DOCUMENT_ITEM.Where(d => d.PROJECT_NO == prj_No && d.ID == document_Id).FirstOrDefault(); |
|
601 |
if(doc != null) |
|
602 |
{ |
|
603 |
doc.DOCUMENT_ID = _doc_id; |
|
604 |
doc.REVISION = rev_No; |
|
605 |
doc.GROUP_NO = group_No; |
|
606 |
doc.DOCUMENT_NO = document_No; |
|
607 |
doc.DOCUMENT_NAME = document_Name; |
|
608 |
doc.ORIGINAL_FILE = document_Url; |
|
609 |
} |
|
610 |
else |
|
611 |
{ |
|
612 |
_kcomEntity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
|
613 |
{ |
|
614 |
ID = document_Id, |
|
615 |
REVISION = rev_No, |
|
616 |
DOCUMENT_NO = document_No, |
|
617 |
DOCUMENT_NAME = document_Name, |
|
618 |
GROUP_NO = group_No, |
|
619 |
ORIGINAL_FILE = document_Url, |
|
620 |
DOCUMENT_ID = _doc_id, |
|
621 |
PROJECT_NO = prj_No, |
|
622 |
}); |
|
623 |
} |
|
624 |
|
|
625 |
_kcomEntity.SaveChanges(); |
|
626 |
|
|
627 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
628 |
{ |
|
629 |
_entity.AddToCONVERTER_DOC(new CONVERTER_DOC |
|
630 |
{ |
|
631 |
ID = _id, |
|
632 |
CREATE_DATETIME = DateTime.Now, |
|
633 |
DOCUMENT_URL = document_Url, |
|
634 |
PROJECT_NO = prj_No, |
|
635 |
DOCUMENT_ID = _doc_id, |
|
636 |
}); |
|
637 |
|
|
638 |
_entity.SaveChanges(); |
|
639 |
} |
|
692 |
group_No = "0"; |
|
640 | 693 |
} |
641 |
|
|
642 |
if (Properties.Settings.Default.MARKUS_V3_PROJECTS.Split(',').Contains(prj_No)) |
|
694 |
if (!document_Url.Contains("http%3a%2f%2f")) |
|
643 | 695 |
{ |
644 |
try |
|
645 |
{ |
|
646 |
System.Net.WebClient client = new System.Net.WebClient(); |
|
647 |
var convertResult = client.DownloadString($"{Properties.Settings.Default.MARKUS_V3_ADDRESS}/Rest/ConvertAdd?ProjectNo={prj_No}&ConvertID={_id}"); |
|
648 |
|
|
649 |
JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings()); |
|
650 |
result = jObject["ConvertAddResult"].ToString(); |
|
651 |
} |
|
652 |
catch (Exception ex) |
|
653 |
{ |
|
654 |
logger.Error("Conversion Web Service SendKcom Error", ex); |
|
655 |
result = $"Markus V3 Connect Error {ex.Message}"; |
|
656 |
} |
|
696 |
document_Url = Base64Decode(document_Url); |
|
697 |
document_Url = System.Net.WebUtility.UrlEncode(document_Url); |
|
657 | 698 |
} |
658 |
else |
|
659 |
{ |
|
660 |
var convertResult = remObj.SetConverterPDF(prj_No, _id); |
|
699 |
document_Name = Base64DecodeFromStr(document_Name); |
|
661 | 700 |
|
662 |
if (convertResult.Exception != null) |
|
663 |
{ |
|
664 |
result = false.ToString(); |
|
665 |
} |
|
666 |
else |
|
667 |
{ |
|
668 |
result = true.ToString(); |
|
669 |
} |
|
701 |
var doc = _kcomEntity.DOCUMENT_ITEM.Where(d => d.PROJECT_NO == prj_No && d.ID == document_Id).FirstOrDefault(); |
|
702 |
if (doc != null) |
|
703 |
{ |
|
704 |
doc.DOCUMENT_ID = _doc_id; |
|
705 |
doc.REVISION = rev_No; |
|
706 |
doc.GROUP_NO = group_No; |
|
707 |
doc.DOCUMENT_NO = document_No; |
|
708 |
doc.DOCUMENT_NAME = document_Name; |
|
709 |
doc.ORIGINAL_FILE = document_Url; |
|
670 | 710 |
} |
671 |
|
|
672 |
} |
|
673 |
|
|
674 |
return result; |
|
675 |
} |
|
676 |
|
|
677 |
private string ManualSendKcom(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url) |
|
678 |
{ |
|
679 |
if (remObj == null) |
|
680 |
{ |
|
681 |
return "Window Service Connection Error"; |
|
682 |
} |
|
683 |
else |
|
684 |
{ |
|
685 |
//string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
|
686 |
string _id = shortGuid(); |
|
687 |
string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
|
688 |
using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("").ToString())) |
|
711 |
else |
|
689 | 712 |
{ |
690 |
var doc = _entity.DOCUMENT_ITEM.Where(d =>d.PROJECT_NO == prj_No && d.ID == document_Id).FirstOrDefault(); |
|
691 |
|
|
692 |
if (doc != null) |
|
693 |
{ |
|
694 |
using (KCOMEntities kCOMEntities = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
695 |
{ |
|
696 |
var converterdoc = kCOMEntities.CONVERTER_DOC.Where(c => c.PROJECT_NO == doc.PROJECT_NO && c.DOCUMENT_ID == doc.DOCUMENT_ID).FirstOrDefault(); |
|
697 |
_entity.DeleteObject(converterdoc); |
|
698 |
_entity.DeleteObject(doc); |
|
699 |
_entity.SaveChanges(); |
|
700 |
} |
|
701 |
|
|
702 |
document_Url = HttpUtility.UrlDecode(document_Url); |
|
703 |
} |
|
704 |
|
|
705 |
int cnt = _entity.DOCUMENT_ITEM.ToList().Count; |
|
706 |
if (string.IsNullOrEmpty(group_No)) |
|
707 |
{ |
|
708 |
group_No = "0"; |
|
709 |
} |
|
710 |
|
|
711 |
_entity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
|
713 |
_kcomEntity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
|
712 | 714 |
{ |
713 | 715 |
ID = document_Id, |
714 | 716 |
REVISION = rev_No, |
715 | 717 |
DOCUMENT_NO = document_No, |
716 | 718 |
DOCUMENT_NAME = document_Name, |
717 | 719 |
GROUP_NO = group_No, |
718 |
ORIGINAL_FILE = HttpUtility.UrlEncodeUnicode(document_Url),
|
|
720 |
ORIGINAL_FILE = document_Url,
|
|
719 | 721 |
DOCUMENT_ID = _doc_id, |
720 | 722 |
PROJECT_NO = prj_No, |
721 | 723 |
}); |
724 |
} |
|
722 | 725 |
|
723 |
_entity.SaveChanges();
|
|
726 |
_kcomEntity.SaveChanges();
|
|
724 | 727 |
|
725 |
using (KCOMEntities kCOMEntities = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
728 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
729 |
{ |
|
730 |
_entity.AddToCONVERTER_DOC(new CONVERTER_DOC |
|
726 | 731 |
{ |
727 |
kCOMEntities.AddToCONVERTER_DOC(new CONVERTER_DOC |
|
728 |
{ |
|
729 |
ID = _id, |
|
730 |
CREATE_DATETIME = DateTime.Now, |
|
731 |
DOCUMENT_URL = HttpUtility.UrlEncodeUnicode(document_Url), |
|
732 |
PROJECT_NO = prj_No, |
|
733 |
DOCUMENT_ID = _doc_id, |
|
734 |
}); |
|
732 |
ID = _id, |
|
733 |
CREATE_DATETIME = DateTime.Now, |
|
734 |
DOCUMENT_URL = document_Url, |
|
735 |
PROJECT_NO = prj_No, |
|
736 |
DOCUMENT_ID = _doc_id, |
|
737 |
}); |
|
735 | 738 |
|
736 |
kCOMEntities.SaveChanges(); |
|
737 |
} |
|
739 |
_entity.SaveChanges(); |
|
738 | 740 |
} |
739 |
var _result = remObj.SetConverterPDF(prj_No, _id);
|
|
741 |
}
|
|
740 | 742 |
|
741 |
if (_result.Exception != null) |
|
742 |
{
|
|
743 |
return false.ToString();
|
|
744 |
}
|
|
745 |
else
|
|
746 |
{ |
|
747 |
return true.ToString();
|
|
748 |
}
|
|
743 |
|
|
744 |
try
|
|
745 |
{
|
|
746 |
System.Net.WebClient client = new System.Net.WebClient();
|
|
747 |
var convertResult = client.DownloadString($"{Properties.Settings.Default.MARKUS_V3_ADDRESS}/Rest/ConvertAdd?ProjectNo={prj_No}&ConvertID={_id}");
|
|
748 |
|
|
749 |
JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings());
|
|
750 |
result = jObject["ConvertAddResult"].ToString();
|
|
749 | 751 |
} |
752 |
catch (Exception ex) |
|
753 |
{ |
|
754 |
logger.Error("Conversion Web Service SendKcom Error", ex); |
|
755 |
result = $"Markus V3 Connect Error {ex.Message}"; |
|
756 |
} |
|
757 |
|
|
758 |
|
|
759 |
return result; |
|
750 | 760 |
} |
751 | 761 |
|
762 |
//private string SendKcom(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url) |
|
763 |
//{ |
|
764 |
// string result = false.ToString(); |
|
765 |
|
|
766 |
// if (remObj == null) |
|
767 |
// { |
|
768 |
// result = "Window Service Connection Error"; |
|
769 |
// } |
|
770 |
// else |
|
771 |
// { |
|
772 |
// //string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
|
773 |
// string _id = shortGuid(); |
|
774 |
// string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
|
775 |
// using (CIEntities _kcomEntity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("").ToString())) |
|
776 |
// { |
|
777 |
// if (string.IsNullOrEmpty(group_No)) |
|
778 |
// { |
|
779 |
// group_No = "0"; |
|
780 |
// } |
|
781 |
// if (!document_Url.Contains("http%3a%2f%2f")) |
|
782 |
// { |
|
783 |
// document_Url = Base64Decode(document_Url); |
|
784 |
// document_Url = System.Net.WebUtility.UrlEncode(document_Url); |
|
785 |
// } |
|
786 |
// document_Name = Base64DecodeFromStr(document_Name); |
|
787 |
|
|
788 |
// var doc = _kcomEntity.DOCUMENT_ITEM.Where(d => d.PROJECT_NO == prj_No && d.ID == document_Id).FirstOrDefault(); |
|
789 |
// if (doc != null) |
|
790 |
// { |
|
791 |
// doc.DOCUMENT_ID = _doc_id; |
|
792 |
// doc.REVISION = rev_No; |
|
793 |
// doc.GROUP_NO = group_No; |
|
794 |
// doc.DOCUMENT_NO = document_No; |
|
795 |
// doc.DOCUMENT_NAME = document_Name; |
|
796 |
// doc.ORIGINAL_FILE = document_Url; |
|
797 |
// } |
|
798 |
// else |
|
799 |
// { |
|
800 |
// _kcomEntity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
|
801 |
// { |
|
802 |
// ID = document_Id, |
|
803 |
// REVISION = rev_No, |
|
804 |
// DOCUMENT_NO = document_No, |
|
805 |
// DOCUMENT_NAME = document_Name, |
|
806 |
// GROUP_NO = group_No, |
|
807 |
// ORIGINAL_FILE = document_Url, |
|
808 |
// DOCUMENT_ID = _doc_id, |
|
809 |
// PROJECT_NO = prj_No, |
|
810 |
// }); |
|
811 |
// } |
|
812 |
|
|
813 |
// _kcomEntity.SaveChanges(); |
|
814 |
|
|
815 |
// using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
816 |
// { |
|
817 |
// _entity.AddToCONVERTER_DOC(new CONVERTER_DOC |
|
818 |
// { |
|
819 |
// ID = _id, |
|
820 |
// CREATE_DATETIME = DateTime.Now, |
|
821 |
// DOCUMENT_URL = document_Url, |
|
822 |
// PROJECT_NO = prj_No, |
|
823 |
// DOCUMENT_ID = _doc_id, |
|
824 |
// }); |
|
825 |
|
|
826 |
// _entity.SaveChanges(); |
|
827 |
// } |
|
828 |
// } |
|
829 |
|
|
830 |
// if (Properties.Settings.Default.MARKUS_V3_PROJECTS.Split(',').Contains(prj_No)) |
|
831 |
// { |
|
832 |
// try |
|
833 |
// { |
|
834 |
// System.Net.WebClient client = new System.Net.WebClient(); |
|
835 |
// var convertResult = client.DownloadString($"{Properties.Settings.Default.MARKUS_V3_ADDRESS}/Rest/ConvertAdd?ProjectNo={prj_No}&ConvertID={_id}"); |
|
836 |
|
|
837 |
// JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings()); |
|
838 |
// result = jObject["ConvertAddResult"].ToString(); |
|
839 |
// } |
|
840 |
// catch (Exception ex) |
|
841 |
// { |
|
842 |
// logger.Error("Conversion Web Service SendKcom Error", ex); |
|
843 |
// result = $"Markus V3 Connect Error {ex.Message}"; |
|
844 |
// } |
|
845 |
// } |
|
846 |
// else |
|
847 |
// { |
|
848 |
// var convertResult = remObj.SetConverterPDF(prj_No, _id); |
|
849 |
|
|
850 |
// if (convertResult.Exception != null) |
|
851 |
// { |
|
852 |
// result = false.ToString(); |
|
853 |
// } |
|
854 |
// else |
|
855 |
// { |
|
856 |
// result = true.ToString(); |
|
857 |
// } |
|
858 |
// } |
|
859 |
|
|
860 |
// } |
|
861 |
|
|
862 |
// return result; |
|
863 |
//} |
|
864 |
|
|
865 |
//private string ManualSendKcom(string rev_No, string document_No, string document_Name, string group_No, string prj_No, string document_Id, string document_Url) |
|
866 |
//{ |
|
867 |
// if (remObj == null) |
|
868 |
// { |
|
869 |
// return "Window Service Connection Error"; |
|
870 |
// } |
|
871 |
// else |
|
872 |
// { |
|
873 |
// //string _id = GetGuid(0, GuidGenerator.GetUniqueGuid()).ToString(); |
|
874 |
// string _id = shortGuid(); |
|
875 |
// string _doc_id = ((UInt32)document_Id.GetHashCode()).ToString(); |
|
876 |
// using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("").ToString())) |
|
877 |
// { |
|
878 |
// var doc = _entity.DOCUMENT_ITEM.Where(d =>d.PROJECT_NO == prj_No && d.ID == document_Id).FirstOrDefault(); |
|
879 |
|
|
880 |
// if (doc != null) |
|
881 |
// { |
|
882 |
// using (KCOMEntities kCOMEntities = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
883 |
// { |
|
884 |
// var converterdoc = kCOMEntities.CONVERTER_DOC.Where(c => c.PROJECT_NO == doc.PROJECT_NO && c.DOCUMENT_ID == doc.DOCUMENT_ID).FirstOrDefault(); |
|
885 |
// _entity.DeleteObject(converterdoc); |
|
886 |
// _entity.DeleteObject(doc); |
|
887 |
// _entity.SaveChanges(); |
|
888 |
// } |
|
889 |
|
|
890 |
// document_Url = HttpUtility.UrlDecode(document_Url); |
|
891 |
// } |
|
892 |
|
|
893 |
// int cnt = _entity.DOCUMENT_ITEM.ToList().Count; |
|
894 |
// if (string.IsNullOrEmpty(group_No)) |
|
895 |
// { |
|
896 |
// group_No = "0"; |
|
897 |
// } |
|
898 |
|
|
899 |
// _entity.AddToDOCUMENT_ITEM(new DOCUMENT_ITEM |
|
900 |
// { |
|
901 |
// ID = document_Id, |
|
902 |
// REVISION = rev_No, |
|
903 |
// DOCUMENT_NO = document_No, |
|
904 |
// DOCUMENT_NAME = document_Name, |
|
905 |
// GROUP_NO = group_No, |
|
906 |
// ORIGINAL_FILE = HttpUtility.UrlEncodeUnicode(document_Url), |
|
907 |
// DOCUMENT_ID = _doc_id, |
|
908 |
// PROJECT_NO = prj_No, |
|
909 |
// }); |
|
910 |
|
|
911 |
// _entity.SaveChanges(); |
|
912 |
|
|
913 |
// using (KCOMEntities kCOMEntities = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
914 |
// { |
|
915 |
// kCOMEntities.AddToCONVERTER_DOC(new CONVERTER_DOC |
|
916 |
// { |
|
917 |
// ID = _id, |
|
918 |
// CREATE_DATETIME = DateTime.Now, |
|
919 |
// DOCUMENT_URL = HttpUtility.UrlEncodeUnicode(document_Url), |
|
920 |
// PROJECT_NO = prj_No, |
|
921 |
// DOCUMENT_ID = _doc_id, |
|
922 |
// }); |
|
923 |
|
|
924 |
// kCOMEntities.SaveChanges(); |
|
925 |
// } |
|
926 |
// } |
|
927 |
// var _result = remObj.SetConverterPDF(prj_No, _id); |
|
928 |
|
|
929 |
// if (_result.Exception != null) |
|
930 |
// { |
|
931 |
// return false.ToString(); |
|
932 |
// } |
|
933 |
// else |
|
934 |
// { |
|
935 |
// return true.ToString(); |
|
936 |
// } |
|
937 |
// } |
|
938 |
//} |
|
939 |
|
|
752 | 940 |
//private Guid GetGuid(int Count,Guid ID) |
753 | 941 |
//{ |
754 | 942 |
// Guid _ID = ID; |
내보내기 Unified diff