예제 #1
0
파일: DataImport.cs 프로젝트: jms7781/DAL
        protected virtual void OnImportComplete()
        {
            timer.Stop();

            args.ImportStop   = DateTime.Now;
            args.Duration     = timer.Elapsed;
            args.RowsImported = TotalRowsImported();

            ImportComplete?.Invoke(this, args);
        }
        public async void ImportFromWebService()
        {
            var    apiurl  = Properties.Settings.Default.pmis_api_url;
            var    project = Properties.Settings.Default.pmis_project_code;
            var    authkey = Properties.Settings.Default.pmis_auth_key;
            string url     = String.Format("{0}/api/register/docs.action", apiurl);

            try
            {
                using (var client = new HttpClient())
                {
                    var values = new Dictionary <string, string> {
                        { "forward", "json" },
                        { "srch_show_hist", "1" },
                        { "pjt_cd", project },
                        { "access_token", authkey },
                        { "pageScale", "200" },
                        { "pageNo", "1" },
                        { "login_locale", "ko_KR" }
                    };

                    var page  = 1;
                    var total = 999;
                    while (page <= total)
                    {
                        values["pageNo"] = "" + page;
                        var content  = new FormUrlEncodedContent(values);
                        var response = await client.PostAsync(url, content);

                        response.EnsureSuccessStatusCode();
                        var responseString = await response.Content.ReadAsStringAsync();

                        PmisJsonResponse <RegisterDocument> dt = JsonConvert.DeserializeObject <PmisJsonResponse <RegisterDocument> >(responseString);
                        ImportData(dt.List);

                        page  = dt.PageInfo.CurrentPage + 1;
                        total = dt.PageInfo.TotalPages;
                        LogUtil.Log(dt.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Log().Display();
                ImportError?.Invoke(this, new ErrorEventArgs(ex));
            }
            finally
            {
                ImportComplete?.Invoke(this, EventArgs.Empty);
            }
        }
예제 #3
0
 private void onImportComplete(ImportResultSet result)
 {
     ImportComplete?.Invoke(result);
 }
예제 #4
0
 private void buttonImport_Click(object sender, EventArgs e)
 {
     DJScanCompletList = DJScan.BaseUnit.ImageTools.DJCommonUnit.OpenFileDialogImport(openFileDialog1, DJImgEncrypt, DJScanTitle, DJScanCompletList);
     ImportComplete.Invoke(sender);
 }
예제 #5
0
 /// <summary>
 /// Invokes import complete event
 /// </summary>
 public void NotifyImportComplete()
 {
     ImportComplete?.Invoke(this, EventArgs.Empty);
 }
 protected virtual void OnImportComplete(EventArgs e)
 {
     ImportComplete?.Invoke(this, e);
 }
예제 #7
0
 public void OnImportComplete()
 {
     ImportComplete?.Invoke(this, new EventArgs());
 }