コード例 #1
0
 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();
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 public object ExecuteScalar(DataTransaction tran)
 {
     return(this.ExecuteScalar(null, tran));
 }
コード例 #7
0
 public DataTable GetDataTable(DataTransaction tran)
 {
     return(this.GetDataTable(null, tran));
 }
コード例 #8
0
 public int ExecuteNonQuery(DataTransaction tran)
 {
     return(this.ExecuteNonQuery(null, tran));
 }
コード例 #9
0
 public virtual int Delete(Entity entity, DataTransaction tran)
 {
     return(0);
 }
コード例 #10
0
 public virtual int Insert(Entity entity, DataTransaction tran)
 {
     return(0);
 }
コード例 #11
0
 public DataSet GetDataSet(DataTransaction tran)
 {
     return(this.GetDataSet(null, tran));
 }