public ActionResult CurrentAppointment() { UserInfo user = GetLoggedInUser(); if (user != null) { DatabaseConnection dbconnect = new DatabaseConnection(); List <DbAppointmentInfo> result = dbconnect.CurrentAppointment(user.UserId); AllAppointments allAppoint = new AllAppointments(); foreach (var value in result) { allAppoint.Appointment.Add(new AppointmentInfo { HostUser = value.HostUser, GuestUser = value.GuestUser, DatenTime = value.DatenTime, Subject = value.Subject }); } return(View("CurrentAppointment", allAppoint)); } else { return(RedirectToAction("Index")); } }
/* * A DataTable copy of all patient appointments for the day is created. * Every time the search filter is updated, the function is called with * the string content of the search filter. Every record is then compared * against the inputted string and if a match is not existent, the row is * removed. Once all rows have been compared, the DataTable remaining * rows will be matches found from the inputted search string. * * Everytime the function is called, the viewable DataTable is reset to a * copy of all todays appointments before being filtered against the inputted * string. */ private void FilterRecords(NotificationMessage msg) { string filterMessage = msg.Notification; filterMessage = filterMessage.ToLower(new System.Globalization.CultureInfo("en-UK", false)); FilteredAppointments = AllAppointments.Copy(); if (!string.IsNullOrWhiteSpace(filterMessage)) { // For each match found, i's value is reduced by 1 to reflect the change in the viewable DataTable's // length. This ensures no row is skipped on each iteration of the comparison. for (int i = 0; i < FilteredAppointments.Rows.Count; i++) { var tempRow = FilteredAppointments.Rows[i]; string tempName = FilteredAppointments.Rows[i]["PatientName"].ToString(); tempName = tempName.ToLower(new System.Globalization.CultureInfo("en-UK", false)); if (tempName.Contains(filterMessage)) { if (tempName.Length < filterMessage.Length) { FilteredAppointments.Rows.Remove(tempRow); i -= 1; } } else { FilteredAppointments.Rows.Remove(tempRow); i -= 1; } } } }
public void InitialiseDataTable() { if (CancelledFilter == "True") { AllAppointments = PatientDBConverter.GetCancelledAppointments().Copy(); CancellationVisibility = Visibility.Visible; EditOptionsVisibility = Visibility.Collapsed; } else { AllAppointments = PatientDBConverter.GetBookedAppointments().Copy(); CancellationVisibility = Visibility.Collapsed; EditOptionsVisibility = Visibility.Visible; } FilteredAppointments = AllAppointments.Copy(); }
public void InitialiseDataTable() { AllAppointments = PatientDBConverter.GetCheckedInAppointments(); FilteredAppointments = AllAppointments.Copy(); }