private void btnSubmit_Click(object sender, EventArgs e) { AuthenticationValidate validate = new AuthenticationValidate(); SaleLaptopSystemEntities db = new SaleLaptopSystemEntities(); UserDAO uDAO = new UserDAO(); String fullname = txtFullname.Text.Trim(); String email = txtEmail.Text.Trim(); String password = txtPass.Text.Trim(); String confirm = txtConfirm.Text.Trim(); String phone = txtPhone.Text.Trim(); String address = txtAddress.Text.Trim(); String img = txtImage.Text.Trim(); String role = cbbRole.SelectedItem.ToString(); if (fullname == "" || email == "" || password == "" || confirm == "" || phone == "" || address == "") { MessageBox.Show("Input the fill", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (isAddress && isConfirm && isEmail && isName && isPass && isPhone) { if (img == "") { img = "user.png"; } if (!uDAO.registration(fullname, password, email, phone, address, "..\\SaleLaptopSystem\\SaleLaptopSystem\\SaleLaptopSystem\\img\\Brands_img\\" + img, role)) { MessageBox.Show("Registration error", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { frmLogin frmLogin = new frmLogin(null); frmLogin.Show(); this.Visible = false; } } else { MessageBox.Show("Invalid register", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }