コード例 #1
0
ファイル: Form1.cs プロジェクト: ssoldner21/SMSSchoolForm2
        private void btnAdd_Click(object sender, EventArgs e)
        {
            switch (tabControl1.SelectedIndex)
            {
                case 0: //student
                    Student ns = new Student();
                    NewMember addNewStudent = new NewMember(ns, tabControl1.SelectedIndex);
                    addNewStudent.ShowDialog();
                    populateStudents();
                    break;

                case 1: //teacher
                    Teacher nt = new Teacher();
                    NewMember addNewTeacher = new NewMember(nt, tabControl1.SelectedIndex);
                    addNewTeacher.ShowDialog();
                    populateTeachers();
                    break;

                case 2: //staff
                    Staff nsm = new Staff();
                    NewMember addNewStaff = new NewMember(nsm, tabControl1.SelectedIndex);
                    addNewStaff.ShowDialog();
                    populateStaff();
                    break;
            }
        }
コード例 #2
0
 public NewMember(Teacher t, int index)
 {
     InitializeComponent();
     tabControl1.SelectedIndex = index;
     t = newTeacher;
     tabIndex = index;
     lblDepartment.Visible = true;
     lblDateHiredTeacher.Visible = true;
     dateTimeTeacherHired.Visible = true;
     cbTeacherDepartment.Visible = true;
 }
コード例 #3
0
 public EditMember(Teacher t, int tabIndexSwitch)
 {
     InitializeComponent();
     txtFirstName.Text = t.FirstName;
     txtLastName.Text = t.LastName;
     dateTimeTeacherHired.Value = t.DateHired;
     cbTeacherDepartment.Text = t.Department;
     editTeacher = t;
     STSmSwitch = tabIndexSwitch;
     tabControl1.SelectedIndex = STSmSwitch;
     lblDateHiredTeacher.Visible = true;
     dateTimeTeacherHired.Visible = true;
     lblDepartment.Visible = true;
     cbTeacherDepartment.Visible = true;
 }