コード例 #1
0
        public void Create(Expense pExpense)
        {
            Database db = GetDataBase();

            db.Expenses.InsertOnSubmit(pExpense);
            db.SubmitChanges();
        }
コード例 #2
0
        public void Delete(Expense expense)
        {
            Database db = GetDataBase();
            var query = from exp in db.Expenses where exp.id == exp.id select exp;
            db.Expenses.DeleteOnSubmit(query.ToList()[0]);

            db.SubmitChanges();
        }
コード例 #3
0
 public void Update(Expense pExpense)
 {
     Database db = GetDataBase();
     var query = from exp in db.Expenses
                 where exp.id == pExpense.id
                 select exp;
     var expenseDoBanco = query.ToList()[0];
     expenseDoBanco.description = pExpense.description;
 }
コード例 #4
0
        private void onClickSave(object sender, EventArgs e)
        {
            NavigationService.GoBack();

            if (expUpdate == null)
            {
                Expense expense = new Expense
                {
                    description = txtDescricao.Text,
                    values = decimal.Parse(txtValor.Text)
                };
                ex.Create(expense);
            }
            else
            {
                expUpdate.description = txtDescricao.Text;
                expUpdate.values = decimal.Parse(txtValor.Text);

                ex.Update(expUpdate);
            }
        }
コード例 #5
0
 private void onSelectedChanged(object sender, SelectionChangedEventArgs e)
 {
     expense = (sender as ListBox).SelectedItem as Expense;
 }
コード例 #6
0
 private void onClickNew(object sender, EventArgs e)
 {
     expense = null;
     NavigationService.Navigate(new Uri("/NewExpense.xaml", UriKind.Relative));
 }