Example #1
0
        /// <summary>
        /// Gets the YAF board access masks.
        /// </summary>
        /// <param name="boardId">The board id.</param>
        /// <returns>Returns the YAF Board access masks</returns>
        public static List <RoleInfo> GetYafBoardAccessMasks(int boardId)
        {
            var roles = new List <RoleInfo>();

            using (var cmd = DbHelpers.GetCommand("accessmask_list"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("BoardID", boardId);
                cmd.AddParam("AccessMaskID", null);
                cmd.AddParam("ExcludeFlags", 0);

                var accessmasksTable = LegacyDb.DbAccess.GetData(cmd);

                roles.AddRange(
                    from DataRow row in accessmasksTable.Rows
                    select
                    new RoleInfo
                {
                    RoleName    = Convert.ToString(row["Name"]),
                    RoleID      = row["AccessMaskID"].ToType <int>(),
                    RoleGroupID = row["Flags"].ToType <int>()
                });
            }

            return(roles);
        }
Example #2
0
        /// <summary>
        /// Gets the read access list for forum.
        /// </summary>
        /// <param name="forumId">The forum unique identifier.</param>
        /// <returns>Returns the read access list for forum</returns>
        public static List <ForumAccess> GetReadAccessListForForum(int forumId)
        {
            var forumAccessList = new List <ForumAccess>();

            using (var cmd = DbHelpers.GetCommand("GetReadAccessListForForum"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("ForumID", forumId);

                var accessListTable = LegacyDb.DbAccess.GetData(cmd);

                forumAccessList.AddRange(
                    from DataRow row in accessListTable.Rows
                    select
                    new ForumAccess
                {
                    GroupID        = row["GroupID"].ToType <int>(),
                    GroupName      = row["GroupName"].ToType <string>(),
                    AccessMaskName = row["AccessMaskName"].ToType <string>(),
                    Flags          = new AccessFlags(row["Flags"])
                });
            }

            return(forumAccessList);
        }
Example #3
0
 /// <summary>
 /// The get number inactive profiles.
 /// </summary>
 /// <param name="appName">
 /// The app name.
 /// </param>
 /// <param name="inactiveSinceDate">
 /// The inactive since date.
 /// </param>
 /// <returns>
 /// The get number inactive profiles.
 /// </returns>
 public int GetNumberInactiveProfiles([NotNull] object appName, [NotNull] object inactiveSinceDate)
 {
     using (SqlCommand cmd = DbHelpers.GetCommand("prov_profile_getnumberinactiveprofiles"))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("ApplicationName", appName);
         cmd.Parameters.AddWithValue("InactiveSinceDate", inactiveSinceDate);
         return(Convert.ToInt32(this.DbAccess.ExecuteScalar(cmd)));
     }
 }
Example #4
0
 /// <summary>
 /// The delete profiles.
 /// </summary>
 /// <param name="appName">
 /// The app name.
 /// </param>
 /// <param name="userNames">
 /// The user names.
 /// </param>
 /// <returns>
 /// The delete profiles.
 /// </returns>
 public int DeleteProfiles([NotNull] object appName, [NotNull] object userNames)
 {
     using (SqlCommand cmd = DbHelpers.GetCommand("prov_profile_deleteprofiles"))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("ApplicationName", appName);
         cmd.Parameters.AddWithValue("UserNames", userNames);
         return(Convert.ToInt32(this.DbAccess.ExecuteScalar(cmd)));
     }
 }
Example #5
0
        /// <summary>
        /// Imports the active forums.
        /// </summary>
        /// <param name="moduleId">The module identifier.</param>
        /// <param name="boardId">The board identifier.</param>
        public static void ImportActiveForums([NotNull] int moduleId, [NotNull] int boardId)
        {
            using (var cmd = DbHelpers.GetCommand("ImportActiveForums"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.AddParam("oModuleID", moduleId);
                cmd.AddParam("tplBoardID", boardId);

                LegacyDb.DbAccess.ExecuteNonQuery(cmd);
            }
        }
Example #6
0
        /// <summary>
        /// Add active access row for the current user outside of YAF
        /// </summary>
        /// <param name="boardId">The board id.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="isGuest">if set to <c>true</c> [is guest].</param>
        /// <returns>
        /// Returns the Table of the Active Access User Table
        /// </returns>
        public static DataTable ActiveAccessUser(object boardId, object userId, bool isGuest)
        {
            using (var cmd = DbHelpers.GetCommand("pageaccess"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("BoardID", boardId);
                cmd.Parameters.AddWithValue("UserID", userId);
                cmd.Parameters.AddWithValue("IsGuest", isGuest);
                cmd.Parameters.AddWithValue("UTCTIMESTAMP", DateTime.UtcNow);

                return(LegacyDb.DbAccess.GetData(cmd));
            }
        }
Example #7
0
 /// <summary>
 /// The get profiles.
 /// </summary>
 /// <param name="appName">
 /// The app name.
 /// </param>
 /// <param name="pageIndex">
 /// The page index.
 /// </param>
 /// <param name="pageSize">
 /// The page size.
 /// </param>
 /// <param name="userNameToMatch">
 /// The user name to match.
 /// </param>
 /// <param name="inactiveSinceDate">
 /// The inactive since date.
 /// </param>
 /// <returns>
 /// </returns>
 public DataSet GetProfiles([NotNull] object appName, [NotNull] object pageIndex, [NotNull] object pageSize,
                            [NotNull] object userNameToMatch, [NotNull] object inactiveSinceDate)
 {
     using (SqlCommand cmd = DbHelpers.GetCommand("prov_profile_getprofiles"))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("ApplicationName", appName);
         cmd.Parameters.AddWithValue("PageIndex", pageIndex);
         cmd.Parameters.AddWithValue("PageSize", pageSize);
         cmd.Parameters.AddWithValue("UserNameToMatch", userNameToMatch);
         cmd.Parameters.AddWithValue("InactiveSinceDate", inactiveSinceDate);
         return(this.DbAccess.GetDataset(cmd));
     }
 }
Example #8
0
        /// <summary>
        /// Get The list of all boards
        /// </summary>
        /// <returns>
        /// Returns the List of all boards
        /// </returns>
        public static List <Board> ListBoards()
        {
            var boards = new List <Board>();

            using (var cmd = DbHelpers.GetCommand("board_list"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("BoardID", null);

                var mesagesTable = LegacyDb.DbAccess.GetData(cmd);

                boards.AddRange(from DataRow row in mesagesTable.Rows select new Board {
                    ID = row["ID"].ToType <int>()
                });
            }

            return(boards);
        }
Example #9
0
        /// <summary>
        /// Get The Latest Post from SQL
        /// </summary>
        /// <param name="boardId">The Board Id of the Board</param>
        /// <param name="numOfPostsToRetrieve">How many post should been retrieved</param>
        /// <param name="pageUserId">Current Users Id</param>
        /// <param name="useStyledNicks">if set to <c>true</c> [use styled nicks].</param>
        /// <param name="showNoCountPosts">if set to <c>true</c> [show no count posts].</param>
        /// <param name="findLastRead">if set to <c>true</c> [find last read].</param>
        /// <returns>
        /// Returns the Table of Latest Posts
        /// </returns>
        public static DataTable TopicLatest(
            object boardId,
            object numOfPostsToRetrieve,
            object pageUserId,
            bool useStyledNicks,
            bool showNoCountPosts,
            bool findLastRead = false)
        {
            using (var cmd = DbHelpers.GetCommand("topic_latest"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("BoardID", boardId);
                cmd.Parameters.AddWithValue("NumPosts", numOfPostsToRetrieve);
                cmd.Parameters.AddWithValue("PageUserID", pageUserId);
                cmd.Parameters.AddWithValue("StyledNicks", useStyledNicks);
                cmd.Parameters.AddWithValue("ShowNoCountPosts", showNoCountPosts);
                cmd.Parameters.AddWithValue("FindLastRead", findLastRead);

                return(LegacyDb.DbAccess.GetData(cmd));
            }
        }
Example #10
0
        /// <summary>
        /// Gets the YAF user roles.
        /// </summary>
        /// <param name="boardId">The board id.</param>
        /// <param name="yafUserId">The YAF user id.</param>
        /// <returns>Returns List of YAF user roles</returns>
        public static List <RoleInfo> GetYafUserRoles(int boardId, int yafUserId)
        {
            var roles = new List <RoleInfo>();

            using (var cmd = DbHelpers.GetCommand("usergroup_list"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("UserID", yafUserId);

                var rolesTable = LegacyDb.DbAccess.GetData(cmd);

                roles.AddRange(
                    from DataRow row in rolesTable.Rows
                    select
                    new RoleInfo {
                    RoleName = row["Name"].ToType <string>(), RoleID = row["GroupID"].ToType <int>(),
                });
            }

            return(roles);
        }
Example #11
0
        /// <summary>
        /// Get all <see cref="Messages"/> From The Forum
        /// </summary>
        /// <returns>
        /// Topics List
        /// </returns>
        public static List <Topics> YafDnnGetTopics()
        {
            var topicsList = new List <Topics>();

            using (var cmd = DbHelpers.GetCommand("YafDnn_Topics"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                var topicsTable = LegacyDb.DbAccess.GetData(cmd);

                topicsList.AddRange(
                    from DataRow row in topicsTable.Rows
                    select
                    new Topics
                {
                    TopicName = row["Topic"].ToType <string>(),
                    TopicId   = row["TopicID"].ToType <int>(),
                    ForumId   = row["ForumID"].ToType <int>(),
                    Posted    = row["Posted"].ToType <DateTime>()
                });
            }

            return(topicsList);
        }
Example #12
0
        /// <summary>
        /// Get all <see cref="Messages"/> From The Forum
        /// </summary>
        /// <returns>
        /// Message List
        /// </returns>
        public static List <Messages> YafDnnGetMessages()
        {
            var messagesList = new List <Messages>();

            using (var cmd = DbHelpers.GetCommand("YafDnn_Messages"))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                var mesagesTable = LegacyDb.DbAccess.GetData(cmd);

                messagesList.AddRange(
                    from DataRow row in mesagesTable.Rows
                    select
                    new Messages
                {
                    Message   = row["Message"].ToType <string>(),
                    MessageId = row["MessageID"].ToType <int>(),
                    TopicId   = row["TopicID"].ToType <int>(),
                    Posted    = row["Posted"].ToType <DateTime>()
                });
            }

            return(messagesList);
        }