Пример #1
0
 private void EditCIInfoBtn_Clicked(object sender, EventArgs e)
 {
     if (isValidEmail(Email.Text))
     {
         if (string.IsNullOrEmpty(Name.Text) || string.IsNullOrEmpty(PhoneNumber.Text) || string.IsNullOrEmpty(Email.Text))
         {
             DisplayAlert("Error", "Please Input Correct Data", "OK");
         }
         else
         {
             ci.Name        = Name.Text;
             ci.PhoneNumber = PhoneNumber.Text;
             ci.Email       = Email.Text;
             WGU.EditCourseInstructor(ci);
             Navigation.PopToRootAsync();
             var pages = Navigation.NavigationStack.ToList();
             foreach (var page in pages)
             {
                 Navigation.RemovePage(page);
             }
         }
     }
     else
     {
         DisplayAlert("Error", "Invalid Email Address", "OK");
     }
 }
 private void SaveBtn_Clicked(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TermTitle.Text))
     {
         DisplayAlert("Error", "Please Fill out All of the Information", "OK");
     }
     else
     {
         if (StartDatePicker.Date < EndDatePicker.Date)
         {
             int      termID    = MainPage.term.TermID;
             string   TermName  = TermTitle.Text;
             DateTime startDate = StartDatePicker.Date;
             DateTime endDate   = EndDatePicker.Date;
             MainPage.terms1.Add(new Term(termID, TermName, startDate, endDate, MainPage.term.Courses));
             MainPage.terms1.Remove(MainPage.term);
             WGU.EditTerm(new Term(termID, TermName, startDate, endDate, MainPage.term.Courses));
             GoToMainPage();
         }
         else
         {
             DisplayAlert("Error", "Please check your dates again.", "OK");
         }
     }
 }
Пример #3
0
        private void SetAlertBtn_Clicked(object sender, EventArgs e)
        {
            DateTime AlertTime = new DateTime();

            AlertTime = DatePicker.Date + TimePicker.Time;
            TimeSpan date = CoursePage.course.EndDate.Subtract(DatePicker.Date);

            WGU.SetCourseNotifications(date, AlertTime);
            Navigation.PopAsync();
        }
Пример #4
0
        private void SetAlertBtn_Clicked(object sender, EventArgs e)
        {
            DateTime dt = new DateTime();

            dt = DatePicker.Date + TimePicker.Time;
            DateTime dt2 = TestsViewPage.test.AssessmentDate.Date + TestsViewPage.test.AssessmentTime.TimeOfDay;
            TimeSpan ts  = dt2.Subtract(DatePicker.Date);

            WGU.SetAssessmentNotifications(ts, dt);
            Navigation.PopAsync();
        }
Пример #5
0
        private void SaveCourseBtn_Clicked(object sender, EventArgs e)
        {
            Course course = new Course(Convert.ToInt32(CourseIDCell.Text), Convert.ToInt32(TermIDCell.Text), CourseNameCell.Text, CourseStartDate.Date,
                                       CourseEndDate.Date, CourseStatusPicker.SelectedItem.ToString(),
                                       CourseViewCell.Text, CourseNotesCell.Text, CoursePage.course.Instructor, CoursePage.course.Assessments);

            MainPage.term.Courses.Remove(CoursePage.course);
            MainPage.term.Courses.Add(course);
            WGU.EditCourse(course);
            GoToCoursesPage();
        }
 private void DeleteTermBtn_Clicked(object sender, EventArgs e)
 {
     Device.BeginInvokeOnMainThread(async() =>
     {
         var result = await DisplayAlert("Confirmation", "Are you sure you want to delete this term?", "Yes", "No");
         if (result)
         {
             WGU.DeleteTerm(term);
             MainPage.terms1.Remove(term);
             await Navigation.PopAsync();
         }
     });
 }
 private void DeleteCourseBtn_Clicked(object sender, System.EventArgs e)
 {
     Device.BeginInvokeOnMainThread(async() =>
     {
         var result = await DisplayAlert("Confirmation", "Are you sure you want to delete this course?", "Yes", "No");
         if (result)
         {
             WGU.DeleteCourse(course);
             course.Assessments.Clear();
             MainPage.term.Courses.Remove(course);
             await Navigation.PopAsync();
         }
     });
 }
 private void AddCourseBtn_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(CourseIDCell.Text) || string.IsNullOrWhiteSpace(CourseNameCell.Text) || string.IsNullOrWhiteSpace(CourseViewCell.Text))
         {
             DisplayAlert("Error", "Please input correct data", "OK");
         }
         else
         {
             if (CourseStartDate.Date > MainPage.term.StartDate && CourseStartDate.Date < MainPage.term.EndDate && CourseEndDate.Date > MainPage.term.StartDate &&
                 CourseEndDate.Date < MainPage.term.EndDate && CourseStartDate.Date < CourseEndDate.Date)
             {
                 int      courseID     = Convert.ToInt32(CourseIDCell.Text);
                 int      termID       = Convert.ToInt32(TermIDCell.Text);
                 string   courseName   = CourseNameCell.Text;
                 DateTime startDate    = CourseStartDate.Date;
                 DateTime endDate      = CourseEndDate.Date;
                 string   courseStatus = CourseStatusPicker.SelectedItem.ToString();
                 string   courseView   = CourseViewCell.Text;
                 string   courseNotes  = CourseNotesCell.Text;
                 WGU.AddCourse(new Course(courseID, termID, courseName, startDate, endDate, courseStatus, courseView, courseNotes, WGU.Instructor, new ObservableCollection <Assessment>()));
                 Navigation.PopAsync();
             }
             else
             {
                 DisplayAlert("Error", "Invalid Dates, Please Make sure your dates are correct.", "OK");
             }
         }
     }
     catch (FormatException ex)
     {
         DisplayAlert("Error", ex.Message, "Okay");
     }
     catch (ArgumentNullException n)
     {
         DisplayAlert("Error", n.Message, "OK");
     }
 }
 private void SaveTestInfoBtn_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(AssessmentIDCell.Text) || string.IsNullOrWhiteSpace(AssessmentNameCell.Text) || string.IsNullOrWhiteSpace(AssessmentInfoCell.Text))
         {
             DisplayAlert("Error", "Please input correct data", "OK");
         }
         else
         {
             if (StartDate.Date > CoursePage.course.StartDate && StartDate.Date < CoursePage.course.EndDate)
             {
                 int        id    = Convert.ToInt32(AssessmentIDCell.Text);
                 string     name  = AssessmentNameCell.Text;
                 string     info  = AssessmentInfoCell.Text;
                 DateTime   start = StartDate.Date;
                 DateTime   time  = start + StartTime.Time;
                 string     type  = TypePicker.SelectedItem.ToString();
                 Assessment ass   = new Assessment(id, CoursePage.course.CourseID, name, start, time, info, type);
                 CoursePage.course.Assessments.Add(ass);
                 WGU.AddAssessment(new Assessment(id, CoursePage.course.CourseID, name, start, time, info, type));
                 Navigation.PopAsync();
             }
             else
             {
                 DisplayAlert("Error", "Test Date is Invalid. Test Date must be after the course starts and before the course ends, thank you.", "Ok");
             }
         }
     }
     catch (ArgumentNullException ex)
     {
         DisplayAlert("Error", ex.Message, "OK");
     }
     catch (FormatException f)
     {
         DisplayAlert("Error", f.Message, "OK");
     }
 }
Пример #10
0
 private void AddBtn_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(TermTitle.Text))
         {
             DisplayAlert("Error", "Please input a Term Name.", "OK");
         }
         else
         {
             if (TermStartDatePicker.Date < TermEndDatePicker.Date)
             {
                 int      termID    = 0;
                 string   termName  = TermTitle.Text;
                 DateTime startDate = TermStartDatePicker.Date;
                 DateTime endDate   = TermEndDatePicker.Date;
                 ObservableCollection <Course> courses = new ObservableCollection <Course>();
                 MainPage.terms1.Add(new Term(MainPage.terms1.Count + 1, termName, startDate, endDate, courses));
                 WGU.AddTerm(new Term(termID, termName, startDate, endDate, courses));
                 Navigation.PopAsync();
             }
             else
             {
                 DisplayAlert("Error", "Invalid Date Selection, please select different dates", "OK");
             }
         }
     }
     catch (FormatException f)
     {
         DisplayAlert("Error", f.Message, "OK");
     }
     catch (ArgumentNullException n)
     {
         DisplayAlert("Error", n.Message, "OK");
     }
 }