markus / FinalService / KCOM_FinalService / UploadTest / MainWindow.xaml.cs @ 5622deac
이력 | 보기 | 이력해설 | 다운로드 (5.35 KB)
1 | f3ab410f | taeseongkim | using KCOMDataModel.Common; |
---|---|---|---|
2 | using KCOMDataModel.DataModel; |
||
3 | using System; |
||
4 | using System.Collections.Generic; |
||
5 | using System.Linq; |
||
6 | using System.Text; |
||
7 | using System.Threading.Tasks; |
||
8 | using System.Web; |
||
9 | using System.Windows; |
||
10 | using System.Windows.Controls; |
||
11 | using System.Windows.Data; |
||
12 | using System.Windows.Documents; |
||
13 | using System.Windows.Input; |
||
14 | using System.Windows.Media; |
||
15 | using System.Windows.Media.Imaging; |
||
16 | using System.Windows.Navigation; |
||
17 | using System.Windows.Shapes; |
||
18 | |||
19 | namespace UploadTest |
||
20 | { |
||
21 | /// <summary> |
||
22 | /// MainWindow.xaml에 대한 상호 작용 논리 |
||
23 | /// </summary> |
||
24 | public partial class MainWindow : Window |
||
25 | { |
||
26 | public MainWindow() |
||
27 | { |
||
28 | InitializeComponent(); |
||
29 | } |
||
30 | |||
31 | private void Button_Click(object sender, RoutedEventArgs e) |
||
32 | { |
||
33 | try |
||
34 | { |
||
35 | 5622deac | taeseongkim | UploadCall2(); |
36 | //UploadCall(); |
||
37 | f3ab410f | taeseongkim | } |
38 | catch (Exception ex) |
||
39 | { |
||
40 | LogWrite(ex.ToString()); |
||
41 | |||
42 | if(ex.InnerException != null) |
||
43 | { |
||
44 | LogWrite(ex.InnerException.ToString()); |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 | |||
49 | 6c45db59 | taeseongkim | private void UploadCall2() |
50 | { |
||
51 | var final = new FINAL_PDF(); |
||
52 | final.DOCUMENT_ID = "2278058250"; |
||
53 | final.PROJECT_NO = "150128"; |
||
54 | |||
55 | var result = UploadFinal.UploadFinal.UploadFinalPDF(@"\\172.20.121.220\comment3\finalPDF\tmp776A.pdf", "ONPZ-ORG-PR-8121-0412.002-0000-DDD-001_R0.pdf", final, ""); |
||
56 | } |
||
57 | |||
58 | f3ab410f | taeseongkim | private void UploadCall() |
59 | { |
||
60 | if(string.IsNullOrEmpty(tbFinalPDFID.Text)) |
||
61 | { |
||
62 | LogWrite("final id null."); |
||
63 | return; |
||
64 | } |
||
65 | |||
66 | if (string.IsNullOrEmpty(tbRemoteFilePath.Text)) |
||
67 | { |
||
68 | LogWrite("remote file path null."); |
||
69 | return; |
||
70 | } |
||
71 | |||
72 | if (string.IsNullOrEmpty(tbServiceUri.Text)) |
||
73 | { |
||
74 | LogWrite("service url null."); |
||
75 | return; |
||
76 | } |
||
77 | |||
78 | LogWrite("Kcom Connection String : " + ConnectStringBuilder.KCOMConnectionString().ConnectionString); |
||
79 | |||
80 | using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
81 | { |
||
82 | var items = entity.FINAL_PDF.Where(x => x.ID == tbFinalPDFID.Text); |
||
83 | |||
84 | if(items.Count() > 0) |
||
85 | { |
||
86 | var item = items.First(); |
||
87 | string filename = ""; |
||
88 | |||
89 | LogWrite("CI Connection String : " + ConnectStringBuilder.ProjectCIConnectString(item.PROJECT_NO).ConnectionString); |
||
90 | |||
91 | using (CIEntities dc = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(item.PROJECT_NO).ToString())) |
||
92 | { |
||
93 | var _docInfoList = dc.DOCINFO.Where(doc => doc.ID == item.DOCINFO_ID); |
||
94 | |||
95 | if (_docInfoList.Count() > 0) |
||
96 | { |
||
97 | var file = _docInfoList.First().ORIGINAL_FILE; |
||
98 | |||
99 | 6c45db59 | taeseongkim | LogWrite("ORIGINAL_FILE Full Url : " + file); |
100 | |||
101 | |||
102 | f3ab410f | taeseongkim | var decodeFile = System.Web.HttpUtility.UrlDecode(file); |
103 | |||
104 | 6c45db59 | taeseongkim | //if (System.Web.HttpUtility.ParseQueryString(decodeFile).AllKeys.Count(x => x.ToLower() == ("filename").ToLower()) > 0) |
105 | //{ |
||
106 | // filename = System.Web.HttpUtility.ParseQueryString(decodeFile).Get("filename"); |
||
107 | //} |
||
108 | //else |
||
109 | //{ |
||
110 | f3ab410f | taeseongkim | filename = decodeFile.Split('/').Last(); |
111 | 6c45db59 | taeseongkim | //} |
112 | f3ab410f | taeseongkim | } |
113 | } |
||
114 | |||
115 | LogWrite("ORIGINAL_FILE : " + filename); |
||
116 | |||
117 | var result = UploadFinal.UploadFinal.UploadFinalPDF(tbRemoteFilePath.Text, filename, items.First(), tbServiceUri.Text); |
||
118 | |||
119 | LogWrite("result : " + result.Value); |
||
120 | } |
||
121 | else |
||
122 | { |
||
123 | LogWrite("final item not found."); |
||
124 | } |
||
125 | } |
||
126 | } |
||
127 | |||
128 | StringBuilder builder = new StringBuilder(); |
||
129 | |||
130 | private void LogWrite(string Msg) |
||
131 | { |
||
132 | builder.AppendLine(Msg); |
||
133 | tbLog.Text = builder.ToString(); |
||
134 | } |
||
135 | 5622deac | taeseongkim | |
136 | string value = @"<Grid Name=""aa32D0608B"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" Width=""205"" Height=""89""> |
||
137 | <Grid.Background> |
||
138 | <SolidColorBrush Color=""#FFFFFFFF"" Opacity=""0.1"" /> |
||
139 | </Grid.Background> |
||
140 | <Rectangle Stretch=""Fill"" Stroke=""#FFFF0000"" StrokeThickness=""5"" StrokeLineJoin=""Round"" Name=""Rectangle"" Width=""205"" Height=""89"" Canvas.Left=""-2.5"" Canvas.Top=""-2.5"" /> |
||
141 | <Grid> |
||
142 | <Grid.RowDefinitions> |
||
143 | <RowDefinition Height=""*"" /> |
||
144 | <RowDefinition Height=""3.5*"" /> |
||
145 | <RowDefinition Height=""*"" /> |
||
146 | </Grid.RowDefinitions> |
||
147 | <TextBlock Text=""APPROVED"" FontWeight=""ExtraBold"" FontSize=""30"" Foreground=""#FFFF0000"" HorizontalAlignment=""Center"" VerticalAlignment=""Center"" Grid.Row=""1"" /> |
||
148 | </Grid> |
||
149 | </Grid>"; |
||
150 | |||
151 | private void btnStamp_Click(object sender, RoutedEventArgs e) |
||
152 | { |
||
153 | var stamp = MarkupToPDF.Serialize.Core.JsonSerializerHelper.CompressStamp(value); |
||
154 | Console.WriteLine(stamp); |
||
155 | } |
||
156 | f3ab410f | taeseongkim | } |
157 | } |