public ucTraCuuMatHang()
        {
            InitializeComponent();
            _MatHangBUS = new MatHangBUS();
            _HinhAnhBUS = new HinhAnhBUS();
            _CauHinhDienThoaiBUS = new CauHinhDienThoaiBUS();

            //ComboBox NhaSanXuat
            DataTable table1 = (new NhaSanXuatBUS().LoadComBoBox());
            this.lueNhaSX.Properties.DataSource = table1;
            this.lueNhaSX.Properties.DisplayMember = "TenNSX";
            this.lueNhaSX.Properties.ValueMember = "MaNSX";
            this.lueNhaSX.Properties.NullText = "Chọn Nhà Sản Xuất";
            this.lueNhaSX.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenNSX" });

            //ConboBox LoaiMatHang
            DataTable table = (new LoaiMatHangBUS().LoadComBoBox());
            this.lueLoaiSanPham.Properties.DataSource = table;
            this.lueLoaiSanPham.Properties.DisplayMember = "TenLoaiMatHang";
            this.lueLoaiSanPham.Properties.ValueMember = "MaLoaiMatHang";
            this.lueLoaiSanPham.Properties.NullText = "Chọn Loại Mặt Hàng";
            this.lueLoaiSanPham.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenLoaiMatHang" });

            //timKiem();
        }
        private void LoadData()
        {
            //ConboBox LoaiMatHang
            DataTable table = (new LoaiMatHangBUS().LoadComBoBox());
            this.lueLoaiSanPham.Properties.DataSource = table;
            this.lueLoaiSanPham.Properties.DisplayMember = "TenLoaiMatHang";
            this.lueLoaiSanPham.Properties.ValueMember = "MaLoaiMatHang";
            this.lueLoaiSanPham.Properties.NullText = "Chọn Loại Sản Phẩm";
            this.lueLoaiSanPham.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenLoaiMatHang" });

            //ComboBox NhaSanXuat
            DataTable table1 = (new NhaSanXuatBUS().LoadComBoBox());
            this.lueNhaSanXuat.Properties.DataSource = table1;
            this.lueNhaSanXuat.Properties.DisplayMember = "TenNSX";
            this.lueNhaSanXuat.Properties.ValueMember = "MaNSX";
            this.lueNhaSanXuat.Properties.NullText = "Chọn Nhà Sản Xuất";
            this.lueNhaSanXuat.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenNSX" });

            //ComboBox NhaCC
            DataTable table5 = (new NhaCungCapBUS().LoadComBoBox());
            this.lueNhaCC.Properties.DataSource = table5;
            this.lueNhaCC.Properties.DisplayMember = "TenNhaCungCap";
            this.lueNhaCC.Properties.ValueMember = "MaNhaCungCap";
            this.lueNhaCC.Properties.NullText = "Chọn Nhà Cung Cấp";
            this.lueNhaCC.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenNhaCungCap" });

            //ComboBox CPU
            DataTable table2 = (new CPUBUS().LoadComBoBox());
            this.lueCPU.Properties.DataSource = table2;
            this.lueCPU.Properties.DisplayMember = "TenCPU";
            this.lueCPU.Properties.ValueMember = "MaCPU";
            this.lueCPU.Properties.NullText = "Chọn CPU";
            this.lueCPU.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenCPU" });

            //ComboBox CPU
            DataTable table3 = (new MauSacBUS().LoadComBoBox());
            this.lueMaSac.Properties.DataSource = table3;
            this.lueMaSac.Properties.DisplayMember = "TenMau";
            this.lueMaSac.Properties.ValueMember = "MaMau";
            this.lueMaSac.Properties.NullText = "Chọn Màu Sắc";
            this.lueMaSac.Properties.Columns.Add(
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo() { FieldName = "TenMau" });

            //Load Data if Update

            if (StaticVariables.gMatHang != null)
            {
                matHang = StaticVariables.gMatHang;

                this.teTenSanPham.Text = matHang.TenMatHang;
                this.lueLoaiSanPham.EditValue = new LoaiMatHangBUS().LayMaLoaiMatHang(matHang.MaLoaiMatHang);
                this.lueNhaSanXuat.EditValue = new NhaSanXuatBUS().LayMaNhaSanXuat(matHang.MaNhaSanXuat);

                this.teThoiGianBaoHanh.Text = matHang.ThoiGianBaoHanh.ToString();
                this.memMoTa.Text = matHang.MoTa;
                this.memGhiChu.Text = matHang.GhiChu;

                CauHinhDienThoai cauHinhDT = new CauHinhDienThoai();
                cauHinhDT = new CauHinhDienThoaiBUS().LayCauHinhByMaMatHang(matHang.MaMatHang);

                this.teKichThuocManHinh.Text = cauHinhDT.KichThuocManHinh.ToString();
                this.teHeDieuHanh.Text = cauHinhDT.HeDieuHanh;
                this.teRam.Text = cauHinhDT.Ram.ToString();
                this.lueMaSac.EditValue = cauHinhDT.MaMauSac;
                this.tePIN.Text = cauHinhDT.DungLuongPin.ToString();
                this.lueCPU.EditValue = cauHinhDT.MaCPU;
                this.teBoNho.Text = cauHinhDT.BoNho.ToString();
                this.teSim.Text = cauHinhDT.SoSim.ToString();

                this.lueNhaCC.EditValue = new NhaCungCapBUS().LayMaCCBangMaSanPham(matHang.MaMatHang);
                this.memGhiChuNCC.Text = new NhaCungCapBUS().LayGhiChuBangMaSanPham(matHang.MaMatHang);

                DonGia donGia = new DonGia();
                donGia = new DonGiaBUS().LayDonGiaBangMaSanPham(matHang.MaMatHang);

                this.teGiaNhap.Text = donGia.GiaNhap.ToString();
                this.teGiaXuat.Text = donGia.GiaXuat.ToString();

                //Load hình
                HinhAnhBUS _HinhAnhBUS = new HinhAnhBUS();
                DataTable dt = _HinhAnhBUS.LayHinhMatHang(matHang.MaMatHang);
                if (dt != null && dt.Rows.Count > 0)
                {
                    this.peHinhAnh.Image = this.Base64ToImage(dt.Rows[0].ItemArray[0].ToString());
                    peHinhAnh.Invalidate();
                }
            }
        }