Example #1
0
 public FrEditProfile(Student student, FrStudentNav studentnav)
 {
     InitializeComponent();
     va              = new Validation(this.Controls, EValidation);
     this.student    = student;
     this.studentnav = studentnav;
 }
 private void BtnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         using (SampleDataContext db = new SampleDataContext())
         {
             if (va.ValidateEmpty() == false)
             {
                 return;
             }
             user = db.Users.Where(u => u.username == TbxUsername.Text && u.password == TbxPassword.Text)
                    .FirstOrDefault();
             if (user != null)
             {
                 if (CheckStudent() == true)
                 {
                     FrStudentNav studentnav = new FrStudentNav(student);
                     studentnav.Show();
                     this.Hide();
                 }
                 else if (CheckTeacner() == true)
                 {
                     FrTeacherNav teachernav = new FrTeacherNav(this.teacher);
                     teachernav.Show();
                     this.Hide();
                 }
             }
             else if (TbxUsername.Text == "admin" && TbxPassword.Text == "admin")
             {
                 FrAdminNav adminnav = new FrAdminNav();
                 adminnav.Show();
                 this.Hide();
             }
             else
             {
                 GlobalUse.GetErrorMessage("Wrong username or password!");
                 va.Clear();
             }
         }
     }
     catch (Exception ex)
     {
         GlobalUse.GetErrorMessage("Error ! " + ex.Message);
     }
 }
 public FrMessageMenu(User user, FrStudentNav studentnav)
 {
     InitializeComponent();
     this.user       = user;
     this.studentnav = studentnav;
 }