示例#1
0
 public void CommitTransaction()
 {
     if (this.Transaction != null)
     {
         LibraryMgr.CommitTransaction(this.Transaction);
     }
 }
示例#2
0
 public void RollbackTransaction()
 {
     if (this.Transaction != null)
     {
         LibraryMgr.RollbackTransaction(this.Transaction);
     }
 }
示例#3
0
 protected void initConnection()
 {
     if (this.Connection == null)
     {
         this.Connection = LibraryMgr.GetConnection(this.connectionStrType);
     }
 }
示例#4
0
 public void BeginTransaction()
 {
     if (this.Connection != null)
     {
         this.Transaction = LibraryMgr.BeginTransaction(this.Connection);
         lMgr.Transaction = this.Transaction;
     }
 }
示例#5
0
 protected void UpdateData(IDataAdapter adapter, DataSet dataSet)
 {
     lMgr.Connection = LibraryMgr.GetConnection(this.connectionStrType);
     lMgr.SetAdapterConnection(adapter, this.connectionStrType);
     try
     {
         adapter.Update(dataSet);
     }
     catch (Exception exception)
     {
         WebUtils.HandleException(exception);
     }
 }
示例#6
0
 protected void ExecuteCommand(System.Data.IDbCommand command)
 {
     lMgr.Connection = LibraryMgr.GetConnection(this.connectionStrType);
     lMgr.SetCommandConnection(command);
     try
     {
         if (command.Connection.State == ConnectionState.Closed)
         {
             command.Connection.Open();
         }
         command.ExecuteNonQuery();
         command.Connection.Close();
     }
     catch (Exception exception)
     {
         command.Connection.Close();
         WebUtils.HandleException(exception);
     }
 }
示例#7
0
 protected SqlDataReader ExecuteCommandReader(System.Data.IDbCommand command)
 {
     lMgr.Connection = LibraryMgr.GetConnection(this.connectionStrType);
     lMgr.SetCommandConnection(command);
     try
     {
         if (command.Connection.State == ConnectionState.Closed)
         {
             command.Connection.Open();
         }
         return((SqlDataReader)command.ExecuteReader(CommandBehavior.CloseConnection));
     }
     catch (Exception exception)
     {
         command.Connection.Close();
         WebUtils.HandleException(exception);
         return(null);
     }
 }
示例#8
0
        protected DataSet FillData(IDataAdapter adapter, DataSet dataSet, string condition)
        {
            string Interncondition;

            if ((condition == "") || (condition == null))
            {
                Interncondition = "";
            }
            else
            {
                Interncondition = " where " + condition;
            }

            switch (connectionStrType)
            {
            case GVC.ConnectionSQL_AppE:
                ((System.Data.SqlClient.SqlDataAdapter)adapter).SelectCommand.CommandText += Interncondition;
                break;

            case GVC.ConnectionAccess_AppE:
                ((System.Data.OleDb.OleDbDataAdapter)adapter).SelectCommand.CommandText += Interncondition;
                break;

            default:
                ((System.Data.SqlClient.SqlDataAdapter)adapter).SelectCommand.CommandText += Interncondition;
                break;
            }

            lMgr.Connection = LibraryMgr.GetConnection(this.connectionStrType);
            lMgr.SetAdapterConnection(adapter, this.connectionStrType);

            try
            {
                adapter.Fill(dataSet);
            }
            catch (Exception exception)
            {
                WebUtils.HandleException(exception);
            }

            return(dataSet);
        }