/// <summary> /// 卡片充值 /// </summary> /// <param name="info"></param> /// <param name="chargeAmount"></param> /// <param name="payment"></param> /// <param name="paymentMode"></param> /// <param name="validDate"></param> /// <param name="memo"></param> /// <param name="keepParkingStatus">是否保持数据库中的卡片运行状态</param> /// <returns></returns> public CommandResult CardCharge(CardInfo info, Decimal chargeAmount, Decimal payment, PaymentMode paymentMode, DateTime validDate, string memo, bool keepParkingStatus) { string op = OperatorInfo.CurrentOperator.OperatorName; string station = WorkStationInfo.CurrentStation.StationName; IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); info.Charge(chargeAmount); info.ValidDate = validDate; if (keepParkingStatus) { UpdateCard(info, unitWork); } else { UpdateCardAll(info, unitWork); } CardChargeRecord record = new CardChargeRecord { CardID = info.CardID, ChargeDateTime = DateTime.Now, OwnerName = info.OwnerName, CardCertificate = info.CardCertificate, CarPlate = info.CarPlate, Balance = info.Balance, ValidDate = info.ValidDate, ChargeAmount = chargeAmount, Payment = payment, PaymentMode = paymentMode, OperatorID = op, StationID = station, Memo = memo, }; ICardChargeRecordProvider recordProvider = ProviderFactory.Create <ICardChargeRecordProvider>(_RepoUri); recordProvider.Insert(record, unitWork); return(unitWork.Commit()); }