public void onDeleteBtnClicked(object sender, RoutedEventArgs e)
        {
            Button       deleteBtn    = (Button)sender;
            AccountTitle accountTitle = (AccountTitle)deleteBtn.DataContext;

            this.sqLiteDbHelper.delete(accountTitle.id, this.userId);
            this.showAllAccounts();
        }
        public void onEditBtnClicked(object sender, RoutedEventArgs e)
        {
            Button               editBtn              = (Button)sender;
            AccountTitle         accountTitle         = (AccountTitle)editBtn.DataContext;
            AccountDetailsWindow accountDetailsWindow = new AccountDetailsWindow(AccountDetailsWindow.State.Edit, accountTitle.id, this.userId);

            accountDetailsWindow.Closed += this.onAccountDetailsWindowClosed;
            accountDetailsWindow.Show();
        }
Exemplo n.º 3
0
        public List <AccountTitle> selectTitles(long userId)
        {
            this.dbConnection.Open();

            SQLiteCommand command = new SQLiteCommand(this.select_titles, dbConnection);

            command.Parameters.Add(new SQLiteParameter("@user_id", userId));
            SQLiteDataReader    reader        = command.ExecuteReader();
            List <AccountTitle> accountTitles = new List <AccountTitle>();

            while (reader.Read())
            {
                AccountTitle accountTitle = new AccountTitle((long)reader["id"], (String)reader["title"]);
                accountTitles.Add(accountTitle);
            }
            this.dbConnection.Close();
            return(accountTitles);
        }