示例#1
0
        /// <summary>
        /// Danh sách Hàng hóa
        /// </summary>
        private void LoadProducts(string stockId)
        {
            var products = _productService.GetProducts()
                           .Select(p => new ProductView()
            {
                ProductID        = p.ProductID,
                ProductName      = p.ProductName,
                ProductGroupID   = p.ProductGroupID,
                ProductGroupName = _productGroupService.GetProductGroupNameById(p.ProductGroupID),
                StockID          = p.StockID,
                StockName        = _stockService.GetStockNameById(p.StockID),
                UnitID           = p.UnitID,
                UnitName         = _unitService.GetUnitNameById(p.UnitID),
                SupplierName     = p.Supplier,
                Origin           = p.Origin,
                Quantity         = p.Quantiry,
                ExpireDate       = p.ExpireDate,
                Image            = p.ProductImage,
                Description      = p.Description,
                IsActive         = p.Active,
                Price            = p.Price,
            }).ToList();

            IEnumerable <ProductView> productViews = !string.IsNullOrEmpty(stockId) ? products.Where(p => p.StockID == stockId) : products;

            gridControl1.DataSource = productViews;
        }