Пример #1
0
        //Retorna as ultimas 10 mensagens postadas ordenadas por data
        public List <ViewAll> ReadMensagemIndex(int iduser, int quant)
        {
            List <ViewAll> lista = new List <ViewAll>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = connection;

            cmd.CommandText = @"SELECT TOP " + quant + " * FROM v_Grupo_Msg_Part WHERE PartIdUser = @iduser AND PartIdGrupo = Idgrupo AND (PartStatus = 1 OR PartStatus = 2) ORDER BY Datahora DESC";


            cmd.Parameters.AddWithValue("@iduser", iduser);
            //cmd.CommandType = System.Data.CommandType.Text;

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ViewAll  p    = new ViewAll();
                DateTime data = (DateTime)reader["Datahora"];
                p.MsgDatahora = data.ToString("dd/MM/yyyy, HH:mm");
                p.MsgTexto    = (string)(reader["Texto"]);
                p.PIdPessoa   = (int)reader["IdUsuario"];
                p.UNick       = (string)reader["Nickusuario"];
                p.UImagem     = (string)reader["Imagemusuario"];
                p.GIdGrupo    = (int)reader["Idgrupo"];
                p.GNome       = (string)reader["Nomegrupo"];

                lista.Add(p);
            }
            return(lista);
        }
Пример #2
0
        //Mostra os usuarios que tem presença confirmada no evento
        public List <ViewAll> ViewConfUserEventoAll(int idgrupo, int idevento)
        {
            List <ViewAll> lista = new List <ViewAll>();
            SqlCommand     cmd   = new SqlCommand();

            cmd.Connection  = connection;
            cmd.CommandText = @"SELECT * FROM v_Conf_Evento_Grupo WHERE ConfGrupoId = @idgrupo AND ConfEventoId = @idevento AND ConfStatus = 1";

            cmd.Parameters.AddWithValue("@idgrupo", idgrupo);
            cmd.Parameters.AddWithValue("@idevento", idevento);

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ViewAll p = new ViewAll();
                p.CIdGrupo   = (int)reader["ConfGrupoId"];
                p.CIdUsuario = (int)reader["ConfUserId"];
                p.CIdEvento  = (int)reader["ConfEventoId"];
                p.UNick      = (string)reader["UserNick"];
                p.UImagem    = (string)(reader["UserImg"] != DBNull.Value ? reader["UserImg"] : null);
                lista.Add(p);
            }
            return(lista);
        }
Пример #3
0
        //Seleciona os grupos do usuario
        public List <ViewAll> ReadGrupoTotal(int iduser)
        {
            List <ViewAll> lista = new List <ViewAll>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = connection;
            cmd.CommandText = @"SELECT * FROM v_Grupo_Part WHERE @id = id AND (PartStatus = 1 OR PartStatus = 2)";

            cmd.Parameters.AddWithValue("@id", iduser);
            //cmd.CommandType = System.Data.CommandType.Text;

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ViewAll p = new ViewAll();
                p.GIdGrupo = (int)reader["IdGrupo"];
                p.GNome    = (string)reader["Nome"];
                p.GImagem  = (string)reader["Imagem"];
                p.JNome    = (string)reader["NomeJogo"];
                lista.Add(p);
            }
            return(lista);
        }
Пример #4
0
        public List <ViewAll> BuscarGrupo(string busca)
        {
            List <ViewAll> lista = new List <ViewAll>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = connection;
            cmd.CommandText = @"SELECT * FROM v_Info_Grupo WHERE NomeGrupo LIKE  @busca";
            cmd.Parameters.AddWithValue("@busca", "%" + busca + "%");

            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.HasRows == false)
            {
                lista = null;
                return(lista);
            }
            else
            {
                while (reader.Read())
                {
                    ViewAll p = new ViewAll();
                    p.GIdGrupo = (int)reader["IdGrupo"];
                    p.GNome    = (string)reader["NomeGrupo"];
                    p.GImagem  = (string)reader["ImagemGrupo"];
                    p.JNome    = (string)reader["NomeJogo"];
                    lista.Add(p);
                }
                return(lista);
            }
        }
Пример #5
0
        //Retorna a quantidade de membros participantes do grupo
        public List <ViewAll> ReadMembrosGrupoTotal(int idgrupo)
        {
            List <ViewAll> lista = new List <ViewAll>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = connection;
            cmd.CommandText = @"SELECT * FROM v_User_Grupo_Part WHERE PartIdGrupo = @idgrupo AND (PartStatus = 1 OR PartStatus = 2) ORDER BY Nick";

            cmd.Parameters.AddWithValue("@idgrupo", idgrupo);
            //cmd.CommandType = System.Data.CommandType.Text;

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ViewAll p = new ViewAll();
                p.PartIdUsuario = (int)reader["PartIdUser"];
                p.PartStatus    = (int)reader["PartStatus"];
                p.PartIdGrupo   = (int)reader["PartIdGrupo"];
                p.UNick         = (string)reader["Nick"];
                p.UImagem       = (string)reader["Imagem"];
                p.PNome         = (string)reader["Nome"];
                lista.Add(p);
            }
            return(lista);
        }
Пример #6
0
        //Retorna as Informações do Grupo
        public ViewAll InfoGrupo(int idgrupo)
        {
            ViewAll    e   = null;
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = connection;
            cmd.CommandText = @"SELECT * FROM v_Info_Grupo WHERE IdGrupo = @idgrupo";

            cmd.Parameters.AddWithValue("@idgrupo", idgrupo);

            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                e            = new ViewAll();
                e.GIdGrupo   = (int)reader["IdGrupo"];
                e.GIdJogo    = (int)reader["IdJogo"];
                e.GNome      = (string)reader["NomeGrupo"];
                e.GImagem    = (string)reader["ImagemGrupo"];
                e.GDescricao = (string)reader["Descricao"];
                e.JNome      = (string)reader["NomeJogo"];
            }
            return(e);
        }