public List<EHistoryDataStoreConfig> GetVehicleStoreTableConfigList(IList<Guid> vehicleCodes)
        {
            if (vehicleCodes.IsNullOrEmpty())
                return null;

            List<EHistoryDataStoreConfig> res = null;
            string cmdText = string.Format("select RecordID, VehicleCode, StoreTable, ENABLE, CreateDate, remark from gps_historydatastoreconfig where VehicleCode in ('{0}')", vehicleCodes.JoinToString<Guid>("','"));
            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
            {
                if (sdr != null)
                {
                    res = new List<EHistoryDataStoreConfig>();
                    while (sdr.Read())
                    {
                        res.Add(new EHistoryDataStoreConfig
                        {
                            RecordID = sdr.GetGuid(0),
                            VehicleCode = sdr.GetGuid(1),
                            StoreTable = GetHisotryDataStoreTable(sdr.GetGuid(2)),
                            Enable = sdr.GetShort(3) == 1,
                            CreateDate = sdr.GetDateTimeExt(4),
                            Remark = sdr.GetStringExt(5)
                        });
                    }
                    sdr.Close();
                }
            }
            return res;
        }
Example #2
0
        public IList<EGPSCurrentInfo> GetCurrentInfoList(IList<Guid> ltVehicleCode)
        {   
            //Query query = new Query(typeof(EGPSCurrentInfo));
            //query.Expression = Expression.CreateExpression("VehicleCode", PolynaryOperatorType.In, ltVehicleCode);
            //using (IRepository repository = SessionManager.CreateRepository(typeof(EGPSCurrentInfo)))
            //{
            //    return repository.List<EGPSCurrentInfo>(query);
            //}

            //优化
            if (ltVehicleCode.IsNullOrEmpty())
                return null;

            List<EGPSCurrentInfo> list = null;
            string sqlText = string.Format(@"SELECT ID,GPSCode,Longitude,Latitude,Speed,Direction,ReportTime,OilState,ACCState,Mileage,PowerState,
StarkMileage,AntennaState,OilBearing,DoorStatus,PhotoPath,VehicleCode,PlunderState,Detector1,Detector2,Detector3,Detector4,CoolerStatus
 FROM gps_currentinfo WHERE VehicleCode in ('{0}')", ltVehicleCode.JoinToString<Guid>("','"));

            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, sqlText))
            {
                if (sdr != null)
                {
                    list = new List<EGPSCurrentInfo>();
                    while (sdr.Read())
                    {
                        list.Add(new EGPSCurrentInfo
                        {
                            ID = sdr.GetGuid(0),
                            GPSCode = sdr.GetString(1),
                            Longitude = sdr.GetDouble(2),
                            Latitude = sdr.GetDouble(3),
                            Speed = sdr.GetDouble(4),
                            Direction = sdr.GetDouble(5),
                            ReportTime = sdr.GetDateTime(6),
                            OilState = sdr.GetInt(7),
                            ACCState = sdr.GetInt(8),
                            Mileage = sdr.GetDouble(9),
                            PowerState = sdr.GetInt(10),
                            StarkMileage = sdr.GetDouble(11),
                            AntennaState = sdr.GetInt(12),
                            OilBearing = sdr.GetDoubleExt(13),
                            DoorStatus = sdr.GetInt(14),
                            PhotoPath = sdr.GetStringExt(15),
                            VehicleCode = sdr.GetGuidExt(16),
                            PlunderState = sdr.GetInt16(17),
                            Detector1 = sdr.GetFloatNull(18),
                            Detector2 = sdr.GetFloatNull(19),
                            Detector3 = sdr.GetFloatNull(20),
                            Detector4 = sdr.GetFloatNull(21),
                            CoolerStatus = sdr.GetInt(22)
                        });
                    }
                    sdr.Close();
                }
            }

            return list;
        }
Example #3
0
 /// <summary>
 /// 根据usercode列表删除用户
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 public int DeleteUser(IList<string> list)
 {
     string strUserCode = "'" + list.JoinToString<string>("','") + "'";
     /*if (list != null && list.Count > 0)
     {
         for (int i = 0; i < list.Count; i++)
         {
             if (i != list.Count - 1)
             {
                 strUserCode = strUserCode + "'" + list[i] + "'" + ",";
             }
             else
             {
                 strUserCode = strUserCode + "'" + list[list.Count - 1] + "'";
             }
         }
     }*/
     string sCmdText = string.Format(@" delete from movo_user where UserCode in ({0})", strUserCode);
     int iCount = MySqlDB.ExecuteNonQuery(CommandType.Text, sCmdText);
     return iCount;
 }