private void LoadCustomerPaymentWindow(Customer customer) { StackPanel sp = new StackPanel { Height = 320, }; List <Account> accounts = new List <Account>(); using (var context = new SystemObsługiBankuDBEntities()) { accounts = context.Account.Where(x => x.CustomerID == customer.ID).ToList(); } AppDockPanel.MultiLabelDockPanel description = new AppDockPanel.MultiLabelDockPanel( new string[6] { "Akcja", "Wpłata", "Wypłata", "Nazwa konta", "Aktualny stan", "Kwota ( ZŁ )" }); AppButton.ActionButton btnBack = new AppButton.ActionButton("Powrót"); AppButton.ActionButton btnApply = new AppButton.ActionButton("Zatwierdź"); AppDockPanel.ButtonsDockPanel buttons = new AppDockPanel.ButtonsDockPanel(new int[4] { 0, 10, 0, 0 }, btnBack, btnApply); sp.Children.Add(description); List <AppDockPanel.AccountInfoDockPanel> dockPanelsAccounts = new List <AppDockPanel.AccountInfoDockPanel>(); foreach (var item in accounts) { var x = new AppDockPanel.AccountInfoDockPanel(item.AccountName, item.Balance); dockPanelsAccounts.Add(x); sp.Children.Add(x); } sp.Children.Add(buttons); customerPayment.Children.Add(sp); btnApply.Click += CustomerPaymentTransaction; btnBack.Click += DeleteWindow; void CustomerPaymentTransaction(object o, EventArgs ev) => ApplyTransaction(dockPanelsAccounts); void DeleteWindow(object o, EventArgs ev) => Close(); }
private void LoadCustomerLoansWindow(Customer customer) { StackPanel sp = new StackPanel { Height = 320, }; List <Loan> loans = new List <Loan>(); using (var context = new SystemObsługiBankuDBEntities()) { loans = context.Loan.Where(x => x.CustomerID == customer.ID).ToList(); } AppDockPanel.MultiLabelDockPanel description = new AppDockPanel.MultiLabelDockPanel( new string[6] { "Kwota ( ZŁ )", "Procent", "Pożyczono", "Spłata do", "Do spłaty ( ZŁ )", "Pozostało dni" }); sp.Children.Add(description); List <AppDockPanel.LoanInfoDockPanel> dockPanelsAccounts = new List <AppDockPanel.LoanInfoDockPanel>(); foreach (var item in loans) { var x = new AppDockPanel.LoanInfoDockPanel(item.Balance, item.PercentValue, item.StartDate, item.EndDate); dockPanelsAccounts.Add(x); sp.Children.Add(x); } AppButton.ActionButton btnBack = new AppButton.ActionButton("Powrót"); AppDockPanel.ButtonsDockPanel buttons = new AppDockPanel.ButtonsDockPanel(new int[4] { 0, 10, 0, 0 }, btnBack); sp.Children.Add(buttons); customerLoans.Children.Add(sp); btnBack.Click += DeleteWindow; void DeleteWindow(object o, EventArgs ev) => Close(); }