Exemple #1
0
 private int RunCommandWithTransatcion(VSM.Entities.BuCarRepair 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);
         }
     }
 }