private static RiakObject ToRiakObject(FacturaVM facturaVM) { var facturaRiakObjectId = new RiakObjectId(facturasBucketName, facturaVM.CodigoF.ToString()); var riakObject = new RiakObject(facturaRiakObjectId, facturaVM); BinIndex facturaEntradaDateIndex = riakObject.BinIndex(facturaFacturaEntradaDateIndexName); facturaEntradaDateIndex.Add(facturaVM.Entrada.ToString("yyyy-MM-dd")); BinIndex facturaSalidaDateIndex = riakObject.BinIndex(facturaFacturaSalidaDateIndexName); facturaSalidaDateIndex.Add(facturaVM.Salida.ToString("yyyy-MM-dd")); BinIndex facturaDNIDateIndex = riakObject.BinIndex(facturaFacturaDNIIndexName); facturaDNIDateIndex.Add(facturaVM.Cliente.DNI); BinIndex facturaNumeroDateIndex = riakObject.BinIndex(facturaFacturaNumeroIndexName); facturaNumeroDateIndex.Add(facturaVM.Numero.Numero.ToString()); BinIndex facturaFormaDateIndex = riakObject.BinIndex(facturaFacturaFormaIndexName); facturaFormaDateIndex.Add(facturaVM.Forma.Forma.ToString()); BinIndex facturaTotalDateIndex = riakObject.BinIndex(facturaFacturaTotalIndexName); facturaTotalDateIndex.Add(facturaVM.Total.ToString()); return(riakObject); }
public ActionResult AgregarFactura(FacturaVM pro) { GestionFacturas g = new GestionFacturas(); g.AgregarFacturas(pro.Factura); return(RedirectToAction("ListarFacturas")); }
// GET: Facturacion/Create public IActionResult Create() { var result = new FacturaVM { Productos = _context.Productos.ToList(), Clientes = _context.Clientes.ToList(), Servicios = _context.Servicios.ToList(), Facturacion = new Facturacion() }; return(View(result)); }
public IActionResult ChangeFacturaType([Bind("FacturacionId,TipoFactura,Cantidad,Itbis,ClienteId,UsuarioId,ProductosId,ServiciosId")] Facturacion facturacion) { var result = new FacturaVM { Productos = _context.Productos.ToList(), Clientes = _context.Clientes.ToList(), Servicios = _context.Servicios.ToList(), Facturacion = facturacion }; return(RedirectToAction("Create", result)); }
// GET: Facturacion/Create public IActionResult Create(FacturaVM fvm) { var result = new FacturaVM { Productos = _context.Productos.ToList(), Clientes = _context.Clientes.ToList(), Servicios = _context.Servicios.ToList(), Facturacion = fvm.Facturacion, }; if (result.Facturacion == null) { result.Facturacion = new Facturacion(); result.Facturacion.TipoFactura = "Productos"; } return(View(result)); }
public JsonResult Create(FacturaVM facturaDto) { decimal imp = (decimal)(facturaDto.Impuesto / 100); facturaDto.Total = facturaDto.Subtotal + (imp * facturaDto.Subtotal); long result = facturaRepository.Create(new Factura { FechaRegistro = facturaDto.FechaRegistro, Impuesto = facturaDto.Impuesto, Subtotal = facturaDto.Subtotal, Total = facturaDto.Total }); ResponseVM response = new ResponseVM(true, null, result); return(Json(response)); }
private void button9_Click(object sender, EventArgs e) { //1) listar empleados EmpleadoVM empleadoVM = null; RiakResult <IList <string> > listaKeysEmpleado = client.ListKeysFromIndex(empleadoBucketName); foreach (string key in listaKeysEmpleado.Value) { var result = client.Get(empleadoBucketName, key); CheckResult(result); empleadoVM = result.Value.GetObject <EmpleadoVM>(); Console.WriteLine("Empleado :" + empleadoVM.ToJson()); } // 5) Obtener el número de habitación, tipo y precio de las habitaciones que estén ocupadas en la actualidad (no tienen fecha de salida). var riakIndexId = new RiakIndexId(facturasBucketName, facturaFacturaSalidaDateIndexName); RiakResult <RiakIndexResult> indexRiakResult = client.GetSecondaryIndex(riakIndexId, DateTime.MinValue.ToString("yyyy-MM-dd")); CheckResult(indexRiakResult); var indexResult = indexRiakResult.Value; FacturaVM facturaVMRespuesta = null; foreach (var item in indexResult.IndexKeyTerms) { var result = client.Get(facturasBucketName, item.Key); CheckResult(result); facturaVMRespuesta = result.Value.GetObject <FacturaVM>(); Console.WriteLine("FACTURA-- (key values): NumHabitacion: {0}, Tipo: {1}, Precio: {2}, CodigoFactura: {3}", facturaVMRespuesta.Numero.Numero, facturaVMRespuesta.Numero.Tipo.Tipo, facturaVMRespuesta.Numero.Tipo.precio, facturaVMRespuesta.CodigoF); } Console.WriteLine("--------------------------"); //2) Obtener el nombre del jefe del servicio de "Restaurante". riakIndexId = new RiakIndexId(empleadoBucketName, empleadoServicioDescripcionIndexName); indexRiakResult = client.GetSecondaryIndex(riakIndexId, "restaurante"); CheckResult(indexRiakResult); indexResult = indexRiakResult.Value; EmpleadoVM empleadoVMRes = null; foreach (var item in indexResult.IndexKeyTerms) { var result = client.Get(empleadoBucketName, item.Key); CheckResult(result); empleadoVMRes = result.Value.GetObject <EmpleadoVM>(); Console.WriteLine("Nobre Jefe Ser Restaurante; {0} ", empleadoVMRes.Servicio.NumReg.Nombre); } Console.WriteLine("--------------------------"); //3) Obtener el nombre del jefe de "Jorge Alonso Alonso". riakIndexId = new RiakIndexId(empleadoBucketName, empleadoNombreIndexName); indexRiakResult = client.GetSecondaryIndex(riakIndexId, "Jorge Alonso Alonso"); CheckResult(indexRiakResult); indexResult = indexRiakResult.Value; EmpleadoVM empleadoVMRes1 = null; foreach (var item in indexResult.IndexKeyTerms) { var result = client.Get(empleadoBucketName, item.Key); CheckResult(result); empleadoVMRes1 = result.Value.GetObject <EmpleadoVM>(); Console.WriteLine("Nobre Jefe a cargo jorge alonso; {0} ", empleadoVMRes1.Servicio.NumReg.Nombre); } Console.WriteLine("--------------------------"); //4) Obtener un listado de los empleados y los servicios a los que están asignados, //exclusivamente para aquellos que tengan algún servicio asignado. riakIndexId = new RiakIndexId(empleadoBucketName, empleadoCodSIndexName); indexRiakResult = client.GetSecondaryIndex(riakIndexId, 1, 1000); CheckResult(indexRiakResult); indexResult = indexRiakResult.Value; EmpleadoVM empleadoVMRes2 = null; foreach (var item in indexResult.IndexKeyTerms) { var result = client.Get(empleadoBucketName, item.Key); CheckResult(result); empleadoVMRes2 = result.Value.GetObject <EmpleadoVM>(); Console.WriteLine("Nobre Empleado con Ser; {0} ", empleadoVMRes2.Nombre); } }