Esempio n. 1
0
        private static SubjectCoords GetSubjectCoords(HomeworkItem homework, ScheduleItem schedule)
        {
            SubjectCoords coords = new SubjectCoords();

            for (int i = 0; i < schedule.Schedule.Count; i++)
            {
                for (int j = 0; j < schedule.Schedule[i].Count; j++)
                {
                    if (homework.Week % 2 != 0)
                    {
                        if (schedule.Schedule[i][j][0] == homework.Subject)
                        {
                            coords.DayOfWeek     = i;
                            coords.SubjectNumber = j;
                            coords.WeekType      = 0;
                            return(coords);
                        }
                    }
                    else
                    {
                        if (schedule.Schedule[i][j][1] == homework.Subject)
                        {
                            coords.DayOfWeek     = i;
                            coords.SubjectNumber = j;
                            coords.WeekType      = 1;
                            return(coords);
                        }
                    }
                }
            }
            return(coords);
        }
Esempio n. 2
0
        public static int GetRemainedDays(UserInfoItem userInfo, HomeworkItem homework, ScheduleItem schedule)
        {
            int currentWeek = Utils.GetCurrentWeek(userInfo.StartDate);

            SubjectCoords coords = GetSubjectCoords(homework, schedule);

            int days  = 0;
            int today = (Convert.ToInt32(DateTime.Now.DayOfWeek) + 6) % 7;

            days = (homework.Week - currentWeek) * 7 + (coords.DayOfWeek - today);
            return(days);
        }