private void btnOk_Click(object sender, EventArgs e) { if (DeferingCard != null) { if (CheckInput()) { if (txtRecieveMoney.DecimalValue <= 0) { if (MessageBox.Show(Resource1.FrmCardPaying_MoneyLittleQuery, Resource1.Form_Alert, MessageBoxButtons.YesNo) == DialogResult.No) { return; } } //写卡模式时,先读取卡片信息 if (this.chkWriteCard.Checked) { if (!CardOperationManager.Instance.CheckCardWithMessage(DeferingCard.CardID)) { return; } } CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); decimal recieveMoney = this.txtRecieveMoney.DecimalValue; DateTime newValidDate = this.dtEnd.Value.Date.AddDays(1).AddSeconds(-1); DateTimeRange dr = new DateTimeRange(dtBegin.Value, dtEnd.Value); CommandResult result = bll.CardDefer(DeferingCard, dr, this.comPaymentMode.SelectedPaymentMode, recieveMoney, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);//写卡模式不需要保持卡片数据库中的运行状态 if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { CardOperationManager.Instance.WriteCardLoop(DeferingCard); } if (ItemUpdated != null) { ItemUpdated(this, new ItemUpdatedEventArgs(DeferingCard)); } if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(DeferingCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } this.Close(); } else { MessageBox.Show(result.Message); } } } }