private void cmb_courses_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmb_courses.SelectedIndex == -1)
            {
                return;
            }

            listView_children.Items.Clear();
            var course = ((Course)cmb_courses.SelectedItem);

            lbl_ageReq.Content = "Age restriction from " + course.AcademicYearStart + " To " + course.AcademicYearEnd;;

            Globals.Children.ToList().ForEach(x =>
            {
                if (x.Value.Age >= course.AcademicYearStart && x.Value.Age <= course.AcademicYearEnd)
                {
                    var newChild = new Objects.CheckedObject()
                    {
                        Checked = false,
                        Child   = x.Value,
                    };

                    if (EditedClass != null && x.Value.RegisteredCourses.Contains(EditedClass))
                    {
                        newChild.Checked = true;
                    }

                    listView_children.Items.Add(newChild);
                }
            });
        }
Esempio n. 2
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Title                 = c.Name + " Properties";
                lbl_courseName.Content     = c.Name;
                lbl_cost.Content           = c.Cost + " (" + CashType + ")";
                lbl_from.Content           = c.AcademicYearStart + " Years old";
                lbl_to.Content             = c.AcademicYearEnd + " Years old";
                lbl_level.Content          = c.Level;
                lbl_totalSessions.Content  = c.TotalSessions + " Days";
                lbl_salaryPerChild.Content = c.PricePerChild + "%";

                lbl_sessionHours.Content = c.SessionDuration + " Hours";

                foreach (var item in (Globals.Children.ToList().Where(x => x.Value.RegisteredCourses.Exists(y => y.CourseId == c.Id))))
                {
                    listView_children.Items.Add(item.Value);
                }

                for (int i = 0; i < c.Classes.Count; i++)
                {
                    var aClass = new Objects.CheckedObject();
                    aClass.Course = c;
                    aClass.Class  = c.Classes[i];
                    if (Globals.Instructors.ToList().Exists(x => x.Value.TeachingCourses.Contains(c.Classes[i])))
                    {
                        aClass.Instructor = Globals.Instructors.ToList().Single(x => x.Value.TeachingCourses.Contains(c.Classes[i])).Value;
                    }
                    else
                    {
                        aClass.Instructor = new Instructor()
                        {
                            Name = "---"
                        }
                    };                                                         //hehe xd
                    listView_sections.Items.Add(aClass);
                }

                lbl_totalChildren.Content = listView_children.Items.Count;
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
            }
        }