public List <entSitioInteres> ListarSinteres()
        {
            SqlCommand             cmd  = null;
            List <entSitioInteres> list = new List <entSitioInteres>();

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd             = new SqlCommand("sp_listarSitin", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    entSitioInteres sint = new entSitioInteres();
                    sint.idSitIn   = Convert.ToInt32(dr["idSitIn"]);
                    sint.nombre    = dr["nombre"].ToString();
                    sint.direccion = dr["direccion"].ToString();
                    list.Add(sint);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { cmd.Connection.Close(); }
            return(list);
        }
        public Boolean RegistrarSinteres(entSitioInteres obj)
        {
            SqlCommand cmd      = null;
            Boolean    registra = false;

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd             = new SqlCommand("sp_registrarSitin", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@nombre", obj.nombre);
                cmd.Parameters.AddWithValue("@direccion", obj.direccion);
                cn.Open();

                int i = cmd.ExecuteNonQuery();

                if (i > 0)
                {
                    registra = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(registra);
        }
Exemple #3
0
        private void btn_Agregar_Click(object sender, EventArgs e)
        {
            entSitioInteres registrar = new entSitioInteres();

            registrar.nombre    = txt_nombre.Text.Trim();
            registrar.direccion = txt_Direccion.Text.Trim();
            logSitioInteres.Instancia.RegistrarSinteres(registrar);
            listarSitin();
        }
Exemple #4
0
        private void btn_aceptar_Click(object sender, EventArgs e)
        {
            entSitioInteres s = new entSitioInteres();

            s.idSitIn   = int.Parse(txt_id.Text.Trim());
            s.nombre    = txt_nombre.Text.Trim();
            s.direccion = txt_direccion.Text.Trim();
            logSitioInteres.Instancia.ModificarSinteres(s);
            this.Hide();
            mostrar.buscarSitin();
        }
Exemple #5
0
 public void ModificarSinteres(entSitioInteres sin)
 {
     try
     {
         datSitioInteres.Instancia.ModificarSitin(sin);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #6
0
 public void RegistrarSinteres(entSitioInteres obj)
 {
     try
     {
         datSitioInteres.Instancia.RegistrarSinteres(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void ModificarSitin(entSitioInteres sin)
        {
            SqlCommand cmd = null;

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd             = new SqlCommand("sp_modificarSitin", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@idSitIn", sin.idSitIn);
                cmd.Parameters.AddWithValue("@nombre", sin.nombre);
                cmd.Parameters.AddWithValue("@direccion", sin.direccion);
                cn.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { cmd.Connection.Close(); }
        }