private void button2_Click(object sender, EventArgs e) { RegistrarForm reg = new RegistrarForm(); reg.Show(); this.Hide(); }
private void button2_Click(object sender, EventArgs e) { if (isValid()) { string userId = UserLog.getUserId(); user.ChangedPass(userId, txtPassword.Text.Trim()); MessageBox.Show("Succesfully Changed Password"); if (role == "System Admin") { Admin admin = new Admin(); admin.Show(); this.Hide(); } else if (role == "Enrollment Admin") { EnrollmentAdmin admin = new EnrollmentAdmin(); admin.Show(); this.Hide(); } else if (role == "Cashier") { CashierDashboard cash = new CashierDashboard(); this.Hide(); cash.Show(); } else if (role == "Registrar") { RegistrarForm registrarForm = new RegistrarForm(); this.Hide(); registrarForm.Show(); } else { TeacherFrm frm = new TeacherFrm(); frm.Show(); this.Hide(); } } }
private void btnLogin_Click(object sender, EventArgs e) { if (!isConnected) { label1.Text = "No Connection"; MessageBox.Show("There is no connection to the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); IPConfigFormcs g = new IPConfigFormcs(); g.ShowDialog(); } else { string role = control.login(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (role == "") { MessageBox.Show("incorrect username or password", "Validation", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { audittrail.addAudit(label7.Text.Trim(), "User has been Login"); control.setOnline(UserLog.getUserId()); int isPaswwordChanged = UserLog.getIsPasswordChanged(); // LoginPreferences.CreateLoginPrefFile(); if (role == "System Admin") { if (isPaswwordChanged == 0) { Generated frmGen = new Generated(role); frmGen.Show(); this.Hide(); } else { Admin frm = new Admin(); frm.Show(); this.Hide(); } } else if (role == "Registrar") { if (isPaswwordChanged == 0) { Generated frmGen = new Generated(role); frmGen.Show(); this.Hide(); } else { RegistrarForm frm = new RegistrarForm(); frm.Show(); this.Hide(); } } else if (role == "Enrollment Admin") { if (isPaswwordChanged == 0) { Generated frmGen = new Generated(role); frmGen.Show(); this.Hide(); } else { EnrollmentAdmin frm = new EnrollmentAdmin(); frm.Show(); this.Hide(); } } else if (role == "Cashier") { if (isPaswwordChanged == 0) { Generated frmGen = new Generated(role); frmGen.Show(); this.Hide(); } else { CashierDashboard frm = new CashierDashboard(); frm.Show(); this.Hide(); } } else if (role == "Teacher") { if (isPaswwordChanged == 0) { Generated frmGen = new Generated(role); frmGen.Show(); this.Hide(); } else { TeacherFrm frm = new TeacherFrm(); frm.Show(); this.Hide(); } } } } }