示例#1
0
 public MainPage()
 {
     InitializeComponent();
     //App.Database.DeleteTables();
     this.DataContext = viewModel;
     NavigationServiceSingleton.GetNavigationService().SetCurrentPage(this);
     viewModel.CheckDebts();
 }
示例#2
0
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            Item newItem = item;

            newItem.Name = txtName.Text;
            newItem.Cost = int.Parse(txtCost.Text);
            App.Database.SaveItemSync(newItem);

            newItem = App.Database.GetAllItemsSync().Last();

            Transaction newTransaction = transaction;

            newTransaction.IDItem          = newItem.ID;
            newTransaction.DateTransaction = dpDate.SelectedDate.Value;

            App.Database.SaveTransactionSync(newTransaction);

            if (itemsList.Type == 1)
            {
                Debt newDebt = debt;
                newDebt.IDTransaction   = newTransaction.ID;
                newDebt.NextDateToPay   = newTransaction.DateTransaction;
                newDebt.RaiseCounter    = 0;
                newDebt.RaisePercentage = int.Parse(txtRaise.Text);

                App.Database.SaveDebtSync(newDebt);
            }

            if (itemsList.ID != 0)
            {
                ItemTies newItemTies = new ItemTies();
                newItemTies.IDItem      = newItem.ID;
                newItemTies.IDItemsList = itemsList.ID;

                App.Database.SaveItemTiesSync(newItemTies);
            }

            NavigationServiceSingleton.GetNavigationService().NavigateBack();
        }
示例#3
0
 private void btnGoBack_Click(object sender, RoutedEventArgs e)
 {
     NavigationServiceSingleton.GetNavigationService().NavigateBack();
 }
示例#4
0
 private void btnShowDebtLists_Click(object sender, RoutedEventArgs e)
 {
     NavigationServiceSingleton.GetNavigationService().NavigateToPage(new DebtListsPage());
 }