예제 #1
0
        public void LoadData()
        {
            BUS_Parameter busParameter = new BUS_Parameter();

            limitRow = busParameter.GetValue("RowInList");
            BUS_Employees bus_employees = new BUS_Employees();
            int           empCount      = bus_employees.CountEmployees();

            if (empCount % limitRow == 0)
            {
                lblMaxPage.Content = empCount / limitRow;
            }
            else
            {
                lblMaxPage.Content = empCount / limitRow + 1;
            }
            if (currentPage == (int)lblMaxPage.Content)
            {
                btnPageNext.IsEnabled = false;
            }
            else
            {
                btnPageNext.IsEnabled = true;
            }
            ReloadDGAccount();
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Media.Effects.BlurEffect objBlur = new System.Windows.Media.Effects.BlurEffect();
            ((MainWindow)App.Current.MainWindow).Opacity = 0.5;
            ((MainWindow)App.Current.MainWindow).Effect  = objBlur;
            Window window = new Window
            {
                ResizeMode            = ResizeMode.NoResize,
                WindowStyle           = WindowStyle.None,
                Title                 = "Thêm tài khoản",
                Content               = new PopupAddAccount(),
                Width                 = 460,
                Height                = 460,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            window.ShowDialog();

            BUS_Employees busEmp   = new BUS_Employees();
            int           empCount = busEmp.CountEmployees();

            if (empCount % limitRow == 0)
            {
                lblMaxPage.Content = empCount / limitRow;
            }
            else
            {
                lblMaxPage.Content = empCount / limitRow + 1;
            }

            if (currentPage < (int)lblMaxPage.Content)
            {
                btnPageNext.IsEnabled = true;
            }
            else
            {
                btnPageNext.IsEnabled = false;
            }

            ReloadDGAccount();
            ((MainWindow)App.Current.MainWindow).Opacity = 1;
            ((MainWindow)App.Current.MainWindow).Effect  = null;
        }
예제 #3
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            string id = ((Button)sender).Tag.ToString();

            if (_context.GetCurrentEmpID() == id)
            {
                MessageBox.Show("Không được xóa tài khoản của bản thân!");
                return;
            }

            if (id == "E001")
            {
                MessageBox.Show("Đây là tài khoản gốc, không thể xóa!");
                return;
            }

            BUS_Employees busEmp = new BUS_Employees();
            string        name   = busEmp.GetEmpNameByID(id);

            System.Windows.Media.Effects.BlurEffect objBlur = new System.Windows.Media.Effects.BlurEffect();
            ((MainWindow)App.Current.MainWindow).Opacity = 0.5;
            ((MainWindow)App.Current.MainWindow).Effect  = objBlur;
            Window window = new Window
            {
                ResizeMode            = ResizeMode.NoResize,
                WindowStyle           = WindowStyle.None,
                Title                 = "Xóa tài khoản",
                Content               = new PopupDeleteConfirm($"Bạn có chắc chắn muốn xóa tài khoản {id}\ncủa nhân viên {name} không?", id, 1),
                Width                 = 420,
                Height                = 210,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            window.ShowDialog();

            int empCount = busEmp.CountEmployees();

            if (empCount % limitRow == 0)
            {
                lblMaxPage.Content = empCount / limitRow;
            }
            else
            {
                lblMaxPage.Content = empCount / limitRow + 1;
            }
            if (currentPage > (int)lblMaxPage.Content)
            {
                tbNumPage.Text = (--currentPage).ToString();
            }

            if (currentPage == (int)lblMaxPage.Content)
            {
                btnPageNext.IsEnabled = false;
            }
            else
            {
                btnPageNext.IsEnabled = true;
            }

            if (currentPage == 1)
            {
                btnPagePre.IsEnabled = false;
            }
            else
            {
                btnPagePre.IsEnabled = true;
            }

            ReloadDGAccount();
            ((MainWindow)App.Current.MainWindow).Opacity = 1;
            ((MainWindow)App.Current.MainWindow).Effect  = null;
        }