protected void btnUserRegister_Click(object sender, EventArgs e) { if (txtCName.Text.Length <= 0) { lblCNameMsg.Text = "Name cannot be blank"; } if (txtCUsername.Text.Length <= 0) { lblCUsernameMsg.Text = "Username cannot be blank"; } if (txtCPassword.Text.Length <= 0) { lblCPasswordMsg.Text = "Password cannot be blank"; } if (txtCName.Text.Length > 0 && txtCUsername.Text.Length > 0 && txtCPassword.Text.Length > 0) { UserAccountBLL uBLL = new UserAccountBLL(); int checkUserName = uBLL.DoCheckUserNameExists(txtCUsername.Text); //If username exists if (checkUserName > 0) { alertFailure.Visible = true; lblAlertMsg.Text = "Username Exists in Database. Please use another username"; ClearTextFieldAndMessages(); } else { int result = uBLL.DoCreateNewUser(txtCName.Text, txtCUsername.Text, txtCPassword.Text); if (result > 0) { alertSuccess.Visible = true; } else { alertFailure.Visible = true; lblAlertMsg.Text = "Unable to create a new user account"; ClearTextFieldAndMessages(); } } } }