protected void Caption_Click(object sender, EventArgs eventArgs) { #region Add a new thread in a group Bobs.Group g = new Bobs.Group(Vars.CompetitionGroupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (gu == null || !g.IsMember(gu)) { //join the group try { g.Join(Usr.Current, gu); } catch { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Sorry, you can't post a caption here. Maybe you're not a member of the <a href=\"" + g.Url() + "\">Bacardi B Live</a> group?"; return; } } string captionStart = "";// "<img src=\"http://www.dontstayin.com/gfx/caption-start.gif\" width=\"26\" height=\"20\" /><span style=\"font-size: 20px;\"> "; string captionEnd = "";// " </span><img src=\"http://www.dontstayin.com/gfx/caption-end.gif\" width=\"26\" height=\"20\" />"; string caption = Cambro.Web.Helpers.StripHtmlDoubleSpacesLineFeeds(CaptionTextBox.Text.Trim()); if (caption.Trim().Length == 0) { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Please enter a caption. Remember you can't enter HTML tags in your caption."; return; }
protected void PostCaption(object sender, EventArgs e) { Group g = new Group(Vars.CompetitionGroupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (gu == null || !g.IsMember(gu)) { //join the group g.Join(Usr.Current, gu); } string caption = this.uiCaptionText.Text; if (caption.StartsWith("\"") || caption.StartsWith("“")) caption = caption.Substring(1); if (caption.EndsWith("\"") || caption.EndsWith("”")) caption = caption.Substring(0, caption.Length - 1); Spotted.WebServices.Controls.CommentsDisplay.Service service = new Spotted.WebServices.Controls.CommentsDisplay.Service(); int? threadK = new Photo(currentPhotoK).ThreadK; if (threadK > 0) { service.CreateReply((int)Model.Entities.ObjectType.Photo, currentPhotoK, threadK.Value, duplicateGuid, caption, false, int.MaxValue, new string[0]); this.uiCommentsDisplay.DataBind(); } else { int newThreadK = service.CreatePublicThread((int) Model.Entities.ObjectType.Photo, currentPhotoK, duplicateGuid, caption, false, false, new string[0]).threadK; this.uiCommentsDisplay.CurrentThread = new Thread(newThreadK); this.uiCommentsDisplay.DataBind(); } duplicateGuid = Guid.NewGuid().ToString(); this.uiCaptionText.Text = ""; }
protected void Caption_Click(object sender, EventArgs eventArgs) { #region Add a new thread in a group Bobs.Group g = new Bobs.Group(Vars.CompetitionGroupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (gu == null || !g.IsMember(gu)) { //join the group try { g.Join(Usr.Current, gu); } catch { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Sorry, you can't post a caption here. Maybe you're not a member of the <a href=\"" + g.Url() + "\">Bacardi B Live</a> group?"; return; } } string captionStart = "";// "<img src=\"http://www.dontstayin.com/gfx/caption-start.gif\" width=\"26\" height=\"20\" /><span style=\"font-size: 20px;\"> "; string captionEnd = "";// " </span><img src=\"http://www.dontstayin.com/gfx/caption-end.gif\" width=\"26\" height=\"20\" />"; string caption = Cambro.Web.Helpers.StripHtmlDoubleSpacesLineFeeds(CaptionTextBox.Text.Trim()); if (caption.Trim().Length == 0) { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Please enter a caption. Remember you can't enter HTML tags in your caption."; return; } if (caption.StartsWith("\"") || caption.StartsWith("“")) caption = captionStart + caption.Substring(1); else caption = captionStart + caption; if (caption.EndsWith("\"") || caption.EndsWith("”")) caption = caption.Substring(0, caption.Length - 1) + captionEnd; else caption = caption + captionEnd; //add comment to current thread Comment.Maker m = CurrentThread.GetCommentMaker(); m.PostingUsr = Usr.Current; m.Body = caption; m.DuplicateGuid = this.ViewState["CaptionDuplicateGuid"]; if (CurrentThread.GroupK > 0) m.CurrentGroupUsr = CurrentThread.Group.GetGroupUsr(Usr.Current); m.CurrentThreadUsr = CurrentThreadUsr; Comment.MakerReturn r = m.Post(null); if (r.Success || r.Duplicate) { if (!r.Duplicate) Log.Increment(Log.Items.CaptionsAdded); Response.Redirect(r.Comment.Url()); } else { CaptionErrorP.Visible = true; CaptionErrorP.InnerText = "Sorry, you can't post a caption here. Maybe you've been banned from the Bacardi B Live group?"; return; } #endregion }
public void PrefsUpdateClick(object o, System.EventArgs e) { Page.Validate(); bool sendVerifyEmail = false; if (Page.IsValid) { #region Handle change of email address if (Usr.Current.Email != Email.Text) { //Check for duplicate email addresses in the database Query q = new Query(); q.QueryCondition = new Q(Usr.Columns.Email, Email.Text); q.ReturnCountOnly = true; UsrSet ds = new UsrSet(q); if (ds.Count == 0) { //No duplicate - update email address Usr.Current.AdminNote += "\nThis user changed their email address from " + Usr.Current.Email + " to " + Email.Text + " on " + DateTime.Now.ToString(); Usr.Current.Email = Email.Text; Usr.Current.EmailDateTime = DateTime.Now; if (HttpContext.Current != null) Usr.Current.EmailIp = Utilities.TruncateIp(HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]); Usr.Current.IsEmailVerified = false; Usr.Current.IsEmailBroken = false; sendVerifyEmail = true; } else { //Duplicate - display error EmailDuplicateValidator.IsValid = false; } } #endregion #region Handle phone number entry System.Text.RegularExpressions.Regex rNumbers = new System.Text.RegularExpressions.Regex("[^0123456789]"); string mobileNumber = rNumbers.Replace(MobileNumber.Text.Trim(), ""); string dialingCode = rNumbers.Replace(DialingCodeDropDown.SelectedValue, ""); string dialingCodeOther = rNumbers.Replace(DialingCodeOther.Text.Trim(), ""); string fullMobile = ""; if (mobileNumber.StartsWith("0")) { mobileNumber = mobileNumber.Substring(1); } if (dialingCode.Equals("0")) { dialingCode = dialingCodeOther; } if (mobileNumber.Length > 0) { fullMobile = dialingCode + mobileNumber; } if (MobileNumber.Text != mobileNumber) MobileNumber.Text = mobileNumber; if (DialingCodeDropDown.SelectedValue.Equals("0") && DialingCodeOther.Text != dialingCode) DialingCodeOther.Text = dialingCode; #endregion //Database will only update if all validators are valid if (Page.IsValid) { Usr.Current.FirstName = Cambro.Web.Helpers.StripHtml(FirstName.Text).Trim(); Usr.Current.LastName = Cambro.Web.Helpers.StripHtml(LastName.Text).Trim(); string nick = Usr.GetCompliantNickName(NickName.Text); Usr.Current.NickName = nick; Usr.Current.IsSkeleton = false; if (!Usr.Current.Mobile.Equals(fullMobile)) Usr.Current.AdminNote += "\n\nUsr has changed mobile number from " + Usr.Current.Mobile + " to: " + fullMobile + " on " + DateTime.Now.ToString() + ".\n"; Usr.Current.Mobile = fullMobile; Usr.Current.MobileCountryCode = dialingCode; Usr.Current.MobileNumber = mobileNumber; Usr.Current.IsMale = SexMale.Checked; Usr.Current.IsFemale = SexFemale.Checked; Usr.Current.DateOfBirth = new DateTime(int.Parse(DateOfBirthYear.Text), int.Parse(DateOfBirthMonth.Text), int.Parse(DateOfBirthDay.Text)); Usr.Current.SendSpottedEmails = SendSpottedEmails.Checked; Usr.Current.SendSpottedTexts = SendSpottedTexts.Checked; Usr.Current.SendFlyers = SendFlyers.Checked; Usr.Current.SendInvites = SendInvites.Checked; Usr.Current.LegalTermsUser2 = true; Usr.Current.IsDj = IsDjYes.Checked; #region Update hometown and add UsrPlaceVisit record for this place Place p = new Place(int.Parse(HomeTownDropDownList.SelectedValue)); if (Usr.Current.HomePlaceK != p.K) { Usr.Current.HomePlaceK = p.K; try { UsrPlaceVisit upv = new UsrPlaceVisit(Usr.Current.K, p.K); } catch { UsrPlaceVisit upv = new UsrPlaceVisit(); upv.UsrK = Usr.Current.K; upv.PlaceK = p.K; upv.Update(); } } Usr.Current.UpdatePlacesVisitCount(false); #endregion #region Update favourite music and add UsrMusicTypeFavourite record for this musictype MusicType mt = new MusicType(int.Parse(FavouriteMusicDropDownList.SelectedValue)); if (Usr.Current.FavouriteMusicTypeK != mt.K) { Usr.Current.FavouriteMusicTypeK = mt.K; Prefs.Current["MusicPref"] = mt.K; try { UsrMusicTypeFavourite newMtf = new UsrMusicTypeFavourite(Usr.Current.K, mt.K); } catch { UsrMusicTypeFavourite newMtf = new UsrMusicTypeFavourite(); newMtf.UsrK = Usr.Current.K; newMtf.MusicTypeK = mt.K; newMtf.Update(); } } Usr.Current.UpdateMusicTypesFavouriteCount(false); #endregion if (!Usr.Current.IsSkeletonFromSignup && Password2.Text.Length > 0) { //Remove all saved cards... Usr.Current.DeleteAllSavedCards(); Usr.Current.SetPassword(Password2.Text.Trim(), false); } Usr.Current.Update(); if (Usr.Current.GroupsWhoHavePendingInvitationsForMe.Count > 0) { foreach (GridViewRow gvr in uiAddedByGroupsGridView.Rows) { if (((CheckBox)gvr.FindControl("uiCheckBox")).Checked) { int groupK = (int)uiAddedByGroupsGridView.DataKeys[gvr.RowIndex].Value; try { Group g = new Group(groupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (Bobs.Group.AllowJoinRequest(Usr.Current, g, gu)) g.Join(Usr.Current, gu); } catch { } } } } if (Usr.Current.UsrsWhoHavePendingBuddyRequestsForMe.Count > 0) { foreach (GridViewRow gvr in uiAddedByUsrsGridView.Rows) { if (((CheckBox)gvr.FindControl("uiCheckBox")).Checked) { int buddyUsrK = (int)uiAddedByUsrsGridView.DataKeys[gvr.RowIndex].Value; try { Usr.Current.AddBuddy(new Usr(buddyUsrK), Usr.AddBuddySource.WelcomePage, Buddy.BuddyFindingMethod.Nickname, null); } catch (Exception ex) { SpottedException.TryToSaveExceptionAndChildExceptions(ex, HttpContext.Current, Usr.Current, Visit.Current, "", "Welcome page", "", 0, null); } } } } #region Send email verify email, if needed if (sendVerifyEmail) { Mailer mail = new Mailer(); mail.SendEvenIfUnverifiedOrBroken = true; mail.Subject = "You changed your DontStayIn email address..."; mail.Body = @"<h1>You changed your email address...</h1><p>Please click the following link to verify your email address and allow posting to our discussion boards:</p> <p align=""center"" style=""padding:8px 0px 9px 0px;""><a href=""[LOGIN]"" style=""font-size:14px;font-weight:bold;"">Click here to verify your email</a></p>"; mail.To = Usr.Current.Email; mail.UsrRecipient = Usr.Current; mail.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; mail.Send(); } #endregion Log.Increment(Log.Items.WelcomeSignUp); if (Usr.Current.AddedByGroupK > 0) { if (Request.QueryString["Url"] != null && Request.QueryString["Url"].Length > 0) Response.Redirect(Request.QueryString["Url"]); else Response.Redirect(Usr.Current.AddedByGroup.Url()); } else { if (Request.QueryString["Url"] != null && Request.QueryString["Url"].Length > 0) Response.Redirect("/popup/mixmag?url=" + HttpUtility.UrlEncode(Request.QueryString["Url"])); else Response.Redirect("/popup/mixmag"); } } } }