Example #1
0
        public Bank(PassBook pb)
        {
            bank = new Views.Bank();
            bank.dtgridListBank.ItemsSource = db.Banks.ToList();

            bank.btnSave.Click += (sender, e) =>
            {
                if (bank.txtBankName.Text != "" && bank.txtShortName.Text != "")
                {
                    db.Banks.Add(new Models.Bank {
                        BankName = bank.txtBankName.Text, ShortName = bank.txtShortName.Text
                    });
                    db.SaveChanges();
                    bank.dtgridListBank.ItemsSource = db.Banks.ToList();
                    pb.passBook.cbbBank.ItemsSource = db.Banks.ToList();
                }
                else
                {
                    MessageBox.Show("Nội dung không được để rỗng", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            };

            bank.btnCancel.Click += (sender, e) =>
            {
                bank.Close();
            };

            bank.btnClose.Click += (sender, e) =>
            {
                bank.Close();
            };
        }
Example #2
0
        public PassbookList(MainWindow mainWindow)
        {
            passBookList = new Views.PassbookList();

            LoadWithDrawal();
            ShowDataGrid();
            LoadHeaderSettlement();

            passBookList.dtgridSettlement.ItemsSource = Models.PassBook.getListPassBookSettlement(UserID);

            passBookList.btnAddPassBook.Click += (sender, e) =>
            {
                passBook = new PassBook(this);
                passBook.ShowDialog();
            };

            passBookList.btnEditPassBook.Click += (sender, e) =>
            {
                try
                {
                    if (lastSelectedItem.Settlement == false)
                    {
                        EditPassBook editPassBook = new EditPassBook(this, lastSelectedItem);
                        editPassBook.ShowDialog();
                    }
                }
                catch { }
            };

            passBookList.btnAddMore.Click += (sender, e) =>
            {
                try
                {
                    if (lastSelectedItem.Settlement == false)
                    {
                        AddToPassBook addMore = new AddToPassBook(this, lastSelectedItem);
                        addMore.ShowDialog();
                    }
                }
                catch { }
            };

            passBookList.btnSettlement.Click += (sender, e) =>
            {
                try
                {
                    if (lastSelectedItem.Settlement == false)
                    {
                        Withdrawal withDrawal = new Withdrawal(this, lastSelectedItem);
                        withDrawal.ShowDialog();
                    }
                }
                catch { }
            };

            passBookList.btnWithDrawal.Click += (sender, e) =>
            {
                try
                {
                    if (lastSelectedItem.Settlement == false)
                    {
                        PartialWithdrawal partialWithDrawal = new PartialWithdrawal(this, lastSelectedItem);
                        partialWithDrawal.ShowDialog();
                    }
                }
                catch { }
            };

            passBookList.btnViewPassBook.Click += (sender, e) =>
            {
                try
                {
                    Models.PassBook pb   = (Models.PassBook)passBookList.dtgridSettlement.SelectedItem;
                    Menu            menu = new Menu(pb);
                    menu.ShowDialog();
                }
                catch { }
            };

            passBookList.btnBack.Click += (sender, e) =>
            {
                passBookList.Close();
                mainWindow.mainWindow.Show();
                Logout();
            };
            passBookList.btnSetting.Click += (sender, e) =>
            {
                userInformation = new UserInformation();
                userInformation.ShowDialog();
            };
        }