Exemple #1
0
        protected override List <AlarmInfo> GetingItems(ParkDataContext parking, SearchCondition search)
        {
            if (search is RecordSearchCondition)
            {
                RecordSearchCondition condition = search as RecordSearchCondition;

                IQueryable <AlarmInfo> result = parking.Alarm;
                if (condition.RecordDateTimeRange != null)
                {
                    result = result.Where(c => c.AlarmDateTime >= condition.RecordDateTimeRange.Begin).AsQueryable();
                    result = result.Where(c => c.AlarmDateTime <= condition.RecordDateTimeRange.End).AsQueryable();
                }
                if (condition.Operator != null)
                {
                    result = result.Where(c => c.OperatorID == condition.Operator.OperatorID).AsQueryable();
                }
                if (condition is AlarmSearchCondition)
                {
                    AlarmSearchCondition s = condition as AlarmSearchCondition;
                    if (!string.IsNullOrEmpty(s.AlarmSource))
                    {
                        result = result.Where(c => c.AlarmSource.Contains(s.AlarmSource)).AsQueryable();
                    }
                    if (!string.IsNullOrEmpty(s.AlarmType))
                    {
                        result = result.Where(c => c.AlarmType.Contains(s.AlarmType)).AsQueryable();
                    }
                }
                return(result.ToList());
            }
            return(new List <AlarmInfo>());
        }
        private void ItemSearching_Handler(object sender, EventArgs e)
        {
            this.customDataGridview1.Rows.Clear();
            AlarmSearchCondition con = new AlarmSearchCondition();

            con.AlarmSource = this.entranceComboBox1.SelectedEntranceName;
            if (Enum.IsDefined(typeof(AlarmType), this.alarmTypeComboBox1.SelectedAlarmType))
            {
                con.AlarmType = this.alarmTypeComboBox1.SelectedAlarmType;
            }
            con.RecordDateTimeRange       = new DateTimeRange();
            con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime;
            con.RecordDateTimeRange.End   = this.ucDateTimeInterval1.EndDateTime;
            con.Operator = this.operatorCombobox1.SelectecOperator;
            AlarmBll bll = new AlarmBll(Ralid.Park.BusinessModel.Configuration.AppSettings.CurrentSetting.ParkConnect);
            QueryResultList <AlarmInfo> result = bll.GetAlarms(con);

            if (result.Result == ResultCode.Successful)
            {
                List <AlarmInfo> items = (from alarm in result.QueryObjects
                                          orderby alarm.AlarmDateTime descending
                                          select alarm).ToList();
                foreach (AlarmInfo alarm in items)
                {
                    int row = this.customDataGridview1.Rows.Add();
                    ShowAlarmOnRow(this.customDataGridview1.Rows[row], alarm);
                }
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Exemple #3
0
        protected override List <AlarmInfo> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            IQueryable <AlarmInfo> result = dc.GetTable <AlarmInfo>();

            if (search is AlarmSearchCondition)
            {
                AlarmSearchCondition con = search as AlarmSearchCondition;
                if (con.AlarmDateTime != null)
                {
                    result = result.Where(c => c.AlarmDateTime >= con.AlarmDateTime.Begin);
                    result = result.Where(c => c.AlarmDateTime <= con.AlarmDateTime.End);
                }
                if (con.AlarmType != null)
                {
                    result = result.Where(c => c.AlarmType == con.AlarmType);
                }
                if (con.OperatorID != null)
                {
                    result = result.Where(c => c.OperatorID == con.OperatorID);
                }
            }
            result = result.OrderBy(item => item.AlarmDateTime);
            return(result.ToList());
        }
Exemple #4
0
        /// <summary>
        /// 生成操作员结算汇总,如果不指定工作站,则表示汇总结果中包括操作员在所有工作站上的收费情况
        /// </summary>
        /// <param name="opt"></param>
        /// <param name="station"></param>
        /// <returns></returns>
        public OperatorSettleLog CreateOperatorLog(OperatorInfo opt, WorkStationInfo station)
        {
            if (opt != null)
            {
                OperatorSettleLog log = new OperatorSettleLog();
                log.OperatorID     = opt.OperatorName;
                log.SettleDateTime = DateTime.Now;
                if (station != null)
                {
                    log.StationID = station.StationName;
                }
                //查询条件
                RecordSearchCondition recordCon = new RecordSearchCondition();
                recordCon.RecordDateTimeRange = new DateTimeRange(log.SettleFrom == null ? new DateTime(1753, 1, 1, 12, 0, 0) : log.SettleFrom.Value, log.SettleDateTime);
                recordCon.Operator            = opt;
                recordCon.IsUnSettled         = true;
                if (station != null)
                {
                    recordCon.StationID = station.StationName;
                }
                //查询收费记录
                CardPaymentRecordBll   paymentBll     = new CardPaymentRecordBll(_RepoUri);
                List <CardPaymentInfo> paymentRecords = paymentBll.GetItems(recordCon).QueryObjects;
                log.PaymentRecords      = paymentRecords;
                log.CashParkFact        = CashParkFactSum(paymentRecords);
                log.CashOperatorCard    = CashOperatorCardSum(paymentRecords);
                log.CashParkDiscount    = CashParkDiscountSum(paymentRecords);
                log.NonCashParkFact     = NoCashParkFactSum(paymentRecords);
                log.NonCashParkDiscount = NoCashParkDiscountSum(paymentRecords);
                //查询卡片发行记录
                CardBll cbll = new CardBll(_RepoUri);
                List <CardReleaseRecord> cardReleaseRecords = cbll.GetCardReleaseRecords(recordCon).QueryObjects;
                log.ReleaseRecords    = cardReleaseRecords;
                log.CashOfCard       += CashCardReleaseSum(cardReleaseRecords);
                log.CashOfDeposit    += CashDepositSum(cardReleaseRecords);
                log.NonCashOfDeposit += NonCashDepositSum(cardReleaseRecords);
                log.NonCashOfCard    += NonCashCardReleaseSum(cardReleaseRecords);
                //查询卡片延期记录
                List <CardDeferRecord> cardDeferRecords = cbll.GetCardDeferRecords(recordCon).QueryObjects;
                log.DeferRecords   = cardDeferRecords;
                log.CashOfCard    += CashCardDeferSum(cardDeferRecords);
                log.NonCashOfCard += NonCashCardDeferSum(cardDeferRecords);
                //查询卡片充值记录
                List <CardChargeRecord> cardChargeRecords = cbll.GetCardChargeRecords(recordCon).QueryObjects;
                log.ChargeRecords  = cardChargeRecords;
                log.CashOfCard    += CashCardChargeSum(cardChargeRecords);
                log.NonCashOfCard += NonCashCardChargeSum(cardChargeRecords);
                //卡片挂失记录
                List <CardLostRestoreRecord> cardLostRecords = cbll.GetCardLostRestoreRecords(recordCon).QueryObjects;
                log.CardLostRecords   = cardLostRecords;
                log.CashOfCardLost    = CashCardLostSum(cardLostRecords);
                log.NonCashOfCardLost = NonCashCardLostSum(cardLostRecords);
                //查询卡片回收记录
                List <CardRecycleRecord> cardRecycleRecords = cbll.GetCardRecycleRecords(recordCon).QueryObjects;
                log.RecycleRecords     = cardRecycleRecords;
                log.CashOfCardRecycle += CashCardRecycleSum(cardRecycleRecords);
                //查询报警记录
                AlarmSearchCondition alarmCon = new AlarmSearchCondition();
                alarmCon.RecordDateTimeRange = new DateTimeRange(log.SettleFrom == null ? new DateTime(1753, 1, 1, 12, 0, 0) : log.SettleFrom.Value, log.SettleDateTime);
                alarmCon.Operator            = opt;
                alarmCon.IsUnSettled         = true;
                alarmCon.AlarmType           = AlarmType.Opendoor;
                if (station != null)
                {
                    alarmCon.StationID = station.StationName;
                }

                List <AlarmInfo> alarmReocrds = (new AlarmBll(_RepoUri)).GetAlarms(alarmCon).QueryObjects;
                log.OpenDoorCount = alarmReocrds.Count;
                log.AlarmRecords  = alarmReocrds;
                //查询事件
                CardEventSearchCondition eventCon = new CardEventSearchCondition();
                eventCon.RecordDateTimeRange = new DateTimeRange(log.SettleFrom == null ? new DateTime(1753, 1, 1, 12, 0, 0) : log.SettleFrom.Value, log.SettleDateTime);
                eventCon.Operator            = opt;
                eventCon.IsUnSettled         = true;
                eventCon.OnlyExitEvent       = true;
                eventCon.CardType            = CardType.TempCard; //只获取临时卡事件
                if (station != null)
                {
                    eventCon.StationID = station.StationName;
                }

                List <CardEventRecord> handledEvents = (new CardEventBll(_RepoUri)).GetCardEvents(eventCon).QueryObjects;
                log.EventRecords    = handledEvents;
                log.TempCardRecycle = TempCardRecycleSum(handledEvents);
                return(log);
            }
            else
            {
                throw new InvalidOperationException(Resource1.OperatorSettleBLL_noOperator);
            }
        }