コード例 #1
0
        private void LoadDSSamPham()
        {
            lueSanPham.Text = "(--Chọn Mặt Hàng--)";
            var listProduct = BLLCommodity.GetAll(int.Parse(AccountSuccess.IdFloor), AccountSuccess.IsAll);

            if (listProduct != null && listProduct.Count > 0)
            {
                lueSanPham.Properties.DataSource    = listProduct;
                lueSanPham.Properties.DisplayMember = "TenSanPham";
                lueSanPham.Properties.ValueMember   = "MaSanPham";
            }
        }
コード例 #2
0
        private void LoadProduct_Grid()
        {
            try
            {
                gridProduct.DataSource = null;
                var item = (Floor)cbFloor.SelectedItem;

                if (item != null && item.IdFloor != 0)
                {
                    var pro = new List <SanPham>();
                    pro.Add(new SanPham()
                    {
                        MaSanPham = 0, TenSanPham = ""
                    });
                    pro.AddRange(BLLCommodity.GetAll(item.IdFloor, AccountSuccess.IsAll));

                    gridProduct.DataSource = pro;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi lấy danh sách mã hàng.\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }