Ejemplo n.º 1
0
        public static ClasesC Buscarr(int?Id)
        {
            ClasesC nuevo = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    nuevo = new ClasesC()
                    {
                        Encabezado = conexion.Citas.Find(Id)
                    };
                    if (nuevo.Encabezado != null)
                    {
                        nuevo.Detalle = BLL.DetalleCitasBLL.Listar(nuevo.Encabezado.CitaId);
                    }
                    else
                    {
                        nuevo = null;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(nuevo);
        }
Ejemplo n.º 2
0
        public static bool Insertar(Citas nuevo)
        {
            bool resultado = false;

            using (var Conn = new BeautyCoreDb())
            {
                try
                {
                    var p = Buscar(nuevo.CitaId);
                    if (p == null)
                    {
                        Conn.Citas.Add(nuevo);
                    }
                    else
                    {
                        Conn.Entry(nuevo).State = EntityState.Modified;
                    }
                    Conn.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Ejemplo n.º 3
0
 public static bool Modificar(FacturaDetalles detalle)
 {
     using (var conexion = new BeautyCoreDb())
     {
         try
         {
             if (Buscar(detalle.Id) != null)
             {
                 conexion.Entry(detalle).State = EntityState.Modified;
                 if (conexion.SaveChanges() > 0)
                 {
                     return(true);
                 }
             }
             else
             {
                 return(Guardar(detalle));
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        public static Clases Buscarr(int?facturaId)
        {
            Clases factura = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    factura = new Clases()
                    {
                        Encabezado = conexion.Facturas.Find(facturaId)
                    };
                    if (factura.Encabezado != null)
                    {
                        factura.Detalle = BLL.FacturaDetallesBLL.Listar(factura.Encabezado.FacturaId);
                    }
                    else
                    {
                        factura = null;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(factura);
        }
Ejemplo n.º 5
0
        public static bool Guardar(Facturas nueva)
        {
            bool resultado = false;

            using (var db = new BeautyCoreDb())
            {
                db.Facturas.Add(nueva);
                db.SaveChanges();
                resultado = true;
            }

            return(resultado);
        }
Ejemplo n.º 6
0
 public static bool Eliminar(FacturaDetalles detalle)
 {
     using (var conexion = new BeautyCoreDb())
     {
         try
         {
             conexion.Entry(detalle).State = EntityState.Deleted;
             conexion.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
        public static Citas Buscar(int nuevoId)
        {
            Citas ID = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    ID = conexion.Citas.Find(nuevoId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(ID);
        }
Ejemplo n.º 8
0
        public static Citas BuscarEncabezado(int?Id)
        {
            Citas nuevo = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    nuevo = conexion.Citas.Find(Id);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(nuevo);
        }
Ejemplo n.º 9
0
        public static List <Citas> GetListaFecha(DateTime D, DateTime H)
        {
            List <Citas> lista = new List <Citas>();

            using (var db = new BeautyCoreDb())
            {
                try
                {
                    lista = db.Citas.Where(p => p.Fecha >= D && p.Fecha <= H).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(lista);
        }
Ejemplo n.º 10
0
        public static Servicios Buscar(int?nuevoId)
        {
            Servicios cliente = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    cliente = conexion.Servicios.Find(nuevoId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(cliente);
        }
Ejemplo n.º 11
0
        public static List <Servicios> ListarId(int Id)
        {
            List <Servicios> list = new List <Servicios>();

            using (var db = new BeautyCoreDb())
            {
                try
                {
                    list = db.Servicios.Where(p => p.ServicioId == Id).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(list);
        }
Ejemplo n.º 12
0
        public static List <Servicios> GetLista()
        {
            var lista = new List <Servicios>();

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    lista = conexion.Servicios.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(lista);
        }
Ejemplo n.º 13
0
        public static Facturas BuscarEncabezado(int?facturaId)
        {
            Facturas factura = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    factura = conexion.Facturas.Find(facturaId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(factura);
        }
Ejemplo n.º 14
0
        public static List <FacturaDetalles> GetLista()
        {
            var lista = new List <FacturaDetalles>();

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    lista = conexion.FacturaDetalles.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(lista);
        }
Ejemplo n.º 15
0
        public static FacturaDetalles Buscar(int nuevoId)
        {
            FacturaDetalles ID = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    ID = conexion.FacturaDetalles.Find(nuevoId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(ID);
        }
Ejemplo n.º 16
0
        public static List <FacturaDetalles> GetListaId(int Id)
        {
            List <FacturaDetalles> list = new List <FacturaDetalles>();

            using (var db = new BeautyCoreDb())
            {
                try
                {
                    list = db.FacturaDetalles.Where(p => p.Id == Id).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(list);
        }
Ejemplo n.º 17
0
        public static FacturaDetalles Buscar(int Id)
        {
            var c = new FacturaDetalles();

            using (var Conn = new BeautyCoreDb())
            {
                try
                {
                    c = Conn.FacturaDetalles.Find(Id);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(c);
        }
Ejemplo n.º 18
0
        public static Citas Buscar(int Id)
        {
            var c = new Citas();

            using (var Conn = new BeautyCoreDb())
            {
                try
                {
                    c = Conn.Citas.Find(Id);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(c);
        }
Ejemplo n.º 19
0
        public static List <Facturas> Listar()
        {
            List <Facturas> listado = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    listado = conexion.Facturas.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(listado);
        }
Ejemplo n.º 20
0
        public static List <Citas> GetListaId(int Id)
        {
            List <Citas> list = new List <Citas>();

            using (var db = new BeautyCoreDb())
            {
                try
                {
                    list = db.Citas.Where(p => p.ClienteId == Id).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(list);
        }
Ejemplo n.º 21
0
        public static Clientes Buscar(int?clienteId)
        {
            Clientes cliente = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    cliente = conexion.Clientes.Find(clienteId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(cliente);
        }
Ejemplo n.º 22
0
        public static Usuarios Buscar(int?usuarioId)
        {
            Usuarios usuario = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    usuario = conexion.Usuarios.Find(usuarioId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(usuario);
        }
Ejemplo n.º 23
0
        public static bool Eliminar(ClasesC nuevo)
        {
            bool resultado = false;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    nuevo = BLL.CitasBLL.Buscarr(nuevo.Encabezado.CitaId);
                    BLL.CitasBLL.Eliminar(nuevo.Encabezado);
                    BLL.DetalleCitasBLL.Eliminar(nuevo.Detalle);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Ejemplo n.º 24
0
 public static bool Guardar(FacturaDetalles detalle)
 {
     using (var conexion = new BeautyCoreDb())
     {
         try
         {
             conexion.FacturaDetalles.Add(detalle);
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Ejemplo n.º 25
0
 public static bool Modificar(Citas nuevo)
 {
     using (var conexion = new BeautyCoreDb())
     {
         try
         {
             conexion.Entry(nuevo).State = EntityState.Modified;
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Ejemplo n.º 26
0
        public static List <CitasDetalles> Listar(int?Id)
        {
            List <CitasDetalles> listado = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    listado = conexion.CitasDetalles.
                              Where(d => d.ClienteId == Id).
                              OrderBy(d => d.Servicio).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(listado);
        }
Ejemplo n.º 27
0
        public static bool Eliminar(Clases factura)
        {
            bool resultado = false;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    factura = BLL.FacturasBLL.Buscarr(factura.Encabezado.FacturaId);
                    BLL.FacturasBLL.Eliminar(factura.Encabezado);
                    BLL.FacturaDetallesBLL.Eliminar(factura.Detalle);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Ejemplo n.º 28
0
        public static List <FacturaDetalles> Listar(int?Id)
        {
            List <FacturaDetalles> listado = null;

            using (var conexion = new BeautyCoreDb())
            {
                try
                {
                    listado = conexion.FacturaDetalles.
                              Where(d => d.FacturaId == Id).
                              OrderBy(d => d.Id).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(listado);
        }
Ejemplo n.º 29
0
        public static bool Eliminar(FacturaDetalles nuevo)
        {
            bool resultado = false;

            using (var Conn = new BeautyCoreDb())
            {
                try
                {
                    Conn.Entry(nuevo).State = EntityState.Deleted;
                    Conn.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Ejemplo n.º 30
0
 public static bool Eliminar(Facturas nuevo)
 {
     using (var conexion = new BeautyCoreDb())
     {
         try
         {
             conexion.Entry(nuevo).State = EntityState.Deleted;
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }