protected void ButtonVerify_Click(object sender, EventArgs e) { Labelmessage.Text = ""; if (Email.Text.Trim() != "") { User user_ = User.SelectUserByEmail("Email", Email.Text.Trim().ToLower(), "RoleName", "landlord"); if (user_ != null) { Labelmessage.Text = "landload verified for email : " + Email.Text.Trim().ToLower(); LandlordId = user_.UserId; //Pass the landlordId back to the main page PassID(user_.UserId.Value); // Email.Text = user_.PersonalEmail; FirstName.Text = user_.FirstName; MiddleName.Text = user_.MiddleName; LastName.Text = user_.LastName; MobileArea.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(6, 4); //Mobile.Text = user_.BestContactNumber; } else { FirstName.Text = ""; MiddleName.Text = ""; LastName.Text = ""; MobileArea.Text = ""; Mobile1.Text = ""; Mobile2.Text = ""; User user_check = new User(); if (user_check.IsUserEmailExist(Email.Text.Trim().ToLower())) { FirstName.Enabled = false; MiddleName.Enabled = false; LastName.Enabled = false; MobileArea.Enabled = false; Mobile1.Enabled = false; Mobile2.Enabled = false; if (user_check.IsPartialUserEmailExist(Email.Text.Trim().ToLower())) { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Partial Account. Please enter another email."; //usp_UserSelectByRoleName user_check = User.SelectUserByEmail("RoleName", "landlord", "Email", Email.Text.Trim().ToLower()); if (user_check != null) { if (user_check.UserId.HasValue && user_check.IsPartialUser == true) { Labelmessage.Text = "landload verified for email : " + Email.Text.Trim().ToLower(); LandlordId = user_check.UserId; PassID(user_check.UserId.Value); Email.Text = user_check.PersonalEmail; FirstName.Text = string.IsNullOrEmpty(user_check.FirstName) ? string.Empty : user_check.FirstName; MiddleName.Text = string.IsNullOrEmpty(user_check.MiddleName) ? string.Empty : user_check.MiddleName; LastName.Text = string.IsNullOrEmpty(user_check.LastName) ? string.Empty : user_check.LastName; MobileArea.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(6, 4); } else { Labelmessage.Text = "can not find registered landload for email : " + Email.Text.Trim().ToLower() + ". Please enter details to continue.."; Email.Text = ""; FirstName.Enabled = true; MiddleName.Enabled = true; LastName.Enabled = true; MobileArea.Enabled = true; Mobile1.Enabled = true; Mobile2.Enabled = true; } } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Student Account. Please enter another email."; } } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Student Account. Please enter another email."; } } else { Labelmessage.Text = "can not find registered landload for email : " + Email.Text.Trim().ToLower() + ". Please enter details to continue.."; // Mobile.Text = ""; FirstName.Enabled = true; MiddleName.Enabled = true; LastName.Enabled = true; MobileArea.Enabled = true; Mobile1.Enabled = true; Mobile2.Enabled = true; } } } else { clear(); } }
protected void CreateUserButton_Click(object sender, EventArgs e) { if (Page.IsValid == true) { ShowPartialUserEmailRequest.Visible = false; try { string AccessCode = Utility.GetQueryStringValueByKey(Request, "ActivationKey"); if (AccessCode != string.Empty && AccessCode != null) { user = User.Select(Guid.Parse(AccessCode)); } bool PartialEmail = false; if (user.IsPartialUser == false) { PartialEmail = checkPartialEmail(); } if (PartialEmail == false) { // need to validate partial email address bool boolMembershipUserCreated = false; user.Email = Email.Text.Trim(); user.PersonalEmail = Email.Text.Trim(); user.Password = Password.Text.Trim(); user.UserName = UserName.Text.Trim(); user.Question = Question.Text.Trim(); user.Answer = Answer.Text.Trim(); aspnet_Roles aspnet_Roles_ = new aspnet_Roles(); aspnet_Roles_ = aspnet_Roles.Select("student"); user.FirstName = FirstName.Text.Trim(); user.MiddleName = MiddleName.Text.Trim(); user.LastName = LastName.Text.Trim(); user.RoleId = aspnet_Roles_.RoleId; user.ReferralCode = ReferralCode.Text.Trim(); object objCreateMembershipUser = new object(); bool IsActivate = false; if (SystemConfig.GetValue(Enums.SystemConfig.IsEmailActivation).ToLower() == "true") { IsActivate = false; } else { IsActivate = true; } if (user.IsPartialUser) { objCreateMembershipUser = user.AddMembershipPartialUser(user.UserName, user.Password, user.Email, user.Question, user.Answer, IsActivate, user.UserId.Value, "student"); } else { objCreateMembershipUser = user.AddMembershipUser(user.UserName, user.Password, user.Email, user.Question, user.Answer, IsActivate, "student"); } bool.TryParse(objCreateMembershipUser.ToString(), out boolMembershipUserCreated); if (boolMembershipUserCreated) { Session[Constants.SESSION_LOGGED_USER] = user; MembershipUser newUser = Membership.GetUser(user.UserName); user.UserId = Guid.Parse(newUser.ProviderUserKey.ToString()); user.AspnetUserId = Guid.Parse(newUser.ProviderUserKey.ToString()); user.CreatedBy = Guid.Parse(newUser.ProviderUserKey.ToString()); user.UpdatedBy = Guid.Parse(newUser.ProviderUserKey.ToString()); user.Save(); if (SystemConfig.GetValue(Enums.SystemConfig.IsEmailActivation).ToLower() == "true") { string strMsgContent = message((Guid)newUser.ProviderUserKey); string strMsgTitle = SystemConfig.GetValue(RHP.Common.Enums.SystemConfig.SITEURL) + " - Action required for account activation."; int rtn = SendEmail(user.Email, strMsgTitle, strMsgContent); if (rtn == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Create_Account_Success + "'); window.location = '/Login.aspx?type=s'; }", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Sending_Email_Error + "'); window.location = '/Login.aspx?type=s'; }", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Create_Account_Success + "'); window.location = '/Login.aspx?type=s'; }", true); } } else { lblError.Text = objCreateMembershipUser.ToString(); Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Profile_Create_Unsuccess + " - " + objCreateMembershipUser.ToString() + "'); }", true); } } else { User user_check = new User(); if (user_check.IsPartialUserEmailExist(Email.Text.Trim().ToLower())) { ShowfullRegistration.Visible = false; ShowPartialUserEmailRequest.Visible = true; lblpartialuserEmail.Text = Email.Text.Trim(); lblpartialuserEmail2.Text = Email.Text.Trim(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Profile_Create_Unsuccess + " - " + Messages.EmailAddressExist + "'); }", true); ShowPartialUserEmailRequest.Visible = false; ShowfullRegistration.Visible = true; } } } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Profile_Create_Unsuccess + "'); }", true); throw ex;//new Exception("student Profile info : " + ex.ToString()); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Validation_Fail + "'); }", true); } }
protected void ButtonVerifyLandload_Click(object sender, EventArgs e) { LandloadLabelmessage.Text = ""; DissableEdit(); hideHouseDetails(); // hdLandloadId.Value = string.Empty; hdHouseId.Value = string.Empty; clearLandload(); DissableLandlord(); House_Search.Visible = false; DrpHouse.Visible = false; if (LandloadEmail.Text.Trim() != "") { User user_check = new User(); user_check = RHP.UserManagement.User.SelectUserByEmail("Email", LandloadEmail.Text.Trim().ToLower(), "RoleName", "landlord"); if (user_check != null) { LandloadLabelmessage.Text = "Landlord verified for email : " + LandloadEmail.Text.Trim().ToLower(); hdLandloadId.Value = user_check.UserId.Value.ToString(); LandloadEmail.Text = user_check.PersonalEmail; LandloadFirstName.Text = string.IsNullOrEmpty(user_check.FirstName) ? string.Empty : user_check.FirstName; LandloadMiddleName.Text = string.IsNullOrEmpty(user_check.MiddleName) ? string.Empty : user_check.MiddleName; LandloadLastName.Text = string.IsNullOrEmpty(user_check.LastName) ? string.Empty : user_check.LastName; LandloadMobileArea.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(0, 3); LandloadMobile1.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(3, 3); LandloadMobile2.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(6, 4); ButtonLandload.Visible = true; LoadInitialHouseData(); loadHouseDatadata(); } else { user_check = new User(); if (user_check.IsUserEmailExist(LandloadEmail.Text.Trim().ToLower())) { if (user_check.IsPartialUserEmailExist(LandloadEmail.Text.Trim().ToLower())) { user_check = new User(); user_check = RHP.UserManagement.User.SelectUserByEmail("RoleName", "landlord", "Email", LandloadEmail.Text.Trim().ToLower()); if (user_check != null) { if (user_check.UserId.HasValue && user_check.IsPartialUser == true) { LandloadLabelmessage.Text = "landlord verified for email : " + LandloadEmail.Text.Trim().ToLower(); hdLandloadId.Value = user_check.UserId.Value.ToString(); LandloadEmail.Text = user_check.PersonalEmail; LandloadFirstName.Text = string.IsNullOrEmpty(user_check.FirstName) ? string.Empty : user_check.FirstName; LandloadMiddleName.Text = string.IsNullOrEmpty(user_check.MiddleName) ? string.Empty : user_check.MiddleName; LandloadLastName.Text = string.IsNullOrEmpty(user_check.LastName) ? string.Empty : user_check.LastName; LandloadMobileArea.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(0, 3); LandloadMobile1.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(3, 3); LandloadMobile2.Text = string.IsNullOrEmpty(user_check.BestContactNumber) ? string.Empty : user_check.BestContactNumber.Substring(6, 4); ButtonLandload.Visible = true; LoadInitialHouseData(); loadHouseDatadata(); } else { LandloadLabelmessage.Text = "can not find registered landlord for email : " + LandloadEmail.Text.Trim().ToLower() + ". Please enter details to continue.."; ButtonLandload.Visible = true; LandloadEmail.Text = ""; EnableLandlord(); } } else { LandloadLabelmessage.Text = "Email Address : " + LandloadEmail.Text.Trim().ToLower() + ", is already Registed with Student Account. Please enter another email."; } } else { LandloadLabelmessage.Text = "Email Address : " + LandloadEmail.Text.Trim().ToLower() + ", is already Registed with Student Account. Please enter another email."; EnableLandlord(); } } else { ButtonLandload.Visible = true; EnableLandlord(); } } } }
protected void ButtonVerify_Click(object sender, EventArgs e) { Labelmessage.Text = ""; if (Email.Text.Trim() != "") { User user_ = RHP.UserManagement.User.SelectUserByEmail("Email", Email.Text.Trim().ToLower(), "RoleName", "student"); if (user_ != null) { if (user_.HouseId.HasValue) { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with a another House. Please enter another email."; } else { FirstName.Enabled = false; MiddleName.Enabled = false; LastName.Enabled = false; MobileArea.Enabled = false; Mobile1.Enabled = false; Mobile2.Enabled = false; if(hdroommatestatus.Value == "Add") { Labelmessage.Text = "student verified for email : " + Email.Text.Trim().ToLower(); FirstName.Text = string.IsNullOrEmpty(user_.FirstName) ? string.Empty : user_.FirstName; MiddleName.Text = string.IsNullOrEmpty(user_.MiddleName) ? string.Empty : user_.MiddleName; LastName.Text = string.IsNullOrEmpty(user_.LastName) ? string.Empty : user_.LastName; MobileArea.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(6, 4); } else if (hdroommatestatus.Value == "Edit") { if (validateemail()) { Labelmessage.Text = "landlord or Roommate allready registerd for email : " + Email.Text.Trim().ToLower() + ". Please enter new details to continue.."; } else { Labelmessage.Text = "Roommate verified for email : " + Email.Text.Trim().ToLower(); FirstName.Text = user_.FirstName; MiddleName.Text = user_.MiddleName; LastName.Text = user_.LastName; MobileArea.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(6, 4); } } } } else { FirstName.Text = ""; MiddleName.Text = ""; LastName.Text = ""; MobileArea.Text = ""; Mobile1.Text = ""; Mobile2.Text = ""; if (hdroommatestatus.Value == "Add") { User user_check = new User(); if (user_check.IsUserEmailExist(Email.Text.Trim().ToLower())) { FirstName.Enabled = false; MiddleName.Enabled = false; LastName.Enabled = false; MobileArea.Enabled = false; Mobile1.Enabled = false; Mobile2.Enabled = false; if (user_check.IsPartialUserEmailExist(Email.Text.Trim().ToLower())) { User userPartial = RHP.UserManagement.User.SelectByRoleName("RoleName", "student", "Email", Email.Text.Trim().ToLower()); if (userPartial != null) { if (userPartial.HouseId.HasValue) { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with a another House. Please enter another email."; } else { Labelmessage.Text = "student verified for email : " + Email.Text.Trim().ToLower(); // NewEmail.Text = string.IsNullOrEmpty(Email.Text.Trim().ToLower()) ? string.Empty : Email.Text.Trim().ToLower(); FirstName.Text = string.IsNullOrEmpty(userPartial.FirstName) ? string.Empty : userPartial.FirstName; MiddleName.Text = string.IsNullOrEmpty(userPartial.MiddleName) ? string.Empty : userPartial.MiddleName; LastName.Text = string.IsNullOrEmpty(userPartial.LastName) ? string.Empty : userPartial.LastName; MobileArea.Text = string.IsNullOrEmpty(userPartial.BestContactNumber) ? string.Empty : userPartial.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(userPartial.BestContactNumber) ? string.Empty : userPartial.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(userPartial.BestContactNumber) ? string.Empty : userPartial.BestContactNumber.Substring(6, 4); } } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Partial Lanlord Account. Please enter another email."; } } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with another Account. Please enter another email."; } } else { Labelmessage.Text = "can not find registered Student for email : " + Email.Text.Trim().ToLower() + ". Please enter details to continue.."; //NewEmail.Text = string.IsNullOrEmpty(Email.Text.Trim().ToLower()) ? string.Empty : Email.Text.Trim().ToLower(); FirstName.Enabled = true; MiddleName.Enabled = true; LastName.Enabled = true; MobileArea.Enabled = true; Mobile1.Enabled = true; Mobile2.Enabled = true; } } else if (hdroommatestatus.Value == "Edit") { if (validateemail()) { FirstName.Enabled = false; MiddleName.Enabled = false; LastName.Enabled = false; MobileArea.Enabled = false; Mobile1.Enabled = false; Mobile2.Enabled = false; } else { Labelmessage.Text = "can not find registered Roommate for email : " + Email.Text.Trim().ToLower() + ". Please enter details to continue.."; FirstName.Enabled = true; MiddleName.Enabled = true; LastName.Enabled = true; MobileArea.Enabled = true; Mobile1.Enabled = true; Mobile2.Enabled = true; } } } } else { clear(); } }
public bool validateemail() { bool isexist = false; Labelmessage.Text = ""; if (Email.Text.Trim() != "") { User user_ = new User(); if (user_.IsUserEmailExist(Email.Text.Trim().ToLower())) { isexist = true; if (user_.IsPartialUserEmailExist(Email.Text.Trim().ToLower())) { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Partial Account. Please enter another email."; } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with another Account. Please enter another email."; } // Labelmessage.Text = "landlord or student allready registerd for email : " + Email.Text.Trim().ToLower() + ". Please enter new details to continue.."; } else { isexist = false; // Labelmessage.Text = "student verified for email : " + Email.Text.Trim().ToLower(); } } else { isexist = false; } return isexist; }
protected void ButtonVerify_Click(object sender, EventArgs e) { Labelmessage.Text = ""; if (Email.Text.Trim() != "") { User user_ = User.SelectUserByEmail("Email", Email.Text.Trim().ToLower(), "RoleName", "student"); if (user_ != null) { Labelmessage.Text = "student verified for email : " + Email.Text.Trim().ToLower(); // Email.Text = user_.PersonalEmail; FirstName.Text = user_.FirstName; MiddleName.Text = user_.MiddleName; LastName.Text = user_.LastName; MobileArea.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(user_.BestContactNumber) ? string.Empty : user_.BestContactNumber.Substring(6, 4); //Mobile.Text = user_.BestContactNumber; } else { FirstName.Text = ""; MiddleName.Text = ""; LastName.Text = ""; MobileArea.Text = ""; Mobile1.Text = ""; Mobile2.Text = ""; User user_check = new User(); if (user_check.IsUserEmailExist(Email.Text.Trim().ToLower())) { FirstName.Enabled = false; MiddleName.Enabled = false; LastName.Enabled = false; MobileArea.Enabled = false; Mobile1.Enabled = false; Mobile2.Enabled = false; if (user_check.IsPartialUserEmailExist(Email.Text.Trim().ToLower())) { User userPartial = User.SelectByRoleName("RoleName", "student", "Email", Email.Text.Trim().ToLower()); if (userPartial != null) { Labelmessage.Text = "student verified for email : " + Email.Text.Trim().ToLower(); FirstName.Text = userPartial.FirstName; MiddleName.Text = userPartial.MiddleName; LastName.Text = userPartial.LastName; MobileArea.Text = string.IsNullOrEmpty(userPartial.BestContactNumber) ? string.Empty : userPartial.BestContactNumber.Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(userPartial.BestContactNumber) ? string.Empty : userPartial.BestContactNumber.Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(userPartial.BestContactNumber) ? string.Empty : userPartial.BestContactNumber.Substring(6, 4); } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Partial Lanlord Account. Please enter another email."; } // Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with Partial Account. Please enter another email."; } else { Labelmessage.Text = "Email Address : " + Email.Text.Trim().ToLower() + ", is already Registed with another Account. Please enter another email."; } } else { Labelmessage.Text = "can not find registered landload for email : " + Email.Text.Trim().ToLower() + ". Please enter details to continue.."; FirstName.Enabled = true; MiddleName.Enabled = true; LastName.Enabled = true; MobileArea.Enabled = true; Mobile1.Enabled = true; Mobile2.Enabled = true; } } } else { clear(); } }