//Refactor to contain type internally instead of default public BookmarkModel(XmlNode node,Constants.TelligentContentType type= Constants.TelligentContentType.Blog) { if(node!=null) { ContentTypeId = node.SelectSingleNode("Content/ContentTypeId").InnerText; ContentId = node.SelectSingleNode("Content/ContentId").InnerText; Type = type; } }
public void LoadState(string contentId, Constants.TelligentContentType type,string contentTypeId=null) { ContentId = contentId; ContentTypeId = contentTypeId; Type = type; //if (!IsPostBack) //{ Text = DictionaryConstants.FollowBlog; switch (type) { case Constants.TelligentContentType.BlogPost: //Check if blog is bookmarked if (CurrentMember != null) { if (CurrentMember.ScreenName != null) { if (!String.IsNullOrEmpty(contentTypeId)) { if (TelligentService.IsBookmarked(CurrentMember.ScreenName, contentId, contentTypeId, type)) { Text = DictionaryConstants.FollowingBlogPost; } else { Text = DictionaryConstants.FollowBlogPost; } } else Text = DictionaryConstants.FollowBlogPost; } } else Text = DictionaryConstants.FollowBlogPost; break; case Constants.TelligentContentType.Forum: break; case Constants.TelligentContentType.Group: break; case Constants.TelligentContentType.Page: break; case Constants.TelligentContentType.Weblog: if (CurrentMember != null) { if (CurrentMember.ScreenName != null) { if (!String.IsNullOrEmpty(contentTypeId)) { if (TelligentService.IsBookmarked(CurrentMember.ScreenName, contentId,contentTypeId, type )) { Text = DictionaryConstants.YouAreFollowingLabel; } else { Text = DictionaryConstants.FollowThisQuestionLabel; } } else Text = DictionaryConstants.FollowThisQuestionLabel; } } else Text = DictionaryConstants.FollowThisQuestionLabel; break; case Constants.TelligentContentType.Blog: //Check if blog is bookmarked if (CurrentMember != null) { if (CurrentMember.ScreenName != null) { if (TelligentService.IsBookmarked(CurrentMember.ScreenName, contentId, type)) { Text = DictionaryConstants.FollowingBlog; } else { Text = DictionaryConstants.FollowBlogPost; } } } else Text = DictionaryConstants.FollowBlog; break; default: break; } //} }
//Load control state based on whether current user has bookmarked this blog public void LoadState(string contentId,Constants.TelligentContentType type) { LoadState(contentId,type,null); //ContentId = contentId; //Type = type; //Text = DictionaryConstants.FollowBlog; //if (CurrentMember != null) //{ // if (CurrentMember.ScreenName != null) //Additional check in case user bypasses redirect // { // //Should be called after properties are set // switch (type) // { // case Constants.TelligentContentType.BlogPost: // break; // case Constants.TelligentContentType.Forum: // break; // case Constants.TelligentContentType.Group: // break; // case Constants.TelligentContentType.Page: // break; // case Constants.TelligentContentType.Weblog: // break; // case Constants.TelligentContentType.Blog: // //Check if blog is bookmarked // if (TelligentService.IsBookmarked(CurrentMember.ScreenName, contentId, type)) // { // Text = DictionaryConstants.FollowingBlog; // } // else // Text = DictionaryConstants.FollowBlog; // break; // default: // break; // } // } //} }