Esempio n. 1
0
        public Dictionary <DateTime, List <Models.WashingDayDefinition> > GetFutureDays()
        {
            var c = new FutureDayListController <WashingDayDefinition>();

            foreach (var d in MainSession.WashingDays)
            {
                var scheduleController = new ScheduleController(d.Scheduled);
                c.AddMultiple(d, scheduleController.GetScheduledDays());
            }
            return(c.GetAllDays());
        }
        public WashingDayInstance GetWashingDayInstance(DateTime date)
        {
            foreach (var i in mWashingDay.Instances)
            {
                if (ScheduleController.IsSameDay(date, i.Day))
                {
                    return(i);
                }
            }

            return(new WashingDayInstance(mWashingDay.ID, Guid.NewGuid().ToString(), date, GetRoutineDefinitions(), mWashingDay.Description));
        }
Esempio n. 3
0
        public void SetReminderShown(String id)
        {
            var list = LoadAlarmHistory();

            if (!list.ContainsKey(id))
            {
                list.Add(id, new AlarmHistory());
            }
            list[id].LastReminder = ScheduleController.GetToday();

            this.alarmHistoryDatabase.Save(list);
        }
Esempio n. 4
0
        public int TimeToNextCareDay()
        {
            var diff = Int32.MaxValue;

            foreach (var d in MainSession.WashingDays)
            {
                var c = new ScheduleController(d.Scheduled);
                var t = c.Time2NextCareDay(DateTime.Now);
                if (t < diff)
                {
                    diff = t;
                }
            }
            return(diff);
        }
Esempio n. 5
0
        private bool ReminderShown(string id)
        {
            var list = LoadAlarmHistory();

            if (list.ContainsKey(id))
            {
                var val = list[id];
                if (val.LastReminder == ScheduleController.GetToday())
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 6
0
        public bool AlarmShown(string id)
        {
            var list = LoadAlarmHistory();

            if (list.ContainsKey(id))
            {
                var val = list[id];
                if (val.LastAlarm == ScheduleController.GetToday())
                {
                    return(true);
                }
            }

            return(false);
        }
        public WashingDayEditorController(WashingDayDefinition wd, List <RoutineDefinition> allroutines, AlarmController ac)
        {
            if (wd == null)
            {
                throw new ArgumentNullException("wd");
            }
            if (ac == null)
            {
                throw new ArgumentNullException("ac");
            }

            this.mWashingDay         = wd;
            this.mAllRoutines        = allroutines;
            this.mScheduleController = new ScheduleController(wd.Scheduled);
            this.mAlarmController    = ac;
        }
Esempio n. 8
0
        public List <ScheduleSqlDefinition> GetTodayWashDays()
        {
            var wdId = new List <ScheduleSqlDefinition>();
            var list = LoadScheduleDatabase();

            foreach (var schedule in list.Values)
            {
                var s          = schedule.GetDefinition();
                var controller = new ScheduleController(s);
                if (controller.IsCareDay(DateTime.Now))
                {
                    if (!AlarmShown(schedule.ID))
                    {
                        wdId.Add(schedule);
                    }
                }
            }
            return(wdId);
        }
Esempio n. 9
0
        public List <ScheduleSqlDefinition> GetReminderWashDays()
        {
            List <ScheduleSqlDefinition> wdId = new List <ScheduleSqlDefinition>();
            Dictionary <string, ScheduleSqlDefinition> list = LoadScheduleDatabase();

            foreach (var schedule in list.Values)
            {
                var s          = schedule.GetDefinition();
                var controller = new ScheduleController(s);
                if (controller.IsCareDay(ScheduleController.GetToday().AddDays(1)))
                {
                    if (!ReminderShown(schedule.ID))
                    {
                        wdId.Add(schedule);
                    }
                }
            }
            return(wdId);
        }
Esempio n. 10
0
        public CommingDays NextDay()
        {
            var diff = new CommingDays();

            foreach (var d in MainSession.WashingDays)
            {
                var c = new ScheduleController(d.Scheduled);
                var t = c.Time2NextCareDay(ScheduleController.GetToday());
                if (t <= diff.Time2Wait)
                {
                    diff.Time2Wait = t;
                    diff.Days      = new List <WashingDayDefinition> {
                        d
                    };
                }
                else if (t == diff.Time2Wait)
                {
                    diff.Time2Wait = t;
                    diff.Days.Add(d);
                }
            }
            return(diff);
        }