Пример #1
0
        public void Page_PageTypeSave(int[] pageIDs, int pageTypeID, int userID)
        {
            TransactionController transactionController = new TransactionController();

            try
            {
                transactionController.BeginTransaction();
                int           index = 0;
                Page_PageType ppt   = new Page_PageType();
                ppt.PageTypeID = pageTypeID;
                ppt.Verified   = true;

                for (index = 0; index < pageIDs.Length; index++)
                {
                    ppt.PageID = pageIDs[index];
                    this.Page_PageTypeSave(ppt, userID, transactionController);
                }
                transactionController.CommitTransaction();
            }
            catch
            {
                transactionController.RollbackTransaction();
            }
            finally
            {
                transactionController.Dispose();
            }
        }
Пример #2
0
        /// <summary>
        /// Select values from Page_PageType by primary key(s).
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="pageID">Unique identifier for each Page record.</param>
        /// <param name="pageTypeID">Unique identifier for each Page Type record.</param>
        /// <returns>Object of type Page_PageType.</returns>
        public Page_PageType Page_PageTypeSelectAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int pageID,
            int pageTypeID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("Page_PageTypeSelectAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("PageID", SqlDbType.Int, null, false, pageID),
                                                                      CustomSqlHelper.CreateInputParameter("PageTypeID", SqlDbType.Int, null, false, pageTypeID)))
            {
                using (CustomSqlHelper <Page_PageType> helper = new CustomSqlHelper <Page_PageType>())
                {
                    CustomGenericList <Page_PageType> list = helper.ExecuteReader(command);
                    if (list.Count > 0)
                    {
                        Page_PageType o = list[0];
                        list = null;
                        return(o);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Update values in Page_PageType. Returns an object of type Page_PageType.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="pageID">Unique identifier for each Page record.</param>
        /// <param name="pageTypeID">Unique identifier for each Page Type record.</param>
        /// <param name="verified"></param>
        /// <param name="lastModifiedUserID"></param>
        /// <returns>Object of type Page_PageType.</returns>
        public Page_PageType Page_PageTypeUpdateAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int pageID,
            int pageTypeID,
            bool verified,
            int?lastModifiedUserID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("Page_PageTypeUpdateAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("PageID", SqlDbType.Int, null, false, pageID),
                                                                      CustomSqlHelper.CreateInputParameter("PageTypeID", SqlDbType.Int, null, false, pageTypeID),
                                                                      CustomSqlHelper.CreateInputParameter("Verified", SqlDbType.Bit, null, false, verified),
                                                                      CustomSqlHelper.CreateInputParameter("LastModifiedUserID", SqlDbType.Int, null, true, lastModifiedUserID),
                                                                      CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false)))
            {
                using (CustomSqlHelper <Page_PageType> helper = new CustomSqlHelper <Page_PageType>())
                {
                    CustomGenericList <Page_PageType> list = helper.ExecuteReader(command);
                    if (list.Count > 0)
                    {
                        Page_PageType o = list[0];
                        list = null;
                        return(o);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
        public void Page_PageTypeSave( int[] pageIDs, int pageTypeID, int userID )
        {
            TransactionController transactionController = new TransactionController();
            try
            {
                transactionController.BeginTransaction();
                int index = 0;
                Page_PageType ppt = new Page_PageType();
                ppt.PageTypeID = pageTypeID;
                ppt.Verified = true;

                for ( index = 0; index < pageIDs.Length; index++ )
                {
                    ppt.PageID = pageIDs[ index ];
                    this.Page_PageTypeSave( ppt, userID, transactionController );
                }
                transactionController.CommitTransaction();
            }
            catch
            {
                transactionController.RollbackTransaction();
            }
            finally
            {
                transactionController.Dispose();
            }
        }
Пример #5
0
        /// <summary>
        /// Manage Page_PageType object.
        /// If the object is of type CustomObjectBase,
        /// then either insert values into, delete values from, or update values in Page_PageType.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="value">Object of type Page_PageType.</param>
        /// <returns>Object of type CustomDataAccessStatus<Page_PageType>.</returns>
        public CustomDataAccessStatus <Page_PageType> Page_PageTypeManageAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            Page_PageType value, int userId)
        {
            if (value.IsNew && !value.IsDeleted)
            {
                value.CreationUserID     = userId;
                value.LastModifiedUserID = userId;
                Page_PageType returnValue = Page_PageTypeInsertAuto(sqlConnection, sqlTransaction,
                                                                    value.PageID,
                                                                    value.PageTypeID,
                                                                    value.Verified,
                                                                    value.CreationUserID,
                                                                    value.LastModifiedUserID);

                return(new CustomDataAccessStatus <Page_PageType>(
                           CustomDataAccessContext.Insert,
                           true, returnValue));
            }
            else if (!value.IsNew && value.IsDeleted)
            {
                if (Page_PageTypeDeleteAuto(sqlConnection, sqlTransaction,
                                            value.PageID,
                                            value.PageTypeID))
                {
                    return(new CustomDataAccessStatus <Page_PageType>(
                               CustomDataAccessContext.Delete,
                               true, value));
                }
                else
                {
                    return(new CustomDataAccessStatus <Page_PageType>(
                               CustomDataAccessContext.Delete,
                               false, value));
                }
            }
            else if (value.IsDirty && !value.IsDeleted)
            {
                value.LastModifiedUserID = userId;
                Page_PageType returnValue = Page_PageTypeUpdateAuto(sqlConnection, sqlTransaction,
                                                                    value.PageID,
                                                                    value.PageTypeID,
                                                                    value.Verified,
                                                                    value.LastModifiedUserID);

                return(new CustomDataAccessStatus <Page_PageType>(
                           CustomDataAccessContext.Update,
                           true, returnValue));
            }
            else
            {
                return(new CustomDataAccessStatus <Page_PageType>(
                           CustomDataAccessContext.NA,
                           false, value));
            }
        }
Пример #6
0
 /// <summary>
 /// Update values in Page_PageType. Returns an object of type Page_PageType.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type Page_PageType.</param>
 /// <returns>Object of type Page_PageType.</returns>
 public Page_PageType Page_PageTypeUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     Page_PageType value)
 {
     return(Page_PageTypeUpdateAuto(sqlConnection, sqlTransaction,
                                    value.PageID,
                                    value.PageTypeID,
                                    value.Verified,
                                    value.LastModifiedUserID));
 }
Пример #7
0
 public void Page_PageTypeSave(SqlConnection sqlConnection, SqlTransaction sqlTransaction, Page_PageType value,
     int userId)
 {
     Page_PageType ppt = this.Page_PageTypeSelectAuto( sqlConnection, sqlTransaction, value.PageID, value.PageTypeID );
     if ( ppt != null )
     {
         ppt.Verified = true;
         ppt.LastModifiedUserID = userId;
         this.Page_PageTypeUpdateAuto( sqlConnection, sqlTransaction, ppt );
     }
     else
     {
         value.LastModifiedUserID = userId;
         value.CreationUserID = userId;
         this.Page_PageTypeInsertAuto( sqlConnection, sqlTransaction, value );
     }
 }
Пример #8
0
        public void Page_PageTypeSave(SqlConnection sqlConnection, SqlTransaction sqlTransaction, Page_PageType value,
                                      int userId)
        {
            Page_PageType ppt = this.Page_PageTypeSelectAuto(sqlConnection, sqlTransaction, value.PageID, value.PageTypeID);

            if (ppt != null)
            {
                ppt.Verified           = true;
                ppt.LastModifiedUserID = userId;
                this.Page_PageTypeUpdateAuto(sqlConnection, sqlTransaction, ppt);
            }
            else
            {
                value.LastModifiedUserID = userId;
                value.CreationUserID     = userId;
                this.Page_PageTypeInsertAuto(sqlConnection, sqlTransaction, value);
            }
        }
Пример #9
0
 private void Page_PageTypeSave(Page_PageType value, int userID, TransactionController transactionController)
 {
     GetPage_PageTypeDalInstance().Page_PageTypeSave(transactionController.Connection,
                                                     transactionController.Transaction, value, userID);
     PageSetPaginationInfo(value.PageID, userID, transactionController);
 }
 private void Page_PageTypeSave( Page_PageType value, int userID, TransactionController transactionController )
 {
     GetPage_PageTypeDalInstance().Page_PageTypeSave( transactionController.Connection,
         transactionController.Transaction, value, userID );
     PageSetPaginationInfo( value.PageID, userID, transactionController );
 }
Пример #11
0
 /// <summary>
 /// Update values in Page_PageType. Returns an object of type Page_PageType.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type Page_PageType.</param>
 /// <returns>Object of type Page_PageType.</returns>
 public Page_PageType Page_PageTypeUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     Page_PageType value)
 {
     return Page_PageTypeUpdateAuto(sqlConnection, sqlTransaction,
         value.PageID,
         value.PageTypeID,
         value.Verified,
         value.LastModifiedUserID);
 }
Пример #12
0
        /// <summary>
        /// Manage Page_PageType object.
        /// If the object is of type CustomObjectBase, 
        /// then either insert values into, delete values from, or update values in Page_PageType.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="value">Object of type Page_PageType.</param>
        /// <returns>Object of type CustomDataAccessStatus<Page_PageType>.</returns>
        public CustomDataAccessStatus<Page_PageType> Page_PageTypeManageAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            Page_PageType value , int userId)
        {
            if (value.IsNew && !value.IsDeleted)
            {
                value.CreationUserID = userId;
                value.LastModifiedUserID = userId;
                Page_PageType returnValue = Page_PageTypeInsertAuto(sqlConnection, sqlTransaction,
                    value.PageID,
                        value.PageTypeID,
                        value.Verified,
                        value.CreationUserID,
                        value.LastModifiedUserID);

                return new CustomDataAccessStatus<Page_PageType>(
                    CustomDataAccessContext.Insert,
                    true, returnValue);
            }
            else if (!value.IsNew && value.IsDeleted)
            {
                if (Page_PageTypeDeleteAuto(sqlConnection, sqlTransaction,
                    value.PageID,
                        value.PageTypeID))
                {
                return new CustomDataAccessStatus<Page_PageType>(
                    CustomDataAccessContext.Delete,
                    true, value);
                }
                else
                {
                return new CustomDataAccessStatus<Page_PageType>(
                    CustomDataAccessContext.Delete,
                    false, value);
                }
            }
            else if (value.IsDirty && !value.IsDeleted)
            {
                value.LastModifiedUserID = userId;
                Page_PageType returnValue = Page_PageTypeUpdateAuto(sqlConnection, sqlTransaction,
                    value.PageID,
                        value.PageTypeID,
                        value.Verified,
                        value.LastModifiedUserID);

                return new CustomDataAccessStatus<Page_PageType>(
                    CustomDataAccessContext.Update,
                    true, returnValue);
            }
            else
            {
                return new CustomDataAccessStatus<Page_PageType>(
                    CustomDataAccessContext.NA,
                    false, value);
            }
        }