示例#1
0
        private void mnQuanLyKhachHang_Click(object sender, EventArgs e)
        {
            panel1.Controls.Clear();
            ucKhachHang banhang = new ucKhachHang();

            panel1.Controls.Add(banhang);

            banhang.Dock = DockStyle.Fill;
            banhang.BringToFront();
        }
示例#2
0
        private void TaoTabpage(ChucNang cn)
        {
            string strTenTabpage = string.Empty;

            switch (cn)
            {
            case ChucNang.BanHang:
                strTenTabpage = "Bán Hàng";
                if (!tabControlMain.Contains(tabBanHang))
                {
                    tabBanHang = new TabPage(strTenTabpage);
                    ucBanHang _ucBanHang = new ucBanHang();
                    tabBanHang.Controls.Add(_ucBanHang);
                    _ucBanHang.Dock = DockStyle.Fill;

                    tabControlMain.TabPages.Add(tabBanHang);
                    tabControlMain.SelectedTab = tabBanHang;
                }
                else
                {
                    tabControlMain.SelectedTab = tabBanHang;
                }
                break;

            case ChucNang.KhachHang:
                strTenTabpage = "Khách Hàng";
                if (!tabControlMain.Contains(tabKhachHang))
                {
                    tabKhachHang = new TabPage(strTenTabpage);
                    ucKhachHang _ucKhachHang = new ucKhachHang();
                    tabKhachHang.Controls.Add(_ucKhachHang);
                    _ucKhachHang.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabKhachHang);
                    tabControlMain.SelectedTab = tabKhachHang;
                }
                else
                {
                    tabControlMain.SelectedTab = tabKhachHang;
                }
                break;

            case ChucNang.BaoCaoBanHang:
                strTenTabpage = "Báo Cáo Bán Hàng";
                if (!tabControlMain.Contains(tabBaoCaoBanHang))
                {
                    tabBaoCaoBanHang = new TabPage(strTenTabpage);
                    ucBaoCaoBanHang _ucBaoCaoBanHang = new ucBaoCaoBanHang();
                    tabBaoCaoBanHang.Controls.Add(_ucBaoCaoBanHang);
                    _ucBaoCaoBanHang.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabBaoCaoBanHang);
                    tabControlMain.SelectedTab = tabBaoCaoBanHang;
                }
                else
                {
                    tabControlMain.SelectedTab = tabBaoCaoBanHang;
                }
                break;

            case ChucNang.NhapHang:
                strTenTabpage = "Nhập Hàng";
                if (!tabControlMain.Contains(tabNhapHang))
                {
                    tabNhapHang = new TabPage(strTenTabpage);
                    ucNhapHang _ucNhapHang = new ucNhapHang();
                    tabNhapHang.Controls.Add(_ucNhapHang);
                    _ucNhapHang.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabNhapHang);
                    tabControlMain.SelectedTab = tabNhapHang;
                }
                else
                {
                    tabControlMain.SelectedTab = tabNhapHang;
                }
                break;

            case ChucNang.NhaCungCap:
                strTenTabpage = "Nhà Cung Cấp";
                if (!tabControlMain.Contains(tabNhaCungCap))
                {
                    tabNhaCungCap = new TabPage(strTenTabpage);
                    ucNhaCungCap _ucNhaCungCap = new ucNhaCungCap();
                    tabNhaCungCap.Controls.Add(_ucNhaCungCap);
                    _ucNhaCungCap.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabNhaCungCap);
                    tabControlMain.SelectedTab = tabNhaCungCap;
                }
                else
                {
                    tabControlMain.SelectedTab = tabNhaCungCap;
                }
                break;

            case ChucNang.BaoCaoNhapHang:
                strTenTabpage = "Báo Cáo Nhập Hàng";
                if (!tabControlMain.Contains(tabBaoCaoNhapHang))
                {
                    tabBaoCaoNhapHang = new TabPage(strTenTabpage);
                    ucBaoCaoNhapHang _ucBaoCaoNhapHang = new ucBaoCaoNhapHang();
                    tabBaoCaoNhapHang.Controls.Add(_ucBaoCaoNhapHang);
                    _ucBaoCaoNhapHang.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabBaoCaoNhapHang);
                    tabControlMain.SelectedTab = tabBaoCaoNhapHang;
                }
                else
                {
                    tabControlMain.SelectedTab = tabBaoCaoNhapHang;
                }
                break;

            case ChucNang.HangHoa:
                strTenTabpage = "Hàng Hoá";
                if (!tabControlMain.Contains(tabPageHangHoa))
                {
                    tabPageHangHoa = new TabPage(strTenTabpage);
                    ucHangHoa _ucHangHoa = new ucHangHoa();
                    tabPageHangHoa.Controls.Add(_ucHangHoa);
                    _ucHangHoa.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabPageHangHoa);
                    tabControlMain.SelectedTab = tabPageHangHoa;
                }
                else
                {
                    tabControlMain.SelectedTab = tabPageHangHoa;
                }
                break;

            case ChucNang.TonKho:
                strTenTabpage = "Tồn Kho";
                if (!tabControlMain.Contains(tabTonKho))
                {
                    tabTonKho = new TabPage(strTenTabpage);
                    ucTonKho _ucTonKho = new ucTonKho();
                    tabTonKho.Controls.Add(_ucTonKho);
                    _ucTonKho.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabTonKho);
                    tabControlMain.SelectedTab = tabTonKho;
                }
                else
                {
                    tabControlMain.SelectedTab = tabTonKho;
                }
                break;

            case ChucNang.NhanBaoHanh:
                strTenTabpage = "Bảo Hành";
                if (!tabControlMain.Contains(tabNhanBaoHanh))
                {
                    tabNhanBaoHanh = new TabPage(strTenTabpage);
                    ucNhanBaoHanh _ucNhanBaoHanh = new ucNhanBaoHanh();
                    _ucNhanBaoHanh.timSoSerial += BatTabTimSoSerial;
                    tabNhanBaoHanh.Controls.Add(_ucNhanBaoHanh);
                    _ucNhanBaoHanh.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabNhanBaoHanh);
                    tabControlMain.SelectedTab = tabNhanBaoHanh;
                }
                else
                {
                    tabControlMain.SelectedTab = tabNhanBaoHanh;
                }
                break;

            case ChucNang.KhoBaoHanh:
                strTenTabpage = "Kho Bảo Hành";
                if (!tabControlMain.Contains(tabKhoBaoHanh))
                {
                    tabKhoBaoHanh = new TabPage(strTenTabpage);
                    ucKhoBaoHanh _ucKhoBaoHanh = new ucKhoBaoHanh();
                    tabKhoBaoHanh.Controls.Add(_ucKhoBaoHanh);
                    _ucKhoBaoHanh.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabKhoBaoHanh);
                    tabControlMain.SelectedTab = tabKhoBaoHanh;
                }
                else
                {
                    tabControlMain.SelectedTab = tabKhoBaoHanh;
                }
                break;

            case ChucNang.BaoCaoBaoHanh:
                strTenTabpage = "Báo Cáo Bảo Hành";
                if (!tabControlMain.Contains(tabBaoCaoBaoHanh))
                {
                    tabBaoCaoBaoHanh = new TabPage(strTenTabpage);
                    ucBaoCaoBaoHanh _ucBaoCaoBaoHanh = new ucBaoCaoBaoHanh();
                    tabBaoCaoBaoHanh.Controls.Add(_ucBaoCaoBaoHanh);
                    _ucBaoCaoBaoHanh.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabBaoCaoBaoHanh);
                    tabControlMain.SelectedTab = tabBaoCaoBaoHanh;
                }
                else
                {
                    tabControlMain.SelectedTab = tabBaoCaoBaoHanh;
                }
                break;

            case ChucNang.NhanVien:
                strTenTabpage = "Nhân Viên";
                if (!tabControlMain.Contains(tabNhanVien))
                {
                    tabNhanVien = new TabPage(strTenTabpage);
                    ucNhanVien _ucNhanVien = new ucNhanVien();
                    tabNhanVien.Controls.Add(_ucNhanVien);
                    _ucNhanVien.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabNhanVien);
                    tabControlMain.SelectedTab = tabNhanVien;
                }
                else
                {
                    tabControlMain.SelectedTab = tabNhanVien;
                }
                break;

            case ChucNang.DoanhThu:
                strTenTabpage = "Doanh Thu";
                if (!tabControlMain.Contains(tabDoanhthu))
                {
                    tabDoanhthu = new TabPage(strTenTabpage);
                    ucDoanhThu _ucDoanhThu = new ucDoanhThu();
                    tabDoanhthu.Controls.Add(_ucDoanhThu);
                    _ucDoanhThu.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabDoanhthu);
                    tabControlMain.SelectedTab = tabDoanhthu;
                }
                else
                {
                    tabControlMain.SelectedTab = tabDoanhthu;
                }
                break;

            case ChucNang.LoiNhuan:
                strTenTabpage = "Lợi Nhuận";
                if (!tabControlMain.Contains(tabLoiNhuan))
                {
                    tabLoiNhuan = new TabPage(strTenTabpage);
                    ucLoiNhuan _ucLoiNhuan = new ucLoiNhuan();
                    tabLoiNhuan.Controls.Add(_ucLoiNhuan);
                    _ucLoiNhuan.Dock = DockStyle.Fill;


                    tabControlMain.TabPages.Add(tabLoiNhuan);
                    tabControlMain.SelectedTab = tabLoiNhuan;
                }
                else
                {
                    tabControlMain.SelectedTab = tabLoiNhuan;
                }
                break;

            default:
                break;
            }
        }