예제 #1
0
        /// <summary>
        /// 卡片发行
        /// </summary>
        /// <param name="info"></param>
        /// <param name="releaseMoney"></param>
        /// <param name="paymentMode"></param>
        /// <param name="memo"></param>
        /// <param name="keepParkingStatus">是否保持卡片运行状态</param>
        /// <returns></returns>
        public CommandResult CardRelease(CardInfo info, decimal releaseMoney, PaymentMode paymentMode, string memo, bool keepParkingStatus)
        {
            string            op       = OperatorInfo.CurrentOperator.OperatorName;
            string            station  = WorkStationInfo.CurrentStation.StationName;
            IUnitWork         unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); //工作单元
            CardReleaseRecord record   = new CardReleaseRecord
            {
                CardID          = info.CardID,
                OwnerName       = info.OwnerName,
                CardCertificate = info.CardCertificate,
                CarPlate        = info.CarPlate,
                ReleaseDateTime = DateTime.Now,
                CardType        = info.CardType,
                ReleaseMoney    = releaseMoney,
                PaymentMode     = paymentMode,
                Balance         = info.Balance,
                ActivationDate  = info.ActivationDate,
                ValidDate       = info.ValidDate,
                HolidayEnabled  = info.HolidayEnabled,
                Deposit         = info.Deposit,
                OperatorID      = op,
                StationID       = station,
                Memo            = memo
            };

            ProviderFactory.Create <ICardReleaseRecordProvider>(_RepoUri).Insert(record, unitWork);
            info.Release();
            ICardProvider icp     = ProviderFactory.Create <ICardProvider>(_RepoUri);
            CardInfo      origial = icp.GetByID(info.CardID).QueryObject;

            if (origial == null)
            {
                icp.Insert(info, unitWork);
            }
            else if (keepParkingStatus)
            {
                UpdateCard(info, unitWork);
            }
            else
            {
                UpdateCardAll(info, unitWork);
            }
            return(unitWork.Commit());
        }
예제 #2
0
        /// <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());
        }