private void LearningPlanList_Load(object sender, EventArgs e) { IntPtr pIcon = Resources.applebooks.GetHicon(); Icon = Icon.FromHandle(pIcon); lpRepo = new LearningPlanRepo(ApiEndpoint); lpdRepo = new LearningPlanDisciplineRepo(ApiEndpoint); lpdsRepo = new LearningPlanDisciplineSemesterRepo(ApiEndpoint); fRepo = new FacultyRepo(ApiEndpoint); Faculties = fRepo.all().OrderBy(f => f.sorting_order).ToList(); lpFaculty.DisplayMember = "name"; lpFaculty.ValueMember = "id"; lpFaculty.DataSource = Faculties; RefreshLearningPlanList(); }
private void RefreshView(RefreshType refreshType) { if (refreshType == RefreshType.FacultiesOnly || refreshType == RefreshType.FullRefresh) { var faculties = fRepo .all() .OrderBy(f => f.sorting_order) .ToList(); FacultiesListView.DataSource = faculties; FacultiesListView.Columns["id"].Visible = false; FacultiesListView.Columns["sorting_order"].Visible = false; FacultiesListView.Columns["name"].Width = FacultiesListView.Width - 30; FacultiesListView.Columns["letter"].Width = 30; } if (refreshType == RefreshType.GroupsOnly || refreshType == RefreshType.FullRefresh) { Faculty faculty = null; if (FacultiesListView.SelectedCells.Count > 0) { faculty = ((List <Faculty>)FacultiesListView.DataSource)[FacultiesListView.SelectedCells[0].RowIndex]; } if (faculty == null) { return; } var facultyGroups = sgRepo.facultyAll(faculty.id); GroupsView.DataSource = facultyGroups; GroupsView.Columns["id"].Visible = false; GroupsView.Columns["name"].Width = GroupsView.Width - 200; GroupsView.Columns["from"].Width = 80; GroupsView.Columns["to"].Width = 80; } }