public string LoginUser(string email, string password) { if ((email == string.Empty) && (password == string.Empty)) { return("Email and Password missing"); } if (email == string.Empty) { return("Email box is empty"); } if (!mEmailRegex.IsMatch(email)) { return("Not a valid email string"); } if (password == string.Empty) { return("Password box is empty"); } LoginManagerBO loginManagerBO = new LoginManagerBO(); if (!loginManagerBO.EmailExists(email)) { return("Password or Email dont match"); } UserBase currentUser = new UserBase(); if (loginManagerBO.GetUser(currentUser, email, password) == false) { return("Password or Email dont match"); } Session["CurrentUser"] = currentUser; return("success"); }
public string CreateUser(string email, string password, string fullName, string gender, string country) { LoginManagerBO loginManagerBO = new LoginManagerBO(); CreateCurrentUser(); ECountry eCountry = (ECountry)Int32.Parse(country.Substring(("ECountry_").Length)); EGender eGender = (EGender)Int32.Parse(gender.Substring(("EGender_").Length)); string firstName; string lastName = ""; string[] fullNameSplit = fullName.Split(' '); firstName = fullNameSplit[0]; for (int i = 1; i < fullNameSplit.Length; i++) { if (i > 1) { lastName += " " + fullNameSplit[i]; } else { lastName += fullNameSplit[i]; } } if (loginManagerBO.EmailExists(email)) { return(email + " already taken"); } // Create User loginManagerBO.CreateUser(mCurrentUser, password, email, firstName, lastName, eGender, eCountry); //loginManagerBO.CreateSampleEvent(mCurrentUser); Session["CurrentUser"] = mCurrentUser; return("success"); }