//CHỌN CHỨC NĂNG TRANG CHỦ private void ChonChucNang_TrangChu(object sender, EventArgs e) { TrangChuUPresentation wpf = (TrangChuUPresentation)sender; int _ChucNang = wpf._ChucNang; switch (_ChucNang) { case 1: BanHangUPresentation _bh = new BanHangUPresentation(); _bh._NhanVien = _NhanVien; gdContentMain.Children.Clear(); gdContentMain.Children.Add(_bh); lbTitle.Content = "LẬP HÓA ĐƠN BÁN HÀNG"; break; case 2: NhapHangTraUPresentation _nht = new NhapHangTraUPresentation(); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_nht); lbTitle.Content = "NHẬP HÀNG TRẢ"; break; case 3: NhapMuaUPresentation _nm = new NhapMuaUPresentation(); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_nm); lbTitle.Content = "NHẬP MUA"; break; case 4: TaoMaVachUPresentation _tmv = new TaoMaVachUPresentation(); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_tmv); lbTitle.Content = "TẠO MÃ VẠCH SẢN PHẨM"; break; case 5: KhachHangUPresentation _kh = new KhachHangUPresentation(); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_kh); lbTitle.Content = "QUẢN LÝ KHÁCH HÀNG"; break; case 6: SanPhamUPresentation _sp = new SanPhamUPresentation(); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_sp); lbTitle.Content = "QUẢN LÝ SẢN PHẨM"; break; } lbTitle.Visibility = System.Windows.Visibility.Visible; btnBack.Visibility = System.Windows.Visibility.Visible; _menu = 1; }
//PHƯƠNG THỨC ĐĂNG NHẬP private void DangNhap(object sender, EventArgs e) { //Chuyển sang trạng thái đã đăng nhập _DangNhap = true; //Lấy thông tin nhân viên DangNhapUPresentation wpf_DangNhap = (DangNhapUPresentation)sender; _NhanVien = wpf_DangNhap.Nv; //Lấy quyền truy nhập _lstQuyen = PhanQuyenBusiness.LayQuyenChucNangTheoQuyen(_NhanVien.ID_Q); HienThiTheoQuyen(); gdContentMain.Children.Clear(); //Hiển thị trang chủ TrangChuUPresentation wpf_Home = new TrangChuUPresentation(); wpf_Home._lstQuyen = _lstQuyen; wpf_Home._ChonChucNang += new EventHandler(ChonChucNang_TrangChu); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_Home); btnBack.Visibility = System.Windows.Visibility.Collapsed; FocusButon(1); //Hiển thị thông tin nhân viên đăng nhập HienThiNhanVien(); }
//NÚT HOME private void btnHome_Click(object sender, RoutedEventArgs e) { TrangChuUPresentation wpf_TrangChu = new TrangChuUPresentation(); wpf_TrangChu._ChonChucNang += new EventHandler(ChonChucNang_TrangChu); wpf_TrangChu._lstQuyen = _lstQuyen; gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_TrangChu); FocusButon(1); _menu = 1; btnBack.Visibility = System.Windows.Visibility.Collapsed; lbTitle.Visibility = System.Windows.Visibility.Collapsed; }
//Nút back private void btnBack_Click(object sender, RoutedEventArgs e) { switch (_menu) { case 0: //Giao diện bắt đầu BatDauUPresentation _wpfBatdau = new BatDauUPresentation(); _wpfBatdau._ChonChucNang += new EventHandler(ChonChucNang_WPFBatDau); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_wpfBatdau); break; case 1: //Trang chủ TrangChuUPresentation wpf_Home = new TrangChuUPresentation(); wpf_Home._lstQuyen = _lstQuyen; wpf_Home._ChonChucNang += new EventHandler(ChonChucNang_TrangChu); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_Home); break; case 2: //Kho KhoUPresentation wpf_kho = new KhoUPresentation(); wpf_kho._lstQuyen = _lstQuyen; wpf_kho._ChonChucNang += new EventHandler(ChonChucNang_KHO); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_kho); break; case 3: //Báo cáo ThongKeBaoCaoUPresentation wpf_baocao = new ThongKeBaoCaoUPresentation(); wpf_baocao._lstQuyen = _lstQuyen; wpf_baocao._ChonChucNang += new EventHandler(ChonChucNang_ThongKeBaoCao); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_baocao); break; case 4: //Thiết lập ThietLapUPresentation wpf_thietlap = new ThietLapUPresentation(); wpf_thietlap._lstQuyen = _lstQuyen; wpf_thietlap.evChonChucNang += new EventHandler(evMoChucNang); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_thietlap); break; } lbTitle.Visibility = System.Windows.Visibility.Collapsed; btnBack.Visibility = System.Windows.Visibility.Collapsed; }