Ejemplo n.º 1
0
        protected override CommandResult UpdateItem(object updatingItem)
        {
            CommandResult result = this.chkWriteCard.Checked ? bll.UpdateCardAll((CardInfo)updatingItem) : bll.UpdateCard((CardInfo)updatingItem);

            if (result.Result == ResultCode.Successful)
            {
                WriteCard((CardInfo)updatingItem);

                if (DataBaseConnectionsManager.Current.StandbyConnected)
                {
                    //备用数据连上时,同步到备用数据库
                    bll.SyncCardToDatabaseWithoutPaymentInfo((CardInfo)updatingItem, AppSettings.CurrentSetting.CurrentStandbyConnect);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        private void btnRepay_Click(object sender, EventArgs e)
        {
            if (_cardInfo != null)
            {
                if (_cardInfo.LastPayment != null)
                {
                    if (_cardInfo.LastPayment.SettleDateTime == null)
                    {
                        bool hadCard = true;
                        //写卡模式时,需要删除卡片内的缴费数据,重新写入缴费数据
                        if (AppSettings.CurrentSetting.EnableWriteCard && !_cardInfo.OnlineHandleWhenOfflineMode)
                        {
                            hadCard = CardOperationManager.Instance.CheckCard(_cardInfo.CardID) == CardOperationResultCode.Success;
                            if (!hadCard)
                            {
                                if (MessageBox.Show(Resource1.FrmCardCenterCharge_NotCard, Resource1.Form_Query,
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                                {
                                    return;
                                }
                            }
                        }
                        if (MessageBox.Show(Resource1.FrmCardPaying_CancelPaymentQuey, Resource1.Form_Query,
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            //CardPaymentRecordBll cprbll = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect);
                            //CommandResult result = cprbll.Delete(_cardInfo.LastPayment);
                            CommandResult result = _CardBll.DeleteLastPayment(_cardInfo);
                            if (result.Result == ResultCode.Successful)
                            {
                                AlarmInfo alarm = new AlarmInfo();
                                alarm.AlarmDateTime = DateTime.Now;
                                alarm.AlarmType     = AlarmType.CancelCardPayment;
                                alarm.OperatorID    = OperatorInfo.CurrentOperator.OperatorName;
                                alarm.AlarmDescr    = string.Format(Resource1.FrmCardPaying_CancelPaymentAlarm, _cardInfo.LastPayment.CardID,
                                                                    _cardInfo.LastPayment.ChargeDateTime.ToString("yyyy-MM-dd HH:mm:ss"), _cardInfo.LastPayment.EnterDateTime.Value.ToString("yyyy-MM-dd HH;mm:ss"),
                                                                    _cardInfo.LastPayment.Accounts);
                                (new AlarmBll(AppSettings.CurrentSetting.ParkConnect)).Insert(alarm);

                                //写卡模式时,需要删除卡片内的缴费数据,重新写入缴费数据
                                if (hadCard &&
                                    AppSettings.CurrentSetting.EnableWriteCard &&
                                    !_cardInfo.OnlineHandleWhenOfflineMode)
                                {
                                    CardOperationManager.Instance.WriteCardLoop(_cardInfo);
                                }
                                ReadCardIDHandler(_cardInfo.CardID, _cardInfo);
                            }
                            else
                            {
                                MessageBox.Show(result.Message);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(Resource1.FrmCenterCharge_RecordHandled, Resource1.Form_Alert);
                    }
                }
                else if (_cardInfo.IsCompletedPaid)
                {
                    //如果卡片有缴费信息,但数据库没有缴费记录,可清除卡片的缴费记录
                    if (MessageBox.Show(Resource1.FrmCardCenterCharge_DeletePayment, Resource1.Form_Query,
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        CardInfo info = _cardInfo.Clone();
                        info.ClearPaidData();
                        CommandResult result = _CardBll.UpdateCard(info);
                        if (result.Result == ResultCode.Successful)
                        {
                            //写卡模式并且不按在线处理时,需写入卡片
                            if (AppSettings.CurrentSetting.EnableWriteCard && !_cardInfo.OnlineHandleWhenOfflineMode)
                            {
                                CardOperationManager.Instance.WriteCardLoop(info);
                            }
                            _cardInfo.ClearPaidData();
                            ReadCardIDHandler(_cardInfo.CardID, _cardInfo);
                        }
                        else
                        {
                            MessageBox.Show(result.Message);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected override CommandResult UpdateItem(object updatingItem)
        {
            CommandResult result = this.chkWriteCard.Checked ? bll.UpdateCardAll((CardInfo)updatingItem) : bll.UpdateCard((CardInfo)updatingItem);

            if (result.Result == ResultCode.Successful)
            {
                WriteCard((CardInfo)updatingItem);
            }
            return(result);
        }