protected override void OnNavigatedTo(NavigationEventArgs e) { int id = (int)e.Parameter; if (viewModel == null) { viewModel = new AppointmentSearchViewModel(id); DataContext = viewModel.Appointment; } }
/// <summary> /// This shows the view which contains the list appointments /// </summary> /// <param name="viewModel">Contains the option by which we can search for report</param> /// <returns>To the Partial view for showing the appointments</returns> public ActionResult Appointment(AppointmentSearchViewModel viewModel) { if (Session["userId"] == null) { return(Redirect("~")); } Report report = new Report(); var FilteredAppointments = report.GetReportByAppointment(viewModel.Option.ToString()); return(PartialView("_Appointments", FilteredAppointments)); }
private async void SearchBarBtn_Click(object sender, RoutedEventArgs e) { MainListBox.Items.Clear(); int numberI; //validate if (!String.IsNullOrEmpty(EventIDTxtBox.Text)) { //validate search section is numeric try { numberI = int.Parse(EventIDTxtBox.Text); } catch { MessageDialog md = new MessageDialog("Please wrtie numberic in this field", "Wrong type method"); await md.ShowAsync(); EventIDTxtBox.Text = string.Empty; EventIDTxtBox.Focus(FocusState.Programmatic); EventIDTxtBox.SelectAll(); return; } //validate data is exist try { viewModelS = new AppointmentSearchViewModel(int.Parse(EventIDTxtBox.Text)); this.DataContext = viewModelS; this.MainListBox.Items.Add(viewModelS.Appointment); //Frame.Navigate(typeof(ContactViewPage), viewModelS.Contact.ContactID); } catch { MessageDialog md = new MessageDialog("There is no data with that ID", "No Data Exist"); await md.ShowAsync(); EventIDTxtBox.Text = string.Empty; EventIDTxtBox.Focus(FocusState.Programmatic); EventIDTxtBox.SelectAll(); return; } //try //{ // Frame.Navigate(typeof(ContactViewPage), viewModelS.Contact.ContactID); //} //catch //{ // MessageDialog md = new MessageDialog("There is no data with that ID", "No Data Exist"); // await md.ShowAsync(); // ContIDTxtBox.Text = string.Empty; // ContIDTxtBox.Focus(FocusState.Programmatic); // ContIDTxtBox.SelectAll(); // return; //} } else { MessageDialog md = new MessageDialog("There is no data with that information", "NO DATA"); await md.ShowAsync(); EventIDTxtBox.Text = string.Empty; EventIDTxtBox.Focus(FocusState.Programmatic); EventIDTxtBox.SelectAll(); return; } EventIDTxtBox.SelectAll(); }