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(); }
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; } } } }
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; } }
private void RefResponce(ComParameter recvdata) { RecvData data = DataFactory.CreateRecvData(recvdata.DataString); if (data.OtherData == null) { HttpErrorDlg dlg = new HttpErrorDlg(); dlg.ShowJobError(this.JobCode(), data.ResultData); dlg.Dispose(); } else { string text = null; if (this.lvList.SelectedItems.Count > 0) { text = this.lvList.SelectedItems[0].Text; } this.lvList.Items.Clear(); int num = 0; for (int i = 1; i < data.OtherData.ItemCount; i += 2) { int num2; ListViewItem item = new ListViewItem { Text = data.OtherData.Items[i] }; if (!string.IsNullOrEmpty(text) && (text == item.Text)) { item.Selected = true; } try { num2 = int.Parse(data.OtherData.Items[i + 1].Trim()); } catch { num2 = 0; } num += num2; item.SubItems.Add(string.Format("{0:n0}", num2)); this.lvList.Items.Add(item); } this.lblTotal.Text = string.Format("Tổng hạng mục: {0:n0}", num); } }
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; } }
private void CallbackOnGetReceived(object sender, string sendkey, ComParameter recvdata) { bool flag = false; bool flag2 = false; if (recvdata.DataString.Length < 400) { ULogClass.LogWrite(string.Format("{0}_RECV", this.JobCode()), recvdata.DataString, false); this.mTurnRtpinfo = ""; this.mNextStop = false; } else { IData data = new NaccsData { Header = { DataString = recvdata.DataString.Substring(0, 400) } }; this.mTurnRtpinfo = data.Header.RtpInfo; flag2 = data.Header.Control.EndsWith("P"); flag = !flag2 && (data.Header.DataType == "R"); } Stopwatch stopwatch = new Stopwatch(); try { stopwatch.Start(); this.mRecvOK = this.OnReceived(recvdata); stopwatch.Stop(); if (flag2) { if (this.mRecvOK) { if ((this.mA2Timeout == 0) || (stopwatch.ElapsedMilliseconds < ((this.mA2Timeout - this.mA2Delay) * 0x3e8))) { this.mA2tm = new System.Windows.Forms.Timer(); this.mA2tm.Tick += new EventHandler(this.A2Send_Tick); this.mA2tm.Interval = 1; if (this.mA2Delay > 0) { this.mA2tm.Interval = this.mA2Delay * 0x3e8; } this.mA2tm.Enabled = true; } else { flag2 = false; ComParameter parameter = new ComParameter { DataString = "A2Timeout" }; this.OnReceived(parameter); new MessageDialog().ShowMessage("E121", null); } } else { flag2 = false; this.mNextStop = false; } } else if (flag) { flag2 = false; this.mNextStop = false; RecvData data2 = DataFactory.CreateRecvData(recvdata.DataString); HttpErrorDlg dlg = new HttpErrorDlg(); dlg.ShowJobError(this.JobCode(), data2.ResultData); dlg.Dispose(); } } finally { stopwatch.Reset(); this.mIsExcute = flag2; this.ButtonLock(false); } }
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(); } }
private void CallbackOnReceived(object sender, string sendkey, ComParameter recvdata) { if (sendkey.StartsWith(RequestCommand.LST.ToString())) { ULogClass.LogWrite("BATCH_RECV", recvdata.DataString.Substring(0, 400), true); this.SendDlgClose(); this.View(recvdata); this.mGetting = false; this.MenuStatusChange(); } else if (recvdata.AttachCount == 0) { ULogClass.LogWrite("BATCH_RECV", recvdata.DataString.Substring(0, 400), true); this.SendDlgClose(); RecvData data = DataFactory.CreateRecvData(recvdata.DataString); if ((data.OtherData == null) && (data.ResultData.Items.Count > 0)) { HttpErrorDlg dlg = new HttpErrorDlg(); dlg.ShowJobError(data.ResultData.Header.JobCode, data.ResultData); dlg.Dispose(); } this.mGetting = false; this.MenuStatusChange(); } else { List<ListViewItem> list = this.ReportCheckedItems(); list[this.mSendIndex].SubItems[this.clmStatus.Index].Text = "取得済み"; this.lvReport.Refresh(); string text = list[this.mSendIndex].SubItems[this.clmFileName.Index].Text; string outcode = list[this.mSendIndex].SubItems[this.clmOutcode.Index].Text; ULogClass.LogWrite(string.Format("BATCH_RECV File({0})", text)); try { try { this.DataSave(recvdata, text, outcode); if (!this.mIsCancel) { System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer { Interval = 10 }; timer.Tick += new EventHandler(this.GetNextFile); timer.Enabled = true; } } finally { this.SendDlgClose(); } } catch (Exception exception) { MessageDialog dialog = new MessageDialog(); string internalCode = string.Format("{0}{1}", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo), "\r\n") + string.Format("<Exception>{0}", "\r\n"); if (exception.Message != null) { internalCode = internalCode + string.Format("-ExceptionMessage{1} {0}{1}{1}", exception.Message, "\r\n"); } dialog.ShowMessage("E303", text, internalCode); this.mGetting = false; this.MenuStatusChange(); } } }
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(); }
private void View(ComParameter recvdata) { RecvData data = DataFactory.CreateRecvData(recvdata.DataString); if (data.OtherData == null) { if (data.ResultData.Items.Count > 0) { HttpErrorDlg dlg = new HttpErrorDlg(); dlg.ShowJobError(data.ResultData.Header.JobCode, data.ResultData); dlg.Dispose(); } } else { if (this.mReportItems == null) { this.mReportItems = new List<ListViewItem>(); } else { this.mReportItems.Clear(); } this.lvReport.VirtualListSize = 0; this.lvReport.Items.Clear(); for (int i = 0; i < data.OtherData.Items.Count; i += 2) { string str2; string str3; string str4; int index = data.OtherData.Items[i].IndexOf('.'); string path = data.OtherData.Items[i].Substring(0, index); if (path.Length > 7) { str2 = path.Substring(0, 7); } else { str2 = path; } string[] strArray = path.Split(new char[] { '_' }); if (strArray.Length > 1) { try { DateTime time; string str = strArray[strArray.Length - 1].ToString(); if (DateTime.TryParseExact(this.getDivFormConv(str, "____/__/__ __:__:__", ' '), "yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out time)) { str3 = time.ToString(); } else { str3 = "__/__/____ __:__:__"; } } catch { str3 = strArray[1]; } } else { str3 = ""; } if ((i + 1) < data.OtherData.Items.Count) { try { long num3 = 0L; num3 = long.Parse(data.OtherData.Items[i + 1].Trim()); str4 = string.Format("{0:n0}", Math.Ceiling((double) (((double) num3) / 1024.0))); } catch { str4 = data.OtherData.Items[i + 1].Trim(); } } else { str4 = ""; } string fileName = this.mOutcodeTbl.Find(str2); if (string.IsNullOrEmpty(fileName)) { fileName = Path.GetFileName(path); } ListViewItem item = new ListViewItem(fileName); item.SubItems.Add(str2); item.SubItems.Add(str3); item.SubItems.Add(str4); item.SubItems.Add(""); item.SubItems.Add(data.OtherData.Items[i].Trim()); this.mReportItems.Add(item); } if (this.mReportItems.Count > 0) { this.mReportItems.Sort(new Comparison<ListViewItem>(this.DefaultCompareItem)); this.lvReport.VirtualListSize = this.mReportItems.Count; this.AllCheck(); } else { this.MenuStatusChange(); } } }