Esempio n. 1
0
 private void label1_Click(object sender, EventArgs e)
 {
     if (label1.Text == "No Connection")
     {
         this.Hide();
         IPConfigFormcs g = new IPConfigFormcs();
         g.ShowDialog();
     }
 }
Esempio n. 2
0
        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();
                        }
                    }
                }
            }
        }