protected void btnSave_Click(object sender, EventArgs e) { settings = MemberSettings.GetMemberSettingsByMemberID(member.MemberID); settings.NotifyOnNewMessage = chbNewMessage.Checked; settings.NotifyOnAAFComment = chbNewAAFComment.Checked; settings.NotifyOnFriendRequest = chbNewFriendRequest.Checked; settings.NotifyOnSubscriberEvent = chbSubscriberEvent.Checked; settings.NotifyOnNewsLetter = chbNewsLetter.Checked; settings.NotifyNewProfileComment = chbNewProfileComment.Checked; settings.NotifyNewPhotoComment = chbNotifyNewPhotoComment.Checked; settings.NotifyNewVideoComment = chbNotifyNewVideoComment.Checked; settings.NotifyOnNewVideo = chbNotifyNewVideo.Checked; settings.NotifyOnNewBlog = chbNotifyNewBlog.Checked; if (RegexPatterns.TestEmailRegex(txtEmail.Text)) { if (member.Email.ToLower().Trim() != txtEmail.Text.ToLower().Trim()) { if (Member.IsEmailAddressAvailable(txtEmail.Text)) { member.Email = txtEmail.Text; PasswordErrorMessage = string.Empty; txtEmail.CssClass = "form_txt"; EmailErrorMessage = "Email address changed"; EmailMessageCss = "floatedOK"; } else { EmailMessageCss = "floatedWarning"; txtEmail.CssClass = "form_txt formerror"; EmailErrorMessage = "Email address already in use"; } } else { PasswordErrorMessage = string.Empty; txtEmail.CssClass = "form_txt"; EmailErrorMessage = ""; EmailMessageCss = "floatedOK"; } } else { txtEmail.CssClass = "form_txt formerror"; EmailErrorMessage = "Invalid Email address"; EmailMessageCss = "floatedWarning"; } txtNewPassword.CssClass = "form_txt"; txtConfirmPassword.CssClass = "form_txt"; txtOldPassword.CssClass = "form_txt"; if (txtOldPassword.Text != string.Empty || txtNewPassword.Text != string.Empty || txtConfirmPassword.Text != string.Empty) { bool PasswordsMatch = false; bool PasswordsMeetRequirement = false; bool PasswordCorrect = false; if (txtOldPassword.Text == member.Password) { PasswordCorrect = true; } if (txtNewPassword.Text == txtConfirmPassword.Text) { PasswordsMatch = true; if (RegexPatterns.TestPassword(txtNewPassword.Text)) { member.Password = txtNewPassword.Text; PasswordsMeetRequirement = true; } } PasswordErrorMessage = string.Empty; if (!PasswordCorrect) { PasswordErrorMessage = "Old password is incorrect"; txtOldPassword.CssClass = "form_txt formerror"; PasswordMessageCss = "floatedWarning"; } else if (!PasswordsMatch) { PasswordErrorMessage = "Passwords dont match"; txtNewPassword.CssClass = "form_txt formerror"; txtConfirmPassword.CssClass = "form_txt formerror"; PasswordMessageCss = "floatedWarning"; } else if (!PasswordsMeetRequirement) { PasswordErrorMessage = "Password must be 7 characters or more"; txtNewPassword.CssClass = "form_txt formerror"; txtConfirmPassword.CssClass = "form_txt formerror"; PasswordMessageCss = "floatedWarning"; } else { PasswordErrorMessage = "Password changed"; PasswordMessageCss = "floatedOK"; } } settings.Save(); member.Save(); string strSignup= Request.Params["signup"]; if (strSignup != null) { Response.Redirect("/invite/?signup=true"); } }
private static void MemberSetUp(Member member) { CreateUserDirectories(member); var defaultGallery = new PhotoCollection() { WebPhotoCollectionID = UniqueID.NewWebID(), MemberID = member.MemberID, DTCreated = DateTime.Now, Name = member.NickName + "'s Gallery", Description = "My First Gallery!" }; defaultGallery.Save(); string StatusText = "New to next2Friends!"; /* Create a new member profile for the member. */ var profile = new MemberProfile() { MemberID = member.MemberID, DTLastUpdated = DateTime.Now, DefaultPhotoCollectionID = defaultGallery.PhotoCollectionID, TagLine = StatusText }; profile.Save(); MemberStatusText.UpdateStatusText(member.MemberID, StatusText); var message = new Message() { Body = "Welcome to Next2Friends", WebMessageID = UniqueID.NewWebID(), MemberIDFrom = 31, MemberIDTo = member.MemberID, DTCreated = DateTime.Now }; message.Save(); message.InReplyToID = message.MessageID; message.Save(); /* Create the default settings for the member. */ var settings = new MemberSettings() { NotifyNewPhotoComment = true, NotifyNewProfileComment = true, NotifyNewVideoComment = true, NotifyOnAAFComment = true, NotifyOnFriendRequest = true, NotifyOnNewMessage = true, NotifyOnNewsLetter = true, NotifyOnSubscriberEvent = true, MemberID = member.MemberID }; settings.Save(); var matchProfile = new MatchProfile() { MemberID = member.MemberID }; matchProfile.Save(); var device = new Device() { MemberID = member.MemberID, PrivateEncryptionKey = UniqueID.NewEncryptionKey(), CreatedDT = DateTime.Now, DeviceTagID = Guid.NewGuid().ToString() }; device.Save(); // Lawrence: Added block to register default friends and profile views try { // Add Lawrence as Auto Friend Friend.AddFriend(1, member.MemberID); // Add Anthony as Auto Friend Friend.AddFriend(3, member.MemberID); // Add Hans as Auto Friend Friend.AddFriend(24, member.MemberID); // Add Becca as Auto Friend Friend.AddFriend(30, member.MemberID); ContentViewed(new Member(1), member.MemberID, CommentType.Member); ContentViewed(new Member(3), member.MemberID, CommentType.Member); ContentViewed(new Member(24), member.MemberID, CommentType.Member); ContentViewed(new Member(30), member.MemberID, CommentType.Member); } catch { } SetOnlineNow(member.MemberID); }
protected void btnSignup2_Click(object sender, EventArgs e) { bool SignUpOkay = true; if (txtFirstName.Text.Trim() == string.Empty) { SignUpOkay = false; errTxtFirstName.Text = "<span class='formerror_msg'>No first name</span>"; } else { errTxtFirstName.Text = string.Empty; } if (txtLastName.Text.Trim() == string.Empty) { SignUpOkay = false; errTxtLastName.Text = "<span class='formerror_msg'>No last name</span>"; } else { errTxtLastName.Text = string.Empty; } if (txtPassword.Text == string.Empty) { SignUpOkay = false; errTxtPassword.Text = "<span class='formerror_msg'>No password</span>"; } else if (txtPassword.Text != txtConfirm.Text) { SignUpOkay = false; errTxtPassword.Text = "<span class='formerror_msg'>Passwords do no match</span>"; } else if (!RegexPatterns.TestPassword(txtPassword.Text)) { SignUpOkay = false; errTxtPassword.Text = "minimum length 7 characters"; } else { errTxtPassword.Text = string.Empty; } if (!cbTOS.Checked) { SignUpOkay = false; errChbTOS.Text = "<span class='formerror_msg'>You must agree to the tos</span>"; } else { errChbTOS.Text = string.Empty; } if (SignUpOkay) { NewMember = (Member)Session["Member"]; CurrentStage = MobileSignupStage.Complete; Database db = DatabaseFactory.CreateDatabase(); DbConnection conn = db.CreateConnection(); DbTransaction Transaction = null; try { conn.Open(); Transaction = conn.BeginTransaction(); NewMember.FirstName = txtFirstName.Text; NewMember.LastName = txtLastName.Text; NewMember.AccountType = 0; NewMember.Password = txtPassword.Text; NewMember.ProfilePhotoResourceFileID = 1; NewMember.WebMemberID = Next2Friends.Misc.UniqueID.NewWebID(); NewMember.CreatedDT = DateTime.Now; NewMember.Save(db); // Ceate the business Account //if (rbBusiness.Checked) //{ // Business business = new Business(); // business.MemberID = NewMember.MemberID; // business.CompanyName = txtCompanyName.Text; // business.IndustrySector = drpIndustrySector.SelectedValue; // business.YearFounded = Int32.Parse(drpYearFounded.SelectedValue); // business.CompanySize = drpCompanySize.Text; // business.IndustrySector = drpIndustrySector.SelectedValue; // business.Save(db); // IMSPlan imsPlan = new IMSPlan(); // imsPlan.BusinessID = business.BusinessID; // imsPlan.Save(db); //} //ResourceFile.CreateUserDirectories(NewMember); TEMPCreateUserDirectories(NewMember); PhotoCollection DefaultGallery = new PhotoCollection(); DefaultGallery.WebPhotoCollectionID = Next2Friends.Misc.UniqueID.NewWebID(); DefaultGallery.MemberID = NewMember.MemberID; DefaultGallery.DTCreated = DateTime.Now; DefaultGallery.Name = NewMember.NickName + "'s Gallery"; DefaultGallery.Description = "My First Gallery!"; DefaultGallery.Save(db); // create a new member profile for the meber Next2Friends.Data.MemberProfile profile = new Next2Friends.Data.MemberProfile(); profile.MemberID = NewMember.MemberID; profile.DTLastUpdated = DateTime.Now; profile.DefaultPhotoCollectionID = DefaultGallery.PhotoCollectionID; profile.Save(db); Message message = new Message(); message.Body = "Welcome to Next2Friends"; message.WebMessageID = Next2Friends.Misc.UniqueID.NewWebID(); message.MemberIDFrom = 31; message.MemberIDTo = NewMember.MemberID; message.DTCreated = DateTime.Now; message.Save(db); message.InReplyToID = message.MessageID; message.Save(db); // create the default settings for the member MemberSettings settings = new MemberSettings(); settings.NotifyNewPhotoComment = true; settings.NotifyNewProfileComment = true; settings.NotifyNewVideoComment = true; settings.NotifyOnAAFComment = true; settings.NotifyOnFriendRequest = true; settings.NotifyOnNewMessage = true; settings.NotifyOnNewsLetter = true; settings.NotifyOnSubscriberEvent = true; settings.MemberID = NewMember.MemberID; settings.Save(db); MatchProfile matchProfile = new MatchProfile(); matchProfile.MemberID = NewMember.MemberID; matchProfile.Save(db); Device Device = new Device(); Device.MemberID = NewMember.MemberID; Device.PrivateEncryptionKey = Next2Friends.Misc.UniqueID.NewEncryptionKey(); Device.CreatedDT = DateTime.Now; Device.DeviceTagID = Guid.NewGuid().ToString(); Device.Save(db); OnlineNow now = new OnlineNow(); now.MemberID = NewMember.MemberID; now.DTOnline = DateTime.Now; now.Save(db); Session["Member"] = NewMember; Transaction.Commit(); Utility.AddToLoggedIn(); } catch (Exception ex) { Transaction.Rollback(); throw ex; } finally { conn.Close(); } } else { CurrentStage = MobileSignupStage.Stage2; } }