public virtual void Delete(Entity entity) { if (entity != null && this.DataObject != null) { DataTransaction tran = new DataTransaction(this.DataObject.ConnectionString); try { this.DataObject.Delete(entity, tran); } catch (Exception ex) { tran.Rollback(); throw ex; } tran.Commit(); } }
private int ExecuteNonQuery(string connectionString, DataTransaction tran) { if (tran == null) { this.Command.Connection.ConnectionString = connectionString; this.Command.Connection.Open(); } else { this.Command.Connection = tran.Transaction.Connection; this.Command.Transaction = tran.Transaction; } this.Command.CommandText = this.Query; this.Command.CommandType = this.Type; int ret = this.Command.ExecuteNonQuery(); if (tran == null) { this.Command.Connection.Close(); } return(ret); }
private DataTable GetDataTable(string connectionString, DataTransaction tran) { if (tran == null) { this.Command.Connection.ConnectionString = connectionString; } else { this.Command.Connection = tran.Transaction.Connection; this.Command.Transaction = tran.Transaction; } this.Command.CommandText = this.Query; this.Command.CommandType = this.Type; SqlDataAdapter adp = new SqlDataAdapter(); adp.SelectCommand = this.Command; DataTable dt = new DataTable(); adp.Fill(dt); return(dt); }
private object ExecuteScalar(string connectionString, DataTransaction tran) { if (tran == null) { this.Command.Connection.ConnectionString = connectionString; this.Command.Connection.Open(); } else { this.Command.Connection = tran.Transaction.Connection; this.Command.Transaction = tran.Transaction; } this.Command.CommandText = this.Name; this.Command.CommandType = CommandType.StoredProcedure; object ret = this.Command.ExecuteScalar(); if (tran == null) { this.Command.Connection.Close(); } return(ret); }
private DataSet GetDataSet(string connectionString, DataTransaction tran) { if (tran == null) { this.Command.Connection.ConnectionString = connectionString; } else { this.Command.Connection = tran.Transaction.Connection; this.Command.Transaction = tran.Transaction; } this.Command.CommandText = this.Name; this.Command.CommandType = CommandType.StoredProcedure; SqlDataAdapter adp = new SqlDataAdapter(); adp.SelectCommand = this.Command; DataSet ds = new DataSet(); adp.Fill(ds); return(ds); }
public object ExecuteScalar(DataTransaction tran) { return(this.ExecuteScalar(null, tran)); }
public DataTable GetDataTable(DataTransaction tran) { return(this.GetDataTable(null, tran)); }
public int ExecuteNonQuery(DataTransaction tran) { return(this.ExecuteNonQuery(null, tran)); }
public virtual int Delete(Entity entity, DataTransaction tran) { return(0); }
public virtual int Insert(Entity entity, DataTransaction tran) { return(0); }
public DataSet GetDataSet(DataTransaction tran) { return(this.GetDataSet(null, tran)); }