Ejemplo n.º 1
0
        private void AddCustomerPanel(object sender, EventArgs e)
        {
            StackPanel sp = new StackPanel
            {
                Width      = 400,
                Background = Brushes.DeepSkyBlue,
                Margin     = new Thickness(0, -120, 0, -120),
            };

            AppButton.ActionButton btnCancel  = new AppButton.ActionButton("Anuluj");
            AppButton.ActionButton btnConfirm = new AppButton.ActionButton("Zatwierdź");

            AppDockPanel.InfoInputDockPanel dpCustomerID     = new AppDockPanel.InfoInputDockPanel("Numer PESEL", 11);
            AppDockPanel.InfoInputDockPanel dpCustomerFN     = new AppDockPanel.InfoInputDockPanel("Imię", 30);
            AppDockPanel.InfoInputDockPanel dpCustomerLN     = new AppDockPanel.InfoInputDockPanel("Nazwisko", 30);
            AppDockPanel.InputDateDockPanel dpCustomerBD     = new AppDockPanel.InputDateDockPanel("Data urodzenia");
            AppDockPanel.InfoInputDockPanel dpCustomerGender = new AppDockPanel.InfoInputDockPanel("Płeć ( M / K )", 1);
            AppDockPanel.InfoInputDockPanel dpCustomerAdress = new AppDockPanel.InfoInputDockPanel("Ulica", 50);
            AppDockPanel.InfoInputDockPanel dpCustomerCity   = new AppDockPanel.InfoInputDockPanel("Miasto", 30);
            AppDockPanel.ButtonsDockPanel   buttons          = new AppDockPanel.ButtonsDockPanel(new int[4] {
                0, 15, 0, 0
            }, btnCancel, btnConfirm);

            btnCancel.Click  += DeletePanel;
            btnConfirm.Click += ConfirmCustomerAdd;

            mainWindow.Children.Add(sp);
            sp.Children.Add(dpCustomerID);
            sp.Children.Add(dpCustomerFN);
            sp.Children.Add(dpCustomerLN);
            sp.Children.Add(dpCustomerBD);
            sp.Children.Add(dpCustomerGender);
            sp.Children.Add(dpCustomerAdress);
            sp.Children.Add(dpCustomerCity);
            sp.Children.Add(buttons);

            Grid.SetColumn(sp, 2);
            Grid.SetRow(sp, 3);

            void DeletePanel(object o, EventArgs ev) => mainWindow.Children.RemoveAt(mainWindow.Children.Count - 1);

            void ConfirmCustomerAdd(object o, EventArgs ev)
            {
                int element = 1;

                AddCustomer
                (
                    (DatePicker)dpCustomerBD.Children[element],
                    (TextBox)dpCustomerID.Children[element],
                    (TextBox)dpCustomerFN.Children[element],
                    (TextBox)dpCustomerLN.Children[element],
                    (TextBox)dpCustomerGender.Children[element],
                    (TextBox)dpCustomerAdress.Children[element],
                    (TextBox)dpCustomerCity.Children[element]
                );

                mainWindow.Children.RemoveAt(mainWindow.Children.Count - 1);
            }
        }
Ejemplo n.º 2
0
        public void LoadNewAccountWindow(Customer customer, Employee loggedEmployee)
        {
            StackPanel sp = new StackPanel
            {
                Height = 320,
            };

            AppButton.ActionButton btnBack  = new AppButton.ActionButton("Powrót");
            AppButton.ActionButton btnApply = new AppButton.ActionButton("Zatwierdź");

            AppDockPanel.InfoInputDockPanel accountName      = new AppDockPanel.InfoInputDockPanel("Nazwa konta", 30);
            AppDockPanel.InfoInputDockPanel accountMoney     = new AppDockPanel.InfoInputDockPanel("Kwota ( ZŁ )", 7);
            AppDockPanel.InputDateDockPanel accountOpenDate  = new AppDockPanel.InputDateDockPanel("Od dnia");
            AppDockPanel.InputDateDockPanel accountCloseDate = new AppDockPanel.InputDateDockPanel("Do dnia");

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

            sp.Children.Add(accountName);
            sp.Children.Add(accountMoney);
            sp.Children.Add(accountOpenDate);
            sp.Children.Add(accountCloseDate);
            sp.Children.Add(buttons);
            customerNewAccount.Children.Add(sp);

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

            void ConfirmNewAccount(object o, EventArgs ev)
            {
                int element = 1;

                CreateNewAccount
                (
                    customer,
                    loggedEmployee,
                    (TextBox)accountName.Children[element],
                    (TextBox)accountMoney.Children[element],
                    (DatePicker)accountOpenDate.Children[element],
                    (DatePicker)accountCloseDate.Children[element]
                );
            }

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