Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            IRepositoryGeneric <Product> repositoryProduct = new RepositoryProduct();

            if (productToBeChanged == null)
            {
                Product newProduct = new Product
                {
                    Name    = txbProductName.Text.Trim(),
                    BrandId = Convert.ToInt32(cmbBrands.SelectedValue)
                };
                repositoryProduct.Insert(newProduct);
            }
            else
            {
                productToBeChanged.Name    = txbProductName.Text;
                productToBeChanged.BrandId = Convert.ToInt32(cmbBrands.SelectedValue);
                repositoryProduct.Update(productToBeChanged);
            }
            Close();
        }
Example #2
0
        public EntityProduct Insert(Material model)
        {
            var objRepository = new RepositoryProduct();

            EntityProduct data = new EntityProduct()
            {
                Model               = model.IDMaterial,
                ProductName         = model.DescripcionRefaccion,
                SaleOrganization    = model.OrganizacionVentas,
                DistributionChannel = model.CanalDistribucion,
                Center              = model.Centro,
                MaterialGroup1      = model.GrupoMaterial1,
                MaterialGroup4      = model.GrupoMaterial4,
                ProductType         = model.TipoProducto,
                BarCode             = "",
                Status              = true,
                CreateDate          = DateTime.Now,
                ModifyDate          = DateTime.UtcNow
            };

            data = objRepository.Insert(data);
            return(data);
        }