/// <summary> /// Initialisierung /// </summary> public NewAppointment() { try { // Initialiserung InitializeComponent(); //Fill up Rooms for Appointment DatabaseReader readerrooms = new DatabaseReader(); rooms = readerrooms.ReadRooms(); foreach (Room r in rooms) { Roompicker.Items.Add(r.RoomName); } } catch (Exception e) { DisplayAlert("Fehler", "Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support: " + Environment.NewLine + e.Message, "OK"); } }
/// <summary> /// Initialisierung /// </summary> /// <param name="appointment">Das zu bearbeitende Appointment</param> public ChangeAppointment(Appointment appointment) { try { // Initialisierung InitializeComponent(); // Ist der angemeldete Benutzer ein Schüler oder nicht der Ersteller des Appointments, kann das Appointment nicht bearbeitet werden if (App.UserLoggedIn.Role == 0 || App.UserLoggedIn.IdPerson != appointment.Creator.IdPerson) { // Alle Felder deaktivieren AppointmentTitel.IsEnabled = false; AppointmentDescription.IsEnabled = false; Roompicker.IsEnabled = false; DatePicker.IsEnabled = false; AllDayEventSwitch.IsEnabled = false; TimePickerStart_Time.IsEnabled = false; TimePickerEnd_Time.IsEnabled = false; ButtonDeleteAppointment.IsVisible = false; ButtonSaveAppointment.IsVisible = false; AppointmentCreator.IsEnabled = false; } else { // Ist der angemeldete Benutzer auch der Ersteller des Appointments, kann dieser das Appointment auch löschen oder speichern AppointmentLabelCreator.IsVisible = false; AppointmentCreator.IsVisible = false; } // Ausgewähltes appointment setzen SelectedAppointment = appointment; //Page Bennenen Title = SelectedAppointment.Title; // Räume auslesen und abfüllen DatabaseReader readerrooms = new DatabaseReader(); Rooms = readerrooms.ReadRooms(); foreach (Room room in Rooms) { Roompicker.Items.Add(room.RoomName); } // Werte Abfüllen this.AppointmentTitel.Text = this.SelectedAppointment.Title; this.AppointmentDescription.Text = this.SelectedAppointment.Description; Roompicker.SelectedIndex = Roompicker.Items.IndexOf(this.SelectedAppointment.Room.RoomName); DatePicker.Date = SelectedAppointment.StartTime.Date; TimePickerStart_Time.Time = TimeSpan.Parse(SelectedAppointment.StartTime.Hour + ":" + SelectedAppointment.StartTime.Minute); TimePickerEnd_Time.Time = TimeSpan.Parse(SelectedAppointment.EndTime.Hour + ":" + SelectedAppointment.EndTime.Minute); Alldayevent = SelectedAppointment.AllDayEvent; AppointmentCreator.Text = SelectedAppointment.Creator.FirstName + " " + SelectedAppointment.Creator.LastName; // Dauert das Appointment den ganzen Tag, kann keine Start- und Endzeit gesetzt werden if (Alldayevent == "Y") { this.AllDayEventSwitch.IsToggled = true; // Informationen zu Start- und Endzeit verbergen LabelBegin.IsVisible = false; TimePickerStart_Time.IsVisible = false; LabelEnd.IsVisible = false; TimePickerEnd_Time.IsVisible = false; } else { this.AllDayEventSwitch.IsToggled = false; } } catch (Exception e) { DisplayAlert("Fehler", "Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support: " + Environment.NewLine + e.Message, "OK"); } }