/// <summary> /// 获取泛型数据列表 /// </summary> public List <Model.UAVSignIn> GetList(int PID) { StringBuilder strSql = new StringBuilder("SELECT * FROM V_UAVSignIn WHERE PID=" + PID); using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { List <Model.UAVSignIn> lst = new List <Model.UAVSignIn>(); while (dr.Read()) { Model.UAVSignIn model = new Model.UAVSignIn(); model.ID = DbHelperSQL.GetInt(dr["ID"]); model.UID = DbHelperSQL.GetInt(dr["UID"]); model.UAVTel = DbHelperSQL.GetString(dr["UAVTel"]); model.TypeID = DbHelperSQL.GetString(dr["TypeID"]); model.UAVTime = DbHelperSQL.GetString(dr["UAVTime"]); model.isChecked = DbHelperSQL.GetBool(dr["isChecked"]); model.Latitude = DbHelperSQL.GetDouble(dr["Latitude"]); model.Longitude = DbHelperSQL.GetDouble(dr["Longitude"]); model.UAVName = DbHelperSQL.GetString(dr["UAVName"]); model.TID = DbHelperSQL.GetString(dr["TID"]); model.PID = DbHelperSQL.GetInt(dr["PID"]); model.isHandled = DbHelperSQL.GetBool(dr["isHandled"]); lst.Add(model); } return(lst); } }
/// <summary> /// 得到最新的一个对象 /// </summary> public Model.UAVSignIn GetTopModel() { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT TOP 1 * FROM UAVSignIn ORDER BY UAVTime DESC "); Model.UAVSignIn model = null; using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (dr.Read()) { model = GetModel(dr); } return(model); } }
/// <summary> /// 得到最新的一个对象 /// </summary> public Model.UAVSignIn GetTopModel(int uid, string time) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT TOP 1 * FROM [dbo].[UAVSignIn] WHERE [UAVTime]<'" + time + "' AND UID=" + uid + " ORDER BY [UAVTime] DESC "); Model.UAVSignIn model = null; using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (dr.Read()) { model = GetModel(dr); } return(model); } }
/// <summary> /// 根据条件得到一个对象实体 /// </summary> public Model.UAVSignIn GetModelByCond(string whereClause) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM UAVSignIn "); strSql.Append(" WHERE " + whereClause + ""); Model.UAVSignIn model = null; using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (dr.Read()) { model = GetModel(dr); } return(model); } }
/// <summary> /// 得到最新的一个对象实体 /// </summary> public Model.UAVSignIn GetModel(int UID, int pid) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT Top 1 * FROM UAVSignIn "); strSql.Append(" WHERE UID=" + UID + " AND PID=" + pid + " order by UAVTime desc"); Model.UAVSignIn model = null; using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (dr.Read()) { model = GetModel(dr); } return(model); } }
/// <summary> /// 由一行数据得到一个实体 /// </summary> private Model.UAVSignIn GetModel(DbDataReader dr) { Model.UAVSignIn model = new Model.UAVSignIn(); model.ID = DbHelperSQL.GetInt(dr["ID"]); model.UID = DbHelperSQL.GetInt(dr["UID"]); model.UAVTel = DbHelperSQL.GetString(dr["UAVTel"]); model.TypeID = DbHelperSQL.GetString(dr["TypeID"]); model.UAVTime = DbHelperSQL.GetString(dr["UAVTime"]); model.isChecked = DbHelperSQL.GetBool(dr["isChecked"]); model.Latitude = DbHelperSQL.GetDouble(dr["Latitude"]); model.Longitude = DbHelperSQL.GetDouble(dr["Longitude"]); model.TID = DbHelperSQL.GetString(dr["TID"]); model.PID = DbHelperSQL.GetInt(dr["PID"]); model.isHandled = DbHelperSQL.GetBool(dr["isHandled"]); return(model); }
/// <summary> /// 获取最新的任务ID /// </summary> public List <Model.UAVSignIn> GetTopList(int uid) { StringBuilder strSql = new StringBuilder("SELECT top 1 * FROM UAVSignIn WHERE uid=" + uid + " order by UAVTime desc"); using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { List <Model.UAVSignIn> lst = new List <Model.UAVSignIn>(); while (dr.Read()) { Model.UAVSignIn model = new Model.UAVSignIn(); model.TID = DbHelperSQL.GetString(dr["TID"]); lst.Add(model); } return(lst); } }
/// <summary> /// 获取无人机完成了的任务列表 /// </summary> public List <Model.UAVSignIn> GetFinishUID(int pid) { StringBuilder strSql = new StringBuilder("SELECT DISTINCT * FROM UAVSignIn WHERE PID=" + pid + " order by UAVTime desc"); using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { List <Model.UAVSignIn> lst = new List <Model.UAVSignIn>(); while (dr.Read()) { Model.UAVSignIn model = new Model.UAVSignIn(); model.UID = DbHelperSQL.GetInt(dr["UID"]); lst.Add(model); } return(lst); } }
/// <summary> /// 获取无人机完成了的任务列表 /// </summary> public List <Model.UAVSignIn> GetFinishTaskList(int uavid, int pid) { StringBuilder strSql = new StringBuilder("SELECT * FROM UAVSignIn WHERE UID=" + uavid + " AND PID=" + pid + " AND TypeID='30003' order by UAVTime desc"); using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { List <Model.UAVSignIn> lst = new List <Model.UAVSignIn>(); while (dr.Read()) { Model.UAVSignIn model = new Model.UAVSignIn(); model.UID = DbHelperSQL.GetInt(dr["UID"]); model.TID = DbHelperSQL.GetString(dr["TID"]); lst.Add(model); } return(lst); } }