Esempio n. 1
0
        public ParentReportVM GetParentReportVM(int childId)
        {
            int weekDay = (int)DateTime.Today.DayOfWeek;

            var child = context.Children
                        .Include(o => o.Schedules)
                        .Where(c => c.Id == childId)
                        .SingleOrDefault();

            ParentReportVM parentReportVM = new ParentReportVM();

            foreach (Schedules schedule in child.Schedules)
            {
                if (schedule.Weekdays == weekDay)
                {
                    parentReportVM.DropOffTime = schedule.Dropoff == null ? default(TimeSpan) : (TimeSpan)schedule.Dropoff;
                    parentReportVM.PickupTime  = schedule.PickUp == null ? default(TimeSpan) : (TimeSpan)schedule.PickUp;
                    parentReportVM.FirstName   = schedule.Children.FirstName;
                    parentReportVM.ChildId     = schedule.Children.Id;
                    parentReportVM.IsActive    = schedule.Children.IsIll == null ? false : (bool)schedule.Children.IsIll;
                    parentReportVM.IsPresent   = schedule.Children.IsPresent;
                    parentReportVM.MinLate     = (int)schedule.Children.MinLate;
                }
            }
            return(parentReportVM);
        }
Esempio n. 2
0
        //public static TeacherStartVM GetTestTeacherStartVM()
        //{
        //    TeacherStartChildItemVM[] children = new TeacherStartChildItemVM[5]
        //    {
        //    new TeacherStartChildItemVM{FirstName = "Sara", LastName = "Andersson", IsPresent = true, DropOfTime = dropOff1, PickupTime = pickUp1},
        //    new TeacherStartChildItemVM{FirstName = "Kalle", LastName = "Johansson", IsPresent = false, DropOfTime = dropOff1, PickupTime = pickUp2},
        //    new TeacherStartChildItemVM{FirstName = "Olle", LastName = "Lundmark", IsPresent = true, DropOfTime = dropOff2, PickupTime = pickUp1},
        //    new TeacherStartChildItemVM{FirstName = "Anna", LastName = "Marklund", IsPresent = false, DropOfTime = dropOff1, PickupTime = pickUp2},
        //    new TeacherStartChildItemVM{FirstName = "Pelle", LastName = "Eriksson", IsPresent = true, DropOfTime = dropOff2, PickupTime = pickUp2}
        //    };

        //    TeacherStartVM teacherStartVM = new TeacherStartVM();

        //    teacherStartVM.ChildItems = children;

        //    int counter = 0;
        //    foreach (var item in children)
        //    {
        //        if (item.IsPresent)
        //        {
        //            counter++;
        //        }
        //    }

        //    teacherStartVM.PresentChildrenCount = counter;

        //    return teacherStartVM;
        //}

        internal static ParentReportVM GetTestParentReportData()
        {
            ParentReportVM parentReportVM = new ParentReportVM();

            parentReportVM.DropOffTime = dropOff1;
            parentReportVM.PickupTime  = pickUp1;
            parentReportVM.FirstName   = "Olle";
            parentReportVM.IsActive    = true;
            parentReportVM.IsPresent   = true;
            parentReportVM.ChildId     = 1;
            return(parentReportVM);
        }