public List <ProductMangementDto> GetAllProduct()
        {
            List <ProductMangementDto> dtos = new List <ProductMangementDto>();

            try
            {
                List <Product> products = this.productRepository.GetAll().ToList();

                foreach (Product pd in products)
                {
                    ProductMangementDto dto = new ProductMangementDto();
                    dto.Id          = pd.ProductId.ToString();
                    dto.Barcode     = pd.Barcode;
                    dto.Unit        = pd.Unit;
                    dto.ProductName = pd.Name;
                    dto.ImageUrl    = Convert.ToBase64String(pd.ImageUrl);
                    dto.Quantity    = this.productDetailRepository.Quantity(Convert.ToInt32(dto.Id));

                    dtos.Add(dto);
                }
            }
            catch
            {
                return(dtos);
            }

            return(dtos);
        }
        public frm_ProductManagementDetail(ProductMangementDto productDetalDto)
        {
            InitializeComponent();

            this.ProductMangementDto = productDetalDto;

            this.initForm();
        }
示例#3
0
        // Xử lý khi double clock [Danh sách sản phẩm]
        private void doubleClickRow(object sender, EventArgs e)
        {
            if (this.tempProductManagementDtos.Count <= 0)
            {
                return;
            }

            if (this.dgvListProduct.SelectedRows.Count == 0)
            {
                return;
            }

            string index = this.dgvListProduct.SelectedRows[0].Cells[0].Value.ToString();

            ProductMangementDto tempDto = this.tempProductManagementDtos[Convert.ToInt32(index) - 1];

            frm_ProductManagementDetail form = new frm_ProductManagementDetail(tempDto);

            form.Show();
        }