コード例 #1
0
 private void btnReadCurCard_Click(object sender, EventArgs e)
 {
     if (reader != null)
     {
         YangChengTongCardInfo        card;
         YangChengTongOperationResult result = reader.ReadCardWithNoLock(out card);
         if (card != null)
         {
             this.txtBalance.DecimalValue = card.Balance;
         }
         else
         {
             MessageBox.Show("读羊城通失败");
         }
     }
 }
コード例 #2
0
ファイル: FrmYCTPayment.cs プロジェクト: darcyg/510-Null
 private void YCTPayment_Thread()
 {
     try
     {
         while (true)
         {
             if (Reader != null)
             {
                 YangChengTongCardInfo card;
                 if (Reader.ReadCard(out card) == YangChengTongOperationResult.Success)
                 {
                     if (card.Balance >= Payment)
                     {
                         YangChengTongPaymentRecord   record;
                         YangChengTongOperationResult ret = Reader.CardPay(Payment, out record);
                         if (ret == YangChengTongOperationResult.Success)
                         {
                             YangChenTongLog log = new YangChenTongLog()
                             {
                                 LogDateTime = DateTime.Now,
                                 CardID      = record.CardID,
                                 LogicalID   = record.LogicalID,
                                 Payment     = record.Payment,
                                 Balance     = record.Balance,
                                 Data        = record.Data
                             };
                             (new YangChenTongLogBll(AppSettings.CurrentSetting.ParkConnect)).Insert(log);
                             ShowMessage(string.Format("初始余额 {0}   扣款 {1}  剩余 {2}", card.Balance, Payment, card.Balance - Payment));
                             Reader.Beep(100);
                             if (AppSettings.CurrentSetting.EnableTTS)
                             {
                                 Ralid.GeneralLibrary.Speech.TTSSpeech.Instance.Speek(Resources.Resource1.FrmYCTPayment_Success);
                             }
                             this.DialogResult = DialogResult.OK;
                             break;
                         }
                         else
                         {
                             ShowMessage(Resources.Resource1.FrmYCTPayment_Fail + "  Reason:" + ret.ToString());
                             if (AppSettings.CurrentSetting.EnableTTS)
                             {
                                 Ralid.GeneralLibrary.Speech.TTSSpeech.Instance.Speek(Resources.Resource1.FrmYCTPayment_Fail);
                             }
                         }
                     }
                     else
                     {
                         ShowMessage(Resources.Resource1.FrmYCTPayment_BalanceNotEnough);
                         if (AppSettings.CurrentSetting.EnableTTS)
                         {
                             Ralid.GeneralLibrary.Speech.TTSSpeech.Instance.Speek(Resources.Resource1.FrmYCTPayment_BalanceNotEnough);
                         }
                     }
                 }
             }
         }
     }
     catch (ThreadAbortException)
     {
     }
 }