Exemplo n.º 1
0
        private async void ButtonAddBudget_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(Item.Text) || String.IsNullOrEmpty(Amount.Text))
                {
                    await DisplayAlert("Alert", "Please enter all fields? ", "OK");
                }
                else
                {
                    BudgetCls add = new BudgetCls()
                    {
                        item      = Item.Text,
                        amount    = double.Parse(Amount.Text),
                        addedAt   = DateTime.Now.ToString(),
                        updatedAt = DateTime.Now.ToString()
                    };

                    using (SQLiteConnection conn = new SQLiteConnection(App.filePath))
                    {
                        conn.CreateTable <BudgetCls>();
                        int rows = conn.Insert(add);
                    }
                }
                Item.Text   = "";
                Amount.Text = "";
                OnAppearing();
            }
            catch (Exception ex)
            {
                await DisplayAlert("Alert", ex.ToString(), "OK");
            }
        }
Exemplo n.º 2
0
        private async void addSavings_Clicked(object sender, EventArgs e)
        {
            try
            {
                var       fkey = getForeighKeyAsync();
                BudgetCls add  = new BudgetCls()
                {
                    //amount = getSalary(),
                    addedAt = DateTime.Now.ToString()
                };

                using (SQLiteConnection conn = new SQLiteConnection(App.filePath))
                {
                    conn.CreateTable <BudgetCls>();
                    int rows = conn.Insert(add);

                    OnAppearing();
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Alert", ex.ToString(), "OK");
            }
        }