Exemple #1
0
 private int RunCommandWithTransatcion(VSM.Entities.BuGastankInfo 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);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// 得到列表
 /// </summary>
 /// <param name="ent"></param>
 /// <returns></returns>
 public List<BuGastankInfo> GetBuGastankInfoList(string Where)
 {
     List<BuGastankInfo> list = new List<BuGastankInfo>();
     using(DbDataReader reader = DataBaseManage.ExecuteReader(DalSql+Where))
     {
         while (reader.Read())
         {
            BuGastankInfo ent = new BuGastankInfo();
             SetEnt(ent, reader);
             list.Add(ent);
         }
     }
     return list;
 }
Exemple #3
0
 /// <summary>
 /// 根据TankNumber得到 BuGastankInfo 实体
 /// </summary>
 /// <param name="ent"></param>
 /// <returns></returns>
 public BuGastankInfo GetBuGastankInfo(string TankNumber)
 {
     BuGastankInfo ent = null;
     string sql = DalSql;
     sql = sql + " And  TankNumber";
     MySqlParameter[] paras = new MySqlParameter[]
     {
         new MySqlParameter("TankNumber",TankNumber)
     };
     using(DbDataReader reader = DataBaseManage.ExecuteReader(sql, paras))
     {
         if (reader.Read())
         {
             ent = new BuGastankInfo();
             SetEnt(ent, reader);
         }
        		}
     return ent;
 }
Exemple #4
0
 public void SetEnt(BuGastankInfo ent, IDataReader dr)
 {
     ent.TankNumber = MyConvert.ToString(dr["TankNumber"]);
     ent.TankKind = MyConvert.ToString(dr["TankKind"]);
     ent.TankVolume = MyConvert.ToString(dr["TankVolume"]);
     ent.Tank1 = MyConvert.ToString(dr["Tank1"]);
     ent.Tank2 = MyConvert.ToString(dr["Tank2"]);
     ent.Tank3 = MyConvert.ToString(dr["Tank3"]);
 }