private void btn_SignUp_Click(object sender, EventArgs e) { if (txt_Username.Text == "Username") { txt_Username.Clear(); } if (txt_Password.Text == "Password") { txt_Password.Clear(); } string UserName = txt_Username.Text; string PassWord = BLL_Account.Instance.MaHoa(txt_Password.Text); Account ac = BLL_Account.Instance.Get_Account(UserName); if (ac != null) { if (ac.PassWord != PassWord) { pic_Password.Image = Properties.Resources.Red_Password; label_Warning.Visible = true; } else { if (ac.Type == 0) { Form_Admin f_admin = new Form_Admin(Convert.ToInt32(ac.idNhanVien)); this.Hide(); f_admin.ShowDialog(); this.Show(); Reset_TextBoxes(); } else { Form_Staff f_staff = new Form_Staff(Convert.ToInt32(ac.idNhanVien)); this.Hide(); f_staff.ShowDialog(); this.Show(); Reset_TextBoxes(); } } } else { MessageBox.Show("Sai ussername"); pic_Username.Image = Properties.Resources.Red_Username; pic_Password.Image = Properties.Resources.Red_Password; label_Warning.Visible = true; return; } }
private void btn_SignUp_Click(object sender, EventArgs e) { if (txt_Username.Text == "Username") { txt_Username.Clear(); } if (txt_Password.Text == "Password") { txt_Password.Clear(); } if (!Check_Username(txt_Username.Text)) { pic_Username.Image = Properties.Resources.Red_Username; pic_Password.Image = Properties.Resources.Red_Password; return; } if (!Check_Password(txt_Password.Text)) { pic_Password.Image = Properties.Resources.Red_Password; return; } if (txt_Username.Text == "1" && txt_Password.Text == "1") { Form_Admin f_admin = new Form_Admin(); this.Hide(); f_admin.ShowDialog(); this.Show(); Reset_TextBoxes(); } if (txt_Username.Text == "2" && txt_Password.Text == "2") { Form_Staff f_staff = new Form_Staff(); this.Hide(); f_staff.ShowDialog(); this.Show(); Reset_TextBoxes(); } }