private void back_Click(object sender, EventArgs e)
        {
            this.Hide();
            MentorMain m = new MentorMain();

            m.Show();
        }
예제 #2
0
 private void back_Click(object sender, EventArgs e)
 {
     this.Hide();
     if (Program.empUser.getType().ToString().Equals("Mentor"))
     {
         MentorMain m = new MentorMain();
         m.Show();
     }
     if (Program.empUser.getType().ToString().Equals("Lecturer"))
     {
         LecturerMain l = new LecturerMain();
         l.Show();
     }
 }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Program.empUser  = null;
            Program.studUser = null;
            string userId;

            userId = UserNameTextBox.Text.ToString();
            string password;

            password = PasswordTextBox.Text.ToString();
            int checkFlag = 0;


            if (userId == "" || password == "")
            {
                string err  = "Please Enter User ID or Password";
                string err2 = "Error";
                MessageBox.Show(err, err2);
                return;
            }
            if (userId != "")
            {
                try
                {
                    int checkUserID = int.Parse(UserNameTextBox.Text);
                }
                catch (Exception ex)
                {
                    checkFlag = 1;
                    MessageBox.Show("User ID in incorrect format", "Error", MessageBoxButtons.OK);
                }
            }

            foreach (Employee elem in Program.employees)
            {
                if (elem.getId() == userId && elem.getPassword() == password.Trim())
                {
                    if (elem.getType().ToString().Equals("Mentor"))
                    {
                        Program.empUser = elem;
                        MentorMain m = new MentorMain();
                        m.Show();
                    }
                    if (elem.getType().ToString().Equals("Lecturer"))
                    {
                        Program.empUser = elem;
                        LecturerMain l = new LecturerMain();
                        l.Show();
                    }
                    if (elem.getType().ToString().Equals("LogisticCoordinator"))
                    {
                        Program.empUser = elem;
                        LogisticCoordinatorMain r = new LogisticCoordinatorMain();
                        r.Show();
                    }
                }
            }
            foreach (Student studi in Program.students)
            {
                if (studi.getId() == userId && studi.getPassword() == password.Trim())
                {
                    Program.studUser = studi;
                    StudentMain sm = new StudentMain();
                    sm.Show();
                }
            }

            if (Program.studUser == null && Program.empUser == null && checkFlag != 1)
            {
                MessageBox.Show("User does not Exist", "Error", MessageBoxButtons.OK);
            }

            if (Program.studUser != null || Program.empUser != null)
            {
                this.Hide();
            }
        }