Beispiel #1
0
        private void HienThiCacDanhMucTreeView()
        {
            for (int i = 1; i < tvPhanLoaiSanPham.Nodes.Count; i++)
            {
                for (int j = 0; j < tvPhanLoaiSanPham.Nodes[i].Nodes.Count; j++)
                {
                    tvPhanLoaiSanPham.Nodes[i].Nodes[j].Remove();
                }
            }
            HienThiLoaiSanPhamBLL hienThiLoaiSanPhamBLL = new HienThiLoaiSanPhamBLL();

            foreach (LoaiSanPham LoaiSanPham in hienThiLoaiSanPhamBLL.HienThiDanhSachLoaiSanPham())
            {
                TreeNode treeNode = new TreeNode(LoaiSanPham.TenLoaiSanPham);
                tvPhanLoaiSanPham.Nodes[2].Nodes.Add(treeNode);
                cbLoaiHang.Items.Add(LoaiSanPham);
                treeNode.Tag = LoaiSanPham;
            }
            HienThiKhoHangBLL hienThiKhoHangBLL = new HienThiKhoHangBLL();

            foreach (KhoHang khoHang in hienThiKhoHangBLL.LayToanBoKhoHang())
            {
                TreeNode treeNode = new TreeNode(khoHang.TenKhoHang);
                tvPhanLoaiSanPham.Nodes[1].Nodes.Add(treeNode);
                cbKhoHang.Items.Add(khoHang);
                treeNode.Tag = khoHang;
            }
            HienThiNhaCungCapBLL hienThiNhaCungCapBLL = new HienThiNhaCungCapBLL();

            foreach (NhaCungCap NhaCungCap in hienThiNhaCungCapBLL.HienThiDanhSachNCC())
            {
                TreeNode treeNode = new TreeNode(NhaCungCap.TenNhaCungCap);
                tvPhanLoaiSanPham.Nodes[3].Nodes.Add(treeNode);
                cbNhaPhanPhoi.Items.Add(NhaCungCap);
                treeNode.Tag = NhaCungCap;
            }
            HienThiNhaSanXuatBLL hienThiNhaSanXuatBLL = new HienThiNhaSanXuatBLL();

            foreach (NhaSanXuat nhaSanXuat in hienThiNhaSanXuatBLL.HienThiDanhSachNSX())
            {
                TreeNode treeNode = new TreeNode("Nhà Sản Xuất " + nhaSanXuat.TenNhaSanXuat);
                tvPhanLoaiSanPham.Nodes[4].Nodes.Add(treeNode);
                cbNhaSanXuat.Items.Add(nhaSanXuat);
                treeNode.Tag = nhaSanXuat;
            }
            //HienThiNhaSanXuatBLL hienSoLuongBLL = new HienThiNhaSanXuatBLL();
            //foreach (S soluong in hienThiNhaSanXuatBLL.HienThiDanhSachNSX())
            //{
            //    TreeNode treeNode = new TreeNode("So Luong " + nhaSanXuat.TenNhaSanXuat);
            //    tvPhanLoaiSanPham.Nodes[4].Nodes.Add(treeNode);
            //    cbNhaSanXuat.Items.Add(nhaSanXuat);
            //    treeNode.Tag = nhaSanXuat;
            //}
        }
Beispiel #2
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (textMaLoaiSanPham.Text == "" || textMaLoaiSanPham.Text == null)
     {
         MessageBox.Show("Bạn Cần Phải Chọn Nhân Viên Cần Xóa");
         return;
     }
     else
     {
         HienThiLoaiSanPhamBLL hienThiLoaiSanPhamBLL = new HienThiLoaiSanPhamBLL();
         hienThiLoaiSanPhamBLL.XoaLoaiSanPham(textMaLoaiSanPham.Text);
         HienThiDanhSachLoaiSP();
     }
 }
Beispiel #3
0
        private void HienThiDanhSachLoaiSP()
        {
            HienThiLoaiSanPhamBLL hienThiLoaiSanPhamBLL = new HienThiLoaiSanPhamBLL();

            gvLoaiSanPham.Rows.Clear();
            foreach (LoaiSanPham loaiSanPham in hienThiLoaiSanPhamBLL.HienThiDanhSachLoaiSanPham())
            {
                DataGridViewRow dataGridViewRow = new DataGridViewRow();
                dataGridViewRow.CreateCells(gvLoaiSanPham);
                dataGridViewRow.Cells[0].Value = loaiSanPham.MaLoaiSanPham;
                dataGridViewRow.Cells[1].Value = loaiSanPham.TenLoaiSanPham;
                dataGridViewRow.Cells[2].Value = loaiSanPham.DonViTinh;
                dataGridViewRow.Cells[3].Value = loaiSanPham.GhiChu;
                gvLoaiSanPham.Rows.Add(dataGridViewRow);
            }
        }
Beispiel #4
0
        private void btnThemMoi_Click(object sender, EventArgs e)
        {
            //textMaLoaiSanPham.SelectedText ="";
            //texTenLoaiSanPham.Text ="";
            //texDonViTinh.Text ="";
            //textBGhiChu.Text ="";

            LoaiSanPham loaiSanPham = new LoaiSanPham()
            {
                MaLoaiSanPham  = textMaLoaiSanPham.Text,
                TenLoaiSanPham = texTenLoaiSanPham.Text,
                DonViTinh      = texDonViTinh.Text,
                GhiChu         = textBGhiChu.Text
            };
            HienThiLoaiSanPhamBLL hienThiLoaiSanPhamBLL = new HienThiLoaiSanPhamBLL();

            hienThiLoaiSanPhamBLL.ThemMoiLoaiSanPham(loaiSanPham);
            HienThiDanhSachLoaiSP();
        }
Beispiel #5
0
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            HienThiLoaiSanPhamBLL hienThiLoaiSanPhamBLL = new HienThiLoaiSanPhamBLL();
            List <LoaiSanPham>    DanhSachLoaiSP        = new List <LoaiSanPham>();

            if (radioMa.Checked)
            {
                DanhSachLoaiSP = hienThiLoaiSanPhamBLL.HienThiDanhSachLoaiSanPhamTheoMa(texTimKiem.Text);
                HienThiDanhSach(DanhSachLoaiSP);
            }
            else if (radioTen.Checked)
            {
                DanhSachLoaiSP = hienThiLoaiSanPhamBLL.HienThiDanhSachLoaiSanPhamTheoTen(texTimKiem.Text);
                HienThiDanhSach(DanhSachLoaiSP);
            }
            else
            {
                MessageBox.Show("Bạn Hãy Nhập Lụa Chọn Trước Khi Tìm Kiếm");
            }
        }
Beispiel #6
0
 private void btnChinhSua_Click(object sender, EventArgs e)
 {
     if (textMaLoaiSanPham.Text == "" || textMaLoaiSanPham.Text == null)
     {
         MessageBox.Show("Bạn Cần Phải Nhập Mã Loại SP Trươc Khi Sửa");
         return;
     }
     else
     {
         LoaiSanPham loaiSanPham = new LoaiSanPham()
         {
             MaLoaiSanPham  = textMaLoaiSanPham.Text,
             TenLoaiSanPham = texTenLoaiSanPham.Text,
             DonViTinh      = texDonViTinh.Text,
             GhiChu         = textBGhiChu.Text
         };
         HienThiLoaiSanPhamBLL hienThiLoaiSanPhamBLL = new HienThiLoaiSanPhamBLL();
         hienThiLoaiSanPhamBLL.SuaThongTinLoaiSanPham(loaiSanPham);
         HienThiDanhSachLoaiSP();
     }
 }