Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (var db = new Session4Entities())
     {
         var ID   = UID.Text;
         var pass = Pass.Text;
         var q    = db.Users.Where(x => x.userId.Trim() == ID && x.passwd == pass).FirstOrDefault();
         if (q != null)
         {
             if (q.userTypeIdFK == 1)
             {
                 this.Hide();
                 AdminMainMenu adminMainMenu = new AdminMainMenu(q);
                 adminMainMenu.Show();
             }
             else if (q.userTypeIdFK == 2)
             {
                 this.Hide();
                 ExpertMainMenu expertMainMenu = new ExpertMainMenu(q);
                 expertMainMenu.Show();
             }
             else
             {
                 this.Hide();
                 UpdateCompetitorTrainingRecords updateCompetitorTrainingRecords = new UpdateCompetitorTrainingRecords(q);
                 updateCompetitorTrainingRecords.Show();
             }
         }
         else
         {
             MessageBox.Show("Invalid User!");
         }
     }
 }