public OperationsPage() { InitializeComponent(); if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile") { HardwareButtons.BackPressed += HardwareButtons_BackPressed; } foreach (var item in MAccountsDal.GetAllAccountsAndSubAccounts()) { var itema = new CheckBox { Content = item.Name, Tag = item.GlobalId, IsChecked = true, }; _visibleAccountsList.Add(item.GlobalId); ((ListView)VisibleAccountsFlyout.Content).Items?.Add(itema); } SetPrevNextIncomingButtons(); ByDateRadioButton.IsChecked = true; ListViewByDate(); ByDateRadioButton.Checked += ByDateRadioButton_Checked; ByCategoryRadioButton.Checked += ByCategoryRadioButton_Checked; SetEmptyListViewInfoVisibility(); }
private void DeleteCardWithOperations(SubMAccount cardAccount) { MAccountWithSubMAccounts bankAccount = Accounts.SingleOrDefault(i => i.MAccount.GlobalId == cardAccount.BossAccountGlobalId); bankAccount.SubMAccounts.Remove(cardAccount); MAccountsDal.RemoveSubAccountWithOperations(cardAccount); }
private async void NewCategory_AddButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { AddedAccount = MAccountsDal.AddAccount(GetNewAccount()); if (!string.IsNullOrEmpty(_acceptedCostValue)) { Dal.SaveOperation(await MakeOperation(AddedAccount.GlobalId)); } }
/* * private async void ShowDeleteCardContentDialog(SubMAccount account) { * AcceptContentDialog acceptDeleteOperationContentDialog = new AcceptContentDialog("Czy chcesz usunąć kartę płatniczą? Zostaną usunięte wszystkie operacje skojażone z tą kartą."); * ContentDialogResult result = await acceptDeleteOperationContentDialog.ShowAsync(); * if (result == ContentDialogResult.Primary) * DeleteAccountWithOperations(account); * } */ private void DeleteAccountWithOperations(MAccount account) { if (account is SubMAccount) { DeleteCardWithOperations((SubMAccount)account); } else { Accounts.Remove(Accounts.SingleOrDefault(i => i.MAccount.Id == account.Id));// /Remove(account); } MAccountsDal.RemoveAccountWithSubAccountsAndOperations(account); }
private async void DeleteButton_Click(object sender, RoutedEventArgs e) { //if (AccountsDal.CountBankAccouns() + AccountsDal.CountCashAccouns() > 1) { if (MAccountsDal.CountAccounts() > 1) { object datacontext = (e.OriginalSource as FrameworkElement)?.DataContext; ShowDeleteAccountContentDialog(((MAccountWithSubMAccounts)datacontext)?.MAccount); } else { MessageDialog message = new MessageDialog("To ostatnie konto. NIE USUWAJ GO ŚMIESZKU :("); await message.ShowAsync(); } }
private bool IsThisCategoryInBase() { return (!String.Equals(_accountToEdit.Name, NameValue.Text, StringComparison.CurrentCultureIgnoreCase) && MAccountsDal.AccountExistInBaseByName(NameValue.Text)); }
private void NewCategory_AddButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { MAccountsDal.UpdateAccount(EditedAccount); }