Ejemplo n.º 1
0
        private void Back_Click(object sender, EventArgs e)
        {
            AdminMainMenu adminMainMenu = new AdminMainMenu(users);

            this.Hide();
            adminMainMenu.Show();
        }
Ejemplo n.º 2
0
 private void Login_Click(object sender, EventArgs e)
 {
     using (var db = new Session3Entities())
     {
         var ID   = UID.Text;
         var pass = Pass.Text;
         var q    = db.Users.Where(x => x.userId == ID && x.passwd == pass).FirstOrDefault();
         if (q != null)
         {
             //Only administrators and country representatives
             //can successfully login via this screen.
             if (q.userTypeIdFK == 1)
             {
                 //When a user successfully logs in, they will be
                 //automatically re‐directed to the appropriate main menu for that type of user.
                 AdminMainMenu adminMainMenu = new AdminMainMenu(q);
                 this.Hide();
                 adminMainMenu.Show();
             }
             else
             {
                 //When a user successfully logs in, they will be
                 //automatically re‐directed to the appropriate main menu for that type of user.
                 CountryRepresentativeMainMenu countryRepresentativeMainMenu = new CountryRepresentativeMainMenu(q);
                 this.Hide();
                 countryRepresentativeMainMenu.Show();
             }
         }
         else
         {
             MessageBox.Show("Invalid User!");
         }
     }
 }