private void addButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (titleBox.Text.Trim(' ').Equals(""))
                {
                    throw new Exception("Dėstomo dalyko pavadinimas negali būti tusčias");
                }

                List <Subject> subjectsList = otherData.GetAllSubjects();
                foreach (Subject subject in subjectsList)
                {
                    if (subject.Title == titleBox.Text)
                    {
                        throw new Exception("Jau egzistuoja toks dėstomas dalykas");
                    }
                }
                otherData.AddNewSubject(titleBox.Text, descriptionBox.Text);
                MessageBox.Show("Sėkmingai pridėjote naują dėstomą dalyką");

                titleBox.Clear();
                descriptionBox.Clear();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
        private void groupsBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Subject_Group> subjectsGroupsList = otherData.GetAllSubject_Group();
            List <Group>         groupsList         = otherData.GetAllGroups();
            List <Subject>       subjectsList       = otherData.GetAllSubjects();

            foreach (Subject subject in subjectsList)
            {
                subjectsListBox.Items.Remove(subject.Title);
            }

            foreach (Group group in groupsList)
            {
                if (groupsBox.Text == group.Name)
                {
                    foreach (Subject subject in subjectsList)
                    {
                        subjectsListBox.Items.Add(subject.Title);
                        foreach (Subject_Group subject_Group in subjectsGroupsList)
                        {
                            if (subject_Group.Subject_id == subject.Id && subject_Group.Group_id == group.Id)
                            {
                                subjectsListBox.Items.Remove(subject.Title);
                            }
                        }
                    }
                }
            }
        }
        private void RemoveSubject_Click(object sender, EventArgs e)
        {
            flowLayoutPanel2.Controls.Clear();
            List <Subject> subjectsList = otherData.GetAllSubjects();

            foreach (Subject subject in subjectsList)
            {
                RemoveSubject iac = new RemoveSubject(subject);
                flowLayoutPanel2.Controls.Add(iac);
            }
        }