Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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();
         }
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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();
         }
     }
 }