コード例 #1
0
ファイル: Form14.cs プロジェクト: Tete1999/ClassRegistration
 private void button1_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem != null)
     {
         string   fac    = listBox1.SelectedItem.ToString();
         Form15   form15 = new Form15(ref DDD, fac);
         Faculty2 fac2   = DDD.getFacultyObject(fac);
         string   s      = fac2.firstName + " " + fac2.middleName + " " + fac2.lastName;
         form15.ChangeLabelName(s);
         form15.ShowDialog();
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Tete1999/ClassRegistration
        private void button1_Click(object sender, EventArgs e)
        {
            //Form2 form2 = new Form2(students, admin, faculty, courses, null);
            bool flag = false;


            foreach (DataRow row in DDD.FacultyDB.Rows)
            {
                if (row.Field <string>(0) == textBox1.Text.ToLower() && row.Field <string>(1) == textBox2.Text)
                {
                    Faculty2 fac   = DDD.getFacultyObject(textBox1.Text.ToLower());
                    Form5    form5 = new Form5(ref DDD, fac.user);
                    //List<Course> studentsCourses = element.getRegisteredCourses();
                    //courseBox = new List<string>();
                    //if (studentsCourses == null)
                    //{
                    //    courseBox.Add("You are not registered for any courses yet!");
                    //}
                    //else
                    //{
                    //    courseBox.Clear();
                    //    foreach (Course c in studentsCourses)
                    //    {
                    //        courseBox.Add(c.ToString());
                    //    }
                    //}


                    string s = "Welcome " + fac.firstName + " " + fac.middleName + " " + fac.lastName;
                    form5.ChangeLabelName(s);
                    form5.ShowDialog();
                    flag = true;
                    form5.Refresh();
                    break;
                    //Faculty2 faculty = DDD.getFacultyObject(textBox1.Text.ToLower());
                    //Form5 form5 = new Form5(ref DDD, faculty.user);
                    //string s = "Welcome " + faculty.firstName + " " +  faculty.middleName + " " +  faculty.lastName;
                    //form5.ChangeLabelName(s);
                    //form5.ShowDialog();
                    //flag = true;
                    //form5.Refresh();
                    //break;
                }
            }
            foreach (DataRow row in DDD.AdminDB.Rows)
            {
                if (row.Field <string>(0) == textBox1.Text.ToLower() && row.Field <string>(1) == textBox2.Text)
                {
                    Admin2 adm   = DDD.getAdminObject(textBox1.Text.ToLower());
                    Form9  form9 = new Form9(ref DDD, adm.user);
                    //Admin2 admin = DDD.getAdminObject(textBox1.Text.ToLower());
                    //Form2 form2 = new Form2(DDD, admin);
                    //string s = "Welcome " + admin.firstName + " " +  admin.middleName + " " +  admin.lastName;
                    //form2.ChangeLabelName(s);
                    //form2.ShowDialog();
                    //flag = true;
                    //break;
                    string s = "Welcome " + adm.firstName + " " + adm.middleName + " " + adm.lastName;
                    form9.ChangeLabelName(s);
                    form9.ShowDialog();
                    flag = true;
                    form9.Refresh();
                    break;
                }
            }
            foreach (DataRow row in DDD.StudentDB.Rows)
            {
                if (row.Field <string>(0) == textBox1.Text.ToLower() && row.Field <string>(1) == textBox2.Text)
                {
                    Student2 student = DDD.getStudentObject(textBox1.Text.ToLower());
                    Form2    form2   = new Form2(ref DDD, student.user);
                    //List<Course> studentsCourses = element.getRegisteredCourses();
                    //courseBox = new List<string>();
                    //if (studentsCourses == null)
                    //{
                    //    courseBox.Add("You are not registered for any courses yet!");
                    //}
                    //else
                    //{
                    //    courseBox.Clear();
                    //    foreach (Course c in studentsCourses)
                    //    {
                    //        courseBox.Add(c.ToString());
                    //    }
                    //}


                    string s = "Welcome " + student.firstName + " " + student.middleName + " " + student.lastName;
                    form2.ChangeLabelName(s);
                    form2.ShowDialog();
                    flag = true;
                    form2.Refresh();
                    break;
                }
            }

            if (flag == false)
            {
                MessageBox.Show("The Username or Password is Incorrect", "Error");
                textBox2.Text = "";
            }
            else
            {
                textBox1.Text = "";
                textBox2.Text = "";
            }
        }