markus / ConvertService / ConverterService / DeepViewConverter / MainWindow.xaml.cs @ 0caa0b73
이력 | 보기 | 이력해설 | 다운로드 (5.88 KB)
1 | 7ca218b3 | KangIngu | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Windows; |
||
6 | using System.Windows.Controls; |
||
7 | using System.Windows.Data; |
||
8 | using System.Windows.Documents; |
||
9 | using System.Windows.Input; |
||
10 | using System.Windows.Media; |
||
11 | using System.Windows.Media.Imaging; |
||
12 | using System.Windows.Navigation; |
||
13 | using System.Windows.Shapes; |
||
14 | using DeepViewDataModel.DataModel; |
||
15 | using System.Threading.Tasks; |
||
16 | using DeepViewDataModel.Common; |
||
17 | using DeepView.Toolkit.GuidGenerator; |
||
18 | using System.Runtime.Remoting.Channels; |
||
19 | using System.Runtime.Remoting.Channels.Tcp; |
||
20 | using IConverterPDF; |
||
21 | |||
22 | namespace DeepViewConverter |
||
23 | { |
||
24 | /// <summary> |
||
25 | /// Interaction logic for MainWindow.xaml |
||
26 | /// </summary> |
||
27 | public partial class MainWindow : Window |
||
28 | { |
||
29 | |||
30 | public MainWindow() |
||
31 | { |
||
32 | InitializeComponent(); |
||
33 | |||
34 | System.Runtime.Remoting.Channels.IChannel _ch = ChannelServices.GetChannel("tcp"); |
||
35 | |||
36 | TcpChannel chan = new TcpChannel(); |
||
37 | ChannelServices.RegisterChannel(chan, false); |
||
38 | // Create an instance of the remote object |
||
39 | remObj = (RemConverterPDFObject)Activator.GetObject(typeof(RemConverterPDFObject), |
||
40 | "tcp://172.20.101.160:8090/remConverterPDF"); |
||
41 | |||
42 | if (remObj == null) MessageBox.Show("remoting error "); |
||
43 | } |
||
44 | |||
45 | RemConverterPDFObject remObj = null; |
||
46 | |||
47 | private void btnSingleVPConveter_Click(object sender, RoutedEventArgs e) |
||
48 | { |
||
49 | AddConverter(tbPrjNo.Text, tbPDFPath.Text,tbItemID.Text); |
||
50 | } |
||
51 | |||
52 | private void AddConverter(string ProjectNo, string PdfUrl,string ItemID) |
||
53 | { |
||
54 | try |
||
55 | { |
||
56 | using (DeepViewEntities _entity = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
57 | { |
||
58 | Guid _id = GuidGenerator.GetUniqueGuid(); |
||
59 | _entity.AddToConverterPDF(new ConverterPDF |
||
60 | { |
||
61 | ID = _id, |
||
62 | CreateDateTime = DateTime.Now, |
||
63 | PdfUrl = PdfUrl, |
||
64 | ProjectNo = ProjectNo, |
||
65 | SharepointItemID = ItemID |
||
66 | }); |
||
67 | _entity.SaveChanges(); |
||
68 | |||
69 | if (remObj != null) |
||
70 | { |
||
71 | var _result = remObj.SetConverterPDF(ProjectNo, _id); |
||
72 | } |
||
73 | } |
||
74 | } |
||
75 | catch (Exception ex) |
||
76 | { |
||
77 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
78 | } |
||
79 | |||
80 | } |
||
81 | |||
82 | private void AddWebConverter(string ProjectNo, string PdfUrl) |
||
83 | { |
||
84 | try |
||
85 | { |
||
86 | ServiceConverter.ConversionSoapClient _client = new ServiceConverter.ConversionSoapClient(); |
||
87 | string _result = _client.Run(tbPrjNo.Text, PdfUrl); |
||
88 | if (_result != true.ToString()) |
||
89 | { |
||
90 | System.Diagnostics.Debug.WriteLine(_result); |
||
91 | } |
||
92 | } |
||
93 | catch (Exception ex) |
||
94 | { |
||
95 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
96 | } |
||
97 | |||
98 | } |
||
99 | |||
100 | private void btnSlipConvert_Click(object sender, RoutedEventArgs e) |
||
101 | { |
||
102 | using(DaelimCI_Entities _daelimCi = new DaelimCI_Entities(ConnectStringBuilder.DaelimCIConnectString(tbPrjNo.Text).ToString())) |
||
103 | { |
||
104 | var _slipItem = _daelimCi.vendor_item.Where(vendor => vendor.slip_no == tbSlip.Text).OrderBy(vendor=>vendor.vp_no); |
||
105 | |||
106 | if (_slipItem.Count() > 0) |
||
107 | { |
||
108 | foreach (var item in _slipItem) |
||
109 | { |
||
110 | AddConverter(tbPrjNo.Text, item.pdf_path,item.sharepoint_itemid); |
||
111 | } |
||
112 | } |
||
113 | } |
||
114 | } |
||
115 | |||
116 | private void btnPrjTakeNConveter_Click(object sender, RoutedEventArgs e) |
||
117 | { |
||
118 | using (DaelimCI_Entities _daelimCi = new DaelimCI_Entities(ConnectStringBuilder.DaelimCIConnectString(tbPrjNo.Text).ToString())) |
||
119 | { |
||
120 | var _slipItem = _daelimCi.vendor_item.OrderByDescending(vendor=>vendor.slip_no).Take(50); |
||
121 | |||
122 | if (_slipItem.Count() > 0) |
||
123 | { |
||
124 | foreach (var item in _slipItem) |
||
125 | { |
||
126 | AddConverter(tbPrjNo.Text, item.pdf_path,item.sharepoint_itemid); |
||
127 | } |
||
128 | } |
||
129 | } |
||
130 | } |
||
131 | |||
132 | private void btnWebSingleConveter_Click(object sender, RoutedEventArgs e) |
||
133 | { |
||
134 | AddWebConverter(tbPrjNo.Text, tbPDFPath.Text); |
||
135 | } |
||
136 | |||
137 | private void btnWebSlipConveter_Click(object sender, RoutedEventArgs e) |
||
138 | { |
||
139 | using (DaelimCI_Entities _daelimCi = new DaelimCI_Entities(ConnectStringBuilder.DaelimCIConnectString(tbPrjNo.Text).ToString())) |
||
140 | { |
||
141 | var _slipItem = _daelimCi.vendor_item.Where(vendor => vendor.slip_no == tbSlip.Text).OrderBy(vendor => vendor.vp_no); |
||
142 | |||
143 | if (_slipItem.Count() > 0) |
||
144 | { |
||
145 | foreach (var item in _slipItem) |
||
146 | { |
||
147 | AddWebConverter(tbPrjNo.Text, item.pdf_path); |
||
148 | } |
||
149 | } |
||
150 | } |
||
151 | } |
||
152 | |||
153 | private void btnWebPrjConveter_Click(object sender, RoutedEventArgs e) |
||
154 | { |
||
155 | using (DaelimCI_Entities _daelimCi = new DaelimCI_Entities(ConnectStringBuilder.DaelimCIConnectString(tbPrjNo.Text).ToString())) |
||
156 | { |
||
157 | var _slipItem = _daelimCi.vendor_item.OrderByDescending(vendor => vendor.slip_no).Take(50); |
||
158 | |||
159 | if (_slipItem.Count() > 0) |
||
160 | { |
||
161 | foreach (var item in _slipItem) |
||
162 | { |
||
163 | AddWebConverter(tbPrjNo.Text, item.pdf_path); |
||
164 | } |
||
165 | } |
||
166 | } |
||
167 | } |
||
168 | } |
||
169 | } |