public static MemberCardModel MemberCardModelFactory(string musername) { MembershipManager memMan = new MembershipManager(); Member mUser = memMan.GetMemberByScreenName(musername); return MemberCardModelFactory(mUser); }
public static bool SendThinkingOfYou(string senderScreenName, string recipientScreenName) { try { //Grab text for thank you from dictionary string strThinkMsg = String.Format(DictionaryConstants.ThinkingOfYouMessage, senderScreenName); //Send private message string newConvID = TelligentService. TelligentService.CreateConversation(senderScreenName, DictionaryConstants.ThinkingOfYouLabel, strThinkMsg, recipientScreenName); if (!String.IsNullOrEmpty(newConvID)) { //Send email MembershipManager mm = new MembershipManager(); Member recipient = mm.GetMemberByScreenName(recipientScreenName); if (recipient != null) { //Send email string myAccountLink = Sitecore.Links.LinkManager.GetItemUrl(Sitecore.Context.Database.GetItem(Constants.Pages.MyAccount.ToString())); BaseReply reply = Services.ExactTarget.ExactTargetService.InvokeEM21PrivateMessage( new InvokeEM21PrivateMessageRequest { PreferredLanguage = recipient.PreferredLanguage, ///TODO: change url to profile setting link ContactSettingsLink = MembershipHelper.GetPublicProfileUrl(senderScreenName), ///TODO: change URL to message centre link MsgCenterLink = myAccountLink, PMText = strThinkMsg, ReportInappropriateLink = "*****@*****.**", ToEmail = recipient.Email }); } } return true; } catch (Exception ex) { Sitecore.Diagnostics.Error.LogError("Error sending thinking of you\n" + ex.Message); } return false; }
/// <summary> /// Log page view for subtopic filter nav /// </summary> private void LogViewForPopularity() { if (Sitecore.Context.PageMode.IsPreview) { return; } if (_currentItem.InheritsTemplate(DefaultArticlePageItem.TemplateId)) { // Check for subtopic Item parent = _currentItem.Parent; if (parent != null && parent.InheritsTemplate(SubtopicLandingPageItem.TemplateId)) { // Setup user which page view will be logged against var mm = new MembershipManager(); Guid viewer = Guid.Empty; if (IsUserLoggedIn) { viewer = CurrentMember.MemberId; } else { // Look up shadow user var shadowUser = mm.GetMemberByScreenName(Constants.UnauthenticatedMember_ScreeName); if (shadowUser != null) { viewer = shadowUser.MemberId; } } try { mm.LogSubtopicPageView(viewer, _currentItem.ID.ToGuid(), parent.ID.ToGuid()); } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Error saving article view log", ex, this); } } } }
protected void Page_Load(object sender, EventArgs e) { if (ProfileUser != null) { // TODO: since we manage telligent users, we should be storing data on our member to avoid // unneeded api lookups var mm = new MembershipManager(); _member = mm.GetMemberByScreenName(ProfileUser.Username); if (_member == null) { return; } ProfileUrl = MembershipHelper.GetPublicProfileUrl(ProfileUser.Username); ProfileActivityUrl = MembershipHelper.GetPublicProfileActivityUrl(ProfileUser.Username); BindEvents(); PopulateContent(); } }
public MemberCardModel(string username,Func<string,List<UserBadgeModel>> badgesPop=null) { MembershipManager memMan = new MembershipManager(); Member mUser = memMan.GetMemberByScreenName(username); if (mUser != null) { initialize(mUser,badgesPop); //this.AvatarUrl = Constants.Settings.AnonymousAvatar; ///TODO: find Avatar URL //this.Children = mUser.Children.ConvertToChildCardModelList(); //this.UserLabel = "Blogger"; //TODO: find role //this.UserLocation = Constants.Settings.DefaultLocation; //TODO: find location translate from zipcode //this.UserName = mUser.ScreenName; //this.Contactable = mUser.allowConnections; //this.ProfileLink = mUser.GetMemberPublicProfile(); //if (badgesPop != null) // Badges = badgesPop(username); } }
public static GroupCardModel GroupCardModelFactory(GroupItem grpItem) { Member owner = null; GroupCardModel grpModel = new GroupCardModel(); if ((grpItem != null)) { string address = String.Empty; string xml=String.Empty; try { using (WebClient client = new WebClient()) { client.Headers.Add("Rest-User-Token", TelligentService.TelligentService.TelligentAuth()); address = string.Format(TelligentService.TelligentService.GetApiEndPoint("groups/{0}/members/users.xml?MembershipType=Owner"), grpItem.GroupID.Text); ///Approved?? //data["FriendshipState"] = Constants.TelligentFriendStatus.Approved.ToString(); xml = Encoding.UTF8.GetString(client.DownloadData(address)); } XmlDocument document = new XmlDocument(); document.LoadXml(xml); XmlNode childNode = document.SelectSingleNode("Response/Users"); if (childNode != null) { //Select first owner string username = childNode.FirstChild.SelectSingleNode("Username").InnerText; MembershipManager mem = new MembershipManager(); owner = mem.GetMemberByScreenName(username); if (owner != null) { grpModel.ModeratorAvatarUrl = childNode.FirstChild.SelectSingleNode("AvatarUrl").InnerText; grpModel.ModeratorName = owner.ScreenName; grpModel.ModeratorTitle = Constants.TelligentRoles.Roles[Constants.TelligentRoles.Moderator]; grpModel.Owner = owner; } else //Use default values { grpModel.ModeratorAvatarUrl = childNode.FirstChild.SelectSingleNode("AvatarUrl").InnerText; grpModel.ModeratorName = username; grpModel.ModeratorTitle = Constants.TelligentRoles.Roles[Constants.TelligentRoles.Moderator]; } grpModel.ForumFunc = TelligentService.TelligentService.ReadForumsList; grpModel.GrpItem = grpItem; grpModel.NumOfMembers = int.Parse(childNode.FirstChild.SelectSingleNode("Group/TotalMembers").InnerText); grpModel.Description = childNode.FirstChild.SelectSingleNode("Group/Description").InnerText; grpModel.Title = grpItem.NavigationTitle.Text; //childNode.FirstChild.SelectSingleNode("Group/Name").InnerText; } } catch (Exception ex) { Sitecore.Diagnostics.Error.LogError("Error in GetGroupOwner function.\nError:\n" + ex.Message); grpModel = null; } } return grpModel; }