Example #1
0
        public static string MostrarBD(this Entidades.Punto6F.Persona person)
        {
            _conexion = new SqlConnection(Properties.Settings.Default.cadenaConexion);
            _comando  = new SqlCommand();

            _comando.CommandType = CommandType.Text;
            _comando.Connection  = _conexion;
            StringBuilder sb = new StringBuilder();

            _comando.CommandText = "SELECT * FROM personas ";


            try
            {
                _conexion.Open();
                SqlDataReader info;

                info = _comando.ExecuteReader();
                while (info.Read())
                {
                    sb.AppendLine(info[0].ToString());
                    sb.AppendLine(info[1].ToString());
                    sb.AppendLine(info[2].ToString());
                    sb.AppendLine(info[3].ToString());
                }
                info.Close();
                _conexion.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(sb.ToString());
        }
Example #2
0
        static void Main(string[] args)
        {
            //Entidades.Inicio.Humano h = new Entidades.Inicio.Humano("Juan", ERaza.Mestiza);
            //Entidades.Inicio.Persona p = new Entidades.Inicio.Persona("Brian", "Lopez", ERaza.Cabeza, 17);
            //Entidades.Inicio.Alumno a = new Entidades.Inicio.Alumno(p, 123, ENivelDeEstudio.Primaria);
            //Entidades.Inicio.AlumnoEgresado ae = new Entidades.Inicio.AlumnoEgresado(a, 4.5f, 2017);

            //Console.WriteLine(p.MostrarBD());

            //Console.ReadLine();


            //Entidades.Punto2F.ClaseConstructores o = new Entidades.Punto2F.ClaseConstructores();


            //Entidades.Punto6F.Persona p = new Entidades.Punto6F.Persona("Brian", "Lopez", ERaza.Cabeza, 17);
            //Entidades.Punto6F.AlumnoEgresado a = new Entidades.Punto6F.AlumnoEgresado(new Entidades.Punto6F.Alumno(p, 123, ENivelDeEstudio.Primaria), 8.8f, 2001);

            //if (a.Xml("alumno.xml"))
            //{
            //    MessageBox.Show("Serializado OK");
            //}
            //else
            //{
            //    MessageBox.Show("NO Serializado");
            //}

            //if (((Entidades.Punto6F.IDeserializar)a).Xml("alumno.xml", out a))
            //{
            //    MessageBox.Show("Deserializado OK");
            //}
            //else
            //{
            //    MessageBox.Show("NO Deserializado");
            //}


            //Entidades.Punto6F.Persona p = new Entidades.Punto6F.Persona("Peter", "Müller", ERaza.Aria, 25);
            //MessageBox.Show(p.MostrarBD());

            Entidades.Punto11.Salon <Entidades.Punto6F.Persona> s = new Entidades.Punto11.Salon <Entidades.Punto6F.Persona>(2);

            try
            {
                Entidades.Punto6F.Persona p  = new Entidades.Punto6F.Persona("Brian", "Lopez", ERaza.Cabeza, 67);
                Entidades.Punto6F.Persona p1 = new Entidades.Punto6F.Persona("Jose", "Lopez", ERaza.Negra, 47);
                Entidades.Punto6F.Persona p2 = new Entidades.Punto6F.Persona("Brian", "Smith", ERaza.Aria, 57);
                s.evento += s.Salon_SalonLlenoEvent;

                s += p;
                s += p1;
                s += p2;
            }
            catch (Entidades.Punto11.NoAgregaException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }