/// <summary> /// 退款 /// </summary> private void Refund(CardInfo cardinfo) { bool offlineHandleCard = AppSettings.CurrentSetting.EnableWriteCard && cardinfo != null && !cardinfo.OnlineHandleWhenOfflineMode; APMRefundRecord record = CreateAPMRefundRecord(cardinfo); CardBll _CardBll = new CardBll(AppSettings.CurrentSetting.ParkConnect); bool success = _CardBll.APMCardRefund(cardinfo, record).Result == ResultCode.Successful; if (offlineHandleCard && success) { success = CardOperationManager.Instance.WriteCardLoop(cardinfo) == CardOperationResultCode.Success; if (!success) { //写入失败时,将数据库的卡片退款信息还原 _CardBll.UpdateCardPaymentInfo(_OriginalCard); APMRefundRecordBll recordBll = new APMRefundRecordBll(AppSettings.CurrentSetting.ParkConnect); recordBll.Delete(record); } } if (success) { MessageBox.Show(Resource1.FrmAPMRefund_Success); ClearInput(); } else { MessageBox.Show(Resource1.FrmAPMRefund_Fail); } }
private APMRefundRecord CreateAPMRefundRecord(CardInfo info) { APMRefundRecord record = new APMRefundRecord(info); record.RefundDateTime = DateTime.Now; record.RefundMoney = this.txtTurnbackMoney.DecimalValue; record.MID = this.comAPM.Text; record.PaymentSerialNumber = this.txtSerialNumber.Text.Trim(); record.OperatorID = OperatorInfo.CurrentOperator.OperatorName; record.StationID = WorkStationInfo.CurrentStation.StationName; record.Memo = this.txtMemo.Text.Trim(); return(record); }
private void ShowAPMRefundRecordOnRow(DataGridViewRow row, APMRefundRecord record) { row.Tag = record; row.Cells["colCardID"].Value = record.CardID; row.Cells["colCardCertificate"].Value = record.CardCertificate; row.Cells["colMID"].Value = record.MID; row.Cells["colPaymentSerialNumber"].Value = record.PaymentSerialNumber; row.Cells["colRefundDateTime"].Value = record.RefundDateTime; row.Cells["colParkFee"].Value = record.ParkFee; row.Cells["colTotalPaidFee"].Value = record.TotalPaidFee; row.Cells["colRefundMoney"].Value = record.RefundMoney; row.Cells["colEnterDateTime"].Value = record.EnterDateTime; row.Cells["colPaidDateTime"].Value = record.PaidDateTime; row.Cells["colSettled"].Value = record.SettleDateTime != null; row.Cells["colSettleDateTime"].Value = record.SettleDateTime; row.Cells["colOperatorID"].Value = record.OperatorID; row.Cells["colStation"].Value = record.StationID; row.Cells["colMemo"].Value = record.Memo; if (record.TotalPaidFee != record.RefundMoney) { row.DefaultCellStyle.ForeColor = Color.Red; } }
/// <summary> /// 操作员结算 /// </summary> /// <param name="opt"></param> /// <returns></returns> public CommandResult Settle(OperatorSettleLog opt) { IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); IOperatorLogProvider ip = ProviderFactory.Create <IOperatorLogProvider>(_RepoUri); ip.Insert(opt, unitWork); if (opt.PaymentRecords != null && opt.PaymentRecords.Count > 0) { ICardPaymentRecordProvider provider = ProviderFactory.Create <ICardPaymentRecordProvider>(_RepoUri); foreach (CardPaymentInfo record in opt.PaymentRecords) { CardPaymentInfo original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.ReleaseRecords != null && opt.ReleaseRecords.Count > 0) { ICardReleaseRecordProvider provider = ProviderFactory.Create <ICardReleaseRecordProvider>(_RepoUri); foreach (CardReleaseRecord record in opt.ReleaseRecords) { CardReleaseRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.ChargeRecords != null && opt.ChargeRecords.Count > 0) { ICardChargeRecordProvider provider = ProviderFactory.Create <ICardChargeRecordProvider>(_RepoUri); foreach (CardChargeRecord record in opt.ChargeRecords) { CardChargeRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.DeferRecords != null && opt.DeferRecords.Count > 0) { ICardDeferRecordProvider provider = ProviderFactory.Create <ICardDeferRecordProvider>(_RepoUri); foreach (CardDeferRecord record in opt.DeferRecords) { CardDeferRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.CardLostRecords != null && opt.CardLostRecords.Count > 0) { ICardLostRestoreRecordProvider provider = ProviderFactory.Create <ICardLostRestoreRecordProvider>(_RepoUri); foreach (CardLostRestoreRecord record in opt.CardLostRecords) { CardLostRestoreRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.RecycleRecords != null && opt.RecycleRecords.Count > 0) { ICardRecycleRecordProvider provider = ProviderFactory.Create <ICardRecycleRecordProvider>(_RepoUri); foreach (CardRecycleRecord record in opt.RecycleRecords) { CardRecycleRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.APMRefundRecords != null && opt.APMRefundRecords.Count > 0) { IAPMRefundRecordProvider provider = ProviderFactory.Create <IAPMRefundRecordProvider>(_RepoUri); foreach (APMRefundRecord record in opt.APMRefundRecords) { APMRefundRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.EventRecords != null && opt.EventRecords.Count > 0) { ICardEventProvider provider = ProviderFactory.Create <ICardEventProvider>(_RepoUri); foreach (CardEventRecord record in opt.EventRecords) { CardEventRecord original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } if (opt.AlarmRecords != null && opt.AlarmRecords.Count > 0) { IAlarmProvider provider = ProviderFactory.Create <IAlarmProvider>(_RepoUri); foreach (AlarmInfo record in opt.AlarmRecords) { AlarmInfo original = record.Clone(); record.SettleDateTime = opt.SettleDateTime; provider.Update(record, original, unitWork); } } return(unitWork.Commit()); }
public CommandResult Delete(APMRefundRecord info) { return(provider.Delete(info)); }
public CommandResult Insert(APMRefundRecord info) { return(provider.Insert(info)); }