public async void Add() { if (String.IsNullOrEmpty(Name) || String.IsNullOrEmpty(BasicCurrency) || String.IsNullOrEmpty(Description)) { MessageBox.Show("Some fields are empty"); } else { if (AlreadyExists()) { MessageBox.Show($"Wallet with name '{Name}' already exists"); } else { wallet = new lab.Wallet(CurrentInfo.Customer, Name, Convert.ToDouble(StartBalance), Description, BasicCurrency); CurrentInfo.Customer.AddWallet(wallet); WalletsHandler handler = new WalletsHandler(); handler.Filename = @"../../../DataBase/Wallet/Wallets.json"; await handler.write(new DBWallet(CurrentInfo.Customer.Email, wallet.Name, wallet.Balance, wallet.Description, wallet.BasicCurrency, null, wallet.Guid)); // CurrentInfo.AddRecord(wallet); _goToAccount.Invoke(); } } }
public async void SubmitW() { WalletsHandler handler = new WalletsHandler(); handler.Filename = @"../../../DataBase/Wallet/Wallets.json"; var n = CurrentInfo.Customer.GetWalletByName(CurrentInfo.Wallet.Name); await handler.Change(n, n.Name); }
public void TestRemovingWallets() { // WalletsHandler walletsHandler = new WalletsHandler(); var filename = @"../../../DataBase/Wallet/wallets.json"; walletsHandler.Filename = filename; // walletsHandler.Remove("OwnerEmail", "Name"); // Assert.NotNull(walletsHandler.Find("OwnerEmail", "changedName")); }
public void TestChangingWallets() { // var testCustomer = new Customer("Vasilii", "Poberezhnii", "*****@*****.**"); var testName = "wallet1"; var testWallet = new Wallet(testCustomer, testName, 0, "", "UAH"); WalletsHandler walletsHandler = new WalletsHandler(); var filename = @"../../../DataBase/Wallet/wallets.json"; walletsHandler.Filename = filename; // walletsHandler.Change(testWallet, "changedName"); // Assert.NotNull(walletsHandler.Find("OwnerEmail", "changedName")); }
public void TestAddingWallets() { // var testDBWallet = new DBWallet { Balance = 120, BasicCurrency = "UAH", WalletGuid = Guid.NewGuid(), Description = "", Name = "Name", OwnerEmail = "OwnerEmail" }; // WalletsHandler walletsHandler = new WalletsHandler(); var filename = @"../../../DataBase/Wallet/wallets.json"; walletsHandler.Filename = filename; walletsHandler.write(testDBWallet); // Assert.NotNull(walletsHandler.Find("OwnerEmail", "Name").Result); }