Beispiel #1
0
 public static Usuario BuscaPeloId(int cont_id)
 {
     Usuario retorno = new Usuario();
     SqlConnection c = BD_SQL.Connection;
     try
     {
         c.Open();
         SqlCommand cmd = new SqlCommand("select tbUsuario.cont_id,cont_nome,cont_foto,cont_inativo,usu_email,usu_senha,usu_texto_status from tbContato inner join tbUsuario on tbContato.cont_id = tbUsuario.cont_id and tbUsuario.cont_id=@Cont_Id", c);
         cmd.Parameters.AddWithValue("@Cont_Id", cont_id);
         using (DataTable select = BD_SQL.ExecutaSelect(cmd))
         {
             if (select.Rows.Count > 0)
                 retorno = MontaVO(select.Rows[0]);
         }
     }
     finally
     {
         c.Close();
     }
     return retorno;
 }
Beispiel #2
0
 public static Usuario MontaVO(DataRow registro)
 {
     Usuario retorno = new Usuario(ContatoDAO.MontaVO(registro));
     retorno.Texto_Status = registro["usu_texto_status"].ToString();
     retorno.Email = registro["usu_email"].ToString();
     retorno.Senha = registro["usu_senha"].ToString();
     retorno.Contatos = BuscaContatos(retorno.IDContato);
     return retorno;
 }
Beispiel #3
0
        public static int Insere(Usuario u)
        {
            SqlConnection c = BD_SQL.Connection;
            try
            {
                c.Open();
                SqlCommand cmd = new SqlCommand("spInsereUsuario", c);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Cont_Nome", u.Nome);
                using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
                {
                    u.Foto.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    cmd.Parameters.AddWithValue("@Cont_Foto", ms.ToArray());
                }
                cmd.Parameters.AddWithValue("@Usu_Email", u.Email);
                cmd.Parameters.AddWithValue("@Usu_Senha", u.Senha);
                cmd.Parameters.AddWithValue("@Usu_Texto_Status", u.Texto_Status);
                cmd.Parameters.Add("@Cont_Id", SqlDbType.Int).Direction = ParameterDirection.Output;

                BD_SQL.ExecutaSQL(cmd);
                return u.IDContato = (int)cmd.Parameters["@Cont_Id"].Value;
            }
            finally
            {
                c.Close();
            }
        }
Beispiel #4
0
 public int RemoveMembro(Usuario usuario)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 public int AdicionaMembro(Usuario usuario)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public Grupo()
     : base()
 {
     Membros = new List<Usuario>();
     Administrador = new Usuario();
 }
Beispiel #7
0
 public int TrocarAdministrador(Usuario novo_administrador)
 {
     throw new NotImplementedException();
 }