private void FetchTasks()
        {
            Monday.Clear();
            Tuesday.Clear();
            Wednesday.Clear();
            Thursday.Clear();
            Friday.Clear();
            Saturday.Clear();
            Sunday.Clear();
            List <DailyTask> Models = db.DailyTasks
                                      .Where(p => p.UserId == User.Id)
                                      .ToList <DailyTask>();

            foreach (var m in Models)
            {
                if (m.Date.HasValue)
                {
                    Debug.WriteLine("Has value!");
                    if (m.Date.Value.Date == (WeekDates[0].Date))
                    {
                        Monday.Add(m);
                    }
                    else if (m.Date.Value.Date == (WeekDates[1].Date))
                    {
                        Tuesday.Add(m);
                    }
                    else if (m.Date.Value.Date == (WeekDates[2].Date))
                    {
                        Wednesday.Add(m);
                    }
                    else if (m.Date.Value.Date == (WeekDates[3].Date))
                    {
                        Thursday.Add(m);
                    }
                    else if (m.Date.Value.Date == (WeekDates[4].Date))
                    {
                        Friday.Add(m);
                    }
                    else if (m.Date.Value.Date == (WeekDates[5].Date))
                    {
                        Saturday.Add(m);
                    }
                    else if (m.Date.Value.Date == (WeekDates[6].Date))
                    {
                        Sunday.Add(m);
                    }
                }
            }
        }
Esempio n. 2
0
        public void SortEvents()
        {
            ClearEventArrays();

            foreach (Event e in TimetableEvents)
            {
                switch (e.Day)
                {
                case 1:
                    Monday.Add(e);
                    break;

                case 2:
                    Tuesday.Add(e);
                    break;

                case 3:
                    Wednesday.Add(e);
                    break;

                case 4:
                    Thursday.Add(e);
                    break;

                case 5:
                    Friday.Add(e);
                    break;

                case 6:
                    Saturday.Add(e);
                    break;

                case 7:
                    Sunday.Add(e);
                    break;
                }
            }
        }
Esempio n. 3
0
        public void CopyData(AAS.DB.Course other)
        {
            CRN           = other.CRN;
            Subject       = other.Subject;
            Credits       = other.Credits;
            Title         = other.Title;
            CourseNumber  = other.CourseNumber;
            SectionNumber = other.SectionNumber;

            foreach (AAS.DB.Period p in other.Periods)
            {
                if (p.DayOfWeek.ToUpper() == "M")
                {
                    Monday.Add(new Period(p));
                }
                if (p.DayOfWeek.ToUpper() == "T")
                {
                    Tuesday.Add(new Period(p));
                }
                if (p.DayOfWeek.ToUpper() == "W")
                {
                    Wednesday.Add(new Period(p));
                }
                if (p.DayOfWeek.ToUpper() == "R")
                {
                    Thursday.Add(new Period(p));
                }
                if (p.DayOfWeek.ToUpper() == "F")
                {
                    Friday.Add(new Period(p));
                }
            }

            foreach (AAS.DB.Exam e in other.Exams)
            {
                Exams.Add(new Exam(e));
            }
        }
Esempio n. 4
0
        private async void DialogHost_DialogClosing(object sender, MaterialDesignThemes.Wpf.DialogClosingEventArgs eventArgs)
        {
            if (!Equals(eventArgs.Parameter, true))
            {
                return;
            }
            if (TaskTitle.Text != null && TaskDescription.Text != null && DialogTime.Text != null)
            {
                switch (DialogDays.Text)
                {
                case "Monday":
                    Monday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(MondayTitle));

                    break;

                case "Tuesday":
                    Tuesday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(TuesdayTitle));

                    break;

                case "Wednesday":
                    Wednesday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(WednesdayTitle));

                    break;

                case "Thursday":
                    Thursday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(ThursdayTitle));

                    break;

                case "Friday":
                    Friday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(FridayTitle));

                    break;

                case "Saturday":
                    Saturday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(SaturdayTitle));

                    break;

                case "Sunday":
                    Sunday.Add(new ListViewStruct
                    {
                        Title       = TaskTitle.Text,
                        Description = TaskDescription.Text,
                        Time        = DialogTime.Text,
                    });
                    await AddToDatabase(Convert.ToDateTime(SundayTitle));

                    break;
                }
            }
        }