Example #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                base.OnNavigatedTo(e);
                GetID = (int)e.Parameter;

                ReminderModel = new RemindersViewModel();
                reminders = ReminderModel.GetAllReminders(GetID);
                string status = string.Empty;

                if (reminders != null)
                {
                    DateTimeOffset datepicker = System.DateTimeOffset.Now.AddDays(1);
                    string date = datepicker.ToString();
                    string reminderdate = date.Substring(0, 10);

                    DateTimeOffset datepicker1 = System.DateTimeOffset.Now.AddDays(0);
                    string date1 = datepicker1.ToString();
                    string reminderdate1 = date1.Substring(0, 10);
                    lstOutput.Items.Clear();

                    foreach (var r in reminders)
                    {
                        if (r.rDate == reminderdate1)
                        {
                            lstOutput.Items.Add(r.rName + " is due today!!.");
                        }
                        else if (r.rDate == reminderdate)
                        {
                            lstOutput.Items.Add(r.rName + " is due the next day.");
                        }
                    }
                }
                else
                {
                    status = "No reminders found for the next 3 days";
                }

                if (status != string.Empty)
                    messageBox(status);
            }
            catch (Exception ex)
            {
                messageBox("error " + ex.Message);
            }
        }
Example #2
0
        private void cmbOutput_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string output = string.Empty;
            btnClear.IsEnabled = true;

            string status = string.Empty;

            try
            {
                output = (string)cmbOutput.SelectedItem;

                if (output != null)
                {
                    if (output == "Progress")
                    {
                        SubjectModel = new SubjectsViewModel();
                        subjets = SubjectModel.GetAllSubjects(GetID);

                        if (subjets != null)
                        {
                            lsvOutput.Items.Clear();
                            foreach (var s in subjets)
                            {
                                lsvOutput.Items.Add("=========================");
                                lsvOutput.Items.Add("Progress Details");
                                lsvOutput.Items.Add("Name: " + s.SbjName);
                                lsvOutput.Items.Add("Goal Mark: " + s.SbjMark);
                                lsvOutput.Items.Add("Obtained Mark: " + s.ObtainMark);
                                lsvOutput.Items.Add("Performance: " + s.Performance);
                            }
                            btnClear.Content = "Delete all Subjects";
                        }
                        else
                        {
                            status = "No Subjects found";
                        }
                    }
                   else if (output == "Reminders")
                    {
                        ReminderModel = new RemindersViewModel();
                       
                            reminders = ReminderModel.GetAllReminders(GetID);
                            if (reminders != null)
                            {
                                lsvOutput.Items.Clear();
                                foreach (var r in reminders)
                                {
                                    lsvOutput.Items.Add("=========================");
                                    lsvOutput.Items.Add("Reminder Details");
                                    lsvOutput.Items.Add("Name: " + r.rName);
                                    lsvOutput.Items.Add("Due Date: " + r.rDate);
                                }
                                btnClear.Content = "Delete all Reminders";
                            }
                            else
                            {
                                status = "No Reminders found";
                            }
                    }
                    else if (output == "StudyTime")
                    {
                        StudyModel = new StudysViewModel();
                        
                            study = StudyModel.GetAllStudies(GetID);
                            if (study != null)
                            {
                                lsvOutput.Items.Clear();
                                foreach (var s in study)
                                {
                                    lsvOutput.Items.Add("=========================");
                                    lsvOutput.Items.Add("Study Details");
                                    lsvOutput.Items.Add("Name: " + s.StudyName);
                                    lsvOutput.Items.Add("Duration: " + s.Duration);
                                    lsvOutput.Items.Add("Date: " + s.Date);
                                }
                                btnClear.Content = "Delete all Study Times";
                            }
                            else
                            {
                                status = "No Studies found";
                            }
                    }
                   
                }
                else
                {
                    status = "No output is selected above";
                }
            }
            catch (Exception ex)
            {
                messageBox("error " + ex.Message);
            }

            if (status != string.Empty)
                messageBox(status);
            btnClear.Visibility = Visibility.Visible;
        }
Example #3
0
        private void btnThree_Click(object sender, RoutedEventArgs e)
        {
            ReminderModel = new RemindersViewModel();
            reminders = ReminderModel.GetAllReminders(GetID);
            string status = string.Empty;

            try
            {
                if (reminders != null)
                {
                    DateTimeOffset datepicker = System.DateTimeOffset.Now.AddDays(3);
                    string date = datepicker.ToString();
                    string reminderdate = date.Substring(0, 10);

                    lstOutput.Items.Clear();
                    foreach (var r in reminders)
                    {

                        if (r.rDate == reminderdate)
                        {
                            lstOutput.Items.Add(r.rName + " is due in the next 3 days.");
                        }
                    }
                }
                else
                {
                    status = "No reminders found for the next 3 days.";
                }

                if (status != string.Empty)
                    messageBox(status);
            }
            catch (Exception ex)
            {
                messageBox("error " + ex.Message);
            }
        }
Example #4
0
        private bool verifyDuplication(string name)
        {
            bool status = false;

            ReminderModel = new RemindersViewModel();

            reminders = ReminderModel.GetAllReminders(GetID);
            if (reminders != null)
            {
                foreach (var r in reminders)
                {
                    if (name == r.rName)
                    {
                        status = true;
                    }
                }
            }
            return status;
        }