private void btnSignUp_Click_1(object sender, EventArgs e) { if (ValidationResult == true) { if (dao.FindByUserName(txtUsername.Text) != null) { MessageBox.Show("This username has already existed"); } else { tblUser u = new tblUser { userName = txtUsername.Text, userFullName = txtFullname.Text, userPass = txtPass.Text, userAddress = txtAddress.Text, userPhone = txtPhone.Text, userRole = "Customer" }; if (dao.AddAccount(u)) { MessageBox.Show("Sign up successfull!"); btnBack_Click(sender, e); } } } else { MessageBox.Show("Enter field required!"); } }
private void btnCreate_Click(object sender, EventArgs e) { if (ValidationResult == true) { if (dao.FindByUserName(txtUsername.Text) != null) { MessageBox.Show("This username has already existed"); } else { tblUser u = new tblUser { userName = txtUsername.Text, userFullName = txtFullname.Text, userPass = txtPass.Text, userAddress = txtAddress.Text, userPhone = txtPhone.Text, userRole = "Staff" }; if (dao.AddAccount(u)) { MessageBox.Show("Create staff successfull!"); txtUsername.Text = ""; txtPass.Text = ""; txtConfirm.Text = ""; txtFullname.Text = ""; txtPhone.Text = ""; txtAddress.Text = ""; lblPhone.Text = ""; } } } else { MessageBox.Show("Enter filed required!"); } }