public AssignSubjectsToGroupControl() { InitializeComponent(); List <Group> groupsList = otherData.GetAllGroups(); foreach (Group group in groupsList) { groupsBox.Items.Add(group.Name); } }
private void addButton_Click(object sender, EventArgs e) { try { if (groupBox.Text.Trim(' ').Equals("")) { throw new Exception("Grupės pavadinimas negali būti tusčias"); } List <Group> groupsList = otherData.GetAllGroups(); foreach (Group group in groupsList) { if (group.Name == groupBox.Text) { throw new Exception("Jau egzistuoja tokia grupe"); } } otherData.AddNewGroup(groupBox.Text); MessageBox.Show("Sėkmingai pridėjote naują grupę"); groupBox.Clear(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void RemoveGroup_Click(object sender, EventArgs e) { flowLayoutPanel2.Controls.Clear(); List <Group> groupsList = otherData.GetAllGroups(); foreach (Group group in groupsList) { RemoveGroup iac = new RemoveGroup(group); flowLayoutPanel2.Controls.Add(iac); } }
private void subjectsBox_SelectedIndexChanged(object sender, EventArgs e) { selectedSubject = null; foreach (Subject subject in currentSubjectsList) { if (subject.Title == subjectsBox.Text) { selectedSubject = subject; } } groupsBox.SelectedIndex = -1; studentsBox.SelectedIndex = -1; groupsBox.Items.Clear(); studentsBox.Items.Clear(); currentGroupsList.Clear(); List <Group> groupsList = otherData.GetAllGroups(); List <Subject_Group> subject_groupList = otherData.GetAllSubject_Group(); foreach (Subject subject in currentSubjectsList) { if (subject.Title == subjectsBox.Text) { foreach (Subject_Group subject_Group in subject_groupList) { if (subject_Group.Subject_id == subject.Id) { groupsBox.Items.Add(otherData.FindGroupNameById(subject_Group.Group_id)); Group group = new Group(subject_Group.Group_id, otherData.FindGroupNameById(subject_Group.Group_id)); currentGroupsList.Add(group); groupsBox.Visible = true; groupsLabel.Visible = true; groupsLabel.Text = "PASIRINKITE STUDENTŲ GRUPĘ:"; studentsLabel.Visible = false; GradeStudentLabelsAndButtonFalse(); } } } } if (groupsBox.Items.Count == 0) { groupsBox.Visible = false; groupsLabel.Visible = true; groupsLabel.Text = "ŠIS DĖSTOMAS DALYKAS NETURI PRISKIRTŲ GRUPIŲ"; studentsLabel.Visible = false; studentsBox.Visible = false; GradeStudentLabelsAndButtonFalse(); } }
public AssignStudentsToGroupControl() { InitializeComponent(); List <Group> groupsList = otherData.GetAllGroups(); foreach (Group group in groupsList) { groupsBox.Items.Add(group.Name); } List <Student> studentsList = usersData.GetAllUnassignedStudents(); foreach (Student student in studentsList) { groupsListBox.Items.Add(student.Name + " " + student.Surname); } if (groupsListBox.Items.Count == 0) { groupsListBox.Visible = false; noStudentsLabel.Visible = true; groupsBox.Visible = false; label1.Visible = false; addButton.Visible = false; } else { groupsListBox.Visible = true; noStudentsLabel.Visible = false; groupsBox.Visible = true; label1.Visible = true; addButton.Visible = true; } }