Example #1
0
        protected override List <ETCPaymentRecord> GetingItems(ParkDataContext parking, SearchCondition search)
        {
            if (search is ETCPaymentRecordSearchCondition)
            {
                ETCPaymentRecordSearchCondition con = search as ETCPaymentRecordSearchCondition;

                IQueryable <ETCPaymentRecord> result = parking.GetTable <ETCPaymentRecord>();
                if (con.AddTime != null)
                {
                    result = result.Where(it => it.AddTime >= con.AddTime.Begin && it.AddTime <= con.AddTime.End);
                }
                if (!string.IsNullOrEmpty(con.LaneNo))
                {
                    result = result.Where(it => it.LaneNo == con.LaneNo);
                }
                if (con.WaitingUpload.HasValue)
                {
                    if (con.WaitingUpload.Value)
                    {
                        result = result.Where(it => it.UploadTime == null);
                    }
                    else
                    {
                        result = result.Where(it => it.UploadTime != null);
                    }
                }
                return(result.ToList());
            }
            return(new List <ETCPaymentRecord>());
        }
        protected override void OnItemSearching(EventArgs e)
        {
            GridView.Rows.Clear();
            ETCPaymentRecordSearchCondition con = new ETCPaymentRecordSearchCondition();

            con.AddTime = new DateTimeRange(ucDateTimeInterval1.StartDateTime, ucDateTimeInterval1.EndDateTime);
            if (chkUnuploaded.Checked)
            {
                con.WaitingUpload = true;
            }
            List <ETCPaymentRecord> items = (new ETCPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect)).GetRecords(con).QueryObjects;

            foreach (var item in items)
            {
                int row = this.GridView.Rows.Add();
                ShowPayOperationLogOnRow(GridView.Rows[row], item);
            }
        }
Example #3
0
 private void UploadListThread()
 {
     try
     {
         while (true)
         {
             var bll = new ETCPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect);
             Thread.Sleep(1000 * 60); //
             var con = new ETCPaymentRecordSearchCondition()
             {
                 WaitingUpload = true
             };
             var items = bll.GetRecords(con).QueryObjects;
             if (items != null && items.Count > 0)
             {
                 foreach (var item in items)
                 {
                     var device = _Devices.SingleOrDefault(it => it.LaneNo == item.LaneNo);
                     if (device != null)
                     {
                         var list = JsonConvert.DeserializeObject <ETCPaymentList>(item.Data);
                         if (list != null)
                         {
                             var res = device.ListUpLoad(list);
                             if (res.ErrorCode == 0)
                             {
                                 bll.UpdateUploadTime(item, DateTime.Now);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (ThreadAbortException)
     {
     }
 }
 /// <summary>
 /// 根据条件获取记录
 /// </summary>
 /// <param name="search"></param>
 /// <returns></returns>
 public QueryResultList <ETCPaymentRecord> GetRecords(ETCPaymentRecordSearchCondition search)
 {
     return(provider.GetItems(search));
 }