public IHttpActionResult Get(DateTime fecha_inicial, DateTime fecha_final) { try { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { //List<rptCantidadProductos11_Result> todos = ReporteBLL.listProductos(); return(Content(HttpStatusCode.OK, ReporteBLL.listVentasCategoriasxMes(fecha_inicial, fecha_final))); } catch (Exception ex) { Console.WriteLine("Error al enviar reporte de Ventas por mes " + ex.Message); throw ex; } } } catch (Exception ex) { return(NotFound()); throw ex; } }
public static List <DETALLE_FACTURA> Ventas(int?id_categoria, string fecha) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.DETALLE_FACTURA.Where(x => x.PRODUCTO.id_pcategoria == id_categoria && x.CAB_FACTURA.fecha.ToString().Contains(fecha)).ToList()); }
public IHttpActionResult Get(Boolean activo) { try { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { //List<rptCantidadProductos11_Result> todos = ReporteBLL.listProductos(); return(Content(HttpStatusCode.OK, ReporteBLL.listMontoAgrupado())); } catch (Exception ex) { Console.WriteLine("Error al enviar reporte de monto agrupado " + ex.Message); throw ex; } } } catch (Exception ex) { return(NotFound()); throw ex; } }
public static List <rptVentasCategoriaxMes_Result> listVentasCategoriasxMes( DateTime fecha_inicial, DateTime fecha_final) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.rptVentasCategoriaxMes(fecha_inicial, fecha_final).ToList()); }
public static CAB_FACTURA GetLastItem() { DeliveryEntidades1 db = new DeliveryEntidades1(); List <CAB_FACTURA> resultado; resultado = db.CAB_FACTURA.ToList(); CAB_FACTURA item = new CAB_FACTURA(); if (resultado.Count > 0) { item = resultado[resultado.Count - 1]; } return(item); }
public static List <PRODUCTO> List() { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.PRODUCTO.ToList()); } catch (Exception ex) { Console.WriteLine("No se ha podido retornar la lista de productos " + ex.Message); throw ex; } } }
public static PRODUCTO Get(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.PRODUCTO.Find(id)); } catch (Exception ex) { Console.WriteLine("No se ha podido retornar el producto " + ex.Message); throw ex; } } }
public static List <CAB_FACTURA> List() { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.CAB_FACTURA.ToList()); } catch (Exception ex) { Console.WriteLine("No se ha podido retornar la lista de cabezas de factura " + ex.Message); throw ex; } } }
public static CLIENTE Get(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.CLIENTE.Find(id)); } catch (Exception ex) { Console.WriteLine("Error al obtener cliente " + ex.Message); throw ex; } } }
public static CAB_FACTURA Get(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.CAB_FACTURA.Find(id)); } catch (Exception ex) { // Console.WriteLine("No se ha podido retornar la cabeza de factura " + ex.Message); throw ex; } } }
public static List <CLIENTE> List() { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.CLIENTE.ToList()); } catch (Exception ex) { Console.WriteLine("Error al enviar la lista de clientes " + ex.Message); throw ex; } } }
public static DETALLE_FACTURA Get(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { try { return(db.DETALLE_FACTURA.Find(id)); } catch (Exception ex) { Console.WriteLine("No se ha podido retornar el detalle de factura " + ex.Message); throw ex; } } }
public static LOG_IN Validate(LOG_IN cuenta) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.LOG_IN.FirstOrDefault(x => x.usuario == cuenta.usuario && x.contrasena == cuenta.contrasena)); /* foreach (var item in db.Usuarios.ToList()) * { * if (item.correo == persona.correo && item.password == persona.password) * { * return item; * } * } * return null;*/ }
public static void Create(CLIENTE c) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) //hace una conexion temporal a la bd { using (var transaction = db.Database.BeginTransaction()) //hace una transaccion { try { db.CLIENTE.Add(c); //agrega a la tabla ALUMNO el objeto (a) db.SaveChanges(); //guarda los cambios en la bd transaction.Commit(); //confirma los cambios } catch (Exception ex) { Console.WriteLine("Error al crear cliente " + ex.Message); transaction.Rollback(); //se revierte el estado de la bd a un estado anterior consistente en caso de error throw ex; } } } }
public static void Create(PRODUCTO p) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { db.PRODUCTO.Add(p); db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine("No se ha podido crear el producto " + ex.Message); transaction.Rollback(); throw ex; } } } }
public static void Create(CAB_FACTURA cf) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { db.CAB_FACTURA.Add(cf); db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine("No se ha podido crear la cabeza de factura " + ex.Message); transaction.Rollback(); throw ex; } } } }
public static void Delete(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { CAB_FACTURA Materia = db.CAB_FACTURA.Find(id); db.Entry(Materia).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine("No se ha podido eliminar la cabeza de factura " + ex.Message); transaction.Rollback(); throw ex; } } } }
public static void Delete(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { CLIENTE cliente = db.CLIENTE.Find(id); db.Entry(cliente).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); Console.WriteLine("Error al eliminar " + ex.Message); throw ex; } } } }
public static bool Update(CLIENTE cliente) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { db.CLIENTE.Attach(cliente); db.Entry(cliente).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); transaction.Commit(); return(true); } catch (Exception ex) { Console.WriteLine("Error al actualizar alumno " + ex.Message); return(false); } } } }
public static void Delete(int?id) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { PRODUCTO p = db.PRODUCTO.Find(id); db.Entry(p).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine("No se ha podido eliminar el producto " + ex.Message); transaction.Rollback(); throw ex; } } } }
public static void Update(CAB_FACTURA cf) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { db.CAB_FACTURA.Attach(cf); db.Entry(cf).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine("No se ha podido actualizar la materia " + ex.Message); transaction.Rollback(); throw ex; } } } }
public static bool Update(PRODUCTO p) { using (DeliveryEntidades1 db = new DeliveryEntidades1()) { using (var transaction = db.Database.BeginTransaction()) { try { db.PRODUCTO.Attach(p); db.Entry(p).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); transaction.Commit(); return(true); } catch (Exception ex) { Console.WriteLine("No se ha podido actualizar el producto " + ex.Message); transaction.Rollback(); throw ex; return(false); } } } }
public static List <PRODUCTO> List(int?id_cat) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.PRODUCTO.Where(x => x.id_pcategoria == id_cat).ToList()); }
public static List <rptCantidadProductos11_Result> listProductos() { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.rptCantidadProductos11().ToList()); }
public static List <PRODUCTO_CATEGORIA> List() { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.PRODUCTO_CATEGORIA.ToList()); }
public static List <rptMontoAgrupadoxCliente_Result> listMontoAgrupado() { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.rptMontoAgrupadoxCliente().ToList()); }
public static List <DETALLE_FACTURA> List(int?id) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.DETALLE_FACTURA.Where(x => x.CAB_FACTURA.id_cliente == id).ToList()); }
public static List <DETALLE_FACTURA> Ventas(int?id_categoria) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.DETALLE_FACTURA.Where(x => x.PRODUCTO.id_pcategoria == id_categoria).ToList()); }
public static List <ESTADO_ENVIO> List() { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.ESTADO_ENVIO.ToList()); }
public static List <CLIENTE> SearchCliente(string cedula) { DeliveryEntidades1 db = new DeliveryEntidades1(); return(db.CLIENTE.Where(x => x.documento.StartsWith(cedula)).ToList()); }