示例#1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string status = string.Empty;

            try
            {
                base.OnNavigatedTo(e);
                GetID = (int)e.Parameter;
                SubjectModel = new SubjectsViewModel();
                subjets = SubjectModel.GetAllSubjects(GetID);

                if (subjets != null)
                {
                    foreach (var s in subjets)
                    {
                        cmbSubjects.Items.Add(s.SbjName);
                    }
                }
                else
                {
                    status = "No Subjects found";
                }
            }
            catch (Exception ex)
            {
                messageBox("error " + ex.Message);
            }

            if (status != string.Empty)
                messageBox(status);


        }
示例#2
0
        private bool verifyDuplication(string name)
        {
            bool status = false;

            SubjectModel = new SubjectsViewModel();

            subjets = SubjectModel.GetAllSubjects(GetID);
            if (subjets != null)
            {
                foreach (var s in subjets)
                {
                    if (name == s.SbjName)
                    {
                        status = true;
                    }
                }
            }
            return status;
        }
示例#3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            cmbSubjects.Items.Clear();
            SubjectModel = new SubjectsViewModel();

            string status = string.Empty;

            try
            {
                base.OnNavigatedTo(e);
                GetID = (int)e.Parameter;
                if (timer.IsEnabled != true)
                {
                    subjets = SubjectModel.GetAllSubjects(GetID);
                    if (subjets != null)
                    {
                        foreach (var s in subjets)
                        {
                            cmbSubjects.Items.Add(s.SbjName);
                        }
                    }
                    else
                    {
                        status = "No Subjects in the database";
                    }
                }
                else
                {
                    status = "Study Time has already been started, please try again after time is finished";
                }
            }
            catch (Exception ex)
            {
                messageBox("error " + ex.Message);
            }

            if (status != string.Empty)
                messageBox(status);

           
        }
示例#4
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;
        }