Ejemplo n.º 1
0
        private void LoadRepaymentLoanWindow(Customer customer)
        {
            StackPanel sp = new StackPanel
            {
                Height = 320,
            };

            AppButton.ActionButton btnBack  = new AppButton.ActionButton("Powrót");
            AppButton.ActionButton btnApply = new AppButton.ActionButton("Spłać");

            List <Loan> loans = new List <Loan>();

            using (var context = new SystemObsługiBankuDBEntities())
            {
                loans = context.Loan.Where(x => x.CustomerID == customer.ID).ToList();
            }

            List <AppDockPanel.ActionDockPanel> dockPanelsLoans = new List <AppDockPanel.ActionDockPanel>();

            foreach (var item in loans)
            {
                var x = new AppDockPanel.ActionDockPanel(
                    ("Kwota początkowa " + Math.Round(item.Balance, 2).ToString() + " + " +
                     Math.Round(item.Balance / 100 * (item.PercentValue / ((item.EndDate - item.StartDate).Days)) *
                                (DateTime.Now - item.StartDate).Days)).ToString() + " odsetki ( ZŁ )", true);

                dockPanelsLoans.Add(x);
                sp.Children.Add(x);
            }

            AppDockPanel.ButtonsDockPanel buttons = new AppDockPanel.ButtonsDockPanel(new int[4] {
                0, 40, 0, 0
            }, btnBack, btnApply);

            sp.Children.Add(buttons);
            customerRepaymentLoan.Children.Add(sp);

            btnApply.Click += DeleteLoan;
            btnBack.Click  += DeleteWindow;

            void DeleteLoan(object o, EventArgs ev) => RepaymentLoanAction(dockPanelsLoans, customer);
            void DeleteWindow(object o, EventArgs ev) => Close();
        }
Ejemplo n.º 2
0
        private void LoadDeleteAccountWindow(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();
            }

            List <AppDockPanel.ActionDockPanel> dockPanelsAccounts = new List <AppDockPanel.ActionDockPanel>();

            foreach (var item in accounts)
            {
                var x = new AppDockPanel.ActionDockPanel(item.AccountName, true);
                dockPanelsAccounts.Add(x);
                sp.Children.Add(x);
            }

            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, 30, 0, 0
            }, btnBack, btnApply);

            sp.Children.Add(buttons);
            customerDeleteAccount.Children.Add(sp);

            btnApply.Click += DeleteCustomerAccount;
            btnBack.Click  += DeleteWindow;

            void DeleteCustomerAccount(object o, EventArgs ev) => DeleteAccount(dockPanelsAccounts);
            void DeleteWindow(object o, EventArgs ev) => Close();
        }