public static EncabezadoDetalle Buscar(int?facturaId) { EncabezadoDetalle factura = null; using (var conexion = new DigitalServicesDB()) { try { factura = new EncabezadoDetalle() { Encabezado = conexion.Factura.Find(facturaId) }; if (factura.Encabezado != null) { factura.Detalle = BLL.FacturaDetalleBLL.Listar(factura.Encabezado.IdFactura); } else { factura = null; } } catch (Exception) { throw; } } return(factura); }
public static EncabezadoDetalle Buscar(int?facturaId) { EncabezadoDetalle factura = null; using (var conexion = new MoviesExtremeDb()) { try { factura = new EncabezadoDetalle() { Encabezado = conexion.Factura.Find(facturaId) }; if (factura.Encabezado != null) { factura.Detalle = BLL.FacturasDetallesBLL.Listar(factura.Encabezado.FacturaId); } else { factura = null; } } catch (Exception) { throw; } } return(factura); }
public JsonResult Guardar(EncabezadoDetalle Factura) { bool result = false; if (ModelState.IsValid) { try { DateTime now = DateTime.Now; int y, m, d, h, min, s; /*Se actualiza la hora de la fecha que viene desde * la ventana de registro a la hora actual*/ y = Factura.Encabezado.Fecha.Year; m = Factura.Encabezado.Fecha.Month; d = Factura.Encabezado.Fecha.Day; h = now.Hour; min = now.Minute; s = now.Second; Factura.Encabezado.Fecha = new DateTime(y, m, d, h, min, s); result = BLL.FacturasBLL.Guardar(Factura); } catch (Exception) { throw; } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult GuardarVentas(EncabezadoDetalle factura) { bool resultado = false; if (ModelState.IsValid) { try { DateTime now = DateTime.Now; int y, m, d, h, min, s; y = factura.Encabezado.Fecha.Year; m = factura.Encabezado.Fecha.Month; d = factura.Encabezado.Fecha.Day; h = now.Hour; min = now.Minute; s = now.Second; factura.Encabezado.Fecha = new DateTime(y, m, d, h, min, s); resultado = FacturasBLL.Guardar(factura); } catch (Exception) { throw; } } return(Json(resultado)); }
public JsonResult Buscar(int?facturaId) { EncabezadoDetalle factura = BLL.FacturasBLL.Buscar(facturaId); if (factura != null) { return(Json(factura, JsonRequestBehavior.AllowGet)); } else { return(Json(false, JsonRequestBehavior.AllowGet)); }//"La factura que haz intentado consultar con Id: " + facturaId +", no esta disponible." }
public JsonResult Eliminar(EncabezadoDetalle factura) { var existe = (BLL.FacturasBLL.BuscarEncabezado(factura.Encabezado.IdFactura) != null); if (existe) { existe = BLL.FacturasBLL.Eliminar(factura); return(Json(existe, JsonRequestBehavior.AllowGet)); } else { return(Json(existe, JsonRequestBehavior.AllowGet)); } }
public static bool Modificar(EncabezadoDetalle factura) { bool resultado = false; using (var conexion = new MoviesExtremeDb()) { try { conexion.Entry(factura.Encabezado).State = EntityState.Modified; if (conexion.SaveChanges() > 0) { resultado = FacturasDetallesBLL.Modificar(factura.Detalle); } } catch (Exception) { throw; } } return(resultado); }
public static bool Guardar(EncabezadoDetalle factura) { bool resultado = false; using (var db = new MoviesExtremeDb()) { try { db.Factura.Add(factura.Encabezado); if (db.SaveChanges() > 0) { resultado = BLL.FacturasDetallesBLL.Guardar(factura.Detalle); } } catch (Exception) { throw; } } return(resultado); }
public static bool Eliminar(EncabezadoDetalle factura) { bool resultado = false; using (var conexion = new MoviesExtremeDb()) { try { if (BLL.FacturasDetallesBLL.Eliminar(factura.Detalle)) { conexion.Entry(factura.Encabezado).State = EntityState.Deleted; resultado = conexion.SaveChanges() > 0; } } catch (Exception) { throw; } } return(resultado); }
public static bool Guardar(EncabezadoDetalle factura) { bool resultado = false; using (var conexion = new DigitalServicesDB()) { try { conexion.Factura.Add(factura.Encabezado); if (conexion.SaveChanges() > 0) { resultado = BLL.FacturaDetalleBLL.Guardar(factura.Detalle); } } catch (Exception) { throw; } } return(resultado); }