예제 #1
0
 void frm_PreRecord(object sender, RecordPositionEventArgs e)
 {
     if (_EventIndex > 0)
     {
         this.customDataGridView1.Rows[_EventIndex].Selected = false;
         _EventIndex--;
         this.customDataGridView1.Rows[_EventIndex].Selected = true;
         if (_EventIndex < this.customDataGridView1.FirstDisplayedScrollingRowIndex)
         {
             if (this.customDataGridView1.FirstDisplayedScrollingRowIndex >= this.customDataGridView1.DisplayedRowCount(false))
             {
                 this.customDataGridView1.FirstDisplayedScrollingRowIndex -= this.customDataGridView1.DisplayedRowCount(false);
             }
             else
             {
                 this.customDataGridView1.FirstDisplayedScrollingRowIndex = 0;
             }
         }
         CardEventRecord   record = this.GridView.Rows[_EventIndex].Tag as CardEventRecord;
         FrmSnapShotViewer frm    = sender as FrmSnapShotViewer;
         if (record.IsExitEvent && record.LastDateTime != null)
         {
             frm.ShowImage(record.EventDateTime, record.LastDateTime.Value, record.CardID);
         }
         else
         {
             frm.ShowImage(record.EventDateTime, record.CardID);
         }
     }
     e.IsTopRecord = (_EventIndex == 0);
 }
예제 #2
0
        private void UploadCardEvent()
        {
            CommandResult            result = null;
            CardEventSearchCondition search = new CardEventSearchCondition();

            search.UpdateFlag = false;
            List <CardEventRecord> sRecords = _StandbyCardEventBll.GetCardEvents(search).QueryObjects;

            if (sRecords != null && sRecords.Count > 0)
            {
                foreach (CardEventRecord sRecord in sRecords)
                {
                    if (_SyncDataPause)
                    {
                        break;
                    }
                    CardEventRecord ceInfo = sRecord.Clone();
                    ceInfo.UpdateFlag = true;
                    result            = _MasterCardEventBll.InsertRecordWithCheck(ceInfo);
                    if (result.Result == ResultCode.Successful)
                    {
                        sRecord.UpdateFlag = true;
                        _StandbyCardEventBll.Update(sRecord);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 更新卡片事件
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public CommandResult Update(CardEventRecord info)
        {
            CardEventRecord oldVal = provider.GetByID(new RecordID(info.CardID, info.EventDateTime)).QueryObject;

            if (oldVal != null)
            {
                return(provider.Update(info, oldVal));
            }
            return(new CommandResult(ResultCode.NoRecord));
        }
예제 #4
0
        /// <summary>
        /// 检查有无该记录,无则插入
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public CommandResult InsertRecordWithCheck(CardEventRecord info)
        {
            CardEventSearchCondition searchCondition = new CardEventSearchCondition();

            searchCondition.CardID = info.CardID;
            searchCondition.RecordDateTimeRange = new DateTimeRange(info.EventDateTime, info.EventDateTime);

            List <CardEventRecord> check = provider.GetItems(searchCondition).QueryObjects;

            if (check == null || check.Count == 0)
            {
                return(provider.Insert(info));
            }
            //已存在该记录,可认为插入成功
            return(new CommandResult(ResultCode.Successful, string.Empty));
        }
예제 #5
0
 private void customDataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         _EventIndex = e.RowIndex;
         CardEventRecord   record = this.GridView.Rows[e.RowIndex].Tag as CardEventRecord;
         FrmSnapShotViewer frm    = new FrmSnapShotViewer();
         frm.PreRecord  += new RecordPositionEventHandler(frm_PreRecord);
         frm.NextRecord += new RecordPositionEventHandler(frm_NextRecord);
         if (record.IsExitEvent && record.LastDateTime != null)
         {
             frm.ShowImage(record.EventDateTime, record.LastDateTime.Value, record.CardID);
         }
         else
         {
             frm.ShowImage(record.EventDateTime, record.CardID);
         }
         frm.ShowDialog();
         frm.PreRecord  -= new RecordPositionEventHandler(frm_PreRecord);
         frm.NextRecord -= new RecordPositionEventHandler(frm_NextRecord);
     }
 }
예제 #6
0
 void frm_NextRecord(object sender, RecordPositionEventArgs e)
 {
     if (_EventIndex < customDataGridView1.Rows.Count - 1)
     {
         this.customDataGridView1.Rows[_EventIndex].Selected = false;
         _EventIndex++;
         this.customDataGridView1.Rows[_EventIndex].Selected = true;
         if (_EventIndex > this.customDataGridView1.FirstDisplayedScrollingRowIndex + this.customDataGridView1.DisplayedRowCount(false) - 1)
         {
             this.customDataGridView1.FirstDisplayedScrollingRowIndex += this.customDataGridView1.DisplayedRowCount(false);
         }
         CardEventRecord   record = this.GridView.Rows[_EventIndex].Tag as CardEventRecord;
         FrmSnapShotViewer frm    = sender as FrmSnapShotViewer;
         if (record.IsExitEvent && record.LastDateTime != null)
         {
             frm.ShowImage(record.EventDateTime, record.LastDateTime.Value, record.CardID);
         }
         else
         {
             frm.ShowImage(record.EventDateTime, record.CardID);
         }
     }
     e.IsButtonRecord = (_EventIndex == GridView.Rows.Count - 1);
 }
예제 #7
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());
        }
예제 #8
0
 /// <summary>
 /// 插入卡片事件
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public CommandResult Insert(CardEventRecord info)
 {
     return(provider.Insert(info));
 }
예제 #9
0
 /// <summary>
 /// 删除卡片事件
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public CommandResult Delete(CardEventRecord info)
 {
     return(provider.Delete(info));
 }
예제 #10
0
        /// <summary>
        /// 获取车牌号码所在停车场
        /// </summary>
        /// <param name="carPlate"></param>
        /// <returns></returns>
        public QueryResult <ParkInfo> GetParkInfoCarPlate(string carPlate)
        {
            QueryResult <ParkInfo> result = new QueryResult <ParkInfo>(ResultCode.Fail, null);

            //先根据车牌查找卡片
            ICardProvider       cardProvider  = ProviderFactory.Create <ICardProvider>(this._repoUri);
            CardSearchCondition cardCondition = new CardSearchCondition();

            cardCondition.CarPlateOrLast = carPlate;

            QueryResultList <CardInfo> cardResult = cardProvider.GetItems(cardCondition);

            if (cardResult.Result == ResultCode.Successful)
            {
                CardInfo card = null;

                if (cardResult.QueryObjects != null && cardResult.QueryObjects.Count > 0)
                {
                    //查找第一个符合条件的已入场卡片
                    card = cardResult.QueryObjects.FirstOrDefault(c => c.IsInPark);
                }

                if (card == null)
                {
                    result = new QueryResult <ParkInfo>(ResultCode.NoRecord, null);
                }
                else
                {
                    //根据卡号和入场时间查找入场事件
                    ICardEventProvider       eventProvider  = ProviderFactory.Create <ICardEventProvider>(this._repoUri);
                    CardEventSearchCondition eventCondition = new CardEventSearchCondition();
                    eventCondition.RecordDateTimeRange = new DateTimeRange(card.LastDateTime, card.LastDateTime);
                    eventCondition.CardID         = card.CardID;
                    eventCondition.OnlyEnterEvent = true;

                    QueryResultList <CardEventRecord> eventResult = eventProvider.GetItems(eventCondition);
                    if (eventResult.Result == ResultCode.Successful)
                    {
                        CardEventRecord eventRecord = null;
                        if (eventResult.QueryObjects != null && eventResult.QueryObjects.Count > 0)
                        {
                            //查找到多条记录时,取第一条记录
                            eventRecord = eventResult.QueryObjects[0];
                        }
                        if (eventRecord == null)
                        {
                            result = new QueryResult <ParkInfo>(ResultCode.NoRecord, null);
                        }
                        else
                        {
                            ParkInfo park = provider.GetByID(eventRecord.ParkID).QueryObject;
                            if (park == null)
                            {
                                result = new QueryResult <ParkInfo>(ResultCode.NoRecord, null);
                            }
                            else
                            {
                                result = new QueryResult <ParkInfo>(ResultCode.Successful, park);
                            }
                        }
                    }
                }
            }
            return(result);
        }