/// <summary> /// 卡片恢复 /// </summary> /// <param name="info"></param> /// <param name="reason"></param> /// <param name="keepParkingStatus">是否保持数据库中的卡片运行状态</param> /// <returns></returns> public CommandResult CardRestore(CardInfo info, string reason, bool keepParkingStatus) { string op = OperatorInfo.CurrentOperator.OperatorName; string station = WorkStationInfo.CurrentStation.StationName; IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); CardLostRestoreRecord record = new CardLostRestoreRecord { CardID = info.CardID, RestoreDateTime = DateTime.Now, RestoreMemo = reason, RestoreOperator = op, RestoreStation = station, }; ICardLostRestoreRecordProvider restorProvider = ProviderFactory.Create <ICardLostRestoreRecordProvider>(_RepoUri); restorProvider.Insert(record, unitWork); info.Restore(); if (keepParkingStatus) { UpdateCard(info, unitWork); } else { UpdateCardAll(info, unitWork); } return(unitWork.Commit()); }
/// <summary> /// 卡片挂失 /// </summary> /// <param name="info"></param> /// <param name="reason"></param> /// <param name="lostCardCost"></param> /// <param name="paymode"></param> /// <param name="keepParkingStatus">是否保持数据库中的卡片运行状态</param> public CommandResult CardLoss(CardInfo info, string reason, decimal lostCardCost, PaymentMode paymode, bool keepParkingStatus) { string op = OperatorInfo.CurrentOperator.OperatorName; string station = WorkStationInfo.CurrentStation.StationName; IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); CardLostRestoreRecord record = new CardLostRestoreRecord { CardID = info.CardID, OwnerName = info.OwnerName, CardCertificate = info.CardCertificate, CarPlate = info.CarPlate, CardStatus = (byte)info.Status, //保存卡片的原有卡状态 LostDateTime = DateTime.Now, LostOperator = op, LostStation = station, LostMemo = reason, LostCardCost = lostCardCost, PaymentMode = paymode }; ICardLostRestoreRecordProvider lostProvider = ProviderFactory.Create <ICardLostRestoreRecordProvider>(_RepoUri); info.Lost(); lostProvider.Insert(record, unitWork); if (keepParkingStatus) { UpdateCard(info, unitWork); } else { UpdateCardAll(info, unitWork); } return(unitWork.Commit()); }
/// <summary> /// 卡片挂失,除了收取了卡片工本费还收取了卡片在场内的停车费用,并把卡片置为出场 /// </summary> /// <param name="info"></param> /// <param name="reason"></param> /// <param name="lostCardCost"></param> /// <param name="paymode"></param> /// <param name="parkFee"></param> /// <returns></returns> public CommandResult CardLoss(CardInfo info, string reason, decimal lostCardCost, PaymentMode paymode, CardPaymentInfo parkFee) { string op = OperatorInfo.CurrentOperator.OperatorName; string station = WorkStationInfo.CurrentStation.StationName; IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); CardLostRestoreRecord record = new CardLostRestoreRecord { CardID = info.CardID, OwnerName = info.OwnerName, CardCertificate = info.CardCertificate, CarPlate = info.CarPlate, CardStatus = (byte)info.Status, //保存卡片的原有卡状态 LostDateTime = DateTime.Now, LostOperator = op, LostStation = station, LostMemo = reason, LostCardCost = lostCardCost, PaymentMode = paymode }; ICardLostRestoreRecordProvider lostProvider = ProviderFactory.Create <ICardLostRestoreRecordProvider>(_RepoUri); lostProvider.Insert(record, unitWork); if (parkFee != null) { parkFee.OperatorID = op; parkFee.StationID = station; parkFee.PaymentMode = paymode; parkFee.Memo = "卡片挂失"; ICardPaymentRecordProvider icpp = ProviderFactory.Create <ICardPaymentRecordProvider>(_RepoUri); icpp.Insert(parkFee, unitWork); } //卡片置为挂失并出场 CardInfo original = info.Clone(); info.Status = CardStatus.Loss; info.ParkingStatus = ParkingStatus.Out; ICardProvider icp = ProviderFactory.Create <ICardProvider>(_RepoUri); icp.Update(info, original, unitWork); return(unitWork.Commit()); }
/// <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.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()); }