/// <summary> /// 读取到卡号处理 /// </summary> /// <param name="cardID">卡号</param> /// <param name="info">从卡片扇区数据中读取到的卡片信息</param> private void ReadCardHandler(CardInfo card) { string msg = string.Empty; if (card.OnlineHandleWhenOfflineMode) { MessageBox.Show("卡片不能写入,请到停车场收费处缴费"); this.timer1.Enabled = true; return; //卡片只能在线处理,返回 } if (!card.IsInPark) { MessageBox.Show("卡片已出场"); this.timer1.Enabled = true; return; } if (card.LastDateTime > DateTime.Now) { MessageBox.Show("入场时间大于当前时间"); this.timer1.Enabled = true; return; } if (MySetting.Current.GetTariff(card.CardType.ID, card.CarType) == null) { MessageBox.Show("非收费卡,可直接出场"); this.timer1.Enabled = true; return; } _Card = card; _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(card, MySetting.Current, card.CarType, DateTime.Now); ShowCardPaymentInfo(_ChargeRecord); }
private void btnUpdate_Click(object sender, EventArgs e) { CardPaymentRecordBll cbll = new CardPaymentRecordBll(AppSettings.CurrentSetting.CurrentMasterConnect); LDB_CardPaymentRecordBll lcbll = new LDB_CardPaymentRecordBll(LDB_AppSettings.Current.LDBConnect); InitProgress(); NotifyProgress(0); foreach (DataGridViewRow row in GridView.Rows) { LDB_CardPaymentInfo info = row.Tag as LDB_CardPaymentInfo; CardPaymentInfo payment = LDB_InfoFactory.CreateCardPaymentInfo(info); CommandResult result = cbll.InsertRecordWithCheck(payment); if (result.Result == ResultCode.Successful) { info.UpdateFlag = true; lcbll.Update(info); ShowCardPaymentOnRow(info, row.Index); row.DefaultCellStyle.ForeColor = Color.Green; } else { row.DefaultCellStyle.ForeColor = Color.Red; } GridView.Refresh(); NotifyProgress(null); } NotifyProgress(this.progressBar1.Maximum); this.progressBar1.Visible = false; }
private void UploadCardPayment() { CommandResult result = null; CardPaymentRecordSearchCondition paymentcon = new CardPaymentRecordSearchCondition(); paymentcon.UpdateFlag = false; List <CardPaymentInfo> sRecords = _StandbyPaymentBll.GetItems(paymentcon).QueryObjects; if (sRecords != null && sRecords.Count > 0) { foreach (CardPaymentInfo sRecord in sRecords) { if (_SyncDataPause) { break; } CardPaymentInfo cpInfo = sRecord.Clone(); cpInfo.UpdateFlag = true; result = _MasterPaymentBll.InsertRecordWithCheck(cpInfo); if (result.Result == ResultCode.Successful) { sRecord.UpdateFlag = true; _StandbyPaymentBll.Update(sRecord); } } } }
private CommandResult SaveCardPayment(CardPaymentInfo cardPayment, PaymentMode paymentMode) { CommandResult result = null; cardPayment.Paid = txtPaid.DecimalValue; cardPayment.Discount = cardPayment.Accounts - cardPayment.Paid; cardPayment.Memo = txtMemo.Text; cardPayment.PaymentMode = paymentMode; cardPayment.OperatorID = OperatorInfo.CurrentOperator.OperatorName; cardPayment.StationID = WorkStationInfo.CurrentStation.StationName; cardPayment.IsCenterCharge = false; CardBll cbll = new CardBll(AppSettings.CurrentSetting.ParkConnect); result = cbll.PayParkFee(_cardInfo, cardPayment); //写卡模式并且不是按在线模式处理时需要将收费信息写入卡片扇区 if (AppSettings.CurrentSetting.EnableWriteCard && result.Result == ResultCode.Successful && !_processingEvent.OnlineHandleWhenOfflineMode) { _cardInfo.IsInPark = false;//标记已出场 CardOperationManager.Instance.WriteCardLoop(_cardInfo); } return(result); }
/// <summary> /// 生成卡片外车场停车收费记录 /// </summary> /// <param name="card">卡片</param> /// <param name="ts">停车场费率设置</param> /// <param name="tos" >收费设置选项</param> /// <param name="chargeDateTime">收费时间</param> /// <returns></returns> public static CardPaymentInfo CreateCardPaymentRecord(CardInfo card, TariffSetting ts, Byte carType, DateTime chargeDateTime) { CardPaymentInfo cardPayment = new CardPaymentInfo(); cardPayment.CardID = card.CardID; cardPayment.OwnerName = card.OwnerName; cardPayment.CardCertificate = card.CardCertificate; cardPayment.CarPlate = card.LastCarPlate; cardPayment.CardType = card.CardType; cardPayment.CarType = carType; cardPayment.EnterDateTime = card.LastDateTime; cardPayment.ChargeDateTime = chargeDateTime; //如果卡片的已缴费用与收费记录不一致,以卡片的数据为准 if ((cardPayment.LastTotalFee + cardPayment.LastTotalDiscount) != card.TotalPaidFee) { cardPayment.LastTotalPaid = card.TotalPaidFee; cardPayment.LastTotalDiscount = 0; cardPayment.LastStationID = string.Empty; } ParkAccountsInfo parkFee = ts.CalculateCardParkFee(card, carType, chargeDateTime); cardPayment.Accounts = parkFee.Accounts; cardPayment.TariffType = parkFee.TariffType; cardPayment.ParkFee = parkFee.ParkFee; cardPayment.PaymentCode = PaymentCode.Computer; return(cardPayment); }
private void ClearInput() { this.txtCardID.Text = string.Empty; this.lblOwnerName.Text = string.Empty; this.lblCarNum.Text = string.Empty; this.lblEnterDateTime.Text = string.Empty; this.lblExitDateTime.Text = string.Empty; this.lblParkingTime.Text = string.Empty; this.lblCardType.Text = string.Empty; this.lblTariffType.Text = string.Empty; this.lblLastTotalPaid.Text = string.Empty; this.lblAccounts.Text = string.Empty; this.lblLastWorkstation.Text = string.Empty; this.txtPaid.DecimalValue = 0; this.lblDiscount.Text = string.Empty; this.btnCancel.Enabled = false; this.btnCash.Enabled = false; this.btnYCT.Enabled = false; this.btnRepay.Enabled = false; this._cardInfo = null; this._ChargeRecord = null; this.picIn.Clear(); this.txtCardID.ReadOnly = false; this.txtMemo.Text = string.Empty; CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard(); }
private void customDataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { if (e.ColumnIndex >= 0) { _EventIndex = e.RowIndex; CardPaymentInfo info = this.GridView.Rows[e.RowIndex].Tag as CardPaymentInfo; if (info.EnterDateTime.HasValue) { FrmSnapShotViewer frm = new FrmSnapShotViewer(); frm.PreRecord += new RecordPositionEventHandler(frm_PreRecord); frm.NextRecord += new RecordPositionEventHandler(frm_NextRecord); frm.ShowImage(info.ChargeDateTime, info.EnterDateTime.Value, info.CardID); frm.ShowDialog(); frm.PreRecord -= new RecordPositionEventHandler(frm_PreRecord); frm.NextRecord -= new RecordPositionEventHandler(frm_NextRecord); } } else if (OperatorInfo.CurrentOperator.Permit(Permission.ModifyCardPaymentRecord)) { CardPaymentInfo info = customDataGridView1.Rows[e.RowIndex].Tag as CardPaymentInfo; if (info != null && info.SettleDateTime == null) { FrmCardPaymentRecordDetail frm = new FrmCardPaymentRecordDetail(); frm.CardPaymentRecord = info; if (frm.ShowDialog() == DialogResult.OK) { ShowCardPaymentOnRow(info, e.RowIndex); } } } } }
/// <summary> /// 生成停车场数据库的卡片缴费记录 /// </summary> /// <param name="info"></param> /// <returns></returns> public static CardPaymentInfo CreateCardPaymentInfo(LDB_CardPaymentInfo info) { CardPaymentInfo record = new CardPaymentInfo(); record.CardID = info.CardID; record.CardCertificate = info.CardCertificate; record.CarPlate = info.CarPlate; record.ChargeDateTime = info.ChargeDateTime; record.EnterDateTime = info.EnterDateTime; record.CardType = info.CardType; record.CarType = info.CarType; record.TariffType = info.TariffType; record.LastTotalPaid = info.LastTotalPaid; record.LastTotalDiscount = info.LastTotalDiscount; record.Accounts = info.Accounts; record.Paid = info.Paid; record.Discount = info.Discount; record.PaymentMode = info.PaymentMode; record.DiscountHour = info.DiscountHour; record.OperatorID = info.OperatorID; record.StationID = info.StationID; record.Memo = info.Memo; record.SettleDateTime = info.SettleDateTime; record.IsCenterCharge = info.IsCenterCharge; record.ParkFee = info.ParkFee; record.PaymentCode = info.PaymentCode; record.OperatorCardID = info.OperatorCardID; return(record); }
/// <summary> /// 收取卡片的停车费 /// </summary> /// <param name="info">缴费卡片,为空值时从数据库中获取,主要用于写卡模式时读取到卡片的数据</param> /// <param name="payment">缴费记录</param> /// <returns></returns> public CommandResult PayParkFee(CardInfo info, CardPaymentInfo payment) { if (info != null) { LDB_CardPaymentInfo ldbRecord = LDB_InfoFactory.CreateLDBCardPaymentInfo(payment); CommandResult result = _Provider.Insert(ldbRecord); if (result.Result == ResultCode.Successful) { if (payment.PaymentMode == PaymentMode.Prepay) { info.Balance -= payment.Paid; } //只有卡片在场或可重复出场,并且与缴费记录的进场时间相同,才会更新卡片信息 if ((info.IsInPark || info.CanRepeatOut) && payment.EnterDateTime.HasValue && info.LastDateTime == payment.EnterDateTime.Value) { //设置卡片缴费信息 info.SetPaidData(payment); } } return(result); } return(new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord))); }
private void ShowCardPaymentOnRow(CardPaymentInfo info, int row) { GridView.Rows[row].Tag = info; GridView.Rows[row].Cells["colCardID"].Value = info.CardID; GridView.Rows[row].Cells["colCardCertificate"].Value = info.CardCertificate; GridView.Rows[row].Cells["colCarType"].Value = CarTypeSetting.Current.GetDescription(info.CarType); GridView.Rows[row].Cells["colCardType"].Value = info.CardType.ToString(); GridView.Rows[row].Cells["colCarPlate"].Value = info.CarPlate; GridView.Rows[row].Cells["colExitDateTime"].Value = info.ChargeDateTime; GridView.Rows[row].Cells["colOperator"].Value = info.OperatorID; GridView.Rows[row].Cells["colPaymentMode"].Value = Ralid.Park.BusinessModel.Resouce.PaymentModeDescription.GetDescription(info.PaymentMode); GridView.Rows[row].Cells["colTariffType"].Value = Ralid.Park.BusinessModel.Resouce.TariffTypeDescription.GetDescription(info.TariffType); GridView.Rows[row].Cells["colEnterDateTime"].Value = info.EnterDateTime; GridView.Rows[row].Cells["colTimeSpan"].Value = info.TimeInterval; GridView.Rows[row].Cells["colPaid"].Value = info.Paid; GridView.Rows[row].Cells["colDiscount"].Value = info.Discount; GridView.Rows[row].Cells["colCurDiscountHour"].Value = info.CurrDiscountHour.HasValue ? info.CurrDiscountHour.Value.ToString() : string.Empty; GridView.Rows[row].Cells["colHandled"].Value = info.SettleDateTime != null; GridView.Rows[row].Cells["colSettleDateTime"].Value = info.SettleDateTime; GridView.Rows[row].Cells["colTotalAccounts"].Value = info.Accounts; GridView.Rows[row].Cells["colTotalPaid"].Value = info.TotalPaid; GridView.Rows[row].Cells["colTotalDiscount"].Value = info.TotalDiscount; GridView.Rows[row].Cells["colDiscountHour"].Value = info.DiscountHour; GridView.Rows[row].Cells["colStation"].Value = info.StationID; GridView.Rows[row].Cells["colMemo"].Value = info.Memo; GridView.Rows[row].Cells["colPaymentCode"].Value = Ralid.Park.BusinessModel.Resouce.PaymentCodeDescription.GetDescription(info.PaymentCode); GridView.Rows[row].Cells["colOperatorCardID"].Value = info.OperatorCardID; GridView.Rows[row].DefaultCellStyle.ForeColor = info.Discount > 0 ? Color.Red : Color.Black; }
public void AddARecord() { CardPaymentInfo record = new CardPaymentInfo(); record.CardID = "233955501"; record.CardType = CardType.TempCard; record.CarType = CarTypeSetting.DefaultCarType; record.ChargeDateTime = new DateTime(2011, 3, 27, 12, 15, 20); record.EnterDateTime = new DateTime(2011, 3, 27, 9, 1, 15); record.Accounts = 30; record.Paid = 30; record.PaymentMode = PaymentMode.Cash; record.TariffType = TariffType.Normal; record.OperatorID = "test"; record.StationID = "一号中央收费"; CardPaymentRecordBll bll = new CardPaymentRecordBll(StaticConnectString.ConnStr); CommandResult result = bll.Insert(record); Assert.IsTrue(result.Result == ResultCode.Successful); CardPaymentInfo r = bll.GetByID(new Ralid.Park.BusinessModel.Report.RecordID(record.CardID, record.ChargeDateTime)); Assert.IsTrue(r != null && r.CardID == record.CardID); bll.Delete(record); r = bll.GetByID(new Ralid.Park.BusinessModel.Report.RecordID(record.CardID, record.ChargeDateTime)); Assert.IsTrue(r == null); }
private void s_OnPaidOk(object sender, OpenCardEventArgs e) { try { if (string.IsNullOrEmpty(e.CardID)) { return; } CardPaymentInfo pay = e.Payment; if (pay != null && (pay.Accounts > 0 || pay.Discount > 0)) //只有要收费的记录才保存 { pay.Paid = e.Paid; pay.IsCenterCharge = true; pay.OperatorID = OperatorInfo.CurrentOperator.OperatorName; pay.StationID = WorkStationInfo.CurrentStation.StationName; CommandResult ret = (new CardBll(AppSettings.CurrentSetting.MasterParkConnect)).PayParkFee(pay); } if (e.Entrance != null) { IParkingAdapter pad = ParkingAdapterManager.Instance[e.Entrance.RootParkID]; if (pad != null) { var notify = new RemoteReadCardNotify(e.Entrance.RootParkID, e.Entrance.EntranceID, e.CardID, string.Empty, OperatorInfo.CurrentOperator.OperatorID, WorkStationInfo.CurrentStation.StationID); string temp = AppSettings.CurrentSetting.GetConfigContent("RemoteReader"); int reader = 0; if (!int.TryParse(temp, out reader)) { reader = 0; } notify.Reader = (EntranceReader)reader; if (!pad.RemoteReadCard(notify)) { if (Debug) { Ralid.GeneralLibrary.LOG.FileLog.Log(e.Entrance.EntranceName, string.Format("【{0}】 缴费事件 远程读卡失败", e.CardID)); } } if (!string.IsNullOrEmpty(e.CardType)) //只有开放卡片才显示余额 { WaitCallback wc = (WaitCallback)((object state) => { System.Threading.Thread.Sleep(AppSettings.CurrentSetting.GetShowBalanceInterval() * 1000); pad.LedDisplay(new SetLedDisplayNotify(e.Entrance.EntranceID, CanAddress.TicketBoxLed, string.Format("车费{0}元 余额{1}元", e.Paid, e.Balance), false, 0)); }); ThreadPool.QueueUserWorkItem(wc); } } } if (this.OnPaidOk != null) { this.OnPaidOk(sender, e); } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); throw ex; } }
private CardPaymentInfo GetPaymentInfo(CardInfo card, OpenCardEventArgs e, DateTime dt) { CardPaymentInfo ret = null; IParkingAdapter pad = null; EntranceInfo entrance = e.Entrance; if (entrance != null) { pad = ParkingAdapterManager.Instance[entrance.RootParkID]; } else //中央收费,默认使用卡片的入场停车场来扣费 { entrance = ParkBuffer.Current.GetEntrance(card.LastEntrance); if (entrance != null) { pad = ParkingAdapterManager.Instance[entrance.RootParkID]; } else { if (ParkingAdapterManager.Instance != null && ParkingAdapterManager.Instance.ParkAdapters != null) { pad = ParkingAdapterManager.Instance.ParkAdapters[0]; } } } if (pad != null) { ret = pad.CreateCardPaymentRecord(card, card.CarType, dt); } return(ret); }
private void ShowCardPaymentInfo(CardPaymentInfo cardPayment) { this.txtCardID.Text = cardPayment.CardID; this.txtCardID.SelectAll(); this.lblOwnerName.Text = cardPayment.OwnerName; this.lblCarNum.Text = cardPayment.CarPlate; this.lblEnterDateTime.Text = cardPayment.EnterDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); this.lblExitDateTime.Text = cardPayment.ChargeDateTime.ToString("yyyy-MM-dd HH:mm:ss"); this.lblParkingTime.Text = cardPayment.TimeInterval; this.lblCardType.Text = cardPayment.CardType.ToString(); this.lblTariffType.Text = Ralid.Park.BusinessModel.Resouce.TariffTypeDescription.GetDescription(cardPayment.TariffType); //this.lblLastTotalPaid.Text = cardPayment.LastTotalPaid.ToString(); this.lblLastTotalPaid.Text = _cardInfo.TotalPaidFee.ToString(); //this.lblLastTotalDiscount.Text = cardPayment.LastTotalDiscount.ToString(); this.lblAccounts.Text = cardPayment.Accounts.ToString(); this.lblLastWorkstation.Text = cardPayment.LastStationID; this.txtPaid.DecimalValue = cardPayment.Accounts - cardPayment.Discount; this.lblDiscount.Text = cardPayment.Discount.ToString(); this.txtMemo.Text = string.Empty; this.picIn.Clear(); List <SnapShot> imgs = _SnapShotBll.GetSnapShots(cardPayment.EnterDateTime.Value, cardPayment.CardID); if (imgs != null && imgs.Count > 0) { this.picIn.ShowSnapShots(imgs); } string msg = string.Format(Resource1.FrmCardPaying_PayingSpeech, TariffSetting.Current.TariffOption.StrMoney(cardPayment.Accounts)); this.carTypePanel1.SelectedCarType = cardPayment.CarType; this.btnCash.Enabled = true; this.btnCash.Focus(); this.btnYCT.Enabled = (_YCTReader != null) ? true : false; this.btnCancel.Enabled = true; this.btnRepay.Enabled = _cardInfo.LastPayment != null || _cardInfo.IsCompletedPaid; if (_cardInfo.IsCompletedPaid && TariffSetting.Current.IsInFreeTime(_cardInfo.PaidDateTime.Value, cardPayment.ChargeDateTime)) { //已缴费,并且未过免费时间 msg = string.Format(Resource1.FrmCardCenterCharge_FreeRemain, TariffSetting.Current.FreeTimeRemaining(_cardInfo.PaidDateTime.Value, cardPayment.ChargeDateTime)); this.eventList.InsertMessage(msg); this.txtMemo.Text = msg; //不允许缴费 this.btnCash.Enabled = false; this.btnYCT.Enabled = false; } if (_ChargeLed != null) { _ChargeLed.DisplayMsg(msg); } if (AppSettings.CurrentSetting.EnableTTS) { TTSSpeech.Instance.Speek(msg); } CardReaderManager.GetInstance(UserSetting.Current.WegenType).StopReadCard(); }
private void CarType_Selected(object sender, EventArgs e) { if (_ChargeRecord != null && CarTypeSetting.Current[carTypePanel1.SelectedCarType] != null) { _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(_cardInfo, TariffSetting.Current, carTypePanel1.SelectedCarType, _ChargeRecord.ChargeDateTime); ShowCardPaymentInfo(_ChargeRecord); } }
private void parkCombobox1_SelectedIndexChanged(object sender, EventArgs e) { if (_cardInfo != null) { _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(this.parkCombobox1.SelectedParkID, _cardInfo, TariffSetting.Current, _cardInfo.CarType, DateTime.Now); ShowCardPaymentInfo(_ChargeRecord); } }
private void parkCombobox1_SelectedIndexChanged(object sender, EventArgs e) { if (LossRestoreCard != null) { _ParkPayment = CardPaymentInfoFactory.CreateCardPaymentRecord(this.parkCombobox1.SelectedParkID, LossRestoreCard, TariffSetting.Current, LossRestoreCard.CarType, DateTime.Now); txtParkFee.DecimalValue = _ParkPayment.Accounts; } }
private void btnCancel_Click(object sender, EventArgs e) { if (_ChargeRecord != null) { _ChargeRecord = null; ClearInput(); } }
public bool Add(CardPaymentInfo info) { string sql = "insert into CardPaymentRecord values ('" + info.ChargeDateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','" + info.CardID + "','" + CardPaymentInfoSerializer.Serialize(info) + "')"; return(ExcuteCmd(sql) == 1); }
/// <summary> /// 读取到卡号处理 /// </summary> /// <param name="cardID">卡号</param> /// <param name="info">从卡片扇区数据中读取到的卡片信息</param> private void ReadCardIDHandler(string cardID, CardInfo info) { txtCardID.TextChanged -= txtCardID_TextChanged; this.txtCardID.Text = cardID; this.txtCardID.ReadOnly = true; string msg = string.Empty; CardInfo card = _CardBll.GetCardDetail(this.txtCardID.Text); if (card == null) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_UnRegister); } else if (AppSettings.CurrentSetting.EnableWriteCard && !card.OnlineHandleWhenOfflineMode && !CardDateResolver.Instance.CopyCardDataToCard(card, info)) { //写卡模式时,卡片信息从扇区数据中获取 msg = Resource1.FrmCardCenterCharge_CardDataErr; } else if (!ValidateCard(card, out msg)) { //卡片无效 } else if (TariffSetting.Current.GetTariff(card.CardType.ID, card.CarType) == null) { //msg = Resource1.FrmCardPaying_NotTempCard; msg = Resource1.FrmCardCenterCharge_NotPaymentCard; } else if (!card.IsInPark) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_StillOut); } else if (card.LastDateTime > DateTime.Now) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_WrongInTime); } else { _cardInfo = card; _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(_cardInfo, TariffSetting.Current, _cardInfo.CarType, DateTime.Now); ShowCardPaymentInfo(_ChargeRecord); } if (!string.IsNullOrEmpty(msg)) { if (_ChargeLed != null) { _ChargeLed.DisplayMsg(msg); } if (AppSettings.CurrentSetting.EnableTTS) { TTSSpeech.Instance.Speek(msg); } ClearInput(); this.txtCardID.Text = cardID; this.txtMemo.Text = msg; } txtCardID.TextChanged += txtCardID_TextChanged; }
private void carTypePanel1_CarTypeSelectedChanged(object sender, EventArgs e) { if (_ChargeRecord != null && CarTypeSetting.Current[carTypePanel1.SelectedCarType] != null) { //_ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(_cardInfo, TariffSetting.Current, carTypePanel1.SelectedCarType, _ChargeRecord.ChargeDateTime); _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(this.parkCombobox1.SelectedParkID, _cardInfo, TariffSetting.Current, carTypePanel1.SelectedCarType, _ChargeRecord.ChargeDateTime); ShowCardPaymentInfo(_ChargeRecord); } }
public decimal GetCardLastPayment(CardInfo info, OperatorInfo operatorInfo) { decimal paid = 0; CardPaymentInfo paymentInfo = (new CardPaymentRecordBll(AppConifg.Current.ParkingConnection)).GetLatestRecord(info.CardID, info.LastDateTime, operatorInfo); if (paymentInfo != null) { paid = paymentInfo.Paid; } return(paid); }
private List <CardPaymentInfo> GetCardPaymentRecordsFromDeviceRecords(List <DevicePaymentRecord> deviceRecords, string entranceName) { if (deviceRecords != null) { List <CardPaymentInfo> records = new List <CardPaymentInfo>(); CardInfo card = null; CardInfo operatorCard = null; foreach (DevicePaymentRecord deviceRecord in deviceRecords) { CardPaymentInfo record = new CardPaymentInfo(); record.PaymentCode = deviceRecord.PaymentCode == DevicePaymentCode.Computer ? PaymentCode.Computer : PaymentCode.FunctionCard; record.ChargeDateTime = deviceRecord.PaymentDateTime; record.CardID = deviceRecord.CardID; record.Accounts = deviceRecord.Amount; record.Paid = deviceRecord.Amount; record.OperatorCardID = deviceRecord.FunctionCardID; record.StationID = entranceName; //缴费卡片相关信息 CardBll _CardBll = new CardBll(AppSettings.CurrentSetting.ParkConnect); if (card == null || card.CardID != record.CardID) { card = _CardBll.GetCardByID(record.CardID).QueryObject; } if (card != null) { record.OwnerName = card.OwnerName; record.CarPlate = card.CarPlate; record.CardType = card.CardType; record.CarType = card.CarType; } //收费功能卡相关信息 if (operatorCard == null || operatorCard.CardID != record.OperatorCardID) { operatorCard = _CardBll.GetCardByID(record.OperatorCardID).QueryObject; } if (operatorCard != null) { record.OperatorID = operatorCard.OwnerName; OperatorSettleBLL osbll = new OperatorSettleBLL(AppSettings.CurrentSetting.ParkConnect); //查找与收费时间最近的结算时间为记录结算时间,如没有找到,则该记录还没结算 record.SettleDateTime = osbll.GetRecentSettleDateTime(operatorCard.OwnerName, deviceRecord.PaymentDateTime); } record.Memo = string.Format("上传时间:{0} ;硬件记录索引:{1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), deviceRecord.RecordIndex); records.Add(record); } return(records); } return(null); }
private void CarType_Selected(object sender, EventArgs e) { if (_ChargeRecord != null && CarTypeSetting.Current[carTypePanel1.SelectedCarType] != null) { //专门针对长隆停车场设置一种“转会员卡"车型,选择“转会员卡"车型时必须重新刷一张会员卡才能时行这个操作,并在收费说明中写入“转会员卡+会员卡号" //这个功能采用硬编码 if (CarTypeSetting.Current[carTypePanel1.SelectedCarType].Description == _ToVipCard) { FrmVipCardReader frm = new FrmVipCardReader(); if (frm.ShowDialog() == DialogResult.OK) { string cardid = frm.VipCardID; if (DataBaseConnectionsManager.Current.MasterConnected || DataBaseConnectionsManager.Current.StandbyConnected) { CardInfo card = null; if (DataBaseConnectionsManager.Current.MasterConnected) { card = (new CardBll(AppSettings.CurrentSetting.CurrentMasterConnect)).GetCardByID(cardid).QueryObject; } else { card = (new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect)).GetCardByID(cardid).QueryObject; } if (card != null && card.CardType.Name == _VipCard) { _TempCardID = _ChargeRecord.CardID; _VipCardID = cardid; } else { MessageBox.Show(string.Format("卡号为 {0} 的卡不存在或者不是会员卡,请刷会员卡", cardid), Resource1.Form_Alert); return; } } else { MessageBox.Show("数据库连接失败!"); return; } } else { return; } } //end 转会员卡功能 _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(_cardInfo, TariffSetting.Current, carTypePanel1.SelectedCarType, _ChargeRecord.ChargeDateTime); ShowCardPaymentInfo(_ChargeRecord); } }
private void Clear() { _ChargeRecord = null; _Card = null; lblCardID.Text = string.Empty; lblEnterDT.Text = string.Empty; lblInterval.Text = string.Empty; lblTotal.Text = string.Empty; lblHasPaid.Text = string.Empty; lblAccount.Text = string.Empty; txtPaid.Text = string.Empty; this.timer1.Enabled = true; }
private void SavePaymentsToPark(List <string> records) { FrmProcessing frmP = new FrmProcessing(); Action action = delegate() { try { int success = 0; int fail = 0; CardPaymentRecordBll bll = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect); foreach (string record in records) { Ralid.Park.POS.Model.CardPaymentInfo p = Ralid.Park.POS.Model.CardPaymentInfoSerializer.Deserialize(record); if (p != null) { CardPaymentInfo item = CreateFrom(p); CommandResult ret = bll.InsertRecordWithCheck(item); if (ret.Result == ResultCode.Successful) { success++; } else { fail++; } } else { fail++; } frmP.ShowProgress(string.Format(Resource1.FrmMain_ImportCharges + " " + Resource1.FrmMain_Success + ":{0} " + Resource1.FrmMain_Fail + ":{1} " + Resource1.FrmMain_ImportTotal + ": {2}", success, fail, records.Count), (decimal)(success + fail) / records.Count); } ShowMessage(string.Format(Resource1.FrmMain_ImportCharges + " " + Resource1.FrmMain_Success + ":{0} " + Resource1.FrmMain_Fail + ":{1} " + Resource1.FrmMain_ImportTotal + ": {2}", success, fail, records.Count), Color.Black); } catch (ThreadAbortException) { } catch (Exception ex) { frmP.ShowProgress(ex.Message, 1); ShowMessage(ex.Message, Color.Red); } }; Thread t = new Thread(new ThreadStart(action)); t.Start(); if (frmP.ShowDialog() != DialogResult.OK) { t.Abort(); } }
/// <summary> /// 读取到卡号处理 /// </summary> /// <param name="cardID">卡号</param> /// <param name="info">从卡片扇区数据中读取到的卡片信息</param> private void ReadCardIDHandler(string cardID, CardInfo info) { this.txtCardID.Text = cardID; this.txtCardID.ReadOnly = true; string msg = string.Empty; CardInfo card = info; if (card == null) { msg = Resource1.FrmCardCenterCharge_CardDataErr; } else if (!ValidateCard(card, out msg)) { //卡片无效 } else if (TariffSetting.Current.GetTariff(card.CardType.ID, card.CarType) == null) { msg = Resource1.FrmCardCenterCharge_NotPaymentCard; } else if (!card.IsInPark) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_StillOut); } else if (card.LastDateTime > DateTime.Now) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_WrongInTime); } else { _cardInfo = card; _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(_cardInfo, TariffSetting.Current, _cardInfo.CarType, DateTime.Now); _ChargeRecord.CarPlate = _cardInfo.CarPlate; ShowCardPaymentInfo(_ChargeRecord); } if (!string.IsNullOrEmpty(msg)) { if (_ChargeLed != null) { _ChargeLed.DisplayMsg(msg); } if (AppSettings.CurrentSetting.EnableTTS) { TTSSpeech.Instance.Speek(msg); } ClearInput(); this.txtCardID.Text = cardID; this.txtMemo.Text = msg; this.eventList.InsertMessage(msg); } }
/// <summary> /// 收取卡片的停车费 /// </summary> /// <param name="info">缴费卡片,为空值时从数据库中获取,主要用于写卡模式时读取到卡片的数据</param> /// <param name="payment">缴费记录</param> /// <returns></returns> public CommandResult PayParkFee(CardInfo info, CardPaymentInfo payment) { CardInfo original = GetCardByID(payment.CardID).QueryObject; if (original != null) { CardInfo card = original.Clone(); if (info != null) { //复制卡片缴费信息 CardDateResolver.Instance.CopyPaidDataToCard(card, info); } IUnitWork uw = ProviderFactory.Create <IUnitWork>(_RepoUri); if (payment.PaymentMode == PaymentMode.Prepay) { card.Balance -= payment.Paid; } //只有卡片在场或可重复出场,并且与缴费记录的进场时间相同,才会更新卡片信息 if ((card.IsInPark || card.CanRepeatOut) && payment.EnterDateTime.HasValue && card.LastDateTime == payment.EnterDateTime.Value) { //设置卡片缴费信息 card.SetPaidData(payment); _Provider.Update(card, original, uw); } (ProviderFactory.Create <ICardPaymentRecordProvider>(_RepoUri)).Insert(payment, uw); CommandResult result = uw.Commit(); if (result.Result == ResultCode.Successful && info != null) { //修改卡片实体类信息 CardDateResolver.Instance.CopyPaidDataToCard(info, card); //info.Balance = card.Balance; //info.ParkingStatus = card.ParkingStatus; //info.ParkFee = card.ParkFee; //info.PaidDateTime = card.PaidDateTime; //info.TotalFee = card.TotalFee; } return(result); } return(new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord))); }
private void s_OnPaying(object sender, OpenCardEventArgs e) { if (string.IsNullOrEmpty(e.CardID)) { return; } //add by Jan 2016-04-27 增加对上次未完成的收费信息的处理 CardPaymentInfo unPay = e.UnFinishedPayment; if (unPay != null && (unPay.Accounts > 0 || unPay.Discount > 0)) //只有要收费的记录才保存 { //先保存上次未完成的收费信息的处理 unPay.IsCenterCharge = true; unPay.OperatorID = OperatorInfo.CurrentOperator.OperatorName; unPay.StationID = WorkStationInfo.CurrentStation.StationName; CommandResult ret = (new CardBll(AppSettings.CurrentSetting.MasterParkConnect)).PayParkFee(unPay); if (ret.Result != ResultCode.Successful) { e.Payment = null; return;//如果保存失败的,就不需要继续了 } } //end add by Jan 2016-04-27 CardInfo card = (new CardBll(AppSettings.CurrentSetting.ParkConnect)).GetCardByID(e.CardID).QueryObject; if (card == null) { return; } DateTime dt = e.ChargeDateTime.HasValue ? e.ChargeDateTime.Value : DateTime.Now; //add by Jan 2016-04-27 有输入计费时间时,用输入的计费时间 CardPaymentInfo payment = GetPaymentInfo(card, e, dt); if (!card.IsInPark && payment != null) { payment.Accounts = 0; payment.Discount = 0; } //停车场获取收费信息时已经出场的卡片也会产生费用信息,所以这里对这种情况处理为应收0元 e.Payment = payment; if (this.OnPaying != null) { this.OnPaying(sender, e); } //add by Jan 2016-04-27 清空上次未完成的收费信息 e.UnFinishedPayment = null; e.ChargeDateTime = null; //end add by Jan 2016-04-27 }
private void ShowCardPaymentInfo(CardPaymentInfo cardPayment) { lblCardID.Text = cardPayment.CardID; if (cardPayment.EnterDateTime != null) { lblEnterDT.Text = cardPayment.EnterDateTime.Value.ToString("yyyy-MM-dd HH:mm:dd"); } lblHasPaid.Text = cardPayment.LastTotalPaid.ToString(); lblInterval.Text = cardPayment.TimeInterval; lblTotal.Text = cardPayment.ParkFee.ToString(); lblHasPaid.Text = cardPayment.LastTotalPaid.ToString(); lblAccount.Text = cardPayment.Accounts.ToString(); txtPaid.Text = cardPayment.Accounts.ToString(); btnOK.Focus(); }