/// <summary>
 /// Initializes a new instance of the <see cref="YafReadTrackCurrentUser"/> class. The yaf read track current user.
 /// </summary>
 /// <param name="yafSession">
 /// </param>
 /// <param name="boardSettings">
 /// </param>
 /// <param name="sessionState">
 /// The session State.
 /// </param>
 public YafReadTrackCurrentUser(
     IYafSession yafSession, YafBoardSettings boardSettings, HttpSessionStateBase sessionState)
 {
     this._yafSession = yafSession;
     this._boardSettings = boardSettings;
     this._sessionState = sessionState;
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="YafDbBroker" /> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="boardSettings">The board settings.</param>
 /// <param name="httpSessionState">The http session state.</param>
 /// <param name="dataCache">The data cache.</param>
 /// <param name="dbFunction">The database function.</param>
 public YafDbBroker(
     IServiceLocator serviceLocator,
     YafBoardSettings boardSettings,
     HttpSessionStateBase httpSessionState,
     IDataCache dataCache,
     IDbFunction dbFunction)
 {
     this.ServiceLocator = serviceLocator;
     this.BoardSettings = boardSettings;
     this.HttpSessionState = httpSessionState;
     this.DataCache = dataCache;
     this.DbFunction = dbFunction;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="YafReadTrackCurrentUser" /> class. The yaf read track current user.
 /// </summary>
 /// <param name="yafSession">The yaf session.</param>
 /// <param name="boardSettings">The board settings.</param>
 /// <param name="sessionState">The session State.</param>
 /// <param name="forumReadRepository"></param>
 /// <param name="topicReadRepository"></param>
 public YafReadTrackCurrentUser(
     IYafSession yafSession,
     YafBoardSettings boardSettings,
     HttpSessionStateBase sessionState,
     IRepository<ForumReadTracking> forumReadRepository,
     IRepository<TopicReadTracking> topicReadRepository)
 {
     this._yafSession = yafSession;
     this._boardSettings = boardSettings;
     this._sessionState = sessionState;
     this._forumReadRepository = forumReadRepository;
     this._topicReadRepository = topicReadRepository;
 }
        /// <summary>
        ///     Gets the featured users.
        /// </summary>
        /// <param name="boardSettings">The board settings.</param>
        /// <returns></returns>
        public List<CarouselData> GetFeaturedUsers(YafBoardSettings boardSettings)
        {
            var avatar = new YafAvatars(boardSettings); // not needed
            var userDs = Db.get_featured_profiles();

            var userFeaturedList = (from r in userDs.Tables[0].AsEnumerable()
                .Where(r => RapGlobalHelpers.IsDateExpired(r.Field<DateTime>("FeaturedUntil")) == false)
                select new CarouselData
                {
                    UserId = r.Field<int>("UserID"),
                    CaptionText = // not needed
                        String.Format("View {0}'s Profile",
                            UserMembershipHelper.GetDisplayNameFromID(r.Field<int>("UserID"))),// not needed
                    HyperLink = this.GetService<UrlProvider>().GetUrl("/Pages/Profile/{0}", (r.Field<int>("UserID"))),// not needed
                    ImagePath = avatar.GetAvatarUrlForUser(r.Field<int>("UserID")),
                    ExpiryDate = r.Field<DateTime>("FeaturedUntil") // not needed
                }).ToList();

            return userFeaturedList;
        }
        /// <summary>
        ///     Gets the random users.
        /// </summary>
        /// <param name="boardSettings">The board settings.</param>
        /// <returns></returns>
        public List<CarouselData> GetRandomUsers(YafBoardSettings boardSettings)
        {
            var randomDs = Db.get_randomprofiles();
            var avatar = new YafAvatars(boardSettings);

            var randomProfileList =
                (from r in randomDs.Tables[0].AsEnumerable().Where(r => r.Field<int>("UserID") != 1)
                    select new CarouselData
                    {
                        UserId = r.Field<int>("UserID"),
                        CaptionText =
                            string.Format("View {0}'s profile",
                                UserMembershipHelper.GetDisplayNameFromID(r.Field<int>("UserID"))),
                        HyperLink =
                            this.GetService<UrlProvider>().GetUrl("/Pages/Profile/{0}", (r.Field<int>("UserID"))),
                        ImagePath = avatar.GetAvatarUrlForUser(r.Field<int>("UserID"))
                    }).Take(30).ToList();


            return randomProfileList;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="YafBoardSettingCollection"/> class.
 /// </summary>
 /// <param name="boardSettings">
 /// The board settings.
 /// </param>
 public YafBoardSettingCollection(YafBoardSettings boardSettings)
 {
   // load up the settings...
   Type boardSettingsType = boardSettings.GetType();
   this._settings = boardSettingsType.GetProperties().ToList();
 }
Beispiel #7
0
        /// <summary>
        /// Sends the digest to users.
        /// </summary>
        /// <param name="usersWithDigest">The users with digest.</param>
        /// <param name="boardSettings">The board settings.</param>
        private void SendDigestToUsers(
            IList<User> usersWithDigest,
            YafBoardSettings boardSettings)
        {
            foreach (var user in usersWithDigest)
            {
                try
                {
                    var digestHtml = this.Get<IDigest>()
                        .GetDigestHtml(user.UserID, boardSettings);

                    if (!digestHtml.IsSet())
                    {
                        continue;
                    }

                    if (user.ProviderUserKey == null)
                    {
                        continue;
                    }

                    var membershipUser = UserMembershipHelper.GetUser(user.ProviderUserKey);

                    if (membershipUser == null || membershipUser.Email.IsNotSet())
                    {
                        continue;
                    }

                    // send the digest...
                    this.Get<IDigest>()
                        .SendDigest(
                            digestHtml,
                            boardSettings.Name,
                            boardSettings.ForumEmail,
                            membershipUser.Email,
                            user.DisplayName,
                            true);
                }
                catch (Exception e)
                {
                    this.Logger.Error(e, "Error In Creating Digest for User {0}".FormatWith(user.UserID));
                }
            }
        }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="YafAvatars"/> class.
 /// </summary>
 /// <param name="boardSettings">
 /// The board settings.
 /// </param>
 public YafAvatars(YafBoardSettings boardSettings)
 {
     this._yafBoardSettings = boardSettings;
 }
Beispiel #9
0
        /// <summary>
        ///     Gets the users profile comments.
        /// </summary>
        /// <param name="boardSettings">The board settings.</param>
        /// <returns></returns>
        public List<UserComments> GetUsersProfileComments(YafBoardSettings boardSettings)
        {
            var commentsDs = Db.get_profilecomments(UserId);
            var avatar = new YafAvatars(boardSettings);

            var userComments =
                (from r in commentsDs.Tables[0].AsEnumerable()
                    select new UserComments
                    {
                        DisplayName = UserMembershipHelper.GetDisplayNameFromID(r.Field<int>("CommenterID")),
                        HyperLink =
                            this.GetService<UrlProvider>().GetUrl("/Pages/Profile/{0}", (r.Field<int>("CommenterID"))),
                        Avatar = avatar.GetAvatarUrlForUser(r.Field<int>("CommenterID")),
                        Comment = r.Field<string>("Comment"),
                        DatePosted = r.Field<DateTime>("DatePosted").ToString("MM/dd/yyyy")
                    }).ToList();

            return userComments;
        }
Beispiel #10
0
 /// <summary>
 /// Gets link to the page with given parameters.
 /// </summary>
 /// <param name="boardSettings">The board settings.</param>
 /// <param name="page">Page to which to create a link.</param>
 /// <param name="fullUrl">The full Url.</param>
 /// <param name="format">Format of parameters.</param>
 /// <param name="args">Array of page parameters.</param>
 /// <returns>
 /// URL to the given page with parameters.
 /// </returns>
 public static string GetLink(YafBoardSettings boardSettings, ForumPages page, bool fullUrl, string format, params object[] args)
 {
     return fullUrl
                ? YafFactoryProvider.UrlBuilder.BuildUrlFull(
                    boardSettings,
                    "g={0}&{1}".FormatWith(page, format.FormatWith(args)))
                : YafFactoryProvider.UrlBuilder.BuildUrl(
                    boardSettings,
                    "g={0}&{1}".FormatWith(page, format.FormatWith(args)));
 }
Beispiel #11
0
 /// <summary>
 /// Gets link to the page.
 /// </summary>
 /// <param name="boardSettings">The board settings.</param>
 /// <param name="page">Page to which to create a link.</param>
 /// <param name="fullUrl">if set to <c>true</c> [full URL].</param>
 /// <returns>
 /// URL to the given page.
 /// </returns>
 public static string GetLink(YafBoardSettings boardSettings, ForumPages page, bool fullUrl = false)
 {
     return fullUrl
                ? YafFactoryProvider.UrlBuilder.BuildUrlFull(boardSettings, "g={0}".FormatWith(page))
                : YafFactoryProvider.UrlBuilder.BuildUrl(boardSettings, "g={0}".FormatWith(page));
 }
Beispiel #12
0
 /// <summary>
 /// Gets base path to the page without ampersand.
 /// </summary>
 /// <param name="boardSettings">The board settings.</param>
 /// <returns>
 /// Base URL to the given page.
 /// </returns>
 public static string GetBasePath(YafBoardSettings boardSettings)
 {
     return YafFactoryProvider.UrlBuilder.BuildUrl(boardSettings, string.Empty).TrimEnd('&');
 }