public ConsumoOferta(CompraService compraService, OfertaService ofertaService) { this.ofertaService = ofertaService; this.compraService = compraService; InitializeComponent(); //cargarDataDridView(); }
/* No construtor da classe, através de injeção de dependência * as classes serão instânciadas de acordo com as interfaces * de que herdam, qual classe será instanciada de acordo com a instância * que é pedida está definido no container do simple injector */ public CompraController(ICompraRepository compraRepository, ICompraProdutoRepository compraProdutoRepository, INotification notification, CompraService service) { _compraRepository = compraRepository; _compraProdutoRepository = compraProdutoRepository; _notification = notification; _appService = service; }
public void Devera_Add_Nova_Compra() { var baseContext = new CotextoBase("AddCompra"); var context = new LojaContexto(baseContext.Options); var fakeCompra = _contextoBase.GetDadosFake <Compra>() .Where(x => x.Id == 4) .Join(_contextoBase.GetDadosFake <Compra>(), compra => compra.ClienteId, cliente => cliente.Id, (cliente, compra) => compra) .Join(_contextoBase.GetDadosFake <Produto>(), compra => compra.ProdutoId, produto => produto.Id, (compra, produto) => compra) .Distinct() .FirstOrDefault(); fakeCompra.Id = 0; //metodo de teste var compraservice = new CompraService(context); var atual = compraservice.Salvar(fakeCompra); //Assert Assert.NotEqual(0, fakeCompra.Id); }
public ConsultarCompra() { InitializeComponent(); oProveedorService = new ProveedorService(); oLibroService = new LibroService(); oCompraService = new CompraService(); oCompraSeleccionada = new Compra(); }
public void ProbarComprarService(string nitProvedor, int usuarioId, string esperado) { CompraRequest request = new CompraRequest.CompraRequestBuilder(nitProvedor, usuarioId) .SetDetalles(compraDetallesCorrectos).Build(); Response response = new CompraService(_unitOfWork).HacerCompraService(request); Assert.AreEqual(esperado, response.Mensaje); }
//private ClienteService _clienteService; //private ProdutoService _produtoService; public CompraServicesTest() { _contextoBase = new CotextoBase("ComprasTestes"); _contexto = new LojaContexto(_contextoBase.Options); _comprasService = new CompraService(_contexto); //_clienteService = new ClienteService(_contexto); //_produtoService = new ProdutoService(_contexto); }
public ActionResult <Response> HacerCompra(CompraRequest request) { Response response = new CompraService(_unitOfWork).HacerCompraService(request); if (response.Data == null) { return(BadRequest(response.Mensaje)); } return(Ok(response)); }
public void ProbarComprarServiceConDetallesIncorrectos() { CompraRequest request = new CompraRequest.CompraRequestBuilder("10103116", 1) .SetDetalles(compraDetallesInCorrectos).Build(); Response response = new CompraService(_unitOfWork).HacerCompraService(request); Assert.AreEqual("El producto con id 7 no existe, " + "La cantidad del producto con id 7 es invalida, " + "El valor del producto con id 7 es invalida", response.Mensaje); }
public CompraServicesTest() { var options = new DbContextOptionsBuilder <LojaContexto>(); options.UseSqlServer("Server=localhost,1433;Database=Loja3;User Id =sa;Password=Ing@2020;Trusted_Connection=False;"); _contexto = new LojaContexto(options.Options); _clienteService = new ClienteService(_contexto); _comprasService = new CompraService(_contexto); _produtoService = new ProdutoService(_contexto); }
public void WhenSistemaSimularAcompra() { var service = new CompraService(new CompraRepository(this.MassaBuilder.Context)); var controller = new CompraController(service); var result = controller.Simular(this.MassaBuilder.Compra); var okResponse = result as OkObjectResult; this.MassaBuilder.Compra = okResponse.Value as Compra; }
public CompraServicesTest() { var options = new DbContextOptionsBuilder <LojaContext>(); options.UseSqlServer("Server=localhost;Database=LojaServices;Integrated Security=True;"); _contexto = new LojaContext(options.Options); _clienteService = new ClienteService(_contexto); _comprasService = new CompraService(_contexto); _produtoService = new ProdutoService(_contexto); }
public void WhenSistemaSalvarAsimulacaoDeCompra() { var service = new CompraService(new CompraRepository(this.MassaBuilder.Context)); var controller = new CompraController(service); var result = controller.Post(this.MassaBuilder.Compra).ConfigureAwait(false); var createdResponse = result.GetAwaiter().GetResult() as CreatedResult; this.MassaBuilder.Compra = createdResponse.Value as Compra; }
public ItemSelecionadoPopUpView(string Produto, int Quantidade, int IdProduto, Compra compra) { InitializeComponent(); // Recupera os valores compraService = new CompraService(); lblProduto.Text = Produto; _quantidade = Quantidade; entryQuantidade.Text = Quantidade.ToString(); _IdProduto = IdProduto; pageCompra = compra; }
public ActionResult CantidadEntradas(Tanda tanda, int descuento, bool Promocion, int PuntosMenos) { if (tanda != null) { var CompraService = new CompraService(); compra = CompraService.Compra(tanda, descuento, Promocion, PuntosMenos); return(View(compra)); } else { return(RedirectToAction("Cartelera")); } }
public FacturarProveedorForm1(CompraService compraService, ProveedorService _proveedorService, OfertaService _ofertaService, FacturaService _facturaService) { this._compraService = compraService; this._proveedorService = _proveedorService; this._ofertaService = _ofertaService; this._facturaService = _facturaService; InitializeComponent(); inicioFactDate.Value = fechaDelDia; finFactDate.Value = fechaDelDia; cargarProveedores(); }
private void btn_confirmar_compra_Click(object sender, EventArgs e) { if (this.entradasCompradasN.Count == 0) { MessageBox.Show("Debes elegir al menos una ubicación!", "Error compra.", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (this.cliente.DatosTarjeta == "Sin información") { MessageBox.Show("Debes ingresar una tarjeta!", "Error compra.", MessageBoxButtons.OK, MessageBoxIcon.Information); Compra_Agregar_Tarjeta tarjeta = new Compra_Agregar_Tarjeta(this, this.cliente); tarjeta.ShowDialog(); } else { DialogResult result = MessageBox.Show("Confirmar compra", "Compra", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == System.Windows.Forms.DialogResult.OK) { try { List <Entrada> entradasTotal = new List <Entrada>(); entradasTotal.AddRange(entradasCompradasN); entradasTotal.AddRange(entradasCompradasSN); CompraService compraService = (CompraService)ServiceFactory.GetService("Compra"); compraService.save(this.cliente, entradasTotal, this.precioTotal, this.publicacion); MessageBox.Show("Compra realizada con exito!", "Compra", MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.form_ubicacion != null) { this.form_ubicacion.Close(); } if (this.form_compraSN != null) { this.form_compraSN.Close(); } this.previous.Show(); this.Close(); } catch (SqlException exception) { Console.WriteLine(exception.Message); MessageBox.Show(exception.Message, "Error al comprar.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } }
private void Historial_Load(object sender, EventArgs e) { ClienteService clienteService = new ClienteService(); Src.Modelo.Entidades.Cliente cliente = clienteService.GetClienteByUsername(this.usuario.Username); this.Cliente = cliente; CompraService compraService = new CompraService(); try { /*------------ Paginador ---------------*/ this.paginator = new ClienteHistorialPaginator(this); this.paginator.Entity = this.Cliente; this.paginator.ItemsPerPage = Utils.Utilities.getTamPagina(); this.panelPaginatorControls.Controls.Clear(); this.panelPaginatorControls.Controls.Add(this.paginator.controls); Page currentPage = this.paginator.NextPage(); List <object> objects = currentPage.GetItems(); List <PalcoNet.Src.Modelo.Entidades.Compra_Ticket> compras = objects.Cast <PalcoNet.Src.Modelo.Entidades.Compra_Ticket>().ToList(); this.dataGridHistorial.DataSource = compras; this.dataGridHistorial.Columns[6].Visible = false; /*------------- Fin Paginador ----------*/ List <string> encabezados = new List <string>(new string[] { "ClienteNombre", "ClienteApellido", "cantidadTotalPaginador" }); List <string> autoCells = new List <string>(new string[] { "Id", "Monto Total", "Fecha Compra", "Tarjeta", "Direccion" }); foreach (DataGridViewColumn column in this.dataGridHistorial.Columns) { if (encabezados.Contains(column.HeaderText)) { column.Visible = false; } if (autoCells.Contains(column.HeaderText)) { column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } } this.dataGridHistorial.AutoSize = false; this.dataGridHistorial.ScrollBars = ScrollBars.Both; this.dataGridHistorial.ClearSelection(); } catch (Exception ex) { Console.WriteLine(ex); } }
public void WhenSistemaVisualizarAsSimulacoesDeCompra() { var service = new CompraService(new CompraRepository(this.MassaBuilder.Context)); var controller = new CompraController(service); var result = controller.Get().ConfigureAwait(false); var okResponse = result.GetAwaiter().GetResult() as OkObjectResult; var compras = okResponse.Value as List <Compra>; var comprasIds = this.MassaBuilder.Compras.Select(c => c.Id).ToList(); this.MassaBuilder.Compras = compras.Where(c => comprasIds.Contains(c.Id)).ToList(); }
public frmCompra() { InitializeComponent(); compraSeleccionada = new Compra(); oSoporteForm = new SoporteForm(); oProveedorService = new ProveedorService(); oLibroService = new LibroService(); oCompraService = new CompraService(); oEjemplarService = new EjemplarService(); oEstadoEjemplarService = new EstadoEjemplarService(); oProveedor = new Proveedor(); oDetalleCompraService = new DetalleCompraService(); formMode = FormMode.insert; nuevo = true; }
// POST api/<controller> public HttpResponseMessage Post([FromBody] RegistrarComprar rc) { HttpResponseMessage response; try { CompraService service = (CompraService) new CompraService().setDatabase(db); service.RegistrarCompra(rc); response = this.getSuccessResponse(rc); } catch (Exception e) { response = this.getErrorResponse(e); } return(response); }
private CompraController CreateCompraController() { _mockCompraRepository.Setup(x => x.Criar(new Compra())); _mockPessoaRepository.Setup(x => x.ObterPorCodigo(1)).Returns(new Pessoa()); _mockFormaPagamentoRepository.Setup(x => x.ObterPorCodigo(1)).Returns(new FormaPagamento()); _mockCondicaoPagamentoRepository.Setup(x => x.ObterPorCodigo(1)).Returns(new CondicaoPagamento()); var compraService = new CompraService(_mockCompraRepository.Object, _mockItemCompraRepository.Object, _mockPessoaRepository.Object, _mockFormaPagamentoRepository.Object, _mockCondicaoPagamentoRepository.Object, _usuarioRepository.Object, _contaPagarRepository.Object, _estoqueRepository.Object, _produtoRepository.Object); var controller = new CompraController(compraService) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; return(controller); }
private void Compra_Ticket_Load(object sender, EventArgs e) { try { CompraService compraService = new CompraService(); compraService.getDetallesCompra(this.Compra); label_nombre.Text = Cliente.Nombre; label_apellido.Text = Cliente.Apellido; label_mail.Text = Cliente.Email; label_tarjeta.Text = Cliente.DatosTarjeta; label_total.Text = Compra.MontoTotal.ToString(); label_espectaculo.Text = Compra.Publicacion; label_fecha.Text = Compra.Entradas[0].FechaEvento.ToString(); SortableBindingList <Entrada_Ticket> entradas = new SortableBindingList <Entrada_Ticket>(this.Compra.Entradas); this.dataGridHistorialEntradas.DataSource = entradas; List <string> encabezados = new List <string>(new string[] { "FechaEvento" }); foreach (DataGridViewColumn column in this.dataGridHistorialEntradas.Columns) { if (encabezados.Contains(column.HeaderText)) { column.Visible = false; } /* if (column.HeaderText == "Publicacion" || column.HeaderText == "Direccion") * column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;*/ } this.dataGridHistorialEntradas.AutoSize = false; this.dataGridHistorialEntradas.ScrollBars = ScrollBars.Both; this.dataGridHistorialEntradas.ClearSelection(); } catch (Exception ex) { Console.WriteLine(ex); } }
private void btn_comisionar_Click(object sender, EventArgs e) { if (this.dataGridViewEmpresas.SelectedRows.Count == 0) { MessageBox.Show("No se seleccionó ninguna empresa!", "Comisionar ventas.", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { try { PalcoNet.Src.Modelo.Entidades.Empresa empresa = (PalcoNet.Src.Modelo.Entidades.Empresa) this.dataGridViewEmpresas.CurrentRow.DataBoundItem; CompraService compraService = new CompraService(); int compras = compraService.getCountComprasOfEmpresa(empresa.Id); if (compras == 0) { MessageBox.Show("No hay compras que requieran rendicion de comisiones!", "Rendición de comisiones.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { Selector_Comisiones selectorComisiones = new Selector_Comisiones(empresa); selectorComisiones.previous = this; selectorComisiones.Show(); this.Hide(); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); MessageBox.Show("Error al rendir comisiones!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
private void RegisterServices() { _factory.Register <ICompraParceiroDomainService>( new CompraParceiroDomainService(_factory.Create <Domain.ComprasParceiro.Repositories.ICompraParceiroRepository>()) ); ICompraService compraService = new CompraService(_factory.Create <ICompraRepository>()); _factory.Register <ICompraService>(compraService); ICompraParceiroService compraParceiroService = new CompraParceiroService(_factory.Create <ICompraParceiroRepository>()); _factory.Register <ICompraParceiroService>(compraParceiroService); IAceiteService aceiteService = new AceiteService(_factory.Create <ICompraParceiroRepository>()); _factory.Register <IAceiteService>(aceiteService); IAtivacaoService ativacaoService = new AtivacaoService(_factory.Create <ICompraRepository>()); _factory.Register <IAtivacaoService>(ativacaoService); ICompraERPService compraERPservice = new CompraERPService(_factory.Create <ICompraERPRepository>(), _factory.Create <IResponseUtil>()); _factory.Register <ICompraERPService>(compraERPservice); _factory.Register <ICompraERPDomainServices>( new CompraERPDomainServices(_factory.Create <ICompraERPRepository>()) ); }
public CompraController(CompraService CompraService) { _compraService = CompraService; }
public CompraController(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _service = new CompraService(_unitOfWork); }
public CompraController(CompraService service, ILogger <CompraController> logger) { this.service = service; this.logger = logger; }
public Compra() { InitializeComponent(); compraService = new CompraService(); }
public void cargarListaCompras() { CompraService compraService = (CompraService)ServiceFactory.GetService("Compra"); try { this.filtros = null; this.filtros = new Dictionary <string, string>(); filtros.Add("fechaActual", Utils.Utilities.getCurrentDate().ToString()); if (fechaInicioCheckBox.Checked) { filtros.Add("fechaInicio", fechaInicioVista.Value.ToString()); } if (fechaFinCheckBox.Checked) { filtros.Add("fechaFin", fechaFinVista.Value.ToString()); if (fechaInicioCheckBox.Checked && fechaInicioVista.Value > fechaFinVista.Value) { MessageBox.Show("La fecha de Fin no puede ser menor a la de Inicio", "Ups!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (categoriasVista.Text != "") { TextBox categorias = new TextBox(); categorias.Visible = false; string str = ""; foreach (Rubro rubro in categoriasElegidas) { if (str == "") { str = str + rubro.codigo; } else { str = str + ", " + rubro.codigo; } } categorias.Text = "(" + str + ")"; filtros.Add("categorias", categorias.Text); } if (this.descripcion.Text != "") { filtros.Add("descripcion", this.descripcion.Text); } /*------------ Paginador ---------------*/ this.paginator = new CompraPublicacionPaginator(this); this.paginator.ItemsPerPage = Utils.Utilities.getTamPagina(); this.panelPaginatorControls.Controls.Clear(); this.panelPaginatorControls.Controls.Add(this.paginator.controls); Page currentPage = this.paginator.NextPage(); List <object> objects = currentPage.GetItems(); List <Publicacion> publicaciones = objects.Cast <Publicacion>().ToList(); SortableBindingList <Publicacion> sorteablePublicaciones = new SortableBindingList <Publicacion>(publicaciones); /*------------- Fin Paginador ----------*/ this.dataGridPublicaciones.DataSource = null; this.dataGridPublicaciones.DataSource = publicaciones; /*if (this.dataGridPublicaciones.Rows.Count == 0) * MessageBox.Show("No se encontraron publicaciones!", "Listado de publicaciones activas.", * MessageBoxButtons.OK, MessageBoxIcon.Information);*/ List <string> encabezados = new List <string>(new string[] { "Codigo", "Fecha de Publicación", "Grado", "Estado", "FechaEventoId" }); List <string> autoSizeCells = new List <string>(new string[] { "Rubro", "Fecha Evento" }); foreach (DataGridViewColumn column in this.dataGridPublicaciones.Columns) { if (encabezados.Contains(column.HeaderText)) { column.Visible = false; } if (autoSizeCells.Contains(column.HeaderText)) { column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } } this.dataGridPublicaciones.AutoGenerateColumns = false; this.dataGridPublicaciones.ClearSelection(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); MessageBox.Show("Error al buscar Publicaciones!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public CompraController(CompraService compraService) { CompraService = compraService; }