Example #1
0
 public int eliminaAlumno(Alumno a)
 {
     try
     {
         return(AlumnoCommands.eliminaAlumno(a));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         MessageBox.Show(e.Message);
         return(-1);
     }
 }
Example #2
0
        public void buscaAlumno(int folio, System.Windows.Forms.TextBox[] cartilla)
        {
            try
            {
                cmd = AlumnoCommands.buscaAlumno(folio);
                //cmd = new SqlCommand(String.Format("SELECT * FROM alumno WHERE alumno.folio = '{0}'", folio), Connect());
                dr = cmd.ExecuteReader();
                String[] param = { "folio", "nombre", "sexo", "mail", "semestre", "programa" };
                dr.Read();
                for (int i = 0; i < 5; i++)
                {
                    cartilla[i].Text = dr[param[i]].ToString();
                    Console.WriteLine(dr[param[i]].ToString());
                }
                Console.WriteLine(dr[param[5]].ToString());
                switch (dr[param[5]].ToString())
                {
                case "1":
                    cartilla[5].Text = "computacion";
                    break;

                case "2":
                    cartilla[5].Text = "telecom";
                    break;

                case "3":
                    cartilla[5].Text = "mecatronica";
                    break;

                case "4":
                    cartilla[5].Text = "negocios";
                    break;

                case "5":
                    cartilla[5].Text = "industrial";
                    break;
                }
                dr.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                MessageBox.Show(e.Message);
            }
        }