Beispiel #1
0
 protected virtual void OnFillerStateChanged(FillBase fill)
 {
     if (fill.FillState == FillState.End)
     {
         Uri url = null;
         try
         {
             url = new Uri(this.EndPageUri);
         }
         catch (Exception)
         {
             this.EndFill();
             WebFillManager.ShowMessageBox(string.Format("填报类型{0}的EndFillPageUri的url地址不正确!", base.FillType), "错误",
                                           MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (fill.CurrentUrl.AbsolutePath == url.AbsolutePath)
         {
             OnFinished(EventArgs.Empty);
             WebFillManager.ShowMessageBox("填报已完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.EndFill();
         }
     }
     else if (fill.FillState == FillState.Exception)
     {
         if (fill.Exception != null)
         {
             LogHelper.Write(fill.Exception);
         }
     }
 }
Beispiel #2
0
 protected override void OnFillerStateChanged(FillBase fill)
 {
     if (fill.FillState == FillState.Exception)
     {
         WebFillManager.ShowMessageBox(string.Format("填报过程发生错误,异常信息:{0}", fill.Exception.Message), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     base.OnFillerStateChanged(fill);
 }
Beispiel #3
0
        private bool SearchMatch(FillParameter parameter, List <KeyValuePair <FillParameterKey, object> > searchOption, List <string> values)
        {
            this.Wait();
            BHPageSearch search = new BHPageSearch(searchOption, values, base.Browser);

            if (search.SearchAndSelect())
            {
                FillElement(parameter, null);
                return(true);
            }
            WebFillManager.ShowMessageBox("未找到指定维修站!", "消息",
                                          System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);
            return(false);
        }
Beispiel #4
0
 protected override void OnFillerStateChanged(FillBase fill)
 {
     if (fill.FillState == FillState.End)
     {
         Uri url = null;
         try
         {
             url = new Uri(this.EndPageUri);
         }
         catch (Exception)
         {
             this.EndFill();
             WebFillManager.ShowMessageBox(string.Format("填报类型{0}的EndFillPageUri的url地址不正确!", base.FillType), "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
     }
 }
Beispiel #5
0
 private void InnerBeginFill(object state)
 {
     try
     {
         using (reader = new ForwardExcelReader(base.DataProvider.DataSourceFile))
         {
             reader.Open();
             sheet1 = reader.Activate(1) as ForwardReadWorksheet;
             sheet2 = reader.Activate(2) as ForwardReadWorksheet;
             Hashtable table = ReadColumnSheet();
             tableList = ReadRowSheet(table);
             for (CurrentRowIndex = 0; CurrentRowIndex < tableList.Count; CurrentRowIndex++)
             {
                 _asyncObject.Reset();
                 bool isBusy = true;
                 while (isBusy)
                 {
                     System.Threading.Thread.Sleep(100);
                     base.Browser.Invoke((Action)(() => { isBusy = base.Browser.IsBusy; }));
                 }
                 base.Browser.Invoke((Action)(() =>
                 {
                     base.Browser.Navigate(base.StartPageUri);
                 }));
                 base.BeginFill();
                 _asyncObject.Wait();
             }
             base.OnFinished(EventArgs.Empty);
             WebFillManager.ShowMessageBox("填报已完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         if (ex is System.Threading.ThreadAbortException)
         {
             return;
         }
         else
         {
             WebFillManager.ShowMessageBox(ex.Message, "错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
         }
     }
 }
Beispiel #6
0
        protected virtual void OnDocumentCompleted(WebBrowser2 browser, WebBrowserDocumentCompletedEventArgs e)
        {
            string uri = e.Url.AbsolutePath;
            Uri    url = null;

            try
            {
                url = new Uri(this.JumpWhenPage);
                if (url.AbsolutePath == uri)
                {
                    browser.Navigate(this.StartPageUri);
                }
            }
            catch
            {
                this.EndFill();
                WebFillManager.ShowMessageBox(string.Format("填报类型{0}的StartFillPageUri的url地址不正确!", base.FillType), "错误",
                                              MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Beispiel #7
0
        private void FillWorker(object state)
        {
            string        windowType = null;
            FillDialog_3C fill       = FillDialog_3C.GetFillDialog(out windowType, processId);

            try
            {
                // 存储数据文件所在目录下的所有文件(不包括子文件夹中的文件)
                _fillParameters = this.ReadFillParameter(state as string);
                TreeValue root = ReadAndConvertData();
                windowType = null;
                FillDialog_3C.BeginListen();
                fill = FillDialog_3C.GetFillDialog(out windowType, processId);
                if (fill != null)
                {
                    if (windowType == CCCWindowType.LoginWindow)
                    {
                        fill.FillValue = _data["厂商关系"] as FillValue3C;
                        fill.DoFillWork(_data["登录证书"]);
                    }
                    else if (windowType == CCCWindowType.FirmWindow)
                    {
                        FillValue3C value = _data["厂商关系"] as FillValue3C;
                        fill.DoFillWork(value == null ? "" : value.Value);
                    }
                }

                main = Main_3C.GetMainWindow(base.DataProvider.DataSourceFile, processId);
                //this.SetWindowPos();
                //main.FileTable = this.files;
                main.FillParameters = this._fillParameters;
                main.Records        = this._records;
                if (main.TreeView.GetCount() == 0)
                {
                    this.GetTreeView();
                }
                else
                {
                    main.UpdateSelectedNode();
                }
                main.TreeValue = root;
                FillDialog_3C.BeginListenSaveRequire(main);
                do
                {
                    System.Threading.Thread.Sleep(200);
                    main.FillPage();
                } while (main.SelectNextNode(true));
                this.EndFill();
                OnFinished(EventArgs.Empty);
                WebFillManager.ShowMessageBox("填报完成!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                if (main != null)
                {
                    LogHelper.Write(ex);
                    MessageBox.Show(ex.StackTrace + ex.Message);
                    this.EndFill();
                }
            }
        }