public PlataInLeiViewModel(PlataSalvata saved) { MasterUserAccounts = new ObservableCollection <Account>(); Accounts = new ObservableCollection <string>(); SavedAlready = new PlataSalvata(); SavedAlready = saved; DestinationIBAN = SavedAlready.IbanDestinatar; BANK = SavedAlready.BancaDestinatar; //Currency = string.Empty; CanExecute = true; Cancel = new CommandHandler(GoBack, param => CanExecute); Apply = new CommandHandler(DoIt, param => CanExecute); Save = new CommandHandler(SavePlata, param => CanExecute); ErrorText = "Efectueaza o plata in lei"; //SelectedIBAN = string.Empty; //Sum = string.Empty; //Currency = string.Empty; //DestinationIBAN = string.Empty; //BANK = string.Empty; //ReceiverName = string.Empty; //Details = string.Empty; //NumePlataToSave = string.Empty; MasterUserAccounts = DatabaseInteraction.GetAccountsForMasterUser(); foreach (var account in MasterUserAccounts) { Accounts.Add(account.IBAN); } }
public void SavePlata(object obj) { ToSave = new PlataSalvata(); if (BANK != string.Empty && DestinationIBAN != string.Empty && NumePlataToSave != String.Empty) { ToSave.BancaDestinatar = BANK; ToSave.IbanDestinatar = DestinationIBAN; ToSave.NumePlata = NumePlataToSave; DatabaseInteraction.InsertPlata(ToSave); } }
public void ReturnPlata(object obj) { NumePlata = string.Empty; PlataSalvata returnPlata = new PlataSalvata(); if (SearchBar != string.Empty) { returnPlata = DatabaseInteraction.GetPlata(SearchBar.ToString()); if (returnPlata != null) { NumePlata = returnPlata.NumePlata; ToSave = returnPlata; } } }