示例#1
0
        public static bool Guardar(Actores nuevo)
        {
            bool retorno = false;

            using (var conn = new DetalleDb())
            {
                try
                {
                    conn.a.Add(nuevo);

                    /*foreach (var rep in nuevo.pelicula)
                     * {
                     *  conn.Entry(rep).State = System.Data.Entity.EntityState.Unchanged;
                     * }*/


                    conn.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
示例#2
0
 public static bool Guardar(Autores nuevo)
 {
     using (var db = new DetalleDb())
     {
         try
         {
             if (Buscar(nuevo.AutoresId) == null)
             {
                 db.autores.Add(nuevo);
                 db.SaveChanges();
                 return(true);
             }
             else
             {
                 db.Entry(nuevo).State = System.Data.Entity.EntityState.Unchanged;
                 db.SaveChanges();
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }
        public static bool Guardar(Libros nuevo)
        {
            using (var db = new DetalleDb())
            {
                try
                {
                    /*foreach(var g in nuevo.autoresList)
                     * {
                     *   db.Entry(g).State = System.Data.Entity.EntityState.Unchanged;
                     */

                    if (Buscar(nuevo.LibrosId) == null)
                    {
                        db.libros.Add(nuevo);
                        db.SaveChanges();
                        return(true);
                    }
                    else
                    {
                        db.Entry(nuevo).State = System.Data.Entity.EntityState.Unchanged;
                        db.SaveChanges();
                        return(true);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                return(false);
            }
        }
示例#4
0
        public void LlenarCombo()
        {
            var            llenar = new DetalleDb();
            List <Actores> lista  = BLL.ActorBLL.GetList();

            actoresComboBox.DataSource    = lista;
            actoresComboBox.DisplayMember = "Nombre";
            actoresComboBox.ValueMember   = "ActorId";
        }
示例#5
0
 public static bool Eliminar(Entidades.Emails id)
 {
     using (var db = new DetalleDb())
     {
         try
         {
             db.Entry(id).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
示例#6
0
 public static Entidades.Emails Buscar(int id)
 {
     Entidades.Emails nuevo;
     using (var db = new DetalleDb())
     {
         try
         {
             nuevo = db.email.Find(id);
         }
         catch (Exception)
         {
             throw;
         }
         return(nuevo);
     }
 }
示例#7
0
        public static List <Peliculas> GetList()
        {
            List <Peliculas> lista = new List <Peliculas>();

            using (var conn = new DetalleDb())
            {
                try
                {
                    lista = conn.p.ToList();
                }
                catch (Exception)
                {
                }
                return(lista);
            }
        }
示例#8
0
        public static List <Entidades.Emails> GetListNombre(string nombre)
        {
            List <Entidades.Emails> lista = new List <Entidades.Emails>();

            using (var db = new DetalleDb())
            {
                try
                {
                    lista = db.email.Where(p => p.Nombre == nombre).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(lista);
            }
        }
示例#9
0
        public static List <Servicios> ListarServicios()
        {
            List <Servicios> listado = null;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    listado = conexion.Servicio.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(listado);
        }
        public static List <Entidades.UsuariosEmails> GetList(Expression <Func <Entidades.UsuariosEmails, bool> > criterioBusqueda)
        {
            List <Entidades.UsuariosEmails> lista = new List <Entidades.UsuariosEmails>();

            using (var db = new DetalleDb())
            {
                try
                {
                    lista = db.usuariosEmails.Where(criterioBusqueda).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(lista);
            }
        }
示例#11
0
        public static List <Peliculas> GetListFecha(DateTime desde, DateTime hasta)
        {
            List <Peliculas> lista = new List <Peliculas>();

            using (var conn = new DetalleDb())
            {
                try
                {
                    lista = conn.p.Where(p => p.Fecha >= desde.Date && p.Fecha <= hasta.Date).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(lista);
            }
        }
示例#12
0
        public static List <CotizacionDetalles> Listar(int?cotizacionId)
        {
            List <CotizacionDetalles> listado = null;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    listado = conexion.DetalleCotizacion.Where(d => d.CotizacionId == cotizacionId).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(listado);
        }
示例#13
0
        public static Autores Buscar(int autor)
        {
            var busca = new Autores();

            using (var db = new DetalleDb())
            {
                try
                {
                    busca = db.autores.Find(autor);
                }
                catch (Exception)
                {
                    throw;
                }
                return(busca);
            }
        }
示例#14
0
        public static Cotizaciones Buscar(int?cotizacionId)
        {
            Cotizaciones cotizacion = null;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    cotizacion = conexion.Cotizacion.Find(cotizacionId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(cotizacion);
        }
示例#15
0
        public static List <Entidades.Emails> GetListodo()
        {
            List <Entidades.Emails> lista = new List <Entidades.Emails>();

            using (var db = new DetalleDb())
            {
                try
                {
                    lista = db.email.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(lista);
            }
        }
示例#16
0
        public static Actores Buscar(int Id)
        {
            var guarda = new Actores();

            using (var conn = new DetalleDb())
            {
                try
                {
                    guarda = conn.a.Find(Id);
                }
                catch (Exception)
                {
                    throw;
                }
                return(guarda);
            }
        }
示例#17
0
        public static CotizacionDetalles Buscar(int?detalleCotizacionId)
        {
            CotizacionDetalles detalle = null;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    detalle = conexion.DetalleCotizacion.Find(detalleCotizacionId);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(detalle);
        }
示例#18
0
        public static List <Autores> GetListTodo()
        {
            List <Autores> lista = new List <Autores>();

            using (var db = new DetalleDb())
            {
                try
                {
                    lista = db.autores.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(lista);
            }
        }
示例#19
0
 public static bool Eliminar(Autores autor)
 {
     using (var db = new DetalleDb())
     {
         try
         {
             db.Entry(autor).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }
示例#20
0
        public static List <Actores> GetList()
        {
            List <Actores> lista = new List <Actores>();

            using (var conn = new DetalleDb())
            {
                try
                {
                    lista = conn.a.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(lista);
            }
        }
示例#21
0
        public static List <Cotizaciones> Listar()
        {
            List <Cotizaciones> listado = null;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    listado = conexion.Cotizacion.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(listado);
        }
示例#22
0
        public static Peliculas Buscar(int Id)
        {
            var guarda = new Peliculas();

            using (var conn = new DetalleDb())
            {
                try
                {
                    guarda = conn.p.Find(Id);
                    guarda.actor.Count();
                }
                catch (Exception)
                {
                    throw;
                }
                return(guarda);
            }
        }
示例#23
0
        public static Entidades.Usuarios Guardar(Entidades.Usuarios n)
        {
            bool retono = false;

            using (var db = new DetalleDb())
            {
                try
                {
                    db.usuario.Add(n);
                    db.SaveChanges();
                    return(n);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
示例#24
0
        public static bool Eliminar(Peliculas usuario)
        {
            bool retorno = false;

            using (var conn = new DetalleDb())
            {
                try
                {
                    conn.Entry(usuario).State = System.Data.Entity.EntityState.Deleted;
                    conn.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
示例#25
0
        public static bool Modificar(CotizacionDetalles detalle)
        {
            bool resultado = false;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    conexion.Entry(detalle).State = EntityState.Modified;
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
示例#26
0
        public static bool Eliminar(Cotizaciones cotizacion)
        {
            bool resultado = false;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    conexion.Entry(cotizacion).State = EntityState.Deleted;
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
示例#27
0
        public static bool Guardar(Cotizaciones cotizacion)
        {
            bool resultado = false;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    conexion.Cotizacion.Add(cotizacion);
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
示例#28
0
        public static bool Guardar(Entidades.Emails n)
        {
            bool retono = false;

            using (var db = new DetalleDb())
            {
                try
                {
                    db.email.Add(n);
                    db.SaveChanges();
                    retono = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retono);
            }
        }
示例#29
0
 public static bool Guardar(Peliculas nuevo)
 {
     using (var guar = new DetalleDb())
     {
         try
         {
             foreach (var rep in nuevo.actor)
             {
                 guar.Entry(rep).State = System.Data.Entity.EntityState.Unchanged;
             }
             guar.p.Add(nuevo);
             guar.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }