private async void Button_Clicked_1(object sender, EventArgs e) { var newTerm = new Term(); newTerm.Title = TermTitle.Text; newTerm.StartDate = startDate.Date; newTerm.EndDate = endDate.Date; if (newTerm.StartDate < newTerm.EndDate) { if (FieldValidation.NullCheck(newTerm.Title)) { await _connection.InsertAsync(newTerm); _mainPage._termList.Add(newTerm); await Navigation.PopModalAsync(); } else { await DisplayAlert("Warining", "Please make sure the Term Title is not blank", "Ok"); } } else { await DisplayAlert("Warining", "Please make sure the start date is before the end date", "Ok"); } }
private async void Button_Clicked_1(object sender, EventArgs e) { var newCourse = new Course(); newCourse.CourseName = CourseName.Text; newCourse.StartDate = startDate.Date; newCourse.EndDate = endDate.Date; newCourse.Status = (string)CourseStatus.SelectedItem; newCourse.InstructorName = InstructorName.Text; newCourse.InstructorPhone = InstructorPhone.Text; newCourse.InstructorEmail = InstructorEmail.Text; newCourse.Notes = Notes.Text; newCourse.Term = _currentTerm.Id; if (FieldValidation.NullCheck(InstructorName.Text) && FieldValidation.NullCheck(InstructorPhone.Text) && FieldValidation.NullCheck(CourseName.Text)) { if (FieldValidation.EmailCheck(InstructorEmail.Text)) { if (newCourse.StartDate < newCourse.EndDate) { await _connection.InsertAsync(newCourse); await Navigation.PopModalAsync(); } else { await DisplayAlert("Warning", "Please make sure the start date is before the end date", "Ok"); } } else { await DisplayAlert("Warning", "Please make sure your email is valid before submitting", "Ok"); } } else { await DisplayAlert("Warning", "Please make sure all fields are filled in before submitting", "Ok"); } }
private async void Edit_Clicked(object sender, EventArgs e) { _currentCourse.CourseName = CourseName.Text; _currentCourse.StartDate = StartDate.Date; _currentCourse.EndDate = EndDate.Date; _currentCourse.Status = (string)CourseStatus.SelectedItem; _currentCourse.InstructorName = InstructorName.Text; _currentCourse.InstructorPhone = InstructorPhone.Text; _currentCourse.InstructorEmail = InstructorEmail.Text; _currentCourse.Notes = Notes.Text; _currentCourse.NotificationEnabled = EnableNotifications.On == true ? 1 : 0; if (FieldValidation.NullCheck(InstructorName.Text) && FieldValidation.NullCheck(InstructorPhone.Text) && FieldValidation.NullCheck(CourseName.Text)) { if (FieldValidation.EmailCheck(InstructorEmail.Text)) { if (_currentCourse.StartDate < _currentCourse.EndDate) { await _connection.UpdateAsync(_currentCourse); await Navigation.PopModalAsync(); } else { await DisplayAlert("Warning", "Please make sure the start date is before the end date", "Ok"); } } else { await DisplayAlert("Warning", "Please make sure your email is valid before submitting", "Ok"); } } else { await DisplayAlert("Warning", "Please make sure no fields are blank before submitting", "Ok"); } }
private async void Button_Clicked(object sender, EventArgs e) { _currentTerm.Title = TermTitle.Text; _currentTerm.StartDate = startDate.Date; _currentTerm.EndDate = endDate.Date; if (_currentTerm.StartDate < _currentTerm.EndDate) { if (FieldValidation.NullCheck(_currentTerm.Title)) { await _connection.UpdateAsync(_currentTerm); await Navigation.PopModalAsync(); } else { await DisplayAlert("Warning", "Please make sure the Term Title is not blank", "Ok"); } } else { await DisplayAlert("Warning", "Please make sure the Start Date is before the End Date", "Ok"); } }