示例#1
0
        private void UploadCardPayment()
        {
            CommandResult result = null;
            CardPaymentRecordSearchCondition paymentcon = new CardPaymentRecordSearchCondition();

            paymentcon.UpdateFlag = false;
            List <CardPaymentInfo> sRecords = _StandbyPaymentBll.GetItems(paymentcon).QueryObjects;

            if (sRecords != null && sRecords.Count > 0)
            {
                foreach (CardPaymentInfo sRecord in sRecords)
                {
                    if (_SyncDataPause)
                    {
                        break;
                    }
                    CardPaymentInfo cpInfo = sRecord.Clone();
                    cpInfo.UpdateFlag = true;
                    result            = _MasterPaymentBll.InsertRecordWithCheck(cpInfo);
                    if (result.Result == ResultCode.Successful)
                    {
                        sRecord.UpdateFlag = true;
                        _StandbyPaymentBll.Update(sRecord);
                    }
                }
            }
        }
示例#2
0
        private QueryResultList <CardPaymentInfo> GetPayRecord()
        {
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            con.RecordDateTimeRange       = new DateTimeRange();
            con.RecordDateTimeRange.Begin = this.ucDateTimeInterval2.StartDateTime;
            con.RecordDateTimeRange.End   = this.ucDateTimeInterval2.EndDateTime;
            // add by tom,2012-2-14
            con.CardType = this.cardTypeComboBox1.SelectedCardType;
            con.CardID   = this.txtCardID.Text.Trim();
            con.Source   = this.ucEntrance2.SelectedEntrances;
            con.CarPlate = this.txtCarPlate.Text;
            // end

            if (this.operatorComboBox2.SelectecOperator != null)
            {
                con.Operator = this.operatorComboBox2.SelectecOperator;
            }
            con.StationID = this.workStationCombobox2.Text;

            QueryResultList <CardPaymentInfo> result = bll.GetItems(con);

            this.CardPaymentList = SortCardPaymentData(result.QueryObjects);

            if (result.Result == ResultCode.Successful)
            {
                ShowReportsOnDetailGrid(result.QueryObjects);
            }
            else
            {
                MessageBox.Show(result.Message);
            }
            return(result);
        }
        protected override void OnItemSearching(EventArgs e)
        {
            this.customDataGridView1.Rows.Clear();
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            con.RecordDateTimeRange       = new DateTimeRange();
            con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime;
            con.RecordDateTimeRange.End   = this.ucDateTimeInterval1.EndDateTime;
            con.CardType       = this.comCardType.SelectedCardType;
            con.CardID         = this.txtCardID.Text.Trim();
            con.OperatorCardID = this.txtOperatorCardID.Text.Trim();
            con.PaymentCode    = this.comPaymentCode.SelectedPaymentCode;

            if (chkPaymentMode.Checked)
            {
                con.PaymentMode = comPaymentMode.SelectedPaymentMode;
            }

            if (this.comOperator.SelectecOperator != null)
            {
                con.Operator = this.comOperator.SelectecOperator;
            }
            if (carTypeComboBox1.SelectedIndex > 0)
            {
                con.CarType = carTypeComboBox1.SelectedCarType;
            }
            con.StationID = this.workStationCombobox1.Text;

            CardPaymentRecordBll bll = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect);
            QueryResultList <CardPaymentInfo> result = bll.GetItems(con);

            if (result.Result == ResultCode.Successful)
            {
                CarFlowStatisticsType group;
                if (this.rdPerHour.Checked)
                {
                    group = CarFlowStatisticsType.perHour;
                }
                else if (this.rdPerDay.Checked)
                {
                    group = CarFlowStatisticsType.perDay;
                }
                else
                {
                    group = CarFlowStatisticsType.perMonth;
                }
                GroupBy(result.QueryObjects, group);
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
示例#4
0
        private void ItemSearching_Handler(object sender, EventArgs e)
        {
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            con.RecordDateTimeRange       = new DateTimeRange();
            con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime;
            con.RecordDateTimeRange.End   = this.ucDateTimeInterval1.EndDateTime;
            con.CardType        = this.comCardType.SelectedCardType;
            con.CardID          = this.txtCardID.Text.Trim();
            con.CardCertificate = txtCertificate.Text.Trim();
            if (carTypeComboBox1.SelectedIndex > 0)
            {
                con.CarType = carTypeComboBox1.SelectedCarType;
            }
            if (rdSettled.Checked)
            {
                con.IsUnSettled = false;
            }
            if (rdUnsettled.Checked)
            {
                con.IsUnSettled = true;
            }
            if (chkCenterCharge.Checked)
            {
                con.IsCenterCharge = true;
            }
            if (chkPaymentMode.Checked)
            {
                con.PaymentMode = comPaymentMode.SelectedPaymentMode;
            }
            con.CarPlate = this.txtCarPlate.Text.Trim();

            if (this.comOperator.SelectecOperator != null)
            {
                con.Operator = this.comOperator.SelectecOperator;
            }
            con.StationID      = this.workStationCombobox1.Text.Trim();
            con.PaymentCode    = this.comPaymentCode.SelectedPaymentCode;
            con.OperatorCardID = this.txtOperatorCardID.Text.Trim();;

            CardPaymentRecordBll bll = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect);
            QueryResultList <CardPaymentInfo> result = bll.GetItems(con);

            if (result.Result == ResultCode.Successful)
            {
                ShowReportsOnGrid(result.QueryObjects);
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
        private void FrmCardInParkReport_ItemSearching(object sender, EventArgs e)
        {
            this.gridCard.Rows.Clear();
            CardPaymentRecordSearchCondition pc = new CardPaymentRecordSearchCondition();

            if (!string.IsNullOrEmpty(this.txtCardID.Text))
            {
                pc.CardID = this.txtCardID.Text;
            }
            if (!string.IsNullOrEmpty(this.txtCarPlate.Text))
            {
                pc.CarPlate = this.txtCarPlate.Text;
            }
            if (this.comCardType.SelectedCardType != null)
            {
                pc.CardType = this.comCardType.SelectedCardType;
            }
            pc.RecordDateTimeRange = new DateTimeRange(this.ucDateTimeInterval1.StartDateTime, this.ucDateTimeInterval1.EndDateTime);
            paymentRecords         = (new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect)).GetItems(pc).QueryObjects;

            CardSearchCondition cc = new CardSearchCondition();

            cc.CardID          = this.txtCardID.Text;
            cc.LastCarPlate    = this.txtCarPlate.Text;
            cc.OwnerName       = this.txtOwnerName.Text;
            cc.CardCertificate = this.txtCertificate.Text;
            if (this.comCardType.SelectedCardType != null)
            {
                cc.CardType = this.comCardType.SelectedCardType;
            }
            if (this.carTypeComboBox1.SelectedIndex > 0)
            {
                cc.CarType = this.carTypeComboBox1.SelectedCarType;
            }
            cc.LastDateTime = new DateTimeRange(this.ucDateTimeInterval1.StartDateTime, this.ucDateTimeInterval1.EndDateTime);
            List <CardInfo> cards = (new CardBll(AppSettings.CurrentSetting.ParkConnect)).GetCards(cc).QueryObjects;

            if (cards != null && cards.Count > 0)
            {
                foreach (CardInfo card in cards)
                {
                    if (card.IsInPark)
                    {
                        AddCardToGrid(card);
                    }
                }
            }
        }
示例#6
0
        public CommandResult InsertRecordWithCheck(CardPaymentInfo info)
        {
            CardPaymentRecordSearchCondition searchCondition = new CardPaymentRecordSearchCondition();

            searchCondition.CardID         = info.CardID;
            searchCondition.ChargeDateTime = info.ChargeDateTime;

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

            if (check == null || check.Count == 0)
            {
                return(provider.Insert(info));
            }
            //已存在该记录,可认为插入成功
            return(new CommandResult(ResultCode.Successful, string.Empty));
        }
示例#7
0
        /// <summary>
        /// 获取卡号为cardID,进场时间为enterDateTime的最近的一条收费记录
        /// </summary>
        /// <param name="cardID"></param>
        /// <param name="enterDateTime"></param>
        /// <returns></returns>
        public CardPaymentInfo GetLatestRecord(string cardID, DateTime enterDateTime)
        {
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            con.CardID        = cardID;
            con.EnterDateTime = enterDateTime;
            List <CardPaymentInfo> records = provider.GetItems(con).QueryObjects;
            CardPaymentInfo        record  = null;

            if (records.Count > 0)
            {
                records = (from r in records
                           orderby r.ChargeDateTime descending
                           select r).ToList();
                record = records[0];
            }
            return(record);
        }
示例#8
0
        public CardPaymentInfo GetByID(RecordID id)
        {
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            con.CardID = id.CardID;
            con.RecordDateTimeRange = new DateTimeRange(id.RecordDateTime, id.RecordDateTime);
            List <CardPaymentInfo> records = provider.GetItems(con).QueryObjects;

            if (records.Count == 1)
            {
                return(records[0]);
            }
            else if (records.Count == 0)
            {
                return(null);
            }
            else
            {
                throw new InvalidCastException(Resource1.CardPaymentRecordBll_notSingle);
            }
        }
        /// <summary>
        /// 获取卡号为cardID,进场时间为enterDateTime的最近的一条收费记录
        /// </summary>
        /// <param name="cardID"></param>
        /// <param name="enterDateTime"></param>
        /// <returns></returns>
        public CardPaymentInfo GetLatestRecord(string cardID, DateTime enterDateTime, OperatorInfo operatorInfo)
        {
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            con.CardID        = cardID;
            con.EnterDateTime = enterDateTime;
            con.Operator      = operatorInfo;
            List <CardPaymentInfo> records = provider.GetItems(con).QueryObjects;
            CardPaymentInfo        record  = null;

            if (records.Count > 0)
            {
                records = (from r in records
                           orderby r.ChargeDateTime descending
                           select r).ToList();
                record = records[0];
                //try
                //{
                //    record.CurrHasPaidDiscountHour = records.Sum(p => p.CurrDiscountHour.Value);
                //}
                //catch { }
            }
            return(record);
        }
示例#10
0
        protected override List <LDB_CardPaymentInfo> GetingItems(LDB_DataContext parking, SearchCondition search)
        {
            List <LDB_CardPaymentInfo>       items  = null;
            IQueryable <LDB_CardPaymentInfo> result = parking.CardPaymentRecord;

            if (search is RecordSearchCondition)
            {
                RecordSearchCondition condition = search as RecordSearchCondition;
                if (condition.RecordDateTimeRange != null)
                {
                    result = result.Where(c => c.ChargeDateTime >= condition.RecordDateTimeRange.Begin);
                    result = result.Where(c => c.ChargeDateTime <= condition.RecordDateTimeRange.End);
                }
                if (!string.IsNullOrEmpty(condition.CardID))
                {
                    result = result.Where(c => c.CardID == condition.CardID);
                }
                if (condition.PaymentMode != null)
                {
                    result = result.Where(c => c.PaymentMode == condition.PaymentMode.Value);
                }
                if (condition.Operator != null)
                {
                    result = result.Where(c => c.OperatorID == condition.Operator.OperatorName);
                }
                if (!string.IsNullOrEmpty(condition.StationID))
                {
                    result = result.Where(c => c.StationID == condition.StationID);
                }
                if (condition.IsUnSettled != null)
                {
                    if (condition.IsUnSettled.Value)
                    {
                        result = result.Where(c => c.SettleDateTime == null);
                    }
                    else
                    {
                        result = result.Where(c => c.SettleDateTime != null);
                    }
                }
                if (condition.SettleDateTime != null)
                {
                    result = result.Where(c => c.SettleDateTime == condition.SettleDateTime.Value);
                }
                if (!string.IsNullOrEmpty(condition.CarPlate))
                {
                    result = result.Where(c => c.CarPlate.Contains(condition.CarPlate));
                }
                if (condition.CarType != null)
                {
                    result = result.Where(c => c.CarType == condition.CarType.Value);
                }
                if (!string.IsNullOrEmpty(condition.CardCertificate))
                {
                    result = result.Where(c => c.CardCertificate.Contains(condition.CardCertificate));
                }
                if (search is CardPaymentRecordSearchCondition)
                {
                    CardPaymentRecordSearchCondition condition1 = search as CardPaymentRecordSearchCondition;
                    if (condition1.EnterDateTime != null)
                    {
                        result = result.Where(c => c.EnterDateTime == condition1.EnterDateTime.Value);
                    }
                    if (condition1.IsCenterCharge != null && condition1.IsCenterCharge.Value)
                    {
                        result = result.Where(c => c.IsCenterCharge == true);
                    }
                    if (condition1.IsCenterCharge != null && !condition1.IsCenterCharge.Value)
                    {
                        result = result.Where(c => c.IsCenterCharge == false);
                    }
                    if (condition1.ChargeDateTime != null)
                    {
                        result = result.Where(c => c.ChargeDateTime == condition1.ChargeDateTime.Value);
                    }
                    if (condition1.PaymentCode != null)
                    {
                        result = result.Where(c => c.PaymentCode == condition1.PaymentCode.Value);
                    }
                    if (!string.IsNullOrEmpty(condition1.OperatorCardID))
                    {
                        result = result.Where(c => c.OperatorCardID == condition1.OperatorCardID);
                    }
                }
                if (search is LDB_CardPaymentRecordSearchCondition)
                {
                    LDB_CardPaymentRecordSearchCondition ldbsearch = search as LDB_CardPaymentRecordSearchCondition;
                    if (ldbsearch.UpdateFlag != null)
                    {
                        result = result.Where(c => c.UpdateFlag == ldbsearch.UpdateFlag);
                    }
                }
                items = result.ToList();
                if (condition.CardType != null)
                {
                    items = items.Where(c => c.CardType == condition.CardType).ToList();
                }
            }
            else
            {
                items = new List <LDB_CardPaymentInfo>();
            }
            return(items);
        }
示例#11
0
        private void SyncTime_Thread()
        {
            try
            {
                while (true)
                {
                    try
                    {
                        _SyncDateBaseEvent.WaitOne(SyncInterval * 60 * 1000);

                        if (DataBaseConnectionsManager.Current.MasterConnected &&
                            DataBaseConnectionsManager.Current.StandbyConnected)
                        {
                            CommandResult result = null;
                            if (!_SyncDataPause)
                            {
                                CardSearchCondition cardcon = new CardSearchCondition();
                                cardcon.UpdateFlag = false;
                                List <CardInfo> sCards = _StandbyCardBll.GetCards(cardcon).QueryObjects;
                                if (sCards != null && sCards.Count > 0)
                                {
                                    foreach (CardInfo sCard in sCards)
                                    {
                                        if (_SyncDataPause)
                                        {
                                            break;
                                        }
                                        CardInfo mCard = _MasterCardBll.GetCardByID(sCard.CardID).QueryObject;
                                        if (mCard != null)
                                        {
                                            sCard.UpdateFlag = true;
                                            result           = _MasterCardBll.UpdateCardPaymentInfo(sCard);
                                            if (result.Result == ResultCode.Successful)
                                            {
                                                _StandbyCardBll.UpdateCard(sCard);
                                            }
                                        }
                                    }
                                }
                            }

                            if (!_SyncDataPause)
                            {
                                CardPaymentRecordSearchCondition paymentcon = new CardPaymentRecordSearchCondition();
                                paymentcon.UpdateFlag = false;
                                List <CardPaymentInfo> sRecords = _StandbyPaymentBll.GetItems(paymentcon).QueryObjects;
                                if (sRecords != null && sRecords.Count > 0)
                                {
                                    foreach (CardPaymentInfo sRecord in sRecords)
                                    {
                                        if (_SyncDataPause)
                                        {
                                            break;
                                        }
                                        CardPaymentInfo cpInfo = sRecord.Clone();
                                        cpInfo.UpdateFlag = true;
                                        result            = _MasterPaymentBll.InsertRecordWithCheck(cpInfo);
                                        if (result.Result == ResultCode.Successful)
                                        {
                                            sRecord.UpdateFlag = true;
                                            _StandbyPaymentBll.Update(sRecord);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
                    }
                }
            }
            catch (ThreadAbortException ex)
            {
                Ralid.GeneralLibrary.LOG.FileLog.Log("系统", "备用数据库同步到主数据库服务停止");
            }
        }
示例#12
0
        private void ItemSearching_Handler(object sender, EventArgs e)
        {
            CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition();

            if (this.chkChargeDateTime.Checked)
            {
                con.RecordDateTimeRange       = new DateTimeRange();
                con.RecordDateTimeRange.Begin = this.UCChargeDateTime.StartDateTime;
                con.RecordDateTimeRange.End   = this.UCChargeDateTime.EndDateTime;
            }
            if (this.chkEnterDateTime.Checked)
            {
                con.EnterDateTimeRange       = new DateTimeRange();
                con.EnterDateTimeRange.Begin = this.UCEnterDateTime.StartDateTime;
                con.EnterDateTimeRange.End   = this.UCEnterDateTime.EndDateTime;
            }
            con.CardType        = this.comCardType.SelectedCardType;
            con.CardID          = this.txtCardID.Text.Trim();
            con.CardCertificate = txtCertificate.Text.Trim();
            if (carTypeComboBox1.SelectedIndex > 0)
            {
                con.CarType = carTypeComboBox1.SelectedCarType;
            }
            if (rdSettled.Checked)
            {
                con.IsUnSettled = false;
            }
            if (rdUnsettled.Checked)
            {
                con.IsUnSettled = true;
            }
            if (chkCenterCharge.Checked)
            {
                con.IsCenterCharge = true;
            }
            if (chkPaymentMode.Checked)
            {
                con.PaymentMode = comPaymentMode.SelectedPaymentMode;
            }
            con.CarPlate = this.txtCarPlate.Text.Trim();

            if (this.comOperator.SelectecOperator != null)
            {
                con.Operator = this.comOperator.SelectecOperator;
            }
            con.StationID      = this.workStationCombobox1.Text.Trim();
            con.PaymentCode    = this.comPaymentCode.SelectedPaymentCode;
            con.OperatorCardID = this.txtOperatorCardID.Text.Trim();
            con.StationIDs     = this.txtWorkStations.Tag as List <string>;
            con.OperatorDeptID = this.comOperatorDept.SelectedDeptID;
            con.StationDeptID  = this.comStationDept.SelectedDeptID;

            //if (!string.IsNullOrEmpty(this.comOperatorDept.SelectedDeptIDString))
            //{//操作员部门
            //    OperatorBll opeBll = new OperatorBll(AppSettings.CurrentSetting.ParkConnect);
            //    OperatorSearchCondition opeCon = new OperatorSearchCondition();
            //    opeCon.DeptID = Guid.Parse(this.comOperatorDept.SelectedDeptIDString);
            //    List<OperatorInfo> operators = opeBll.GetOperators(opeCon).QueryObjects;
            //    List<string> lts_operators = new List<string>();
            //    if (operators.Count > 0)
            //    {
            //        foreach (OperatorInfo item in operators)
            //        {
            //            //lts_operators.Add(item.OperatorID);
            //            lts_operators.Add(item.OperatorName);
            //        }
            //    }
            //    else
            //    {
            //        lts_operators.Add("此部门没有操作员");
            //    }
            //    con.OperatorIDs = lts_operators;
            //}
            //if (!string.IsNullOrEmpty(this.comStationDept.SelectedDeptIDString))
            //{//工作站部门
            //    WorkstationBll workBll = new WorkstationBll(AppSettings.CurrentSetting.ParkConnect);
            //    WorkstationSearchCondition workCon = new WorkstationSearchCondition();
            //    workCon.DeptID = Guid.Parse(this.comStationDept.SelectedDeptIDString);
            //    List<WorkStationInfo> stations = workBll.GetWorkstations(workCon).QueryObjects;
            //    List<string> lts_stations = new List<string>();
            //    if (stations.Count > 0)
            //    {
            //        foreach (WorkStationInfo item in stations)
            //        {
            //            lts_stations.Add(item.StationName);
            //        }
            //    }
            //    else
            //    {
            //        lts_stations.Add("此部门没有工作站");
            //    }
            //    con.StationIDs = lts_stations;
            //}

            CardPaymentRecordBll bll = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect);
            QueryResultList <CardPaymentInfo> result = bll.GetItems(con);

            if (result.Result == ResultCode.Successful)
            {
                ShowReportsOnGrid(result.QueryObjects);
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
        private void UpdateLocalData_Thread()
        {
            try
            {
                while (true)
                {
                    _UpdateLoaclDataEvent.WaitOne(UpdateInterval * 60 * 1000);

                    if (AppSettings.CurrentSetting.EnableWriteCard)
                    {
                        LDB_CardPaymentRecordBll bll = new LDB_CardPaymentRecordBll(LDB_AppSettings.Current.LDBConnect);
                        try
                        {
                            //如果是主数据库时,需要主数据库连接上
                            if (!DataBaseConnectionsManager.Current.IsMasterConnectionString(_DataBaseUri) ||
                                DataBaseConnectionsManager.Current.MasterConnected)
                            {
                                LDB_CardPaymentRecordSearchCondition con = new LDB_CardPaymentRecordSearchCondition();
                                con.UpdateFlag = false;
                                List <LDB_CardPaymentInfo> records = bll.GetItems(con).QueryObjects;
                                if (records != null && records.Count > 0)
                                {
                                    CommandResult result = null;
                                    foreach (LDB_CardPaymentInfo record in records)
                                    {
                                        CardPaymentInfo info = LDB_InfoFactory.CreateCardPaymentInfo(record);
                                        info.UpdateFlag = true;

                                        CardPaymentRecordSearchCondition searchCondition = new CardPaymentRecordSearchCondition();
                                        searchCondition.CardID         = info.CardID;
                                        searchCondition.ChargeDateTime = info.ChargeDateTime;

                                        List <CardPaymentInfo> check = _CardPaymentProvider.GetItems(searchCondition).QueryObjects;
                                        if (check == null || check.Count == 0)
                                        {
                                            result = _CardPaymentProvider.Insert(info);
                                        }
                                        else
                                        {
                                            //已存在该记录,可认为插入成功
                                            result = new CommandResult(ResultCode.Successful, string.Empty);
                                        }

                                        if (result.Result == ResultCode.Successful)
                                        {
                                            record.UpdateFlag = true;
                                            bll.Update(record);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
                        }
                    }
                }
            }
            catch (ThreadAbortException ex)
            {
                Ralid.GeneralLibrary.LOG.FileLog.Log("系统", "上传本地数据库数据服务停止");
            }
        }
        protected override List <CardPaymentInfo> GetingItems(ParkDataContext parking, Ralid.Park.BusinessModel.SearchCondition.SearchCondition search)
        {
            List <CardPaymentInfo>       items  = null;
            IQueryable <CardPaymentInfo> result = parking.GetTable <CardPaymentInfo>();

            if (search is CardPaymentRecordSearchCondition)
            {
                CardPaymentRecordSearchCondition condition = search as CardPaymentRecordSearchCondition;

                if (condition.RecordDateTimeRange != null)
                {
                    result = result.Where(c => c.ChargeDateTime >= condition.RecordDateTimeRange.Begin);
                    result = result.Where(c => c.ChargeDateTime <= condition.RecordDateTimeRange.End);
                }
                if (!string.IsNullOrEmpty(condition.CardID))
                {
                    result = result.Where(c => c.CardID == condition.CardID);
                }
                if (condition.EnterDateTime != null)
                {
                    result = result.Where(c => c.EnterDateTime == condition.EnterDateTime.Value);
                }
                if (condition.PaymentMode != null)
                {
                    result = result.Where(c => c.PaymentMode == condition.PaymentMode.Value);
                }
                if (condition.Operator != null)
                {
                    result = result.Where(c => c.OperatorID == condition.Operator.OperatorID);
                }
                if (!string.IsNullOrEmpty(condition.StationID))
                {
                    result = result.Where(c => c.StationID == condition.StationID);
                }
                if (!string.IsNullOrEmpty(condition.CarPalte))
                {
                    result = result.Where(c => c.CarPlate.Contains(condition.CarPalte));
                }
                if (condition.PaymentMode != null)
                {
                    result = result.Where(c => c.PaymentMode == condition.PaymentMode);
                }
                items = result.ToList();
                if (condition.CardType != null)
                {
                    items = items.Where(c => c.CardType == condition.CardType).ToList();
                }
            }
            else if (search is RecordSearchCondition)
            {
                RecordSearchCondition condition = search as RecordSearchCondition;
                if (condition.RecordDateTimeRange != null)
                {
                    result = result.Where(c => c.ChargeDateTime >= condition.RecordDateTimeRange.Begin);
                    result = result.Where(c => c.ChargeDateTime <= condition.RecordDateTimeRange.End);
                }
                if (!string.IsNullOrEmpty(condition.CardID))
                {
                    result = result.Where(c => c.CardID == condition.CardID);
                }
                if (condition.PaymentMode != null)
                {
                    result = result.Where(c => c.PaymentMode == condition.PaymentMode.Value);
                }
                if (condition.Operator != null)
                {
                    result = result.Where(c => c.OperatorID == condition.Operator.OperatorID);
                }
                if (!string.IsNullOrEmpty(condition.StationID))
                {
                    result = result.Where(c => c.StationID == condition.StationID);
                }
                items = result.ToList();
                if (condition.CardType != null)
                {
                    items = items.Where(c => c.CardType == condition.CardType).ToList();
                }
            }
            else
            {
                items = new List <CardPaymentInfo>();
            }
            return(items);
        }