protected void Page_Load(object sender, EventArgs e) { if (IsUserLoggedIn) { ActivityLog log = new ActivityLog(); if (log.FoundItemHelpful(context.ID.ToGuid(), CurrentMember.MemberId)) { btnYes.Attributes.Add("class", "button helpful-yes"); btnNo.Attributes.Add("class", "helpful-no"); } else if (log.FoundItemNotHelpful(context.ID.ToGuid(), CurrentMember.MemberId)) { btnNo.Attributes.Add("class", "button helpful-no"); btnYes.Attributes.Add("class", "helpful-yes"); } else { btnNo.Attributes.Add("class", "helpful-no"); btnYes.Attributes.Add("class", "helpful-yes"); } } else { btnNo.Attributes.Add("class", "helpful-no"); btnYes.Attributes.Add("class", "helpful-yes"); } ltlDidYouFindThisHelpful.Text = DictionaryConstants.DidYouFindThisHelpful; btnNo.InnerText = DictionaryConstants.NoButtonText; btnYes.InnerText = DictionaryConstants.YesButtonText; }
protected void btnThisHelped_Click(object sender, EventArgs e) { if (IsUserLoggedIn) { var currentMember = this.CurrentMember; ActivityLog log = new ActivityLog(); LinkButton btn = (LinkButton)(sender); string ids = btn.CommandArgument; string[] s = ids.Split('&'); Guid? ContentId = s[0].AsNGuid(); string contentTypeId = s[1]; Guid MemberId = this.CurrentMember.MemberId; if (ContentId.HasValue && !(log.FoundItemHelpful(ContentId.Value, MemberId))) { // instantiate MM MembershipManager mgr = new MembershipManager(); // write to the DB mgr.LogMemberHelpfulVote(MemberId, ContentId.Value, Constants.UserActivity_Values.FoundHelpful_True, Constants.UserActivity_Types.FoundHelpfulVote); Response.Redirect(Request.RawUrl); } } else { //this.ProfileRedirect(Constants.UserPermission.CommunityUser); } //var webClient = new WebClient(); //// replace the "admin" and "Admin's API key" with your valid user and apikey! //var adminKey = String.Format("{0}:{1}", Settings.GetSetting(Constants.Settings.TelligentAdminApiKey), "admin"); //var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey)); //webClient.Headers.Add("Rest-User-Token", adminKeyBase64); //webClient.Headers.Add("Rest-Impersonate-User", this.CurrentMember.ScreenName.Trim()); //var requestUrl = String.Format("{0}api.ashx/v2/likes.xml", Settings.GetSetting(Constants.Settings.TelligentConfig)); //var values = new NameValueCollection(); //values.Add("ContentId", contentId); //values.Add("ContentTypeId", contentTypeId); //var xml = Encoding.UTF8.GetString(webClient.UploadValues(requestUrl, values)); //Console.WriteLine(xml); }
protected void Page_Load(object sender, EventArgs e) { if (IsUserLoggedIn) { //ActivityLog log = new ActivityLog(CurrentMember.MemberId, Constants.UserActivity_Values.FoundHelpful_True); //ActivityItem temp = log.Activities.Where(i => i.ContentId == context.ID.ToGuid()).FirstOrDefault(); ActivityLog log = new ActivityLog(); if (log.FoundItemHelpful(context.ID.ToGuid(), CurrentMember.MemberId)) { btnYes.Attributes.Add("class", "button helpful-yes"); btnSmallYes.Attributes.Add("class", "button helpful-yes"); btnNo.Attributes.Add("class", "helpful-no"); btnSmallNo.Attributes.Add("class", "helpful-no"); } else if (log.FoundItemNotHelpful(context.ID.ToGuid(), CurrentMember.MemberId)) { btnNo.Attributes.Add("class", "button helpful-no"); btnSmallNo.Attributes.Add("class", "button helpful-no"); btnYes.Attributes.Add("class", "helpful-yes"); btnSmallYes.Attributes.Add("class", "helpful-yes"); } else { btnNo.Attributes.Add("class", "helpful-no"); btnSmallNo.Attributes.Add("class", "helpful-no"); btnYes.Attributes.Add("class", "helpful-yes"); btnSmallYes.Attributes.Add("class", "helpful-yes"); } } else { btnNo.Attributes.Add("class", "helpful-no"); btnSmallNo.Attributes.Add("class", "helpful-no"); btnYes.Attributes.Add("class", "helpful-yes"); btnSmallYes.Attributes.Add("class", "helpful-yes"); } ltlDidYouFindThisHelpful.Text = ltlDidYouFindThisHelpfulSmall.Text = DictionaryConstants.DidYouFindThisHelpful; btnNo.InnerText = btnSmallNo.InnerText = DictionaryConstants.NoButtonText; btnYes.InnerText = btnSmallYes.InnerText = DictionaryConstants.YesButtonText; }
protected void btnYes_ServerClick(object sender, EventArgs e) { ActivityLog log = new ActivityLog(); if (IsUserLoggedIn) { if (!(log.FoundItemHelpful(context.ID.ToGuid(), CurrentMember.MemberId))) { VoteYes(); } else { VoteNeutral(); } } else { Page.Session[Constants.SessionPreviousUrl] = null; this.ProfileRedirect(UnderstoodDotOrg.Common.Constants.UserPermission.RegisteredUser); } }