partial void OpleidingRemoveClicked(NSButton sender) { Debug.WriteLine("Start: OpleidingenController.OpleidingRemoveClicked"); if ((int)OpleidingenTable.SelectedRow >= 0) { SelectedOpleiding = ds.Opleidingen[(int)OpleidingenTable.SelectedRow] as OpleidingModel; // Configure alert var alert = new NSAlert() { AlertStyle = NSAlertStyle.Informational, InformativeText = $"Weet je zeker dat je de opleiding {SelectedOpleiding.OpleidingNaam} wilt verwijderen?\n\nDit kan niet meer ongedaan gemaakt worden.", MessageText = $"Delete {SelectedOpleiding.OpleidingNaam}?", }; alert.AddButton("Cancel"); alert.AddButton("Delete"); alert.BeginSheetForResponse(this.View.Window, (result) => { // Should we delete the requested row? if (result == 1001) { // Remove the given row from the dataset SelectedOpleiding.Delete(AppDelegate.Conn); ds.Opleidingen.Remove(SelectedOpleiding); ReloadTable(); } }); } Debug.WriteLine("Einde: OpleidingenController.OpleidingRemoveClicked"); }
partial void OpleidingAddClicked(NSButton sender) { Debug.WriteLine("Start: OpleidingenController.OpleidingAddClicked"); SelectedOpleiding = null; PerformSegue("OpleidingSegue", this); Debug.WriteLine("Einde: OpleidingenController.OpleidingAddClicked"); }
public void RowDoubleClicked(NSObject sender) { Debug.WriteLine("Start: OpleidingenController.RowDoubleClicked"); SelectedOpleiding = ds.Opleidingen[(int)OpleidingenTable.SelectedRow] as OpleidingModel; PerformSegue("OpleidingSegue", this); Debug.WriteLine("Einde: OpleidingenController.RowDoubleClicked"); }
void LoadOpleidingen(SqliteConnection conn) { bool shouldClose = false; // Is the database already open? if (conn.State != ConnectionState.Open) { shouldClose = true; conn.Open(); } // Execute query using (var command = conn.CreateCommand()) { try { // Create new command command.CommandText = "SELECT DISTINCT ID FROM [Opleiding]"; using (var reader = command.ExecuteReader()) { while (reader.Read()) { var opleiding = new OpleidingModel(); var id = (string)reader["ID"]; opleiding.Load(conn, id); //AddPersoon(persoon); Opleidingen.Add(opleiding); } } } catch (Exception Exception) { Debug.WriteLine(Exception.Message); } } if (shouldClose) { conn.Close(); } }
public override void AwakeFromNib() { Debug.WriteLine("Start: OpleidingController.AwakeFromNib"); base.AwakeFromNib(); _parentController = this.PresentingViewController as OpleidingenController; if (_parentController != null) { Opleiding = _parentController.SelectedOpleiding; if (Opleiding != null) { } else { Opleiding = new OpleidingModel(); } } Debug.WriteLine("Einde: OpleidingController.AwakeFromNib"); }
public bool AddOpleiding(OpleidingModel _opleiding) { Opleidingen.Add(_opleiding); return(true); }