Esempio n. 1
0
        /// <summary>
        /// 卡片解禁
        /// </summary>
        /// <param name="info"></param>
        /// <param name="reason"></param>
        /// <param name="keepParkingStatus">是否保持卡片运行状态</param>
        /// <returns></returns>
        public CommandResult CardEnable(CardInfo info, string reason, bool keepParkingStatus)
        {
            string    op                   = OperatorInfo.CurrentOperator.OperatorName;
            string    station              = WorkStationInfo.CurrentStation.StationName;
            IUnitWork unitWork             = ProviderFactory.Create <IUnitWork>(_RepoUri);
            CardDisableEnableRecord record = new CardDisableEnableRecord
            {
                CardID          = info.CardID,
                EnableDateTime  = DateTime.Now,
                EnableOperator  = op,
                EnableStationID = station,
                EnableMemo      = reason,
            };
            ICardDisableEnableRecordProvider recordProvider = ProviderFactory.Create <ICardDisableEnableRecordProvider>(_RepoUri);

            recordProvider.Insert(record, unitWork);
            info.Enable();
            if (keepParkingStatus)
            {
                UpdateCard(info, unitWork);
            }
            else
            {
                UpdateCardAll(info, unitWork);
            }
            return(unitWork.Commit());
        }