public void GetListTest() { RepositorioVentas repositorio = new RepositorioVentas(); var Listar = repositorio.GetList(x => true); Assert.IsNotNull(Listar); }
public void Guardar(Venta venta) { try { conexion = new ConexionBd(); SqlConnection cn = conexion.AbrirConexion(); sqlTransaction = cn.BeginTransaction(); repositorioVentas = new RepositorioVentas(cn, sqlTransaction); repositorioVentasMedicamentos = new RepositorioVentasMedicamentos(cn, sqlTransaction); repositorioMedicamentos = new RepositorioMedicamentos(cn, sqlTransaction); repositorioVentas.Guardar(venta); foreach (var vm in venta.ventasMedicamentos) { vm.venta = venta; repositorioVentasMedicamentos.Guardar(vm); repositorioMedicamentos.ModificarStok(-vm.Cantidad, vm.medicamento.MedicamentoId); } sqlTransaction.Commit(); conexion.CerrarConexion(); } catch (Exception ex) { sqlTransaction.Rollback(); throw new Exception(ex.Message); } }
private void LlenarImporte() { int Cantidad, Precio; Cantidad = Utils.ToInt(CantidadTextBox.Text); Precio = Utils.ToInt(PrecioTextBox.Text); ImporteTextBox.Text = RepositorioVentas.CalcularImporte(Precio, Cantidad).ToString(); }
public void EliminarTest() { RepositorioVentas repositorio = new RepositorioVentas(); bool paso; int id = 1; paso = repositorio.Eliminar(id); Assert.AreEqual(paso, true); }
public void BuscarTest() { RepositorioVentas repositorio = new RepositorioVentas(); int idVenta = repositorio.GetList(x => true)[0].VentaId; Ventas ventas = repositorio.Buscar(idVenta); bool paso = ventas.Detalle.Count > 0; Assert.AreEqual(true, paso); }
protected void BtnGuardar_Click(object sender, EventArgs e) { RepositorioVentas repositorio = new RepositorioVentas(); Ventas ventas = LlenaClase(); bool paso = false; if (UsuarioDropDownList != null) { if (Page.IsValid) { if (ventas.VentaId == 0 && Utils.ToInt(TotalLabel.Text) != 0) { paso = repositorio.Guardar(ventas); } else if (Utils.ToInt(VentaIdTextBox.Text) != 0) { var verificar = repositorio.Buscar(Utils.ToInt(VentaIdTextBox.Text)); if (verificar != null) { paso = repositorio.Modificar(ventas); } else { Utils.ShowToastr(this, "No se encuentra el ID", "Fallo", "error"); return; } } if (paso) { Utils.ShowToastr(this, "Registro Con Exito", "Exito", "success"); } else { Utils.ShowToastr(this, "No se pudo Guardar", "Fallo", "error"); } LimpiarCampos(); return; } } else { Utils.ShowToastr(this, "El numero de cuenta no existe", "Fallo", "error"); return; } }
private void LlenaValores() { RepositorioVentas repositorio = new RepositorioVentas(); decimal total = 0; List <VentasDetalle> lista = (List <VentasDetalle>)ViewState["VentasDetalle"]; foreach (var item in lista) { total += item.Importe; } decimal Itbis = 0; decimal SubTotal = 0; Itbis = total * 18 / 100; SubTotal = total - Itbis; SubTotalLabel.Text = SubTotal.ToString(); ItbisLabel.Text = Itbis.ToString(); TotalLabel.Text = total.ToString(); }
public void GuardarTest() { bool paso; Ventas ventas = new Ventas(); RepositorioVentas repositorio = new RepositorioVentas(); ventas.VentaId = 1; ventas.UsuarioId = 1; ventas.Fecha = DateTime.Now; ventas.Descripcion = "Venta de equipo"; ventas.NombreCliente = "Marledy"; ventas.TelefonoCliente = "809-361-1686"; ventas.Itbis = 2700; ventas.SubTotal = 15000; ventas.Total = 17700; ventas.Detalle.Add(new VentasDetalle(1, 1, 1, "Iphone 6", 1, 15000, 15000)); paso = repositorio.Guardar(ventas); Assert.AreEqual(paso, true); }
public void ModificarTest() { //int idVenta = VentasBLL.GetList(x => true)[0].VentaId; RepositorioVentas repositorio = new RepositorioVentas(); Ventas ventas = new Ventas();//VentasBLL.Buscar(idVenta); ventas.VentaId = 1; ventas.UsuarioId = 1; ventas.Fecha = DateTime.Now; ventas.Descripcion = "Venta de equipo"; ventas.NombreCliente = "Maggy"; ventas.TelefonoCliente = "829-899-6654"; ventas.Itbis = 2700; ventas.SubTotal = 15000; ventas.Total = 17700; ventas.Detalle.Add(new VentasDetalle(1, 1, 1, "Iphone 6", 1, 15000, 15000)); bool paso = repositorio.Modificar(ventas); Assert.AreEqual(paso, true); }