Пример #1
0
 private void OnSend(object sender, IData Data)
 {
     if (base.ComStatus == 1)
     {
         this.sendjobsender = sender;
         if (Data.Signflg == 1)
         {
             if (this.CA == null)
             {
                 this.CA = new SignaturesCert();
             }
             try
             {
                 IntPtr handle;
                 if (sender == null)
                 {
                     handle = base.Handle;
                 }
                 else
                 {
                     handle = ((Form) sender).Handle;
                 }
                 this.CA.GetSigneture(handle);
             }
             catch (Exception exception)
             {
                 new MessageDialog().ShowMessage("E124", MessageDialog.CreateExceptionMessage(exception));
                 base.StatusChange(1);
                 base.Enabled = true;
                 this.SendRecvDlgHide();
                 return;
             }
         }
         this.SendRecvDlgShow(1);
         if (this.bSendFlag)
         {
             base.frmSendRecv.lblSendJobCode.Text = Data.JobCode + " " + this.SendCount.ToString() + "/" + this.SendAllCount.ToString();
         }
         else
         {
             base.frmSendRecv.lblSendJobCode.Text = Data.JobCode;
         }
         base.Enabled = false;
         ComParameter senddata = new ComParameter();
         Data = base.SendDataCreate(Data, 0);
         senddata.DataString = Data.GetDataString();
         senddata.AttachFolder = Data.AttachFolder;
         if (Data.Signflg == 1)
         {
             senddata.SelectSign = this.CA.Cert;
             senddata.Sign = Data.Signflg.ToString();
         }
         base.StatusChange(2);
         string iD = Data.ID;
         if (!this.bSendFlag)
         {
             if (Data.ID == null)
             {
                 iD = base.idv.AppendJobData(Data, 0, false, false, false);
             }
             else
             {
                 iD = base.idv.UpdateJobData(Data);
             }
         }
         else
         {
             iD = base.idv.UpdateJobData(Data);
         }
         if (base.sysenv.TerminalInfo.Debug)
         {
             ULogClass.LogWrite("INET_SEND ", Data.GetDataString(), false);
         }
         else
         {
             ULogClass.LogWrite("INET_SEND ", Data.GetDataString().Substring(0, 400), true);
         }
         this.ConnectFlag = true;
         int errcode = this.ihc.Send(this, iD, senddata);
         if (errcode > 0)
         {
             HttpErrorDlg dlg = new HttpErrorDlg();
             base.StatusChange(1);
             base.Enabled = true;
             this.SendRecvDlgHide();
             dlg.ShowSendError(errcode);
             ULogClass.LogWrite("SendError Status=" + System.Enum.GetNames(typeof(HttpResult))[errcode].ToString());
             dlg.Dispose();
         }
         else if (errcode < 0)
         {
             base.StatusChange(1);
             base.Enabled = true;
             this.SendRecvDlgHide();
             ULogClass.LogWrite("User Cancel StatusCode = " + errcode.ToString());
             if (this.bSendFlag)
             {
                 if (base.BatchSendFlag)
                 {
                     base.BatchSendFlag = false;
                     MessageDialog dialog2 = new MessageDialog();
                     if (dialog2.ShowMessage("I104", base.SendReportDlg.StatusCount(USendReportDlg.ReportStatus.Sent).ToString(), "") == DialogResult.Yes)
                     {
                         base.SendReportDlg.Show();
                     }
                     dialog2.Dispose();
                 }
                 this.bSendFlag = false;
             }
         }
     }
 }
Пример #2
0
 private void RequestSend(ComParameter data, string sendkey, string msg)
 {
     try
     {
         this.SendDlgShow(msg);
         ULogClass.LogWrite(string.Format("BATCH_SEND Command({0})", msg), data.DataString.Substring(0, 400), true);
         int num = this.mHttpClient.Send(this.mOwnerControl, sendkey, data);
         if (num > 0)
         {
             ULogClass.LogWrite(string.Format("BATCH_SEND Error code({0})", num));
             this.SendDlgClose();
             HttpErrorDlg dlg = new HttpErrorDlg();
             dlg.ShowSendError(num);
             dlg.Dispose();
             this.mGetting = false;
             this.MenuStatusChange();
         }
     }
     catch
     {
         this.SendDlgClose();
         HttpErrorDlg dlg2 = new HttpErrorDlg();
         dlg2.ShowSendError(9);
         dlg2.Dispose();
         this.mGetting = false;
         this.MenuStatusChange();
     }
 }