프로젝트

일반

사용자정보

개정판 c05bc6fc

IDc05bc6fc411c9dc5cad1556542860ba82064d52f
상위 5ca5dd7c
하위 40cf5bf7

백흠경이(가) 5년 이상 전에 추가함

issue #937: load UploadFinal.dll dynamically

Change-Id: I333cd4555db2d6500d8b6123bc1d44c0e34a5d76

차이점 보기:

FinalService/KCOM_FinalService/KCOM_FinalService/Remoting/RemFinalPDFStation.cs
7 7
using System.Collections.Generic;
8 8
using System.IO;
9 9
using System.Linq;
10
using System.Reflection;
10 11
using System.Runtime.Remoting.Channels.Tcp;
11 12
using System.Threading;
12 13
using System.Threading.Tasks;
......
25 26
        int _TypeName = 1;
26 27
        Properties.Settings _SettingPlace = null;
27 28

  
28
        //Queue<FINAL_PDF> _WorkItem = new Queue<FINAL_PDF>();
29 29
        ConcurrentQueue<FINAL_PDF> WorkingQueue = null;
30 30
        List<FINAL_PDF> WaitThread = null;
31 31
        List<FINAL_PDF> WorkingThread = null;
32

  
33
        private Type _UploadFinalType = null;
32 34
        #endregion
33 35

  
34 36
        public RemFinalPDFStation()
35 37
        {
36 38
            System.Diagnostics.EventLog _eventLog = new System.Diagnostics.EventLog();
37 39
            _Log = new ServiceEventLog(_eventLog, "FinalService", "Application");
40

  
41
            /// get legacy interface for upload final pdf file
42
            string UploadFinalDllPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFinal.dll");
43
            Assembly asm = Assembly.LoadFrom(UploadFinalDllPath);
44
            this._UploadFinalType = asm.GetType("UploadFinal.UploadFinal");
45
            /// up to here
46

  
38 47
            Init();
39 48
        }
40 49

  
......
187 196
                
188 197
            });
189 198
        }
199

  
190 200
        public FinalPDFResult Notify(string ProjectNo, string FinalID)
191 201
        {
192 202
            using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
......
199 209
            return new FinalPDFResult();
200 210
        }
201 211

  
202
        
203

  
204

  
205 212
        void _markuptoPDF_EndFinal(object sender, MarkupToPDF.EndFinalEventArgs e)
206 213
        {
207 214
            var _T = WorkingThread.Where(t => t == (sender as MarkupToPDF.MarkupToPDF).FinalItem);
......
220 227
                    string pdfpath = !string.IsNullOrEmpty(finalpdfroot) ? finalpdfroot + filename : filename;
221 228
                    if (!string.IsNullOrEmpty(soapurl))
222 229
                    {
223
                        //Legacy IF
224
                        KeyValuePair<bool, string> result = UploadFinal.UploadFinal.UploadFinalPDF(pdfpath, e.OriginPDFName, e.FinalPDF, soapurl);
225
                        if (result.Key)
230
                        MethodInfo UploadFinalPDFMethod = this._UploadFinalType.GetMethod("UploadFinalPDF", new Type[] { typeof(string), typeof(string), typeof(FINAL_PDF), typeof(string) });
231
                        if (null != UploadFinalPDFMethod)
226 232
                        {
227
                            SetFinalState(_item.ID, FinalStatus.Success);
233
                            object inst = Activator.CreateInstance(this._UploadFinalType, null);
234
                            //Legacy IF
235
                            object[] parameters = new object[] { pdfpath, e.OriginPDFName, e.FinalPDF, soapurl };
236
                            KeyValuePair<bool, string> result = (KeyValuePair<bool, string>)(UploadFinalPDFMethod.Invoke(inst, parameters));
237
                            if (result.Key)
238
                            {
239
                                SetFinalState(_item.ID, FinalStatus.Success);
240
                            }
241
                            else
242
                            {
243
                                SetFinalState(_item.ID, FinalStatus.Error);
244
                                _Log.Write("Upload error:" + filename + ",pdfname:" + e.OriginPDFName + ",message:" + result.Value);
245
                            }
228 246
                        }
229 247
                        else
230 248
                        {
231
                            SetFinalState(_item.ID, FinalStatus.Error);
232
                            _Log.Write("Upload error:" + filename + ",pdfname:" + e.OriginPDFName +",message:"+result.Value);
249

  
233 250
                        }
234 251
                        WorkingThread.Remove(_T.First());
235 252
                    }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)