Exemple #1
0
        public List <beCanal> ListarCanal(SqlConnection con)
        {
            List <beCanal> lstObeCanal = new List <beCanal>();
            SqlCommand     cmd         = new SqlCommand("sp_Consultar_Canal", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader drd = cmd.ExecuteReader();

            if (drd != null)
            {
                beCanal obeCanal;
                int     posIdCanal = drd.GetOrdinal("ID_CANAL");
                int     posNombre  = drd.GetOrdinal("CANAL");
                int     posEstado  = drd.GetOrdinal("ESTADO");
                while (drd.Read())
                {
                    obeCanal              = new beCanal();
                    obeCanal.ID_Canal     = drd.GetInt32(posIdCanal);
                    obeCanal.NOMBRE_Canal = drd.GetString(posNombre);
                    obeCanal.ESTADO       = drd.GetString(posEstado);
                    lstObeCanal.Add(obeCanal);
                }
            }
            drd.Close();
            return(lstObeCanal);
        }
Exemple #2
0
        public bool ActualizarCanal(SqlConnection con, beCanal obeCanal, string usuario)
        {
            bool       exito = false;
            SqlCommand cmd   = new SqlCommand("sp_Actualizar_Canal", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ID_Canal", obeCanal.ID_Canal);
            cmd.Parameters.AddWithValue("@NOMBRE", obeCanal.NOMBRE_Canal);
            cmd.Parameters.AddWithValue("@USUARIO", usuario);
            int nRegistros = cmd.ExecuteNonQuery();

            exito = (nRegistros > 0);
            return(exito);
        }
Exemple #3
0
        public int AdicionarCanal(SqlConnection con, beCanal obeCanal, string usuario)
        {
            int        idElemento = -1;
            SqlCommand cmd        = new SqlCommand("sp_Insertar_Canal", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@NOMBRE", obeCanal.NOMBRE_Canal);
            cmd.Parameters.AddWithValue("@USUARIO", usuario);
            int nRegistros = cmd.ExecuteNonQuery();

            if (nRegistros > 0)
            {
                idElemento = nRegistros;
            }
            return(idElemento);
        }
Exemple #4
0
        public bool ActualizarCanal(beCanal obeCanal, string usuario)
        {
            bool exito = false;

            using (SqlConnection con = new SqlConnection(CadenaConexion))
            {
                try
                {
                    con.Open();
                    daCanal odaCanal = new daCanal();
                    exito = odaCanal.ActualizarCanal(con, obeCanal, usuario);
                }
                catch (Exception ex)
                {
                    //GrabarLog(ex.Message, ex.StackTrace);
                }
                return(exito);
            }
        }
Exemple #5
0
        public int AdicionarCanal(beCanal obeCanal, string usuario)
        {
            int idCanal = -1;

            using (SqlConnection con = new SqlConnection(CadenaConexion))
            {
                try
                {
                    con.Open();
                    daCanal odaCanal = new daCanal();
                    idCanal = odaCanal.AdicionarCanal(con, obeCanal, usuario);
                }
                catch (Exception ex)
                {
                    //GrabarLog(ex.Message, ex.StackTrace);
                }
            }
            return(idCanal);
        }