public Movement(decimal amount, DateTime date, IFAccount source, IFAccount target) { this.Amount = amount; this.Date = date; this.Source = source; this.Target = target; }
public MainPage() { this.InitializeComponent(); //MainGrid.MaxHeight = main.MinHeight; //Accounts.MaxHeight = main.MinHeight; //AccountsScroll.MaxHeight = main.MinHeight; banks = new List <IFBank>(); banks.Add(new Bank("Nordea")); banks[0].Customers.Add(new Customer("Ole Hansen", 1, banks[0])); banks[0].Customers.Add(new Customer("Bent Jensen", 2, banks[0])); banks[0].Customers.Add(new Customer("Kurt Jensen", 3, banks[0])); banks.Add(new Bank("Danske Bank")); banks[1].Customers.Add(new Customer("Ole Hansen", 1, banks[1])); banks[1].Customers.Add(new Customer("Børge jørgensen", 2, banks[1])); banks[1].Customers.Add(new Customer("Aase Olsen", 3, banks[1])); banks.Add(new Bank("Jyske Bank")); banks[2].Customers.Add(new Customer("Søren Christensen", 1, banks[2])); banks[2].Customers.Add(new Customer("Ida Sørensen", 2, banks[2])); banks[2].Customers.Add(new Customer("Freja Hansen", 3, banks[2])); banks[0].banks = banks; banks[1].banks = banks; banks[2].banks = banks; selectedBank = null; SelectedCustomer = null; selectedAccount = null; Bank depositWithdrawBank = new Bank("dWBank"); depositWithdrawBank.Customers.Add(new Customer("dWCustomer", 1, depositWithdrawBank)); depositWithdrawAccount = new Account(depositWithdrawBank, depositWithdrawBank.Customers.ToList()[0], depositWithdrawBank.GetNextAccountNumber()); depositWithdrawBank.Accounts.Add(depositWithdrawAccount); }
public void Move(decimal amount, int source, int target) { IFBank targetBank = banks.FirstOrDefault(b => b.Accounts.ToList <IFAccount>().Exists(acc => acc.Number.Equals(target))); IFAccount transferTargetAccount = targetBank.Accounts.FirstOrDefault(acc => acc.Number.Equals(target)); IFAccount transverSourceAccount = this.Accounts.FirstOrDefault <IFAccount>(acc => acc.Number.Equals(source)); transverSourceAccount.InOutMovement.Add(new Movement(amount, DateTime.Now, transverSourceAccount, transferTargetAccount)); transferTargetAccount.InOutMovement.Add(new Movement(amount, DateTime.Now, transverSourceAccount, transferTargetAccount)); }
private void btnViewAccount_Click(object sender, RoutedEventArgs e) { selectedAccount = SelectedCustomer.Accounts.FirstOrDefault(acc => acc.Number.Equals(((Button)sender).Content)); DateList.Items.Clear(); AmountList.Items.Clear(); TargetList.Items.Clear(); SourceList.Items.Clear(); ListViewHeaderItem HeaderDate = new ListViewHeaderItem(); ListViewHeaderItem HeaderSource = new ListViewHeaderItem(); ListViewHeaderItem HeaderTarget = new ListViewHeaderItem(); ListViewHeaderItem HeaderAmount = new ListViewHeaderItem(); TextBlock dateText = new TextBlock(); TextBlock sourceText = new TextBlock(); TextBlock targetText = new TextBlock(); TextBlock amountText = new TextBlock(); dateText.Text = "Date"; sourceText.Text = "Source"; targetText.Text = "Target"; amountText.Text = "Amount"; HeaderDate.Content = dateText; HeaderSource.Content = sourceText; HeaderTarget.Content = targetText; HeaderAmount.Content = amountText; AmountList.Items.Add(HeaderAmount); TargetList.Items.Add(HeaderTarget); SourceList.Items.Add(HeaderSource); DateList.Items.Add(HeaderDate); List <IFMovement> movementList = selectedBank.MakeStatement(SelectedCustomer, selectedAccount).ToList <IFMovement>(); foreach (IFMovement aMovement in movementList) { ListViewItem AmountItem = new ListViewItem(); ListViewItem TargetItem = new ListViewItem(); ListViewItem SourceItem = new ListViewItem(); ListViewItem DateItem = new ListViewItem(); AmountItem.Content = aMovement.Amount; TargetItem.Content = aMovement.Target.BankInfo.Name + ": " + aMovement.Target.Number; SourceItem.Content = aMovement.Source.BankInfo.Name + ": " + aMovement.Source.Number; DateItem.Content = aMovement.Date.ToString(); AmountList.Items.Add(AmountItem); TargetList.Items.Add(TargetItem); SourceList.Items.Add(SourceItem); DateList.Items.Add(DateItem); } accBallance.Text = selectedAccount.Balance.ToString(); }
public ICollection <IFMovement> MakeStatement(IFCustomer aCustomer, IFAccount aAccount) { return(aAccount.InOutMovement); }
public ICollection <IFMovement> MakeStatement(IFCustomer aCustomer, IFAccount aAccount) { Contract.Requires(aCustomer.Accounts.Contains(aAccount)); return(null); }