Exemple #1
0
        public UnassignSubjectFromProfessorControl()
        {
            InitializeComponent();
            List <Subject> subjectsList = otherData.GetAllAssignedSubjects();

            foreach (Subject subject in subjectsList)
            {
                subjectsListBox.Items.Add(subject.Title);
            }
        }
Exemple #2
0
        public StudentWindow()
        {
            InitializeComponent();
            int groupId = otherData.GetStudentsGroup(student.Name, student.Surname);

            userLabel.Text += student.Name + " " + student.Surname;

            List <Subject_Group> allSubjectsAndGroups        = otherData.GetAllSubject_Group();
            List <Subject>       allAssignedsubjectsList     = otherData.GetAllAssignedSubjects();
            List <Subject_Group> studentsSubjectsAndGroupIds = new List <Subject_Group>();
            List <Subject>       studentSubjects             = new List <Subject>();

            foreach (Subject_Group subject_Group in allSubjectsAndGroups)
            {
                if (subject_Group.Group_id == groupId)
                {
                    studentsSubjectsAndGroupIds.Add(subject_Group); // Pridedami į listą visi studento subjectsid
                }
            }

            foreach (Subject subject in allAssignedsubjectsList)
            {
                foreach (Subject_Group subject_Group in studentsSubjectsAndGroupIds)
                {
                    if (subject_Group.Subject_id == subject.Id)
                    {
                        studentSubjects.Add(subject); // Pridedami į listą visi studento subjects
                    }
                }
            }

            int width = SubjectsLayoutPanel.Width - 7;

            foreach (Subject subject in studentSubjects)
            {
                Button subjectButton = new Button();
                subjectButton.Text  = subject.Title;
                subjectButton.Width = width;
                subjectButton.UseVisualStyleBackColor = true;
                subjectButton.Tag    = subject;
                subjectButton.Click += SubjectButton_Click;
                SubjectsLayoutPanel.Controls.Add(subjectButton);
            }
        }
Exemple #3
0
        public ProfessorWindow()
        {
            InitializeComponent();
            userLabel.Text += professor.degree + " " + professor.Name + " " + professor.Surname;

            List <Subject> subjectsList = otherData.GetAllAssignedSubjects();

            foreach (Subject subject in subjectsList)
            {
                if (professor.Id == otherData.FindSubjectProfessorId(subject.Title))
                {
                    subjectsBox.Items.Add(subject.Title);
                    currentSubjectsList.Add(subject);
                }
            }
            if (subjectsBox.Items.Count == 0)
            {
                groupsBox.Visible = false;
                GradeStudentLabelsAndButtonFalse();
            }
        }