Exemple #1
0
 /// <summary>
 /// Apaga um Favorito.
 /// </summary>
 /// <param name="Obj">Objeto Favorito</param>
 public void Delete(ENFavorito Obj)
 {
     SqlConnection _con = new SqlConnection(ConfigurationManager.ConnectionStrings["PipiConnection"].ConnectionString);
     SqlCommand _cmd = new SqlCommand("sprFavoritosCRUD", _con);
     _cmd.CommandType = CommandType.StoredProcedure;
     _cmd.Parameters.AddWithValue("@sprstrOperacao", "D");
     _cmd.Parameters.AddWithValue("@sprintEspecificoR", 0);
     _cmd.Parameters.AddWithValue("@sprintIdFavorito", Obj.IdFavorito);
     _cmd.Parameters.AddWithValue("@sprintIdFuncionario", Obj.IdFuncionario);
     _cmd.Parameters.AddWithValue("@sprstrNomeFavorito", Obj.NomeFavorito);
     _cmd.Parameters.AddWithValue("@sprstrUrlFavorito", Obj.UrlFavorito);
     try
     {
         _con.Open();
         _cmd.ExecuteNonQuery();
     }
     finally
     {
         _con.Close();
     }
 }
Exemple #2
0
 /// <summary>
 /// Atualiza um Favorito
 /// </summary>
 /// <param name="Obj">ENFavorito Obj</param>
 public void UpdateFavorito(ENFavorito Obj)
 {
     (new DAFavorito()).Update(Obj);
 }
Exemple #3
0
 /// <summary>
 /// Apaga um Favorito
 /// </summary>
 /// <param name="Obj">ENFavorito Obj</param>
 public void DeleteFavorito(ENFavorito Obj)
 {
     (new DAFavorito()).Delete(Obj);
 }
Exemple #4
0
 /// <summary>
 /// Cria um novo Favorito
 /// </summary>
 /// <param name="Obj">ENFavorito Obj</param>
 public void CreateFavorito(ENFavorito Obj)
 {
     (new DAFavorito()).Create(Obj);
 }
Exemple #5
0
        /// <summary>
        /// Seleciona uma lista de favoritos de acordo com os parâmetros
        /// </summary>
        /// <param name="EspecificoR">int EspecificoR</param>
        /// <returns>Lista de Favoritos</returns>
        public List<ENFavorito> Read(int EspecificoR, int idFavorito, int idFuncionario)
        {
            List<ENFavorito> _objs = new List<ENFavorito>();
            SqlConnection _con = new SqlConnection(ConfigurationManager.ConnectionStrings["PipiConnection"].ConnectionString);
            SqlCommand _cmd = new SqlCommand("sprFavoritosCRUD", _con);
            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.Parameters.AddWithValue("@sprstrOperacao", "R");
            _cmd.Parameters.AddWithValue("@sprintEspecificoR", EspecificoR);
            _cmd.Parameters.AddWithValue("@sprintIdFavorito", idFavorito);
            _cmd.Parameters.AddWithValue("@sprintIdFuncionario", idFuncionario);
            _cmd.Parameters.AddWithValue("@sprstrNomeFavorito", string.Empty);
            _cmd.Parameters.AddWithValue("@sprstrUrlFavorito", string.Empty);

            _con.Open();
            SqlDataReader rd = _cmd.ExecuteReader(CommandBehavior.CloseConnection);

            try
            {
                while (rd.Read())
                {
                    ENFavorito NewObj = new ENFavorito();
                    NewObj.IdFavorito = Convert.ToInt32(rd[0].ToString());
                    NewObj.IdFuncionario = Convert.ToInt32(rd[1].ToString());
                    NewObj.NomeFavorito = rd[2].ToString();
                    NewObj.UrlFavorito = rd[3].ToString();
                    _objs.Add(NewObj);
                }
            }
            finally
            {
                rd.Close();
            }
            return _objs;
        }