Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            LibrarianHomepage al = new LibrarianHomepage();

            al.StartPosition = FormStartPosition.CenterScreen;
            al.Show();
            this.Hide();
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            var   db = new DBDataContext();
            Login t  = null;

            t = db.Logins.SingleOrDefault(p => p.Username == textBox1.Text && p.Password == textBox2.Text);


            if (t != null)
            {
                if (t.Role == "Admin")
                {
                    MessageBox.Show("Login as a Librarian");
                    LibrarianHomepage obj = new LibrarianHomepage();
                    obj.StartPosition = FormStartPosition.CenterScreen;
                    obj.Show();
                    this.Hide();

                    textBox1.Clear();
                    textBox2.Clear();
                }
                else if (t.Role == "Faculty")
                {
                    MessageBox.Show("Login as a Faculty");
                    FacultyDashboard fd = new FacultyDashboard(t.Username);
                    fd.StartPosition = FormStartPosition.CenterScreen;
                    fd.Show();
                    this.Hide();
                    textBox1.Clear();
                    textBox2.Clear();
                }

                else
                {
                    MessageBox.Show("Login as a Student");

                    StudentDashboard sd = new StudentDashboard(t.Username);
                    sd.StartPosition = FormStartPosition.CenterScreen;
                    sd.Show();
                    this.Hide();
                    textBox1.Clear();
                    textBox2.Clear();
                }
            }
            else
            {
                MessageBox.Show("Invalid Username or Password! ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }