Exemplo n.º 1
0
        public int Topic_QuickCreate(int PortalId, int ModuleId, int ForumId, string Subject, string Body, int UserId, string DisplayName, bool IsApproved, string IPAddress)
        {
            int       topicId = -1;
            TopicInfo ti      = new TopicInfo();

            ti.AnnounceEnd        = Utilities.NullDate();
            ti.AnnounceStart      = Utilities.NullDate();
            ti.Content.AuthorId   = UserId;
            ti.Content.AuthorName = DisplayName;
            ti.Content.Subject    = Subject;
            ti.Content.Body       = Body;
            ti.Content.Summary    = string.Empty;

            ti.Content.IPAddress = IPAddress;
            DateTime dt = DateTime.Now;

            ti.Content.DateCreated = dt;
            ti.Content.DateUpdated = dt;
            ti.IsAnnounce          = false;
            ti.IsApproved          = IsApproved;
            ti.IsArchived          = false;
            ti.IsDeleted           = false;
            ti.IsLocked            = false;
            ti.IsPinned            = false;
            ti.ReplyCount          = 0;
            ti.StatusId            = -1;
            ti.TopicIcon           = string.Empty;
            ti.TopicType           = TopicTypes.Topic;
            ti.ViewCount           = 0;
            topicId = TopicSave(PortalId, ti);
            if (topicId > 0)
            {
                Topics_SaveToForum(ForumId, topicId, PortalId, ModuleId);
                if (UserId > 0)
                {
                    Data.Profiles uc = new Data.Profiles();
                    uc.Profile_UpdateTopicCount(PortalId, UserId);
                }
            }
            return(topicId);
        }
Exemplo n.º 2
0
        private void SaveTopic()
        {
            var subject = ctlForm.Subject;
            var body = ctlForm.Body;
            subject = Utilities.CleanString(PortalId, subject, false, EditorTypes.TEXTBOX, ForumInfo.UseFilter, false, ForumModuleId, _themePath, false);
            body = Utilities.CleanString(PortalId, body, _allowHTML, _editorType, ForumInfo.UseFilter, ForumInfo.AllowScript, ForumModuleId, _themePath, ForumInfo.AllowEmoticons);
            var summary = ctlForm.Summary;
            int authorId;
            string authorName;
            if (Request.IsAuthenticated)
            {
                authorId = UserInfo.UserID;
                switch (MainSettings.UserNameDisplay.ToUpperInvariant())
                {
                    case "USERNAME":
                        authorName = UserInfo.Username.Trim(' ');
                        break;
                    case "FULLNAME":
                        authorName = Convert.ToString(UserInfo.FirstName + " " + UserInfo.LastName).Trim(' ');
                        break;
                    case "FIRSTNAME":
                        authorName = UserInfo.FirstName.Trim(' ');
                        break;
                    case "LASTNAME":
                        authorName = UserInfo.LastName.Trim(' ');
                        break;
                    case "DISPLAYNAME":
                        authorName = UserInfo.DisplayName.Trim(' ');
                        break;
                    default:
                        authorName = UserInfo.DisplayName;
                        break;
                }
            }
            else
            {
                authorId = -1;
                authorName = Utilities.CleanString(PortalId, ctlForm.AuthorName, false, EditorTypes.TEXTBOX, true, false, ForumModuleId, _themePath, false);
                if (authorName.Trim() == string.Empty)
                    return;
            }

            var tc = new TopicsController();
            TopicInfo ti;

            if (TopicId > 0)
            {
                ti = tc.Topics_Get(PortalId, ForumModuleId, TopicId);
                ti.Content.DateUpdated = DateTime.Now;
                authorId = ti.Author.AuthorId;
            }
            else
            {
                ti = new TopicInfo();
                var dt = DateTime.Now;
                ti.Content.DateCreated = dt;
                ti.Content.DateUpdated = dt;
            }

            ti.AnnounceEnd = ctlForm.AnnounceEnd;
            ti.AnnounceStart = ctlForm.AnnounceStart;
            ti.Priority = ctlForm.TopicPriority;

            if (!_isEdit)
            {
                ti.Content.AuthorId = authorId;
                ti.Content.AuthorName = authorName;
                ti.Content.IPAddress = Request.UserHostAddress;
            }

            if (Regex.IsMatch(body, "<CODE([^>]*)>", RegexOptions.IgnoreCase))
            {
                foreach (Match m in Regex.Matches(body, "<CODE([^>]*)>(.*?)</CODE>", RegexOptions.IgnoreCase))
                    body = body.Replace(m.Value, m.Value.Replace("<br>", System.Environment.NewLine));
            }

            if (!(string.IsNullOrEmpty(ForumInfo.PrefixURL)))
            {
                var cleanSubject = Utilities.CleanName(subject).ToLowerInvariant();
                if (SimulateIsNumeric.IsNumeric(cleanSubject))
                    cleanSubject = "Topic-" + cleanSubject;

                var topicUrl = cleanSubject;
                var urlPrefix = "/";

                if (!(string.IsNullOrEmpty(ForumInfo.ForumGroup.PrefixURL)))
                    urlPrefix += ForumInfo.ForumGroup.PrefixURL + "/";

                if (!(string.IsNullOrEmpty(ForumInfo.PrefixURL)))
                    urlPrefix += ForumInfo.PrefixURL + "/";

                var urlToCheck = urlPrefix + cleanSubject;

                var topicsDb = new Data.Topics();
                for (var u = 0; u <= 200; u++)
                {
                    var tid = topicsDb.TopicIdByUrl(PortalId, ModuleId, urlToCheck);
                    if (tid > 0 && tid == TopicId)
                        break;

                    if (tid <= 0)
                        break;

                    topicUrl = (u + 1) + "-" + cleanSubject;
                    urlToCheck = urlPrefix + topicUrl;
                }
                if (topicUrl.Length > 150)
                {
                    topicUrl = topicUrl.Substring(0, 149);
                    topicUrl = topicUrl.Substring(0, topicUrl.LastIndexOf("-", StringComparison.Ordinal));
                }

                ti.TopicUrl = topicUrl;
            }
            else
            {
                //.URL = String.Empty
                ti.TopicUrl = string.Empty;
            }

            ti.Content.Body = body; //Utilities.CleanString(PortalId, Body, fi.AllowHTML, fi.EditorType, fi.UseFilter, fi.AllowScript, ForumModuleId, String.Empty)
            ti.Content.Subject = subject;
            ti.Content.Summary = summary;
            ti.IsAnnounce = ti.AnnounceEnd != Utilities.NullDate() && ti.AnnounceStart != Utilities.NullDate();

            if (_canModApprove && _fi.IsModerated)
                ti.IsApproved = ctlForm.IsApproved;
            else
                ti.IsApproved = _isApproved;

            bool bSend = ti.IsApproved;

            ti.IsArchived = false;
            ti.IsDeleted = false;
            ti.IsLocked = _canLock && ctlForm.Locked;
            ti.IsPinned = _canPin && ctlForm.Pinned;
            ti.StatusId = ctlForm.StatusId;
            ti.TopicIcon = ctlForm.TopicIcon;
            ti.TopicType = 0;
            if (ForumInfo.Properties != null)
            {
                var tData = new StringBuilder();
                tData.Append("<topicdata>");
                tData.Append("<properties>");
                foreach (var p in ForumInfo.Properties)
                {
                    var pkey = "afprop-" + p.PropertyId.ToString();

                    tData.Append("<property id=\"" + p.PropertyId.ToString() + "\">");
                    tData.Append("<name><![CDATA[");
                    tData.Append(p.Name);
                    tData.Append("]]></name>");
                    if (Request.Form[pkey] != null)
                    {
                        tData.Append("<value><![CDATA[");
                        tData.Append(Utilities.XSSFilter(Request.Form[pkey]));
                        tData.Append("]]></value>");
                    }
                    else
                    {
                        tData.Append("<value></value>");
                    }
                    tData.Append("</property>");
                }
                tData.Append("</properties>");
                tData.Append("</topicdata>");
                ti.TopicData = tData.ToString();
            }

            TopicId = tc.TopicSave(PortalId, ti);
            ti = tc.Topics_Get(PortalId, ForumModuleId, TopicId, ForumId, -1, false);
            if (ti != null)
            {
                tc.Topics_SaveToForum(ForumId, TopicId, PortalId, ModuleId);
                SaveAttachments(ti.ContentId);
                if (ti.IsApproved && ti.Author.AuthorId > 0)
                {
                    var uc = new Data.Profiles();
                    uc.Profile_UpdateTopicCount(PortalId, ti.Author.AuthorId);
                }
            }

            if (Permissions.HasPerm(ForumInfo.Security.Tag, ForumUser.UserRoles))
            {
                DataProvider.Instance().Tags_DeleteByTopicId(PortalId, ForumModuleId, TopicId);
                var tagForm = string.Empty;
                if (Request.Form["txtTags"] != null)
                    tagForm = Request.Form["txtTags"];

                if (tagForm != string.Empty)
                {
                    var tags = tagForm.Split(',');
                    foreach (var tag in tags)
                    {
                        var sTag = Utilities.CleanString(PortalId, tag.Trim(), false, EditorTypes.TEXTBOX, false, false, ForumModuleId, string.Empty, false);
                        DataProvider.Instance().Tags_Save(PortalId, ForumModuleId, -1, sTag, 0, 1, 0, TopicId, false, -1, -1);
                    }
                }
            }

            if (Permissions.HasPerm(ForumInfo.Security.Categorize, ForumUser.UserRoles))
            {
                if (Request.Form["amaf-catselect"] != null)
                {
                    var cats = Request.Form["amaf-catselect"].Split(';');
                    DataProvider.Instance().Tags_DeleteTopicToCategory(PortalId, ForumModuleId, -1, TopicId);
                    foreach (var c in cats)
                    {
                        if (string.IsNullOrEmpty(c) || !SimulateIsNumeric.IsNumeric(c))
                            continue;

                        var cid = Convert.ToInt32(c);
                        if (cid > 0)
                            DataProvider.Instance().Tags_AddTopicToCategory(PortalId, ForumModuleId, cid, TopicId);
                    }
                }
            }

            if (!String.IsNullOrEmpty(ctlForm.PollQuestion) && !String.IsNullOrEmpty(ctlForm.PollOptions))
            {
                //var sPollQ = ctlForm.PollQuestion.Trim();
                //sPollQ = Utilities.CleanString(PortalId, sPollQ, false, EditorTypes.TEXTBOX, true, false, ForumModuleId, string.Empty, false);
                var pollId = DataProvider.Instance().Poll_Save(-1, TopicId, UserId, ctlForm.PollQuestion.Trim(), ctlForm.PollType);
                if (pollId > 0)
                {
                    var options = ctlForm.PollOptions.Split(new[] { System.Environment.NewLine }, StringSplitOptions.None);

                    foreach (string opt in options)
                    {
                        if (opt.Trim() != string.Empty)
                        {
                            var value = Utilities.CleanString(PortalId, opt, false, EditorTypes.TEXTBOX, true, false, ForumModuleId, string.Empty, false);
                            DataProvider.Instance().Poll_Option_Save(-1, pollId, value.Trim(), TopicId);
                        }
                    }
                }

                ti = tc.Topics_Get(PortalId, ForumModuleId, TopicId, ForumId, -1, false);
                ti.TopicType = TopicTypes.Poll;
                tc.TopicSave(PortalId, ti);
            }

            try
            {
                var cachekey = string.Format("AF-FV-{0}-{1}", PortalId, ModuleId);
                DataCache.CacheClearPrefix(cachekey);
                if (ctlForm.Subscribe && authorId == UserId)
                {
                    if (!(Subscriptions.IsSubscribed(PortalId, ForumModuleId, ForumId, TopicId, SubscriptionTypes.Instant, authorId)))
                    {
                        var sc = new SubscriptionController();
                        sc.Subscription_Update(PortalId, ForumModuleId, ForumId, TopicId, 1, authorId, ForumUser.UserRoles);
                    }
                }
                else if (_isEdit)
                {
                    bool isSub = Subscriptions.IsSubscribed(PortalId, ForumModuleId, ForumId, TopicId, SubscriptionTypes.Instant, authorId);
                    if (isSub && !ctlForm.Subscribe)
                    {
                        var sc = new SubscriptionController();
                        sc.Subscription_Update(PortalId, ForumModuleId, ForumId, TopicId, 1, authorId, ForumUser.UserRoles);
                    }
                }

                if (bSend && !_isEdit)
                    Subscriptions.SendSubscriptions(PortalId, ForumModuleId, ForumTabId, _fi, TopicId, 0, ti.Content.AuthorId);

                if (ti.IsApproved == false)
                {
                    var mods = Utilities.GetListOfModerators(PortalId, ForumId);
                    var notificationType = NotificationsController.Instance.GetNotificationType("AF-ForumModeration");

                    var notifySubject = Utilities.GetSharedResource("NotificationSubjectTopic");
                    notifySubject = notifySubject.Replace("[DisplayName]", UserInfo.DisplayName);
                    notifySubject = notifySubject.Replace("[TopicSubject]", ti.Content.Subject);

                    var notifyBody = Utilities.GetSharedResource("NotificationBodyTopic");
                    notifyBody = notifyBody.Replace("[Post]", ti.Content.Body);

                    var notificationKey = string.Format("{0}:{1}:{2}:{3}:{4}", TabId, ForumModuleId, ForumId, TopicId, ReplyId);

                    var notification = new Notification
                                           {
                                               NotificationTypeID = notificationType.NotificationTypeId,
                                               Subject = notifySubject,
                                               Body = notifyBody,
                                               IncludeDismissAction = false,
                                               SenderUserID = UserInfo.UserID,
                                               Context = notificationKey
                                           };

                    NotificationsController.Instance.SendNotification(notification, PortalId, null, mods);

                    string[] @params = { ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=confirmaction", ParamKeys.ConfirmActionId + "=" + ConfirmActions.MessagePending };
                    Response.Redirect(NavigateUrl(ForumTabId, "", @params), false);
                }
                else
                {
                    if (ti != null)
                        ti.TopicId = TopicId;

                    var ctlUtils = new ControlUtils();

                    var sUrl = ctlUtils.BuildUrl(ForumTabId, ForumModuleId, ForumInfo.ForumGroup.PrefixURL, ForumInfo.PrefixURL, ForumInfo.ForumGroupId, ForumInfo.ForumID, TopicId, ti.TopicUrl, -1, -1, string.Empty, 1, -1, SocialGroupId);

                    if (sUrl.Contains("~/") || Request.QueryString["asg"] != null)
                        sUrl = Utilities.NavigateUrl(ForumTabId, "", ParamKeys.TopicId + "=" + TopicId);

                    if (!_isEdit)
                    {
                        try
                        {
                            var amas = new Social();
                            amas.AddTopicToJournal(PortalId, ForumModuleId, ForumId, TopicId, UserId, sUrl, subject, summary, body, ForumInfo.ActiveSocialSecurityOption, ForumInfo.Security.Read, SocialGroupId);
                            if (Request.QueryString["asg"] == null && !(string.IsNullOrEmpty(MainSettings.ActiveSocialTopicsKey)) && ForumInfo.ActiveSocialEnabled)
                            {
                                // amas.AddTopicToJournal(PortalId, ForumModuleId, ForumId, UserId, sUrl, Subject, Summary, Body, ForumInfo.ActiveSocialSecurityOption, ForumInfo.Security.Read)
                            }
                            else
                            {
                                amas.AddForumItemToJournal(PortalId, ForumModuleId, UserId, "forumtopic", sUrl, subject, body);
                            }
                        }
                        catch (Exception ex)
                        {
                            Services.Exceptions.Exceptions.LogException(ex);
                        }
                    }

                    Response.Redirect(sUrl, false);
                }
            }
            catch (Exception ex)
            {
                Services.Exceptions.Exceptions.LogException(ex);
            }
        }
Exemplo n.º 3
0
        public int Topic_QuickCreate(int PortalId, int ModuleId, int ForumId, string Subject, string Body, int UserId, string DisplayName, bool IsApproved, string IPAddress)
        {
            int topicId = -1;
            TopicInfo ti = new TopicInfo();
            ti.AnnounceEnd = Utilities.NullDate();
            ti.AnnounceStart = Utilities.NullDate();
            ti.Content.AuthorId = UserId;
            ti.Content.AuthorName = DisplayName;
            ti.Content.Subject = Subject;
            ti.Content.Body = Body;
            ti.Content.Summary = string.Empty;

            ti.Content.IPAddress = IPAddress;
            DateTime dt = DateTime.Now;
            ti.Content.DateCreated = dt;
            ti.Content.DateUpdated = dt;
            ti.IsAnnounce = false;
            ti.IsApproved = IsApproved;
            ti.IsArchived = false;
            ti.IsDeleted = false;
            ti.IsLocked = false;
            ti.IsPinned = false;
            ti.ReplyCount = 0;
            ti.StatusId = -1;
            ti.TopicIcon = string.Empty;
            ti.TopicType = TopicTypes.Topic;
            ti.ViewCount = 0;
            topicId = TopicSave(PortalId, ti);
            if (topicId > 0)
            {
                Topics_SaveToForum(ForumId, topicId, PortalId, ModuleId);
                if (UserId > 0)
                {
                    Data.Profiles uc = new Data.Profiles();
                    uc.Profile_UpdateTopicCount(PortalId, UserId);
                }
            }
            return topicId;
        }
Exemplo n.º 4
0
		// KR - added caching to profiles to skip the DB hit
		public UserProfileInfo Profiles_Get(int SiteId, int InstanceId, int UserId)
		{

			string cachekey = string.Format("AF-prof-{0}-{1}-{2}", UserId, SiteId, InstanceId);
			DataTable dt = null;
			UserProfileInfo upi = null;
			Data.Profiles db = new Data.Profiles();
			PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();
			if (SiteId == -1)
			{
				SiteId = _portalSettings.PortalId;
			}

			// see if it's in cache already
			object data = DataCache.CacheRetrieve(cachekey);

			if (data != null)
			{
				dt = (DataTable)data;
			}
			else
			{
                dt = DotNetNuke.Common.Globals.ConvertDataReaderToDataTable(db.Profiles_Get(SiteId, -1, UserId));
				DataCache.CacheStore(cachekey, dt);
			}

			foreach (DataRow row in dt.Rows)
			{
				upi = new UserProfileInfo();
				upi.PortalId = SiteId;
				upi.UserID = UserId;
				upi.ModuleId = -1;
				upi.AdminWatch = bool.Parse(row["AdminWatch"].ToString());
				upi.AnswerCount = int.Parse(row["AnswerCount"].ToString());
				upi.AOL = row["AOL"].ToString();
				upi.AttachDisabled = bool.Parse(row["AttachDisabled"].ToString());
				upi.Avatar = row["Avatar"].ToString();
				upi.AvatarDisabled = bool.Parse(row["AvatarDisabled"].ToString());
				upi.AvatarType = (AvatarTypes)(int.Parse(row["AvatarType"].ToString()));
				upi.Badges = row["Badges"].ToString();
					//.Bio = dr("Bio").ToString
				upi.DateLastActivity = DateTime.Parse(row["DateLastActivity"].ToString());
				upi.DateLastPost = DateTime.Parse(row["DateLastPost"].ToString());
				upi.ForumsAllowed = string.Empty;
				upi.ICQ = row["ICQ"].ToString();
				upi.Interests = row["Interests"].ToString();
				upi.IsUserOnline = Convert.ToBoolean(((int.Parse(row["IsUserOnline"].ToString()) == 1) ? 1 : 0));
				upi.Location = row["Location"].ToString();
				upi.MSN = row["MSN"].ToString();
				upi.Occupation = row["Occupation"].ToString();
				upi.PrefBlockAvatars = bool.Parse(row["PrefBlockAvatars"].ToString());
				upi.PrefBlockSignatures = bool.Parse(row["PrefBlockSignatures"].ToString());
				upi.PrefDefaultShowReplies = bool.Parse(row["PrefDefaultShowReplies"].ToString());
				upi.PrefDefaultSort = row["PrefDefaultSort"].ToString();
				upi.PrefJumpLastPost = bool.Parse(row["PrefJumpLastPost"].ToString());
				upi.PrefPageSize = int.Parse(row["PrefPageSize"].ToString());
				upi.PrefSubscriptionType = (SubscriptionTypes)(int.Parse(row["PrefSubscriptionType"].ToString()));
				upi.PrefTopicSubscribe = bool.Parse(row["PrefTopicSubscribe"].ToString());
				upi.PrefUseAjax = bool.Parse(row["PrefUseAjax"].ToString());
				upi.ProfileId = int.Parse(row["ProfileId"].ToString());
				upi.ReplyCount = int.Parse(row["ReplyCount"].ToString());
				upi.RewardPoints = int.Parse(row["RewardPoints"].ToString());
				upi.Signature = row["Signature"].ToString();
				upi.SignatureDisabled = bool.Parse(row["SignatureDisabled"].ToString());
				upi.TopicCount = int.Parse(row["TopicCount"].ToString());
				upi.TrustLevel = int.Parse(row["TrustLevel"].ToString());
				upi.UserCaption = row["UserCaption"].ToString();
				upi.ViewCount = int.Parse(row["ViewCount"].ToString());
				upi.WebSite = row["WebSite"].ToString();
				upi.Yahoo = row["Yahoo"].ToString();
				upi.DateCreated = DateTime.Parse(row["DateCreated"].ToString());

			}

			return upi;
		}
        // KR - added caching to profiles to skip the DB hit
        public UserProfileInfo Profiles_Get(int SiteId, int InstanceId, int UserId)
        {
            string          cachekey = string.Format("AF-prof-{0}-{1}-{2}", UserId, SiteId, InstanceId);
            DataTable       dt       = null;
            UserProfileInfo upi      = null;

            Data.Profiles  db = new Data.Profiles();
            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();

            if (SiteId == -1)
            {
                SiteId = _portalSettings.PortalId;
            }

            // see if it's in cache already
            object data = DataCache.CacheRetrieve(cachekey);

            if (data != null)
            {
                dt = (DataTable)data;
            }
            else
            {
                dt = DotNetNuke.Common.Globals.ConvertDataReaderToDataTable(db.Profiles_Get(SiteId, -1, UserId));
                DataCache.CacheStore(cachekey, dt);
            }

            foreach (DataRow row in dt.Rows)
            {
                upi                = new UserProfileInfo();
                upi.PortalId       = SiteId;
                upi.UserID         = UserId;
                upi.ModuleId       = -1;
                upi.AdminWatch     = bool.Parse(row["AdminWatch"].ToString());
                upi.AnswerCount    = int.Parse(row["AnswerCount"].ToString());
                upi.AOL            = row["AOL"].ToString();
                upi.AttachDisabled = bool.Parse(row["AttachDisabled"].ToString());
                upi.Avatar         = row["Avatar"].ToString();
                upi.AvatarDisabled = bool.Parse(row["AvatarDisabled"].ToString());
                upi.AvatarType     = (AvatarTypes)(int.Parse(row["AvatarType"].ToString()));
                upi.Badges         = row["Badges"].ToString();
                //.Bio = dr("Bio").ToString
                upi.DateLastActivity = DateTime.Parse(row["DateLastActivity"].ToString());
                upi.DateLastPost     = DateTime.Parse(row["DateLastPost"].ToString());
                upi.ForumsAllowed    = string.Empty;
                upi.ICQ                    = row["ICQ"].ToString();
                upi.Interests              = row["Interests"].ToString();
                upi.IsUserOnline           = Convert.ToBoolean(((int.Parse(row["IsUserOnline"].ToString()) == 1) ? 1 : 0));
                upi.Location               = row["Location"].ToString();
                upi.MSN                    = row["MSN"].ToString();
                upi.Occupation             = row["Occupation"].ToString();
                upi.PrefBlockAvatars       = bool.Parse(row["PrefBlockAvatars"].ToString());
                upi.PrefBlockSignatures    = bool.Parse(row["PrefBlockSignatures"].ToString());
                upi.PrefDefaultShowReplies = bool.Parse(row["PrefDefaultShowReplies"].ToString());
                upi.PrefDefaultSort        = row["PrefDefaultSort"].ToString();
                upi.PrefJumpLastPost       = bool.Parse(row["PrefJumpLastPost"].ToString());
                upi.PrefPageSize           = int.Parse(row["PrefPageSize"].ToString());
                upi.PrefSubscriptionType   = (SubscriptionTypes)(int.Parse(row["PrefSubscriptionType"].ToString()));
                upi.PrefTopicSubscribe     = bool.Parse(row["PrefTopicSubscribe"].ToString());
                upi.PrefUseAjax            = bool.Parse(row["PrefUseAjax"].ToString());
                upi.ProfileId              = int.Parse(row["ProfileId"].ToString());
                upi.ReplyCount             = int.Parse(row["ReplyCount"].ToString());
                upi.RewardPoints           = int.Parse(row["RewardPoints"].ToString());
                upi.Signature              = row["Signature"].ToString();
                upi.SignatureDisabled      = bool.Parse(row["SignatureDisabled"].ToString());
                upi.TopicCount             = int.Parse(row["TopicCount"].ToString());
                upi.TrustLevel             = int.Parse(row["TrustLevel"].ToString());
                upi.UserCaption            = row["UserCaption"].ToString();
                upi.ViewCount              = int.Parse(row["ViewCount"].ToString());
                upi.WebSite                = row["WebSite"].ToString();
                upi.Yahoo                  = row["Yahoo"].ToString();
                upi.DateCreated            = DateTime.Parse(row["DateCreated"].ToString());
            }

            return(upi);
        }