private void TransactionAdd(object sender, EventArgs e) { Transaction transaction; String transactionTitle = String.Empty; try { String pickerValue = PickerPerson.SelectedItem as String; if (pickerValue != String.Empty || pickerValue != null) { transactionTitle = "Wpłata od: " + pickerValue; transaction = new Transaction(DateTime.Now, transactionTitle, float.Parse(EntryTransactionValueDeposit.Text), true); dataBase.Insert(transaction); ViewTransactionManager.ClearInput(EditorTransactionTitle, EntryTransactionValueDeposit); ViewTransactionManager.CalculateBudget(dataBase, LabelShoppingBudgetValue); LabelLastDepositValue.Text = pickerValue; DisplayAlert("Information", "Transaction Added", "Ok"); } else { throw new Exception("Empty value of picker, please pick person"); } } catch (Exception ex) { DisplayAlert("Exception!", ex.Message, "Ok"); } }
private void TransactionSubstract(object sender, EventArgs e) { Transaction transaction; try { transaction = new Transaction(DateTime.Now, EditorTransactionTitle.Text, -float.Parse(EntryTransactionValueTransaction.Text), false); dataBase.Insert(transaction); ViewTransactionManager.ClearInput(EditorTransactionTitle, EntryTransactionValueTransaction); ViewTransactionManager.CalculateBudget(dataBase, LabelShoppingBudgetValue); DisplayAlert("Information", "Transaction Added", "Ok"); }catch (Exception ex) { DisplayAlert("Exception!", ex.Message, "Ok"); } }