internal bool MoverMulti(ListBox lbI, ListBox lbF) { ListBox LBI = lbI as ListBox; ListBox LBF = lbF as ListBox; if (LBI.Items.Count > 0) { for (int i = 0; i < LBI.Items.Count; i++) { string g = AlTraslado.rer[LBI.GetItemText(LBI.Items[i])].ToString(); F2.PropiedadAlumno actual = new F2.PropiedadAlumno(); actual = AlTraslado.alumnos[int.Parse(g)]; string nombre = actual.Nombre; LBF.Items.Add(nombre); } LBI.Items.Clear(); LBF.Sorted = true; return(true); } else { return(false); } }
public AlumnosR(F2.PropiedadAlumno n) { InitializeComponent(); alumno = n as F2.PropiedadAlumno; txtTelefono.KeyPress += Telefono_KeyPress; txtResponsable.KeyPress += Responsable_KeyPress; LlenarCombos(); LlenarCampos(); }
private void btnContinuar_Click(object sender, EventArgs e) { string AlSelected; foreach (string item in listBox2.Items) { AlSelected = AlTraslado.rer[item].ToString(); F2.PropiedadAlumno temp = AlTraslado.alumnos[int.Parse(AlSelected)]; alu.Recuperar(temp); } repe fh = new repe(); this.Visible = false; fh.ShowDialog(); this.Close(); }
internal void llenarData() { int c = AlTraslado.Repetidos.Count; F2.PropiedadAlumno actual; if (c > 0) { for (int i = 0; i < c; i++) { actual = new F2.PropiedadAlumno(); actual = AlTraslado.Repetidos[i]; dataGridView1.Rows.Add(actual.Nie, actual.Nombre, "Ya se encuentra en la base de datos"); } } else { textBox1.Visible = true; } }
public void Recuperar(F2.PropiedadAlumno n) { SqlConnection conn = Conexion.Cnn(); F2.PropiedadAlumno item = n as F2.PropiedadAlumno; try { string cadena = "SELECT * FROM ALUMNO WHERE NIE='" + item.Nie + "'"; SqlCommand cmm = new SqlCommand(cadena, conn); SqlDataReader reader; reader = cmm.ExecuteReader(); if (reader.HasRows) { Repetidos.Add(item); return; } reader.Close(); item.Estado = 1; cmm = new SqlCommand("Ingresaralumnos", conn); cmm.CommandType = CommandType.StoredProcedure; cmm.Parameters.AddWithValue("@NIE", item.Nie); cmm.Parameters.AddWithValue("@Nombre", item.Nombre); cmm.Parameters.AddWithValue("@Fecha_nac", item.Fechanac); cmm.Parameters.AddWithValue("@Telefono", item.Telefono); cmm.Parameters.AddWithValue("@Direccion", item.Direccion); cmm.Parameters.AddWithValue("@Responsable", item.Responsable); cmm.Parameters.AddWithValue("@Grado", item.Grado); cmm.Parameters.AddWithValue("@Seccion", item.Seccion); cmm.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { conn.Close(); MessageBox.Show(ex.Message, "Error retornando alumnos", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
internal bool MoverSimple(ListBox lbI, ListBox lbF) { ListBox LBI = lbI as ListBox; ListBox LBF = lbF as ListBox; if (LBI.Items.Count > 0) { List <string> nombres = new List <string>(); for (int i = 0; i < LBI.Items.Count; i++) { if (LBI.GetSelected(i) == true) { string g = AlTraslado.rer[LBI.GetItemText(LBI.Items[i])].ToString(); F2.PropiedadAlumno actual = new F2.PropiedadAlumno(); actual = AlTraslado.alumnos[int.Parse(g)]; string nombre = actual.Nombre; LBI.SetSelected(i, false); LBF.Items.Add(nombre); nombres.Add(nombre); } } foreach (string item in nombres) { LBI.Items.Remove(item); } LBF.Sorted = true; return(true); } else { return(false); } }
internal List <F2.PropiedadAlumno> GetAlumnos(int año, int grado, int seccion, string procedimiento, string nombre) { List <F2.PropiedadAlumno> temp = new List <F2.PropiedadAlumno>(); try { F2.PropiedadAlumno alumno; cmm = new SqlCommand(procedimiento, conn); cmm.CommandType = CommandType.StoredProcedure; cmm.Parameters.AddWithValue("@ano", año); //Busqueda añosecciongrado if (procedimiento == "GetAl") { cmm.Parameters.AddWithValue("@grado", grado); cmm.Parameters.AddWithValue("@seccion", seccion); } //Busqueda año -nombre else if (procedimiento == "GetAl2") { nombre = nombre + "%"; cmm.Parameters.AddWithValue("@nombre", nombre); } conn.Open(); reader = cmm.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { alumno = new F2.PropiedadAlumno(); alumno.Nie = reader["NIE"].ToString().Trim(); alumno.Nombre = reader["Nombre"].ToString().Trim(); alumno.Fechanac = reader["Fecha_nac"].ToString().Trim(); alumno.Direccion = reader["Direccion"].ToString().Trim(); alumno.Telefono = reader["Telefono"].ToString().Trim(); alumno.Responsable = reader["Responsable"].ToString().Trim(); alumno.Grado = int.Parse(reader["Grado"].ToString().Trim()) + 1; alumno.Seccion = int.Parse(reader["Seccion"].ToString().Trim()); if (alumno.Grado != 13) { alumno.Grado = alumno.Grado + 1; } temp.Add(alumno); } } conn.Close(); return(temp); } catch { conn.Close(); return(null); } }