public string Register(string Code, string FirstName, string LastName, string Email, string Username, string Password) { string status = "Not Register"; string UserRefID = ""; string SessionID = Session["CurrentSession"].ToString(); Register newRegister = new Register(FirstName, LastName, Email, Username, Password, Code); bool IsExist = newRegister.CheckUserExist(); if (IsExist) { status = "Exist"; UserRefID = newRegister.GetUserRefID(); } else { status = newRegister.AddNewUser(); if (status == "Success") { status = "Registered"; UserRefID = newRegister.GetUserRefID(); } } User currentuser = new User(UserRefID, SessionID, status); JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(currentuser)); }
private void btnRegister_Click(object sender, EventArgs e) { register = new Register(); string username = txtUsername.Text; string email = txtEmail.Text; string password = txtPassword.Text; string repeatPassword = txtRepeatPassword.Text; string name = txtName.Text; string surname = txtSurname.Text; int zipcode = 0; Int32.TryParse(txtZipcode.Text, out zipcode); string city = txtCity.Text; string adress = txtAddress.Text; string endResult = register.AddNewUser(name, surname, username, password, repeatPassword, email, city, zipcode, adress, imagePath); MessageBox.Show(endResult); if (endResult == "Success! You have successfully made an account for Custom Pizza!") { GoToLogin(); } }