public EHisotryDataStoreTables GetHisotryDataStoreTableByTbName(string tableName)
        {
            if (string.IsNullOrEmpty(tableName))
            {
                return null;
            }

            EHisotryDataStoreTables res = null;
            string cmdText = "SELECT RecordID,TableName,SelectConnStr,AddConnStr,UsedCount,MaxCount,ENABLE,CreateDate,remark FROM gps_historydatastoretables where TableName=@TableName";
            MySqlParameter[] cmdParams = new MySqlParameter[] {
                new MySqlParameter("TableName", tableName),
            };
            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText, cmdParams))
            {
                if (sdr != null)
                {
                    if (sdr.Read())
                    {
                        res = new EHisotryDataStoreTables();

                        res.RecordID = sdr.GetGuid(0);
                        res.TableName = sdr.GetStringExt(1);
                        res.SelectConnStr = sdr.GetStringExt(2);
                        res.AddConnStr = sdr.GetStringExt(3);
                        res.UsedCount = sdr.GetInt(4);
                        res.MaxCount = sdr.GetInt(5);
                        res.Enable = sdr.GetShort(6) == 1;
                        res.CreateDate = sdr.GetDateTimeExt(7);
                        res.Remark = sdr.GetStringExt(8);
                    }
                    sdr.Close();
                }
            }
            return res;
        }
예제 #2
0
 /// <summary>
 /// 获取所有准确历史数据时只获取IsGPSOverFlow=0;
 /// </summary>
 private IList<EGPSHistoryInfo> GetGPSHistoryInfoList(EHisotryDataStoreTables table , IList<Guid> ltVehicleCode, DateTime beginTime, DateTime endTime)
 {
     if (table == null || ltVehicleCode.IsNullOrEmpty())
         return null;
     string codes = string.Join("','", ltVehicleCode.Select(s => s.ToString()).ToArray());
     codes = " ('" + codes + "') ";
     string sqlText = string.Format("select * from {0} where VehicleCode in {1} and reporttime between '{2}' and '{3}' and IsGPSOverFlow=0  order by ReportTime asc ",
         table.TableName, codes, beginTime, endTime);
     return List(table.SelectConnStr, sqlText);
 }
        private EHisotryDataStoreTables GetHisotryDataStoreTable(Guid tableid)
        {
            if(Guid.Empty.Equals(tableid))
            {
                return null;
            }

            EHisotryDataStoreTables res = null;
            string cmdText = string.Format("SELECT RecordID,TableName,SelectConnStr,AddConnStr,UsedCount,MaxCount,ENABLE,CreateDate,remark FROM gps_historydatastoretables where RecordID='{0}'", tableid);
            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
            {
                if (sdr != null)
                {
                    if (sdr.Read())
                    {
                        res = new EHisotryDataStoreTables();

                        res.RecordID = sdr.GetGuid(0);
                        res.TableName = sdr.GetStringExt(1);
                        res.SelectConnStr = sdr.GetStringExt(2);
                        res.AddConnStr = sdr.GetStringExt(3);
                        res.UsedCount = sdr.GetInt(4);
                        res.MaxCount = sdr.GetInt(5);
                        res.Enable = sdr.GetShort(6) == 1;
                        res.CreateDate = sdr.GetDateTimeExt(7);
                        res.Remark = sdr.GetStringExt(8);
                    }
                    sdr.Close();
                }
            }
            return res;
        }
예제 #4
0
        public EHisotryDataStoreTables GetHistoryTable(string stableName)
        {
            EHisotryDataStoreTables ht = new EHisotryDataStoreTables();
            string sCmdText = string.Format(@" select * from gps_historydatastoretables where TableName='{0}'", stableName);
            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, sCmdText))
            {
                if (sdr != null)
                {
                    if (sdr.Read())
                    {
                       
                        ht.RecordID = sdr["RecordID"].ToGuid();
                        ht.TableName = sdr["TableName"].ToString();
                        ht.SelectConnStr = sdr["SelectConnStr"].ToString();
                        ht.AddConnStr = sdr["AddConnStr"].ToString();
                        ht.UsedCount = sdr["UsedCount"].ToInt();
                        ht.MaxCount = sdr["MaxCount"].ToInt();
                        ht.Enable = sdr["Enable"].ToBoolean();
                        ht.CreateDate = sdr["CreateDate"].ToDateTime();
                        ht.Remark = sdr["Remark"].ToString();

                    }
                    sdr.Close();
                }
            }
            return ht;
        }