private void Btn_LogIn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Txt_UserName.Text) || string.IsNullOrEmpty(Txt_Password.Text)) { MetroMessageBox.Show(this, "User Name can not be Blank Or Password can not be Blank ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Txt_UserName.Clear(); Txt_Password.Clear(); } else { int count = log.LogIn(Txt_UserName.Text, Txt_Password.Text); if (count == 0) { count += 1; MetroMessageBox.Show(this, " Check User Name Or Password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Txt_Password.Clear(); } else { string designation = log.GetDesignation(Txt_UserName.Text, Txt_Password.Text); if (designation == "Manager") { Manager_Home_Form MHome = new Manager_Home_Form(); MHome.Show(); this.Hide(); } else { Employee_Registration_Form ER = new Employee_Registration_Form(); ER.Show(); } } } }
private void Btn_Ok_Click(object sender, EventArgs e) { CP.ValidateData(Txt_UserName.Text, Txt_CurrentPass.Text, Txt_NewPass.Text, Txt_ConfimNewPass.Text); int count = CP.CheckCurrentDetails(Txt_UserName.Text, Txt_CurrentPass.Text); if (count == 0) { count += 1; MetroMessageBox.Show(this, " Check User Name Or Current Password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Txt_NewPass.Clear(); Txt_ConfimNewPass.Clear(); } else { if (Txt_NewPass.Text != Txt_ConfimNewPass.Text) { MessageBox.Show("Check New Password And Confirm Password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Txt_NewPass.Clear(); Txt_ConfimNewPass.Clear(); } else { int rows = CP.SaveNewPassword(Txt_UserName.Text, Txt_CurrentPass.Text, Txt_NewPass.Text); if (rows == 1) { DialogResult DR = MetroFramework.MetroMessageBox.Show(this, "Data Updated Succesfully", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); if (Convert.ToString(DR) == "OK") { Txt_UserName.Clear(); Txt_CurrentPass.Clear(); Txt_NewPass.Clear(); Txt_ConfimNewPass.Clear(); } } else if (rows != 1) { MetroFramework.MetroMessageBox.Show(this, "Data Is Not Updated Succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public void Clear() { Txt_FirstName.Clear(); Txt_LastName.Clear(); Txt_UserName.Clear(); Txt_Password.Clear(); Txt_ConfirmPassword.Clear(); }