partial void ClubRemoveClicked(NSButton sender)
        {
            Debug.WriteLine("Start: ClubsController.ClubRemoveClicked");

            if ((int)ClubsTable.SelectedRow >= 0)
            {
                SelectedClub = ds.Clubs[(int)ClubsTable.SelectedRow] as ClubModel;

                // Configure alert
                var alert = new NSAlert()
                {
                    AlertStyle      = NSAlertStyle.Informational,
                    InformativeText = $"Weet je zeker dat je de club {SelectedClub.ClubNaam} wilt verwijderen?\n\nDit kan niet meer ongedaan gemaakt worden.",
                    MessageText     = $"Delete {SelectedClub.ClubNaam}?",
                };
                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
                        SelectedClub.Delete(AppDelegate.Conn);
                        ds.Clubs.Remove(SelectedClub);
                        ReloadTable();
                    }
                });
            }

            Debug.WriteLine("Einde: ClubsController.ClubRemoveClicked");
        }
        partial void ClubAddClicked(NSButton sender)
        {
            Debug.WriteLine("Start: ClubsController.ClubAddClicked");

            SelectedClub = null;

            PerformSegue("ClubSegue", this);

            Debug.WriteLine("Einde: ClubsController.ClubAddClicked");
        }
        public void RowDoubleClicked(NSObject sender)
        {
            Debug.WriteLine("Start: ClubsController.RowDoubleClicked");

            SelectedClub = ds.Clubs[(int)ClubsTable.SelectedRow] as ClubModel;

            PerformSegue("ClubSegue", this);

            Debug.WriteLine("Einde: ClubsController.RowDoubleClicked");
        }
Exemple #4
0
        void LoadClubs(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 [Club]";

                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var club = new ClubModel();
                            var id   = (string)reader["ID"];

                            club.Load(conn, id);

                            //AddPersoon(persoon);
                            Clubs.Add(club);
                        }
                    }
                }
                catch (Exception Exception)
                {
                    Debug.WriteLine(Exception.Message);
                }
            }

            if (shouldClose)
            {
                conn.Close();
            }
        }
Exemple #5
0
        public override void AwakeFromNib()
        {
            Debug.WriteLine("Start: ClubController.AwakeFromNib");

            base.AwakeFromNib();

            _parentController = this.PresentingViewController as ClubsController;

            if (_parentController != null)
            {
                Club = _parentController.SelectedClub;

                if (Club != null)
                {
                }
                else
                {
                    Club = new ClubModel();
                }
            }

            Debug.WriteLine("Einde: ClubController.AwakeFromNib");
        }
Exemple #6
0
        public bool AddClub(ClubModel _club)
        {
            Clubs.Add(_club);

            return(true);
        }