Ejemplo n.º 1
0
        public static void SaveList( SqlConnection sqlConnection, SqlTransaction sqlTransaction,
            CustomGenericList<PageName> pageNames)
        {
            SqlConnection connection = sqlConnection;
            SqlTransaction transaction = sqlTransaction;

            if ( connection == null )
            {
                connection =
                    CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ) );
            }

            bool isTransactionCoordinator = CustomSqlHelper.IsTransactionCoordinator( transaction );

            try
            {
                transaction = CustomSqlHelper.BeginTransaction( connection, transaction, isTransactionCoordinator );

                if ( pageNames.Count > 0 )
                {
                    PageNameDAL pageNameDAL = new PageNameDAL();
                    foreach ( PageName pageName in pageNames )
                    {
                        pageNameDAL.PageNameManageAuto( connection, transaction, pageName );
                    }
                }

                CustomSqlHelper.CommitTransaction( transaction, isTransactionCoordinator );
            }
            catch ( Exception ex )
            {
                CustomSqlHelper.RollbackTransaction( transaction, isTransactionCoordinator );

                throw new Exception( "Exception in Save", ex );
            }
            finally
            {
                CustomSqlHelper.CloseConnection( connection, isTransactionCoordinator );
            }
        }
Ejemplo n.º 2
0
        public static void SaveList(SqlConnection sqlConnection, SqlTransaction sqlTransaction,
                                    CustomGenericList <PageName> pageNames)
        {
            SqlConnection  connection  = sqlConnection;
            SqlTransaction transaction = sqlTransaction;

            if (connection == null)
            {
                connection =
                    CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"));
            }

            bool isTransactionCoordinator = CustomSqlHelper.IsTransactionCoordinator(transaction);

            try
            {
                transaction = CustomSqlHelper.BeginTransaction(connection, transaction, isTransactionCoordinator);

                if (pageNames.Count > 0)
                {
                    PageNameDAL pageNameDAL = new PageNameDAL();
                    foreach (PageName pageName in pageNames)
                    {
                        pageNameDAL.PageNameManageAuto(connection, transaction, pageName);
                    }
                }

                CustomSqlHelper.CommitTransaction(transaction, isTransactionCoordinator);
            }
            catch (Exception ex)
            {
                CustomSqlHelper.RollbackTransaction(transaction, isTransactionCoordinator);

                throw new Exception("Exception in Save", ex);
            }
            finally
            {
                CustomSqlHelper.CloseConnection(connection, isTransactionCoordinator);
            }
        }
Ejemplo n.º 3
0
        private PageNameDAL GetPageNameDalInstance()
        {
            if ( pageNameDal == null )
                pageNameDal = new PageNameDAL();

            return pageNameDal;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Update the Name Bank ID and Active flag for the specified Page Name.
 /// </summary>
 /// <param name="pageNameID">Identifier of the Page Name to update</param>
 /// <param name="nameBankID">Name Bank ID to assign to the Page Name</param>
 /// <param name="active">Active flag value to assign to the Page Name</param>
 /// <returns>The updated Page Name</returns>
 public PageName PageNameUpdateNameBankID( int pageNameID, int nameBankID, bool active )
 {
     PageNameDAL dal = new PageNameDAL();
     PageName storedPageName = dal.PageNameSelectAuto( null, null, pageNameID );
     if ( storedPageName != null )
     {
         storedPageName.NameBankID = nameBankID;
         storedPageName.Active = active;
         storedPageName.LastUpdateDate = System.DateTime.Now;
         storedPageName = dal.PageNameUpdateAuto( null, null, storedPageName );
     }
     else
     {
         throw new Exception( "Could not find existing page name record" );
     }
     return storedPageName;
 }