コード例 #1
0
        private void FrmAddStock_Load(object sender, EventArgs e)
        {
            using (var depositService = _serviceFactory.Create<IDepositService>())
            {
                var deposits = depositService.GetAll().OrderBy(x => x.Name).ToList();
                ucDepositSelection.Deposits = deposits;
            }

            using (var productService = _serviceFactory.Create<IProductService>())
            {
                var products = productService.GetAll().OrderBy(x => x.Name).ToList();
                ddlProducts.ValueMember = "Id";
                ddlProducts.DisplayMember = "Name";

                var product = new Product();
                product.Id = Guid.Empty;
                product.Name = "Seleccione un producto..";
                products.Insert(0, product);

                ddlProducts.DataSource = products;
            }

            using (var providerService = _serviceFactory.Create<IProviderService>())
            {
                var providers = providerService.GetAll().OrderBy(x => x.Name).ToList();
                ddlProviders.ValueMember = "Id";
                ddlProviders.DisplayMember = "Name";

                var provider = new Provider();
                provider.Id = Guid.Empty;
                provider.Name = "Seleccione un proveedor..";
                providers.Insert(0, provider);

                ddlProviders.DataSource = providers;
            }

            using (var shiftService = _serviceFactory.Create<IShiftService>())
            {
                var shifts = shiftService.GetAll().OrderBy(x => x.Name).ToList();
                ddlShifts.ValueMember = "Id";
                ddlShifts.DisplayMember = "Name";

                var shift = new Shift();
                shift.Id = Guid.Empty;
                shift.Name = "Seleccione un turno..";
                shifts.Insert(0, shift);

                ddlShifts.DataSource = shifts;
            }
        }
コード例 #2
0
 public void Create(Product product)
 {
     Uow.Products.Add(product);
     Uow.Commit();
 }