Esempio n. 1
0
 public static void EndConnection()
 {
     try
     {
         if (SQLSConnection.State == ConnectionState.Open)
         {
             SQLSConnection.Close();
         }
     }
     catch (Exception)
     { throw; }
 }
Esempio n. 2
0
 public static void BeginTransaction()
 {
     try
     {
         ValidateConnection();
         SQLSConnection.Open();
         SQLSTransaction = SQLSConnection.BeginTransaction();
     }
     catch (Exception)
     {
         EndConnection();
         throw;
     }
 }
Esempio n. 3
0
 public static SqlConnection BeginConnection()
 {
     try
     {
         ValidateConnection();
         SQLSConnection.Open();
         return(SQLSConnection);
     }
     catch (Exception e)
     {
         EndConnection();
         throw;
     }
 }
Esempio n. 4
0
 public static void RollBackTransaction()
 {
     try
     {
         if (SQLSTransaction != null)
         {
             SQLSTransaction.Rollback();
             SQLSConnection.Close();
             SQLSTransaction = null;
         }
     }
     catch (Exception)
     {
         EndConnection();
         throw;
     }
 }
Esempio n. 5
0
 public static void CommitTransaction()
 {
     try
     {
         if (SQLSTransaction != null)
         {
             SQLSTransaction.Commit();
             SQLSConnection.Close();
             SQLSTransaction = null;
         }
     }
     catch (Exception)
     {
         EndConnection();
         throw;
     }
 }
Esempio n. 6
0
        public static SqlCommand AsignProcedure(string procedureName)
        {
            try
            {
                SqlCommand _command;

                _command                = SQLSConnection.CreateCommand();
                _command.CommandText    = procedureName;
                _command.Connection     = SQLSConnection;
                _command.CommandTimeout = SQLSConnection.ConnectionTimeout;
                _command.CommandType    = CommandType.StoredProcedure;

                return(_command);
            }
            catch (Exception)
            {
                EndConnection();
                throw;
            }
        }