protected override CommandResult AddItem(object addingItem) { CommandResult result = bll.AddCard((CardInfo)addingItem); if (result.Result == ResultCode.Successful) { WriteCard((CardInfo)addingItem); if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo((CardInfo)addingItem, AppSettings.CurrentSetting.CurrentStandbyConnect); } } return(result); }
private void btnOk_Click(object sender, EventArgs e) { if (!CheckInput()) { return; } CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); CommandResult result; if (LossRestoreCard.Status == CardStatus.Loss) { result = bll.CardRestore(LossRestoreCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard); } else { if (chkPayParkFee.Checked && _ParkPayment != null) { _ParkPayment.Paid = txtParkFee.DecimalValue; _ParkPayment.Discount = _ParkPayment.Accounts - _ParkPayment.Paid; result = bll.CardLoss(LossRestoreCard, this.txtMemo.Text, txtCardCost.DecimalValue, comPaymentMode.SelectedPaymentMode, _ParkPayment); } else { result = bll.CardLoss(LossRestoreCard, this.txtMemo.Text, txtCardCost.DecimalValue, comPaymentMode.SelectedPaymentMode); } } if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { //恢复时才将卡片信息写入,挂失时不写入 if (LossRestoreCard.Status == CardStatus.Enabled) { CardOperationManager.Instance.WriteCardLoop(LossRestoreCard); } } if (this.ItemUpdated != null) { this.ItemUpdated(this, new ItemUpdatedEventArgs(LossRestoreCard)); } if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(LossRestoreCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } this.Close(); } else { MessageBox.Show(result.Message); } }
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); } } } }
private void btnOk_Click(object sender, EventArgs e) { ReleasingCard = this.ucCard1.Card; if (ReleasingCard != null) { if (CheckInput()) { if (txtRecieveMoney.DecimalValue <= 0) { if (MessageBox.Show(Resources.Resource1.FrmCardPaying_MoneyLittleQuery, Resources.Resource1.Form_Alert, MessageBoxButtons.YesNo) == DialogResult.No) { return; } } CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); CommandResult result = bll.CardRelease(ReleasingCard, txtRecieveMoney.DecimalValue, comPaymentMode.SelectedPaymentMode, txtMemo.Text.Trim()); if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { CardOperationManager.Instance.WriteCardLoop(ReleasingCard); } if (!_isAdding) { if (ItemUpdated != null) { ItemUpdated(this, new ItemUpdatedEventArgs(ReleasingCard)); } } else { if (ItemAdded != null) { ItemAdded(this, new ItemAddedEventArgs(ReleasingCard)); } } this.ucCard1.Clear(); this.txtRecieveMoney.DecimalValue = 0; if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(ReleasingCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } } else { MessageBox.Show(result.Message); } } } }
private void btnOk_Click(object sender, EventArgs e) { try { if (CheckInput()) { CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); CommandResult result; if (this.DisableEnableCard.Status == CardStatus.Disabled) { result = bll.CardEnable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard); } else { result = bll.CardDisable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard); } if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { CardOperationManager.Instance.WriteCardLoop(DisableEnableCard); } if (ItemUpdated != null) { ItemUpdated(this, new ItemUpdatedEventArgs(DisableEnableCard)); } if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(DisableEnableCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } this.Close(); } else { MessageBox.Show(result.Message); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected override CommandResult UpdateItem(object updatingItem) { CardInfo card = (CardInfo)updatingItem; CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); CommandResult result = bll.UpdateCardAll(card); if (result.Result == ResultCode.Successful) { WriteCard(card); if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo((CardInfo)updatingItem, AppSettings.CurrentSetting.CurrentStandbyConnect); } } return(result); }
private void btnOk_Click(object sender, EventArgs e) { if (RecycleCard != null) { if (CheckInput()) { decimal money; money = this.txtTurnbackMoney.DecimalValue; CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); CommandResult result = bll.CardRecycle(this.RecycleCard, money, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard); if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { CardOperationManager.Instance.WriteCardLoop(RecycleCard); } if (this.ItemUpdated != null) { ItemUpdated(this, new ItemUpdatedEventArgs(RecycleCard)); } if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(RecycleCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } this.Close(); } else { MessageBox.Show(result.Message); } } } }
private void btnOk_Click(object sender, EventArgs e) { try { if (ChargingCard != null) { if (CheckInput()) { if (this.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(ChargingCard.CardID)) { return; } } CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); decimal chargeAmount = this.txtChargeAmount.DecimalValue; decimal recieveMoney = this.txtRecieveMoney.DecimalValue; DateTime newValid = this.dtValidDate.Value.Date.AddDays(1).AddSeconds(-1); bool keepParkingStatus = !AppSettings.CurrentSetting.EnableWriteCard || ChargingCard.OnlineHandleWhenOfflineMode;//写卡模式时,脱机处理卡片不需要保持卡片数据库中的运行状态 CommandResult result = bll.CardCharge(ChargingCard, chargeAmount, recieveMoney, this.comPaymentMode.SelectedPaymentMode, newValid, this.txtMemo.Text, keepParkingStatus); if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { CardOperationManager.Instance.WriteCardLoop(ChargingCard); } if (ItemUpdated != null) { ItemUpdated(this, new ItemUpdatedEventArgs(ChargingCard)); } if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(ChargingCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } this.Close(); } else { MessageBox.Show(result.Message); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnOk_Click(object sender, EventArgs e) { //这里先停止读卡是为了防止有些读卡器会不停读卡,在卡片操作过程中,读卡器又读到卡片,影响操作 CardReaderManager.GetInstance(UserSetting.Current.WegenType).StopReadCard(); try { ReleasingCard = this.ucCard1.Card; if (ReleasingCard != null) { if (CheckInput()) { if (txtRecieveMoney.DecimalValue <= 0) { if (MessageBox.Show(Resources.Resource1.FrmCardPaying_MoneyLittleQuery, Resources.Resource1.Form_Alert, MessageBoxButtons.YesNo) == DialogResult.No) { CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard(); return; } } CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect); CommandResult result = null; if (ReleasingCard.ListType == CardListType.Card) { result = bll.CardRelease(ReleasingCard, txtRecieveMoney.DecimalValue, comPaymentMode.SelectedPaymentMode, txtMemo.Text.Trim()); } else { //发行车牌名单,生成卡号最多重试10次 result = bll.CarPlateRelease(ReleasingCard, txtRecieveMoney.DecimalValue, comPaymentMode.SelectedPaymentMode, txtMemo.Text.Trim(), 10); } if (result.Result == ResultCode.Successful) { //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消 if (this.chkWriteCard.Checked) { CardOperationManager.Instance.WriteCardLoop(ReleasingCard); } if (!_isAdding) { if (ItemUpdated != null) { ItemUpdated(this, new ItemUpdatedEventArgs(ReleasingCard)); } } else { if (ItemAdded != null) { ItemAdded(this, new ItemAddedEventArgs(ReleasingCard)); } } this.ucCard1.Clear(); this.txtRecieveMoney.DecimalValue = 0; if (DataBaseConnectionsManager.Current.StandbyConnected) { //备用数据连上时,同步到备用数据库 bll.SyncCardToDatabaseWithoutPaymentInfo(ReleasingCard, AppSettings.CurrentSetting.CurrentStandbyConnect); } } else { MessageBox.Show(result.Message); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard(); }