예제 #1
0
 public void Accumulate_OnNetworkError(int senderror, HttpExceptionEx ex)
 {
     string str;
     HttpErrorDlg dlg = new HttpErrorDlg();
     base.stbReqStatus.Text = "";
     dlg.ShowHttpError(senderror, ex);
     if (ex == null)
     {
         str = System.Enum.GetNames(typeof(HttpResult))[senderror].ToString();
     }
     else
     {
         str = System.Enum.GetNames(typeof(HttpCause))[(int) ex.Cause].ToString();
     }
     ULogClass.LogWrite("Accumulate_NetworkError Status=" + str);
     dlg.Dispose();
 }
예제 #2
0
 public void Logon_AtOnce_OnNetworkError(int senderror, HttpExceptionEx ex)
 {
     try
     {
         string str;
         HttpErrorDlg dlg = new HttpErrorDlg();
         base.stbRepStatus.Text = "";
         dlg.ShowHttpError(senderror, ex);
         if (ex == null)
         {
             str = System.Enum.GetNames(typeof(HttpResult))[senderror].ToString();
         }
         else
         {
             str = System.Enum.GetNames(typeof(HttpCause))[(int) ex.Cause].ToString();
         }
         ULogClass.LogWrite("Logon_AtOnce_NetworkError Status=" + str);
         dlg.Dispose();
         base.UserCode = "";
         base.UserPassword = "";
         base.StatusChange(0);
         base.UserCodeJobSet("");
     }
     finally
     {
         base.Enabled = true;
         if (this.Logonsender != null)
         {
             ((CommonJobForm) this.Logonsender).Enabled = true;
         }
         this.SendRecvDlgHide();
         this.LogonSendFlag = false;
     }
 }
예제 #3
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;
     }
 }
예제 #4
0
 private void RequestSend(RequestCommand command, string outcode)
 {
     try
     {
         int num;
         if (command == RequestCommand.GET)
         {
             this.mIsExcute = true;
         }
         ComParameter senddata = new ComParameter {
             DataString = this.CreateRequestData(command, outcode)
         };
         ULogClass.LogWrite(string.Format("{0}_SEND Command({1})", this.JobCode(), command.ToString()), senddata.DataString.Substring(0, 400), true);
         if (command == RequestCommand.GET)
         {
             num = this.mGetClient.Send(this.mOwnerControl, command.ToString() + this.mSendCount.ToString(), senddata);
         }
         else
         {
             num = this.mCmdClient.Send(this.mOwnerControl, command.ToString() + this.mSendCount.ToString(), senddata);
         }
         if (num > 0)
         {
             ULogClass.LogWrite(string.Format("{0}_SEND Error code({1})", this.JobCode(), num));
             this.OnNetworkError(num, null);
             this.mIsExcute = false;
             this.ButtonLock(false);
         }
     }
     catch (Exception exception)
     {
         ULogClass.LogWrite(string.Format("{0}_SEND Error code({1})", this.JobCode(), "Exception"));
         HttpExceptionEx ex = new HttpExceptionEx(HttpStatus.Idle, HttpCause.ProgramError, exception);
         this.OnNetworkError(9, ex);
         this.mIsExcute = false;
         this.ButtonLock(false);
     }
 }
예제 #5
0
 private void A2Send()
 {
     try
     {
         ComParameter senddata = new ComParameter {
             DataString = this.CreateA2Data()
         };
         string str = this.JobCode();
         if (this.mNextStop)
         {
             ULogClass.LogWrite(string.Format("{0}_SEND", str + "(Next Stop)"), senddata.DataString.Substring(0, 400), true);
         }
         else
         {
             ULogClass.LogWrite(string.Format("{0}_SEND", str), senddata.DataString.Substring(0, 400), true);
         }
         int num = this.mGetClient.Send(this.mOwnerControl, str + this.mSendCount.ToString(), senddata);
         if (num > 0)
         {
             ULogClass.LogWrite(string.Format("{0}_SEND Error code({1})", str, num));
             this.OnNetworkError(num, null);
             this.mIsExcute = false;
             this.ButtonLock(false);
         }
     }
     catch (Exception exception)
     {
         ULogClass.LogWrite(string.Format("{0}_SEND Error code({1})", this.JobCode(), "Exception"));
         HttpExceptionEx ex = new HttpExceptionEx(HttpStatus.Idle, HttpCause.ProgramError, exception);
         this.OnNetworkError(9, ex);
         this.mIsExcute = false;
         this.ButtonLock(false);
     }
     this.mNextStop = false;
 }
예제 #6
0
 private void CallbackOnError(IHttpClient sender, string sendkey, HttpExceptionEx ex)
 {
     ULogClass.LogWrite(string.Format("{0}_NetworkError", this.JobCode()));
     this.mNextStop = false;
     this.OnNetworkError(0, ex);
     this.mIsExcute = false;
     this.ButtonLock(false);
 }
예제 #7
0
 private void ErrorResponse(WebException wex, bool isWebException)
 {
     this.mTimer.Enabled = false;
     if (((Control) this.mRequestSender).InvokeRequired)
     {
         ErrorDelegate method = new ErrorDelegate(this.ErrorResponse);
         ((Control) this.mRequestSender).Invoke(method, new object[] { wex, isWebException });
     }
     else
     {
         try
         {
             this.mTrace.WriteString(this.mTracekind, string.Format("# {0,-16} : status[{1}]", "ErrorResponse", this.mStatus));
             if (isWebException)
             {
                 if (wex.Status == WebExceptionStatus.RequestCanceled)
                 {
                     if (this.mIsTimeout)
                     {
                         this.mIsTimeout = false;
                         this.mTrace.WriteString(this.mTracekind, string.Format("- {0,-16} : error[{1}]", "ErrorResponse", HttpCause.Timeout));
                         HttpExceptionEx ex = new HttpExceptionEx(this.mStatus, HttpCause.Timeout, wex);
                         this.OnNetworkError(this, this.mSendkey, ex);
                     }
                     else
                     {
                         this.mTrace.WriteString(this.mTracekind, string.Format("- {0,-16} : error[{1}]", "ErrorResponse", HttpCause.UserCancel));
                         HttpExceptionEx ex2 = new HttpExceptionEx(this.mStatus, HttpCause.UserCancel, wex);
                         this.OnNetworkError(this, this.mSendkey, ex2);
                     }
                 }
                 else
                 {
                     this.mTrace.WriteString(this.mTracekind, string.Format("- {0,-16} : error[{1}]", "ErrorResponse", HttpCause.WebException));
                     HttpExceptionEx ex3 = new HttpExceptionEx(this.mStatus, HttpCause.WebException, wex);
                     this.OnNetworkError(this, this.mSendkey, ex3);
                 }
             }
             else
             {
                 this.mTrace.WriteString(this.mTracekind, string.Format("- {0,-16} : error[{1}]", "ErrorResponse", HttpCause.Exception));
                 HttpExceptionEx ex4 = new HttpExceptionEx(this.mStatus, HttpCause.Exception, wex);
                 this.OnNetworkError(this, this.mSendkey, ex4);
             }
         }
         finally
         {
             this.Status = HttpStatus.Idle;
         }
     }
 }
예제 #8
0
 private void CallbackOnError(IHttpClient sender, string sendkey, HttpExceptionEx ex)
 {
     if (ex.Cause != HttpCause.UserCancel)
     {
         this.SendDlgClose();
         HttpErrorDlg dlg = new HttpErrorDlg();
         dlg.ShowHttpError(ex);
         dlg.Dispose();
     }
     this.mGetting = false;
     this.MenuStatusChange();
 }
예제 #9
0
 public void ShowHttpError(int senderror, HttpExceptionEx ex)
 {
     if (senderror == 0)
     {
         this.ShowHttpError(ex);
     }
     else if (ex != null)
     {
         this.ShowHttpError(ex);
     }
     else
     {
         this.ShowSendError(senderror);
     }
 }
예제 #10
0
 public void ShowHttpError(HttpExceptionEx ex)
 {
     string str;
     bool flag = false;
     string applyStr = null;
     string str3 = null;
     string str4 = null;
     if (ex.Cause == HttpCause.UserCancel)
     {
         str = "E114";
     }
     else if (ex.Cause == HttpCause.Timeout)
     {
         str = "E113";
     }
     else if (ex.Cause == HttpCause.WebException)
     {
         str = "E111";
         str3 = ex.WebStatus.ToString();
         if (ex.WebStatus == WebExceptionStatus.ProtocolError)
         {
             str4 = string.Format("{0}({1})", ex.HttpErrorStatusCode, ex.HttpErrorStatusDescription);
         }
         if (ex.Message != null)
         {
             applyStr = ex.Message;
         }
         flag = true;
     }
     else if (ex.Cause == HttpCause.Exception)
     {
         str = "E112";
         if (ex.Message != null)
         {
             applyStr = ex.Message;
         }
         flag = true;
     }
     else
     {
         str = "E119";
     }
     string internalCode = null;
     if (flag)
     {
         internalCode = string.Format("-ModuleStatus : {1}{0}", "\r\n", ex.Status);
         if (str3 != null)
         {
             internalCode = internalCode + string.Format("-WebStatus : {1}{0}", "\r\n", str3);
         }
         if (str4 != null)
         {
             internalCode = internalCode + string.Format("-HttpStatusCode : {1}{0}", "\r\n", str4);
         }
         if (ex.Message != null)
         {
             internalCode = internalCode + string.Format("-ExceptionMessage{0} {1}{0}", "\r\n", ex.Message);
         }
         if (ex.InnerException != null)
         {
             internalCode = internalCode + string.Format("-InnerException :{0} type={1}{0} {2}{0}", "\r\n", ex.InnerException.GetType(), ex.InnerException.ToString());
         }
         if (ex.TargetSite != null)
         {
             internalCode = internalCode + string.Format("-TargetSite :{0} {1}{0}", "\r\n", ex.TargetSite.ToString());
         }
         if (ex.StackTrace != null)
         {
             internalCode = internalCode + string.Format("-StackTrace :{0} {1}{0}", "\r\n", ex.StackTrace.ToString());
         }
     }
     if (applyStr == null)
     {
         base.ShowMessage(str, internalCode);
     }
     else
     {
         base.ShowMessage(str, applyStr, internalCode);
     }
 }