Пример #1
0
        public static Evento ObtenerPorId(int id)
        {
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Evento_SelectRow", oservidor.Conectar());
                command.Parameters.AddWithValue("@Id", id);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                // Ejecuta la sentencia sql en la conexion indicada
                SqlDataReader reader = command.ExecuteReader();
                // Cada Read lee un registro de la consulta
                while (reader.Read())
                {
                    Evento evento = new Evento();
                    evento.Id              = Convert.ToInt32(reader["Id"]);
                    evento.Nombre          = reader["Nombre"].ToString();
                    evento.F_Limite        = Convert.ToDateTime(reader["f_limite"]);
                    evento.F_Entrega       = Convert.ToDateTime(reader["f_entrega"]);
                    evento.Cupo            = Convert.ToInt32(reader["cupo"]);
                    evento.Localizacion    = reader["localizacion"].ToString();
                    evento.Activo          = Convert.ToBoolean(reader["activo"].ToString());
                    evento.P_Maximo_Regalo = Convert.ToInt32(reader["p_maximo_regalo"]);
                    evento.P_Minimo_Regalo = Convert.ToInt32(reader["p_minimo_regalo"]);
                    evento.Grupo           = Convert.ToBoolean(reader["grupo"]);

                    evento.lista_invitados = ListaInv_Datos.obtenerTodos();

                    evento.Participante = Participante_Datos.ObtenerPaticipantes_PorEvento(evento.Id);

                    return(evento);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                oservidor.Desconectar();
            }

            return(null);
        }
Пример #2
0
        public static List <Participante> ObtenerPaticipantes_PorEvento(int id)
        {
            List <Participante> lista     = new List <Participante>();
            Servidor            oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Participante_Select_PorEvento", oservidor.Conectar());
                command.CommandType = System.Data.CommandType.StoredProcedure;
                // Ejecuta la sentencia sql en la conexion indicada
                SqlDataReader reader = command.ExecuteReader();
                // Cada Read lee un registro de la consulta
                while (reader.Read())
                {
                    Participante participante = new Participante();

                    participante.id       = Convert.ToInt32(reader["id"]);
                    participante.Correo   = reader["correo"].ToString();
                    participante.Nombre   = reader["Nombre"].ToString();
                    participante.Genero   = Convert.ToChar(reader["genero"]);
                    participante.Telefono = Convert.ToInt32(reader["telefono"]);
                    //participante.Foto = Convert.ToSByte(reader["foto"].ToString());
                    participante.Registrado = Convert.ToBoolean(reader["registrado"]);
                    participante.Id_Rol     = Convert.ToInt32(reader["id_Rol"]);
                    participante.Id_Evento  = Convert.ToInt32(reader["id_Evento"]);

                    lista.Add(participante);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                oservidor.Desconectar();
            }

            return(lista);
        }
Пример #3
0
        public static List <Evento> ObtenerTodos()
        {
            List <Evento> lista     = new List <Evento>();
            Servidor      oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Evento_SelectAll", oservidor.Conectar());
                command.CommandType = System.Data.CommandType.StoredProcedure;
                // Ejecuta la sentencia sql en la conexion indicada
                SqlDataReader reader = command.ExecuteReader();
                // Cada Read lee un registro de la consulta
                while (reader.Read())
                {
                    Evento evento = new Evento();
                    evento.Id              = Convert.ToInt32(reader["Id"]);
                    evento.Nombre          = reader["Nombre"].ToString();
                    evento.F_Limite        = Convert.ToDateTime(reader["f_limite"]);
                    evento.F_Entrega       = Convert.ToDateTime(reader["f_entrega"]);
                    evento.Cupo            = Convert.ToInt32(reader["cupo"]);
                    evento.Localizacion    = reader["localizacion"].ToString();
                    evento.Activo          = Convert.ToBoolean(reader["activo"].ToString());
                    evento.P_Maximo_Regalo = Convert.ToInt32(reader["p_maximo_regalo"]);
                    evento.P_Minimo_Regalo = Convert.ToInt32(reader["p_minimo_regalo"]);
                    evento.Grupo           = Convert.ToBoolean(reader["grupo"]);

                    lista.Add(evento);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                oservidor.Desconectar();
            }

            return(lista);
        }
Пример #4
0
        public static List <Regalo> Obtener_Regalos_PorParticipante(int id)
        {
            List <Regalo> lista     = new List <Regalo>();
            Servidor      oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Regalo_PorParticipante", oservidor.Conectar());
                command.Parameters.AddWithValue("@id_Participante", id);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                // Ejecuta la sentencia sql en la conexion indicada
                SqlDataReader reader = command.ExecuteReader();
                // Cada Read lee un registro de la consulta
                while (reader.Read())
                {
                    Regalo regalo = new Regalo();
                    regalo.Id              = Convert.ToInt32(reader["id"].ToString());
                    regalo.Nombre          = reader["Nombre"].ToString();
                    regalo.Cantida         = Convert.ToChar(reader["cantidad"]);
                    regalo.Enlace          = reader["enlace"].ToString();
                    regalo.Deseado         = Convert.ToBoolean(reader["deseo"]);
                    regalo.Descripcion     = reader["descripcion"].ToString();
                    regalo.Id_Participante = Convert.ToInt32(reader["id_Participante"]);

                    lista.Add(regalo);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                oservidor.Desconectar();
            }

            return(lista);
        }
Пример #5
0
        public static int ObtenerUltimo()
        {
            Servidor oservidor = new Servidor();
            int      ultimo;

            try
            {
                SqlCommand command = new SqlCommand("SP_Participante_Ultimo", oservidor.Conectar());
                command.CommandType = System.Data.CommandType.StoredProcedure;
                //SqlDataReader reader = command.ExecuteReader();
                object valor = command.ExecuteScalar();
                ultimo = Convert.ToInt32(valor);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                oservidor.Desconectar();
            }
            return(ultimo);
        }
 public Notificaciones_Datos()
 {
     servidor = new Servidor();
 }
Пример #7
0
 public Roles_Datos()
 {
     servidor = new Servidor();
 }
Пример #8
0
 public Sorteo_Datos()
 {
     servidor = new Servidor();
 }
Пример #9
0
 public Recibrir_Inv_Datos()
 {
     servidor = new Servidor();
 }
Пример #10
0
 public Grupo_Datos()
 {
     servidor = new Servidor();
 }
Пример #11
0
 public Participante_Datos()
 {
     servidor = new Servidor();
 }
Пример #12
0
 public ListaInv_Datos()
 {
     servidor = new Servidor();
 }
Пример #13
0
 public Regalo_Datos()
 {
     servidor = new Servidor();
 }
Пример #14
0
 public Evento_Datos()
 {
     servidor = new Servidor();
 }
Пример #15
0
 public Enviar_Invita_Datos()
 {
     servidor = new Servidor();
 }
Пример #16
0
 public Seguidos_Datos()
 {
     servidor = new Servidor();
 }