예제 #1
0
 private void LogoffStart()
 {
     base.TimerStop();
     if (base.mnLogoffConf.Checked)
     {
         MessageDialog dialog = new MessageDialog();
         if (dialog.ShowMessage("C101", "") != DialogResult.Yes)
         {
             dialog.Dispose();
             base.TimerStart();
             return;
         }
         dialog.Dispose();
     }
     this.ato.NextStop();
     this.acm.NextStop();
     base.UserCode = "";
     base.UserPassword = "";
     base.iuc.Password = "";
     this.CA = null;
     base.StatusChange(0);
     base.UserCodeJobSet("");
 }
예제 #2
0
 private void Http_OnError(IHttpClient sender, string sendkey, HttpExceptionEx ex)
 {
     this.ConnectFlag = false;
     base.Enabled = true;
     if ((base.frmSendRecv != null) && base.frmSendRecv.Visible)
     {
         this.SendRecvDlgHide();
     }
     base.StatusChange(1);
     if (ex.Cause != HttpCause.UserCancel)
     {
         HttpErrorDlg dlg = new HttpErrorDlg();
         dlg.ShowHttpError(ex);
         if (ex.WebStatus == WebExceptionStatus.UnknownError)
         {
             this.CA = null;
         }
         ULogClass.LogWrite("NetworkError Status=" + System.Enum.GetNames(typeof(HttpCause))[(int) ex.Cause].ToString());
         dlg.Dispose();
     }
     if (this.bSendFlag)
     {
         if (ex.Cause != HttpCause.UserCancel)
         {
             base.SendReportDlg.SetStatus(sendkey, USendReportDlg.ReportStatus.Wait, "Failure in Sending.");
         }
         if (base.BatchSendFlag)
         {
             base.BatchSendFlag = false;
             MessageDialog dialog = new MessageDialog();
             if (dialog.ShowMessage("I104", base.SendReportDlg.StatusCount(USendReportDlg.ReportStatus.Sent).ToString(), "") == DialogResult.Yes)
             {
                 base.SendReportDlg.Show();
             }
             dialog.Dispose();
         }
         this.bSendFlag = false;
     }
 }
예제 #3
0
 private void Http_OnReceived(object sender, string sendkey, ComParameter dt)
 {
     string[,] strArray = new string[,] { { "High security alert", "E123" }, { "Verification GW Error", "E134" }, { "Message Format GW Error", "E135" } };
     ULogClass.LogWrite(string.Format("INET_RECV_START Length={0} AttachCount={1}", dt.DataString.Length, dt.AttachCount), null, false);
     this.ConnectFlag = false;
     base.idv.SendStatusChange(sendkey);
     for (int i = 0; i < strArray.GetLength(0); i++)
     {
         if ((dt.DataString.IndexOf(Environment.NewLine) != 0x18e) && dt.DataString.Contains(strArray[i, 0]))
         {
             base.StatusChange(1);
             if (!this.bSendFlag)
             {
                 base.Enabled = true;
                 this.SendRecvDlgHide();
             }
             MessageDialog dialog = new MessageDialog();
             dialog.ShowMessage(strArray[i, 1].ToString(), "", dt.DataString);
             dialog.Dispose();
             if (strArray[i, 0] == "Verification GW Error")
             {
                 this.CA = null;
             }
             return;
         }
     }
     if (dt.DataString.Length < 400)
     {
         dt.DataString = base.ErrCreate(dt.DataString);
     }
     RecvData recvdata = DataFactory.CreateRecvData(dt);
     IData data = null;
     IData data3 = null;
     IData data4 = null;
     string str = "-1";
     if (recvdata.MData != null)
     {
         data = recvdata.ResultData;
         if (base.usrenv.InteractiveInfo.JobConnect && (data.JobData.Substring(0, 15) == "00000-0000-0000"))
         {
             this.RepSend(1);
         }
         data = recvdata.MData;
         str = base.idv.AppendJobData(data, 2, false, true, false);
     }
     else
     {
         if (recvdata.ResultData != null)
         {
             data = recvdata.ResultData;
             if (base.usrenv.InteractiveInfo.JobConnect && (data.JobData.Substring(0, 15) == "00000-0000-0000"))
             {
                 this.RepSend(1);
             }
             str = base.idv.AppendJobData(data, 2, false, true, false);
             data3 = data;
         }
         if (recvdata.OtherData != null)
         {
             data = recvdata.OtherData;
             str = base.idv.AppendJobData(data, 2, false, true, false);
             data4 = data;
         }
     }
     ULogClass.LogWrite(string.Format("INET_RECV_DB_APPEND Key={0}", str), null, false);
     base.StatusChange(1);
     if (!this.bSendFlag)
     {
         base.Enabled = true;
         this.SendRecvDlgHide();
     }
     if (this.DateCheckFlag)
     {
         try
         {
             string s = data.Header.ServerRecvTime.ToString().Trim().PadRight(14, '0');
             string format = "yyyyMMddHHmmss";
             DateTime time = DateTime.ParseExact(s, format, null);
             DateTime now = DateTime.Now;
             TimeSpan span = (TimeSpan) (now - time);
             if ((-5.0 > span.TotalMinutes) || (5.0 < span.TotalMinutes))
             {
                 MessageDialog dialog2 = new MessageDialog();
                 dialog2.ShowMessage("W001", "Server's Time : " + time.ToString("dd/MM/yyyy HH:mm:ss", DateTimeFormatInfo.InvariantInfo) + Environment.NewLine + "PC's time : " + now.ToString("dd/MM/yyyy HH:mm:ss", DateTimeFormatInfo.InvariantInfo) + Environment.NewLine + Environment.NewLine, "");
                 dialog2.Dispose();
             }
         }
         catch
         {
         }
         this.DateCheckFlag = false;
     }
     if (!this.bSendFlag)
     {
         bool flag = false;
         if (base.sysenv.TerminalInfo.UserKind == 4)
         {
             KioskLink link = new KioskLink(recvdata);
             IData data5 = link.CreateLinkData();
             if (data5 != null)
             {
                 flag = true;
                 if (this.sendjobsender != null)
                 {
                     ((JobForm) this.sendjobsender).Close();
                 }
                 this.KioskLinkData = new _KioskLinkData();
                 this.KioskLinkData.Data = data5;
                 this.KioskLinkData.Data.Header.System = this.KioskLinkSystem;
                 this.KioskLinkData.File = link.LinkFile;
                 this.KioskLinkData.No = 1;
                 System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer {
                     Interval = 10
                 };
                 timer.Tick += new EventHandler(this.KioskLink_Tick);
                 timer.Enabled = true;
             }
         }
         if (!flag)
         {
             base.JobFormOpen(int.Parse(str), data, this.sendjobsender);
         }
     }
     if (data4 != null)
     {
         ULogClass.LogWrite("INET_RECV_OTHER ", data4.GetDataString().Substring(0, 400), true);
         try
         {
             string path = base.SaveFileCheck(data4);
             if (path != "")
             {
                 if (data4.Header.DataType == "A")
                 {
                     base.idv.AppendRecord(data4, Path.GetDirectoryName(path));
                 }
                 else
                 {
                     DataFactory.SaveToEdiFile(data4, path);
                     base.idv.SaveStatusChange(data4.ID, false);
                 }
             }
         }
         catch
         {
         }
         data4 = base.ContainedSet(data4);
         base.pr.Print(this, data4.ID, data4, 2);
     }
     if (data3 != null)
     {
         ULogClass.LogWrite("INET_RECV_RESULT ", data3.GetDataString().Substring(0, 400), true);
         try
         {
             string fileName = base.SaveFileCheck(data3);
             if (fileName != "")
             {
                 DataFactory.SaveToEdiFile(data3, fileName);
                 base.idv.SaveStatusChange(data3.ID, false);
             }
         }
         catch
         {
         }
     }
     if (((data3 == null) && (data4 == null)) && (data != null))
     {
         ULogClass.LogWrite("INET_RECV_MDATA ", data.GetDataString().Substring(0, 400), true);
         try
         {
             string str6 = base.SaveFileCheck(data);
             if (str6 != "")
             {
                 DataFactory.SaveToEdiFile(data, str6);
                 base.idv.SaveStatusChange(data.ID, false);
             }
         }
         catch
         {
         }
         RecvData data6 = DataFactory.CreateRecvData(data);
         data6.OtherData = base.ContainedSet(data6.OtherData);
         base.pr.Print(this, data.ID, data6.OtherData, 2);
     }
     if (data4 != null)
     {
         base.idv.Distribute(data4);
     }
     if (data3 != null)
     {
         base.idv.Distribute(data3);
     }
     if (((data3 == null) && (data4 == null)) && (data != null))
     {
         base.idv.Distribute(data);
     }
     base.idv.DataViewSaveRepaint();
     if (this.bSendFlag && !this.cancelflag)
     {
         ULogClass.LogWrite("INET_RECV_END NextSend", null, false);
         base.SendReportDlg.SetStatus(sendkey, USendReportDlg.ReportStatus.Sent, "");
         System.Windows.Forms.Timer timer2 = new System.Windows.Forms.Timer {
             Interval = 10
         };
         timer2.Tick += new EventHandler(this.tm_Tick);
         timer2.Enabled = true;
     }
     else
     {
         ULogClass.LogWrite("INET_RECV_END", null, false);
     }
 }
예제 #4
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;
             }
         }
     }
 }