Exemplo n.º 1
0
        public void Guardar(Evento evento)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Evento_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", evento.Id),
                    new SqlParameter("nombre", evento.Nombre),
                    new SqlParameter("f_limite", evento.F_Limite),
                    new SqlParameter("f_entrega", evento.F_Entrega),
                    new SqlParameter("cupo", evento.Cupo),
                    new SqlParameter("localizacion", evento.Localizacion),
                    new SqlParameter("activo", evento.Activo),
                    new SqlParameter("p_minimo_regalo", evento.P_Minimo_Regalo),
                    new SqlParameter("p_maximo_regalo", evento.P_Maximo_Regalo),
                    new SqlParameter("grupo", evento.Grupo)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 2
0
        public void Guardar(Lista_Invitados invitados)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_lista_invitados_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", invitados.Id),
                    new SqlParameter("Correos", invitados.Correo)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 3
0
        public void Guardar(Regalo regalo)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Regalo_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", regalo.Id),
                    new SqlParameter("nombre", regalo.Nombre),
                    new SqlParameter("cantidad", regalo.Cantida),
                    new SqlParameter("enlace", regalo.Enlace),
                    new SqlParameter("deseo", regalo.Deseado),
                    new SqlParameter("descripcion", regalo.Descripcion),
                    new SqlParameter("id_Participante", regalo.Id_Participante)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 4
0
        public void Guardar(Roles rol)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Roles_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", rol.Id),
                    new SqlParameter("descripcion", rol.Descripcion)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
        public void Guardar(Enviar_Invitaciones Enviar_Inv)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Enviar_Invitaciones_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", Enviar_Inv.id),
                    new SqlParameter("nombre", Enviar_Inv.Id_Evento),
                    new SqlParameter("f_limite", Enviar_Inv.Id_listaInvitaciones)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 6
0
        public void Guardar(Grupos grupo)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Grupos_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", grupo.Id),
                    new SqlParameter("Descripcion", grupo.Id_Evento),
                    new SqlParameter("id_Participante", grupo.Id_Participante)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 7
0
        public void Guardar(Lista_Seguidos seguido)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Lista_Seguidos_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", seguido.Id),
                    new SqlParameter("Id_Participante", seguido.Id_Participante)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 8
0
        public static List <Lista_Invitados> obtenerTodos()
        {
            List <Lista_Invitados> lista = new List <Lista_Invitados>();
            Servidor oservidor           = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_lista_invitados_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())
                {
                    Lista_Invitados listaInv = new Lista_Invitados();
                    listaInv.Id     = Convert.ToInt32(reader["id"].ToString());
                    listaInv.Correo = reader["Correos"].ToString();

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

            return(lista);
        }
Exemplo n.º 9
0
        public static Lista_Invitados ObtenerPorId(int id)
        {
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_lista_invitados_SelectRow", oservidor.Conectar());
                command.CommandType = System.Data.CommandType.StoredProcedure;


                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())
                {
                    Lista_Invitados invitado = new Lista_Invitados();
                    invitado.Id     = Convert.ToInt32(reader["Id"]);
                    invitado.Correo = reader["Correos"].ToString();

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

            return(null);
        }
Exemplo n.º 10
0
        public static List <Sorteo> ObtenerTodos()
        {
            List <Sorteo> lista     = new List <Sorteo>();
            Servidor      oservidor = new Servidor();

            try
            {
                // Ejecuta la sentencia sql en la conexion indicada
                SqlCommand command = new SqlCommand("SP_Sorteo_SelectAll", oservidor.Conectar());
                command.CommandType = System.Data.CommandType.StoredProcedure;

                SqlDataReader reader = command.ExecuteReader();
                // Cada Read lee un registro de la consulta
                while (reader.Read())
                {
                    Sorteo sorteo = new Sorteo();
                    sorteo.Id       = Convert.ToInt32(reader["id"].ToString());
                    sorteo.Id_Grupo = Convert.ToInt32(reader["id_Grupo"].ToString());

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

            return(lista);
        }
Exemplo n.º 11
0
        public static Roles ObtenerPorId(int id)
        {
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Roles_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())
                {
                    Roles rol = new Roles();
                    rol.Id          = Convert.ToInt32(reader["id"].ToString());
                    rol.Descripcion = reader["descripcion"].ToString();


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

            return(null);
        }
Exemplo n.º 12
0
        public static List <Roles> ObtenerTodos()
        {
            List <Roles> lista     = new List <Roles>();
            Servidor     oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Roles_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())
                {
                    Roles rol = new Roles();
                    rol.Id          = Convert.ToInt32(reader["id"].ToString());
                    rol.Descripcion = reader["descripcion"].ToString();

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

            return(lista);
        }
Exemplo n.º 13
0
        public void Guardar(Participante participante)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Participante_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", participante.id),
                    new SqlParameter("correo", participante.Correo),
                    new SqlParameter("nombre", participante.Nombre),
                    new SqlParameter("genero", participante.Genero),
                    new SqlParameter("telefono", participante.Telefono),
                    new SqlParameter("registrado", participante.Registrado),
                    new SqlParameter("id_Rol", participante.Id_Rol),
                    new SqlParameter("id_Evento", participante.Id_Evento)
                };
                command.Parameters.Add("@foto", SqlDbType.Image);

                // Stream usado como buffer
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                // Se guarda la imagen en el buffer
                ////foto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                // Se extraen los bytes del buffer para asignarlos como valor para el
                // parámetro.
                command.Parameters["@foto"].Value = ms.GetBuffer();

                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 14
0
        public static Participante ObtenerPorId(int id)
        {
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Participante_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())
                {
                    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"]);

                    foreach (Regalo item in Regalo_Datos.ObtenerTodos())
                    {
                        if (item.Deseado == true)
                        {
                            participante.regalos_Deseados = Regalo_Datos.Obtener_Regalos_PorParticipante(participante.id);
                        }
                        else
                        {
                            participante.regalos_No_Deseados = Regalo_Datos.Obtener_Regalos_PorParticipante(participante.id);
                        }
                    }


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

            return(null);
        }
Exemplo n.º 15
0
        public void Guardar(Sorteo sorteo)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Sorteo_Insert", servidor.Conectar());
                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", sorteo.Id),
                    new SqlParameter("id_Grupo", sorteo.Id_Grupo)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
        public static List <Enviar_Notificaciones> ObtenerTodos()
        {
            List <Enviar_Notificaciones> lista = new List <Enviar_Notificaciones>();
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Enviar_Notificaciones_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())
                {
                    Enviar_Notificaciones enviar_notif = new Enviar_Notificaciones();
                    enviar_notif.Id = Convert.ToInt32(reader["Id"]);
                    enviar_notif.Id_Participante = reader["id_Participante"].ToString();
                    enviar_notif.Descripcion     = reader["descripcion"].ToString();
                    enviar_notif.General         = Convert.ToBoolean(reader["General"]);

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

            return(lista);
        }
Exemplo n.º 21
0
        public void Guardar(Enviar_Notificaciones notificacion)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Enviar_Notificaciones_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", notificacion.Id),
                    new SqlParameter("Descripcion", notificacion.Descripcion),
                    new SqlParameter("id_Participante", notificacion.Id_Participante),
                    new SqlParameter("noti_general", notificacion.General),
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 22
0
        public static Enviar_Notificaciones ObtenerPorId(int id)
        {
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Enviar_Notificaciones_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())
                {
                    Enviar_Notificaciones enviar_notif = new Enviar_Notificaciones();
                    enviar_notif.Id = Convert.ToInt32(reader["Id"]);
                    enviar_notif.Id_Participante = reader["id_Participante"].ToString();
                    enviar_notif.Descripcion     = reader["descripcion"].ToString();
                    enviar_notif.General         = Convert.ToBoolean(reader["General"]);

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

            return(null);
        }
Exemplo n.º 23
0
        public static List <Enviar_Invitaciones> ObtenerTodos()
        {
            List <Enviar_Invitaciones> lista = new List <Enviar_Invitaciones>();
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Enviar_Invitaciones_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())
                {
                    Enviar_Invitaciones enviar_inv = new Enviar_Invitaciones();
                    enviar_inv.id                   = Convert.ToInt32(reader["Id"]);
                    enviar_inv.Id_Evento            = Convert.ToInt32(reader["id_Evento"]);
                    enviar_inv.Id_listaInvitaciones = Convert.ToInt32(reader["id_ListaInvitados"]);

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

            return(lista);
        }
Exemplo n.º 24
0
        public void Guardar(Recivir_Invitaciones recibir_inv)
        {
            try
            {
                SqlCommand command = new SqlCommand("SP_Recivir_Invitaciones_Insert", servidor.Conectar());

                command.CommandType = CommandType.StoredProcedure;

                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("id", recibir_inv.Id),
                    new SqlParameter("Id_Participante", recibir_inv.Id_Participante),
                    new SqlParameter("descripcion", recibir_inv.Descripcion)
                };
                command.Parameters.AddRange(parameters);
                cargar = command.ExecuteReader();
            }
            catch
            {
                throw;
            }
            finally
            {
                servidor.Desconectar();
            }
        }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
0
        public static Enviar_Invitaciones ObtenerPorId(int id)
        {
            Servidor oservidor = new Servidor();

            try
            {
                SqlCommand command = new SqlCommand("SP_Enviar_Invitaciones_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())
                {
                    Enviar_Invitaciones evento = new Enviar_Invitaciones();
                    evento.id                   = Convert.ToInt32(reader["Id"]);
                    evento.Id_Evento            = Convert.ToInt32(reader["Id_Evento"]);
                    evento.Id_listaInvitaciones = Convert.ToInt32(reader["Id_listaInvitaciones"]);

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

            return(null);
        }