Beispiel #1
0
        private void AddStudentForm_Load(object sender, EventArgs e)
        {
            Student t = CoursesRequests.GetStudent(EditId);

            if (t == null)
            {
                Close();
            }
            else
            {
                nameBox.Text            = t.Name;
                groupBox.Text           = t.GroupN.ToString();
                schoolBox.DisplayMember = "Name";
                schoolBox.ValueMember   = "Id";
                schoolBox.DataSource    = CoursesRequests.GetSchools();
                if (t.SchoolId != null)
                {
                    schoolBox.SelectedValue = t.SchoolId;
                }
            }
        }
Beispiel #2
0
        private void RefreshTab(string name)
        {
            switch (name)
            {
            case "TeachersPage":
            {
                TeachersGridView.DataSource = CoursesRequests.GetTeachers().Where(p => p.Name.Contains(findTeacherBox.Text)).ToList();
                if (TeachersGridView.RowCount == 0)
                {
                    CallDTeacherForm.Enabled = CallETeacherForm.Enabled = false;
                }
                else
                {
                    CallDTeacherForm.Enabled = CallETeacherForm.Enabled = true;
                } break;
            }

            case "SchoolsPage":
            {
                SchoolsGridView.DataSource = CoursesRequests.GetSchools().Where(p => p.Name.Contains(findSchoolBox.Text)).ToList();
                if (SchoolsGridView.RowCount == 0)
                {
                    CallDSchoolForm.Enabled = CallESchoolForm.Enabled = false;
                }
                else
                {
                    CallDSchoolForm.Enabled = CallESchoolForm.Enabled = true;
                } break;
            }

            case "SubjectsPage":
            {
                SubjectsGridView.DataSource = CoursesRequests.GetSubjects().Where(p => p.Name.Contains(findSubjectBox.Text)).ToList();
                if (SubjectsGridView.RowCount == 0)
                {
                    CallDSubjectForm.Enabled = CallESubjectForm.Enabled = false;
                }
                else
                {
                    CallDSubjectForm.Enabled = CallESubjectForm.Enabled = true;
                } break;
            }

            case "StudentsPage":
            {
                StudentsGridView.DataSource = CoursesRequests.GetStudentViews().Where(p => p.Name.Contains(findStudentBox.Text)).ToList();
                if (StudentsGridView.RowCount == 0)
                {
                    CallDStudentForm.Enabled = CallEStudentForm.Enabled = false;
                }
                else
                {
                    CallDStudentForm.Enabled = CallEStudentForm.Enabled = true;
                } break;
            }

            case "CoursesPage":
            {
                CoursesGridView.Columns[3].DefaultCellStyle.Format = "C";
                CoursesGridView.DataSource = CoursesRequests.GetCourseViews();
                if (CoursesGridView.RowCount == 0)
                {
                    CallDCourseForm.Enabled = CallECourseForm.Enabled = false;
                }
                else
                {
                    CallDCourseForm.Enabled = CallECourseForm.Enabled = true;
                } break;
            }

            default: break;
            }
        }
 private void AddStudentForm_Load(object sender, EventArgs e)
 {
     schoolBox.DisplayMember = "Name";
     schoolBox.ValueMember   = "Id";
     schoolBox.DataSource    = CoursesRequests.GetSchools();
 }