예제 #1
0
 private void Process(Expenses sit)
 {
     Expenses git = App.ViewModel.Items.FirstOrDefault(x => x.Title == sit.Title);
     App.ViewModel.Removeitem(git);
 }
예제 #2
0
 public async void AddAtem(Expenses itemToAdd)
 {
     itemToAdd.UserIdentifier = getUniqueid();
     itemToAdd.AddedOn = DateTime.Now;
     
     await itemsTable.InsertAsync(itemToAdd);
     this.Items.Add(itemToAdd);
     ApplicationData.Current.LocalSettings.Values["Exp"] = (Double)ApplicationData.Current.LocalSettings.Values["Exp"] + Double.Parse(itemToAdd.Amount);
     BudgetLeft = ((Double)ApplicationData.Current.LocalSettings.Values["Bud"] - (Double)ApplicationData.Current.LocalSettings.Values["Exp"]).ToString();
 }
예제 #3
0
        private async void add_button_Click(object sender, RoutedEventArgs e)
        {
            if (title_TextBox.Text != "" && amountTextbox.Text != "")
            {
                Expenses newItem;
                if (type.SelectedIndex == 0)
                    newItem = new Expenses() { Title = title_TextBox.Text, Amount = amountTextbox.Text, Type = "/Assets/Images/bills.png" };
                else if (type.SelectedIndex == 1)
                    newItem = new Expenses() { Title = title_TextBox.Text, Amount = amountTextbox.Text, Type = "/Assets/Images/accessories.png" };
                else if (type.SelectedIndex == 2)
                    newItem = new Expenses() { Title = title_TextBox.Text, Amount = amountTextbox.Text, Type = "/Assets/Images/cloths.png" };
                else
                    newItem = new Expenses() { Title = title_TextBox.Text, Amount = amountTextbox.Text, Type = "/Assets/Images/others.png" };


                App.ViewModel.AddAtem(newItem);
                amountTextbox.Text = "";
                title_TextBox.Text = "";
            }
            else
            {
                var dialog= new MessageDialog("Please proivde complete info.");
                await dialog.ShowAsync();
            }
        }
예제 #4
0
 public async void Removeitem(Expenses itemToRemove)
 {
     await itemsTable.DeleteAsync(itemToRemove);
     this.Items.Remove(itemToRemove);
     ApplicationData.Current.LocalSettings.Values["Exp"] = (Double)ApplicationData.Current.LocalSettings.Values["Exp"] - Double.Parse(itemToRemove.Amount);
     BudgetLeft = ((Double)ApplicationData.Current.LocalSettings.Values["Bud"] - (Double)ApplicationData.Current.LocalSettings.Values["Exp"]).ToString();
 }