Beispiel #1
0
 private int RunCommandWithTransatcion(VSM.Entities.BuGPSInfo ent, string vSql, IDbTransaction TRANS)
 {
     if (null == TRANS)
     {
         MySqlParameter[] paras = new MySqlParameter[ent.Column.Count];
         for (int i = 0; i < ent.Column.Count; i++)
         {
             paras[i] = new MySqlParameter();
             paras[i].ParameterName = ent.Column[i].FieldName;
             paras[i].DbType        = ent.Column[i].FieldType;
             paras[i].Value         = ent.Column[i].FieldValue;
         }
         return(DataBaseManage.ExecuteSql(vSql, paras));
     }
     else
     {
         System.Data.IDbCommand CM = TRANS.Connection.CreateCommand();
         CM.CommandText = vSql;
         CM.CommandType = CommandType.Text;
         CM.Transaction = TRANS;
         GetEntityDeleteParameter(CM, ent);
         try
         {
             return(CM.ExecuteNonQuery());
         }
         catch (System.Exception e)
         {
             if (isDebug)
             {
                 throw new Exception(e.Message);
             }
             return(0);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// 得到列表
 /// </summary>
 /// <param name="ent"></param>
 /// <returns></returns>
 public List<BuGPSInfo> GetBuGPSInfoList(string Where)
 {
     List<BuGPSInfo> list = new List<BuGPSInfo>();
     using(DbDataReader reader = DataBaseManage.ExecuteReader(DalSql+Where))
     {
         while (reader.Read())
         {
            BuGPSInfo ent = new BuGPSInfo();
             SetEnt(ent, reader);
             list.Add(ent);
         }
     }
     return list;
 }
Beispiel #3
0
 /// <summary>
 /// 根据GPSId得到 BuGPSInfo 实体
 /// </summary>
 /// <param name="ent"></param>
 /// <returns></returns>
 public BuGPSInfo GetBuGPSInfo(string GPSId)
 {
     BuGPSInfo ent = null;
     string sql = DalSql;
     sql = sql + " And  GPSId";
     MySqlParameter[] paras = new MySqlParameter[]
     {
         new MySqlParameter("GPSId",GPSId)
     };
     using(DbDataReader reader = DataBaseManage.ExecuteReader(sql, paras))
     {
         if (reader.Read())
         {
             ent = new BuGPSInfo();
             SetEnt(ent, reader);
         }
        		}
     return ent;
 }
Beispiel #4
0
 public void SetEnt(BuGPSInfo ent, IDataReader dr)
 {
     ent.GPSId = MyConvert.ToString(dr["GPSId"]);
     ent.SynchronizationType = MyConvert.ToString(dr["SynchronizationType"]);
     ent.SynchronizationTime = MyConvert.ToDateTime(dr["SynchronizationTime"]);
     ent.SynchronizationStatus = MyConvert.ToString(dr["SynchronizationStatus"]);
     ent.Longitude = MyConvert.ToString(dr["Longitude"]);
     ent.Latitude = MyConvert.ToString(dr["Latitude"]);
     ent.CarId = MyConvert.ToInt(dr["CarId"]);
 }