manual de usuario

36
MANUAL DE USUARIO. Informacion General: Sistema de control de horas realiza como parte del proyecto de cuarto ciclo en ela materia de programación y base da datos, sistema de diseño básico, idealizado para el control de materias y horas, para llevar un control de su correcto inicio de clases y que sea finalizado en el tiempo especifico, asi se ayuda en la mejora de que las horas, que son asignadas a los profesores por materia sean correspondidos y no haya interferencia de horarios, un interfaz grafica sencilla de utilizar y ralacionada con cada una de sus especialidades, bueno aunque por el momento solo se utilizara el sistema con ingreso de datos y mas no solo eso Para la realización de este p proyecto se ha requerido de la base de datos Objetivo: s¡demostra que se puede desarrollar aplicaciones en base a los conocimientos y adquiridos y mas aun del método del autoaprendizaje. El obetivo es demostrar que a pesar de los pocos conocimientos impartidos sean cualquiera su causa es demostra que se puede mejorar y salir adelante. Alcances: demostra las habilidades y los conocimientos que han sido necesarios para poder desarrollar, mostrar una interfaz agradable sencilla con el usuario Limitantes: uno de los grandes limitantes que se obtuvo fue el poco conocimiento en la programación, la poca instrucción que se dio en las clases, y las pocas explicaciones por parte de quien se impartiría dicha materia Utilización: la utilización es lo mas sensillo pues a continuación se detallara conmo hubiese sido la función, pero se deja con la idea y la aplicación de las misma.

Upload: francisco-flores

Post on 17-Jul-2015

26 views

Category:

Education


0 download

TRANSCRIPT

MANUAL DE USUARIO.

Informacion General:

Sistema de control de horas realiza como parte del proyecto de cuarto ciclo en ela materia de

programación y base da datos, sistema de diseño básico, idealizado para el control de materias

y horas, para llevar un control de su correcto inicio de clases y que sea finalizado en el tiempo

especifico, asi se ayuda en la mejora de que las horas, que son asignadas a los profesores por

materia sean correspondidos y no haya interferencia de horarios, un interfaz grafica sencilla de

utilizar y ralacionada con cada una de sus especialidades, bueno aunque por el momento solo

se utilizara el sistema con ingreso de datos y mas no solo eso

Para la realización de este p proyecto se ha requerido de la base de datos Objetivo:

s¡demostra que se puede desarrollar aplicaciones en base a los conocimientos y adquiridos y

mas aun del método del autoaprendizaje. El obetivo es demostrar que a pesar de los pocos

conocimientos impartidos sean cualquiera su causa es demostra que se puede mejorar y salir adelante.

Alcances: demostra las habilidades y los conocimientos que han sido necesarios para poder desarrollar, mostrar una interfaz agradable sencilla con el usuario

Limitantes: uno de los grandes limitantes que se obtuvo fue el poco conocimiento en la

programación, la poca instrucción que se dio en las clases, y las pocas explicaciones por parte de quien se impartiría dicha materia

Utilización: la utilización es lo mas sensillo pues a continuación se detallara conmo hubiese sido la función, pero se deja con la idea y la aplicación de las misma.

Estructura De Programacion De La Pantalla Profesores using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using CONTROL_DE_ASISTENCIA; using System.IO; namespace CONTROL_DE_ASISTENCIA { public partial class profesores : Form { //objeto para usar las variables definidas en la clase clsvariables uso_variables=new clsvariables(); byte[] imagen; String ubicacion_imagen1; int ind_cerrar; public profesores() { InitializeComponent(); } private void profesores_Load(object sender, EventArgs e) { this.Left=(this.Width)/2; this.Top = (this.Height) / 2; BTNNUEVO_Click(sender, e); } private void BTNNUEVO_Click(object sender, EventArgs e) { try { ind_cerrar = 0; TXTAPELLIDOS.Clear(); TXTCEDULA.Clear(); TXTCIUDAD.Clear(); TXTCODPRO.Clear(); TXTDIRECCION.Clear(); TXTESTCIV.Clear(); TXTFECNAC.Clear(); TXTHIJOS.Clear(); TXTINGRESO.Clear(); TXTNOMBRES.Clear(); TXTODSERVACIONES.Clear(); TXTSALIDA.Clear(); TXTTELEFONO.Clear(); BTNBORRAR.Enabled = false; BTNEDITAR.Enabled = false; BTNGUARDAR.Enabled = true; if (uso_variables.conexion.State == 0) {//sentencia que abre la conexion si se encuentra cerrada uso_variables.conexion = new SqlConnection();

uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); } //enlazamosla consulta con la base de datos uso_variables.sql = "select*from materia"; //genramos un comado para asociarlo con el data adapter uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion); //creamos el obejto data table uso_variables.tabla = new DataTable(); //carga los datos en el combo e inicializasin seleccionar a ninguno uso_variables.dataAdaptaer.Fill(uso_variables.tabla); //poniendo index -1 if (uso_variables.tabla.Rows.Count>0) { cmbciclos.DataSource = uso_variables.tabla; cmbciclos.DisplayMember = "nivel"; cmbciclos.ValueMember = "codigo"; cmbciclos.SelectedIndex = -1; } uso_variables.sql = "select * from materia order by codigo"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count > 0) { cmbmaterias.DataSource = uso_variables.tabla; cmbmaterias.DisplayMember = "nombre"; cmbmaterias.ValueMember = "codigo"; cmbmaterias.SelectedIndex = -1; } uso_variables.sql = "select * from profesores"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql,uso_variables.conexion); //enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count==0) { dataGridView1.DataSource=null ; } else { dataGridView1.Columns.Clear(); dataGridView1.DataSource = uso_variables.tabla; } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNGUARDAR_Click(object sender, EventArgs e) {

try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada if (ubicacion_imagen1!="") { imagen = leer_imagen(ubicacion_imagen1); } else { imagen = null; } SqlCommand comando = new SqlCommand("insert into profesores(codigo, cod_materia, cod_ciclo, cedula,nombre,apellido,,fecha_naciemiento,hijos,estado_civil,provincia,ciudad,direccion,telefono,observaciones,hora_ingreso,hora_salida,foto)values(@codigo,@cod_materia,@cod_ciclo,@cedula,@nombre,@apellido,@fecha_naciemiento,@hijos,@estado_civil,@provincia,@ciudad,@direccion,@telefono,@observaciones,@hora_ingreso,@hora_salida,@foto)", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODPRO.Text); comando.Parameters.AddWithValue("cod_materia",cmbmaterias.SelectedValue.ToString()); comando.Parameters.AddWithValue("cod_ciclo", cmbciclos.SelectedValue.ToString()); comando.Parameters.AddWithValue("cedula", TXTCEDULA.Text); comando.Parameters.AddWithValue("nombre", TXTNOMBRES.Text); comando.Parameters.AddWithValue("apellido", TXTAPELLIDOS.Text); comando.Parameters.AddWithValue("fecha_nacimiento",TXTFECNAC); comando.Parameters.AddWithValue("hijos", TXTHIJOS.Text); comando.Parameters.AddWithValue("estado_civil", TXTESTCIV.Text); comando.Parameters.AddWithValue("provincia", cmbprovincias.Text); comando.Parameters.AddWithValue("ciudad", TXTCIUDAD.Text); comando.Parameters.AddWithValue("direccion", TXTDIRECCION.Text); comando.Parameters.AddWithValue("telefono", TXTTELEFONO.Text); comando.Parameters.AddWithValue("observaciones", TXTODSERVACIONES.Text); comando.Parameters.AddWithValue("hora_ingreso", TXTINGRESO.Text); comando.Parameters.AddWithValue("hora_salida", TXTSALIDA.Text); comando.Parameters.AddWithValue("foto", (object) imagen); comando.ExecuteNonQuery(); MessageBox.Show("Registro Agregado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } }//fin guardar byte[] leer_imagen(string ubicacion) { FileStream fStream = new FileStream(ubicacion, FileMode.Open, FileAccess.Read); byte[] aux_imagen = new byte[fStream.Length];

// Lee la información del archivo fStream.Read(aux_imagen, 0, (int)fStream.Length); fStream.Close(); return aux_imagen; } private void btncargar_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Imágenes|*.jpg;*.bmp;*.gif;*.png;*.jpeg"; DialogResult dialogresult = dialog.ShowDialog(); if (dialogresult == DialogResult.OK) // a_PTBFOTO.Image = Image.FromFile(dialog.FileName); { //Mostrar la imagen y la dirección ubicacion_imagen1 = dialog.FileName; PTBFOTO.ImageLocation = dialog.FileName; } } private void profesores_FormClosing(object sender, FormClosingEventArgs e) { if (ind_cerrar==0) this.Close(); } private void BTNBUSCAR_Click(object sender, EventArgs e) { byte[] imagen; Image imagen_mostrar = null; try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from profesores where codigo='" + TXTCODPRO.Text + "'"; SqlCommand comando = new SqlCommand(uso_variables.sql, uso_variables.conexion); SqlDataReader leer = comando.ExecuteReader(); int renglon = 0; if (leer.Read()) { TXTCODPRO.Enabled = false; TXTCEDULA.Enabled = false; TXTAPELLIDOS.Text = leer.GetString(3); TXTESTCIV.Text = leer.GetString(10); TXTHIJOS.Text = leer.GetString(11); TXTCIUDAD.Text = leer.GetString(6); cmbciclos.SelectedValue = leer.GetString(2); cmbmaterias.SelectedValue = leer.GetString(1); TXTDIRECCION.Text = leer.GetString(7); TXTNOMBRES.Text = leer.GetString(3); cmbprovincias.SelectedValue = leer.GetString(5); TXTTELEFONO.Text = leer.GetString(8); TXTODSERVACIONES.Text = leer.GetString(12); TXTINGRESO.Enabled = true; TXTSALIDA.Enabled = true;

imagen = (byte[])leer.GetValue(9); // Leer la imagen en memoria using (MemoryStream ms = new MemoryStream(imagen, 0, imagen.Length)) { ms.Write(imagen, 0, imagen.Length); // Graba la imagen imagen_mostrar = Image.FromStream(ms, true); } // Establece la imagen PTBFOTO.Image = imagen_mostrar; BTNGUARDAR.Enabled = false; BTNEDITAR.Enabled = true; BTNBORRAR.Enabled = true; } uso_variables.conexion.Close(); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNEDITAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada if (ubicacion_imagen1 != "") { imagen = leer_imagen(ubicacion_imagen1); } else { imagen = null; } SqlCommand comando = new SqlCommand("update profesores set cedula=@cedula,cod_materia=@cod_materia,cod_ciclo=@cod_ciclo,nombre=@nombre,apellido=@apellido,fecha_nacimiento=@fecha_nacimiento,estado_civil=@estado_civil,hijos=@hijos,provincia=@provincia,ciudad=@ciudad,direccion=@direccion,telefono=@telefono,observaciones=@observaciones,hora_ingreso=@hora_ingreso,hora_salida=@hora_salida,foto=@foto where codigo=@codigo", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODPRO.Text); comando.Parameters.AddWithValue("cod_materia", cmbmaterias.SelectedValue.ToString()); comando.Parameters.AddWithValue("cod_ciclo", cmbciclos.SelectedValue.ToString()); comando.Parameters.AddWithValue("nombre", TXTNOMBRES.Text); comando.Parameters.AddWithValue("apellido", TXTAPELLIDOS.Text); comando.Parameters.AddWithValue("fecha_naciemto", TXTFECNAC.Text); comando.Parameters.AddWithValue("hijos",TXTHIJOS.Text); comando.Parameters.AddWithValue("estado_civil",TXTESTCIV.Text); comando.Parameters.AddWithValue("provincia", cmbprovincias.Text); comando.Parameters.AddWithValue("ciudad", TXTCIUDAD.Text); comando.Parameters.AddWithValue("direccion", TXTDIRECCION.Text);

comando.Parameters.AddWithValue("telefono", TXTTELEFONO.Text); comando.Parameters.AddWithValue("observaciones", TXTODSERVACIONES.Text); comando.Parameters.AddWithValue("foto", (object)imagen); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBORRAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("delete profesores where codigo=@codigo", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODPRO.Text); comando.ExecuteNonQuery(); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void PTBFOTO_Click(object sender, EventArgs e) { } // private void TXTCODPRO_keypress(object sender, KeyPressEventArgs e) // {// //if(e, keychar=!13); // { // BTNBUSCAR_Click(sender,e); //} //} private void BTNSALIR_Click(object sender, EventArgs e) { ind_cerrar = 1; this.Close(); } }//fin clase secundaria }//fin clase princcipal

Código de ventana estudiantes using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.IO; namespace CONTROL_DE_ASISTENCIA { public partial class estudiantes : Form { clsvariables uso_variables = new clsvariables();//objeto para usar las variables definidas en la clase byte[] imagen; String ubicacion_imagen1; int ind_cerrar; public estudiantes() { InitializeComponent(); } private void BTNNUEVO_Click(object sender, EventArgs e) { try { ind_cerrar = 0; TXTAPELLIDOS.Clear(); TXTCIUDAD.Clear(); //TXTCODCICLO.Clear(); TXTCODIGO.Clear(); //TXTCODMAT.Clear(); TXTDIRECCION.Clear(); TXTNOMBRES.Clear(); //TXTPROVINCIA.Clear(); TXTTELEFONO.Clear(); BTNGUARDAR.Enabled = true; BTNEDITAR.Enabled = false; BTNBORRAR.Enabled = false; if (uso_variables.conexion.State==0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from ciclo"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); //carga los datos en el combo e inicializa sin seleccionar a ninguno //poniendo en index en -1

if (uso_variables.tabla.Rows.Count>0) { cmbciclos.DataSource = uso_variables.tabla; cmbciclos.DisplayMember = "nivel"; cmbciclos.ValueMember = "codigo"; cmbciclos.SelectedIndex = -1; } uso_variables.sql = "select * from materia order by codigo"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count > 0) { cmbmaterias.DataSource = uso_variables.tabla; cmbmaterias.DisplayMember = "nombre"; cmbmaterias.ValueMember = "codigo"; cmbmaterias.SelectedIndex = -1; } uso_variables.sql = "select * from estudiantes"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql,uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count==0) { dataGridView1.DataSource=null ; } else { dataGridView1.Columns.Clear(); dataGridView1.DataSource = uso_variables.tabla; } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void estudiantes_Load(object sender, EventArgs e) { BTNNUEVO_Click(sender, e); } private void btncargar_foto_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Imágenes|*.jpg;*.bmp;*.gif;*.png;*.jpeg"; DialogResult dlgRes = dlg.ShowDialog(); if (dlgRes != DialogResult.Cancel) { //Mostrar la imagen y la dirección ubicacion_imagen1 = dlg.FileName; PTBFOTO.ImageLocation = dlg.FileName; //PTBFOTO.Image= }

} private void estudiantes_FormClosing(object sender, FormClosingEventArgs e) { if (ind_cerrar==0) this.Close(); } private void BTNGUARDAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada if (ubicacion_imagen1!="") { imagen = leer_imagen(ubicacion_imagen1); } else { imagen = null; } SqlCommand comando = new SqlCommand("insert into estudiantes(codigo, cod_materia, cod_ciclo,nombre,apellido,provincia,ciudad,direccion,telefono,foto)values(@codigo,@cod_materia,@cod_ciclo,@nombre,@apellido,@provincia,@ciudad,@direccion,@telefono,@foto)", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODIGO.Text); comando.Parameters.AddWithValue("cod_materia", TXTCODMAT.Text);// cmbmaterias.SelectedValue.ToString()); comando.Parameters.AddWithValue("cod_ciclo", TXTCODCICLO.Text);// cmbciclos.SelectedValue.ToString()); comando.Parameters.AddWithValue("nombre", TXTNOMBRES.Text); comando.Parameters.AddWithValue("apellido", TXTAPELLIDOS.Text); comando.Parameters.AddWithValue("provincia", cmbprovincias.Text); comando.Parameters.AddWithValue("ciudad", TXTCIUDAD.Text); comando.Parameters.AddWithValue("direccion", TXTDIRECCION.Text); comando.Parameters.AddWithValue("telefono", TXTTELEFONO.Text); comando.Parameters.AddWithValue("foto", (object) imagen); comando.ExecuteNonQuery(); MessageBox.Show("Registro Agregado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } }//fin guardar byte[] leer_imagen(string ubicacion) { FileStream fStream = new FileStream(ubicacion, FileMode.Open, FileAccess.Read); byte[] aux_imagen = new byte[fStream.Length]; // Lee la información del archivo fStream.Read(aux_imagen, 0, (int)fStream.Length);

fStream.Close(); return aux_imagen; } private void BTNBUSCAR_Click(object sender, EventArgs e) { byte[] imagen; Image imagen_mostrar = null; try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from estudiantes where codigo='" + TXTCODIGO.Text + "'"; SqlCommand comando = new SqlCommand(uso_variables.sql, uso_variables.conexion); SqlDataReader leer = comando.ExecuteReader(); int renglon = 0; if (leer.Read()) { TXTCODIGO.Enabled = false; TXTAPELLIDOS.Text = leer.GetString(3); TXTCIUDAD.Text = leer.GetString(6); cmbciclos.SelectedValue = leer.GetString(2); cmbmaterias.SelectedValue = leer.GetString(1) ; TXTDIRECCION.Text = leer.GetString(7); TXTNOMBRES.Text = leer.GetString(3); cmbprovincias.SelectedValue = leer.GetString(5); TXTTELEFONO.Text = leer.GetString(8); imagen = (byte[])leer.GetValue(9); // Leer la imagen en memoria using (MemoryStream ms = new MemoryStream(imagen, 0, imagen.Length)) { ms.Write(imagen, 0, imagen.Length); // Graba la imagen imagen_mostrar = Image.FromStream(ms, true); } // Establece la imagen PTBFOTO.Image = imagen_mostrar; BTNGUARDAR.Enabled = false; BTNEDITAR.Enabled = true; BTNBORRAR.Enabled = true; } uso_variables.conexion.Close(); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNEDITAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection();

uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada if (ubicacion_imagen1 != "") { imagen = leer_imagen(ubicacion_imagen1); } else { imagen = null; } SqlCommand comando = new SqlCommand("update estudiantes set cod_materia=@cod_materia,cod_ciclo=@cod_ciclo,nombre=@nombre,apellido=@apellido,provincia=@provincia,ciudad=@ciudad,direccion=@direccion,telefono=@telefono,foto=@foto where codigo=@codigo", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODIGO.Text); comando.Parameters.AddWithValue("cod_materia", cmbmaterias.SelectedValue.ToString()); comando.Parameters.AddWithValue("cod_ciclo", cmbciclos.SelectedValue.ToString()); comando.Parameters.AddWithValue("nombre", TXTNOMBRES.Text); comando.Parameters.AddWithValue("apellido", TXTAPELLIDOS.Text); comando.Parameters.AddWithValue("provincia", cmbprovincias.Text); comando.Parameters.AddWithValue("ciudad", TXTCIUDAD.Text); comando.Parameters.AddWithValue("direccion", TXTDIRECCION.Text); comando.Parameters.AddWithValue("telefono", TXTTELEFONO.Text); comando.Parameters.AddWithValue("foto", (object)imagen); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBORRAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("delete estudiantes where codigo=@codigo", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODIGO.Text); comando.ExecuteNonQuery(); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex);

} } private void TXTCODIGO_keypress(object sender, KeyPressEventArgs e) { if (e.KeyChar==13) { BTNBUSCAR_Click(sender, e); } } private void BTNTERMINAR_Click(object sender, EventArgs e) { ind_cerrar = 1; this.Close(); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } }// }

CÓDIGO DE VENTANA MATERIAS using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using CONTROL_DE_ASISTENCIA; using System.IO; namespace CONTROL_DE_ASISTENCIA { public partial class materias : Form { clsvariables uso_variables = new clsvariables(); int ind_cerrar; public materias() { InitializeComponent(); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void BTNGUARDAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("update materia set, nombre=@nombre,duracion=@duracion,descripcion=@descripcion,hora_inicial=@hora_inicial,hora_final=@hora_final, where codigo=@codigo", uso_variables.conexion); comando.Parameters.AddWithValue("codigo", TXTCODMAT.Text); comando.Parameters.AddWithValue("nombre", TXTNOMAT.Text); comando.Parameters.AddWithValue("duracion", TXTDURAC.Text); comando.Parameters.AddWithValue("descripcion", TXTDESMAT.Text); comando.Parameters.AddWithValue("hora_inicio", TXTHORINI.Text); comando.Parameters.AddWithValue("hora_salida", TXTHORFIN.Text); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNNUEVO_Click(object sender, EventArgs e)

{ throw new NotImplementedException(); } private void materias_Load(object sender, EventArgs e) { } } } private void materias_Load(object sender, EventArgs e) { BTNNUEVO_Click(sender, e); // TODO: esta línea de código carga datos en la tabla 'control_de_asistenciaDataSet5.materia' Puede moverla o quitarla según sea necesario. //this.materiaTableAdapter.Fill(this.control_de_asistenciaDataSet5.materia); } private void BTNBORRAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("delete materias where codigo=@codigo", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codigo", TXTCODMAT.Text ); comando.ExecuteNonQuery(); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void TXTCODIGO_keypress(object sender, KeyPressEventArgs e) { if (e.KeyChar==13) { BTNBUSCAR_Click(sender, e); } } private void BTNNUEVO_Click(object sender, EventArgs e) { try { TXTCODMAT.Clear(); TXTDESMAT.Clear(); TXTDURAC.Clear(); TXTHORFIN.Clear(); TXTHORINI.Clear(); TXTNOMAT.Clear(); BTNGUARDAR.Enabled = true;

BTNEDITAR.Enabled = false; BTNBORRAR.Enabled = false; if (uso_variables.conexion.State==0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from estudiantes"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql,uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count==0) { dataGridView1.DataSource=null ; } else { dataGridView1.Columns.Clear(); dataGridView1.DataSource = uso_variables.tabla; } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNEDITAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("update materias set codigo=@codigo,nombre=@nombre,duracion=@duracion,descripcion=@descripcion,hora_inicial=@hora_inicial,hora_salida=@hora_salida", uso_variables.conexion); comando.Parameters.AddWithValue("codigo", TXTCODMAT.Text); comando.Parameters.AddWithValue("nombre", TXTNOMAT.Text); comando.Parameters.AddWithValue("duracion",TXTDURAC.Text); comando.Parameters.AddWithValue("descripcion",TXTDESMAT.Text); comando.Parameters.AddWithValue("hora_ingresa",TXTHORINI.Text); comando.Parameters.AddWithValue("hora_salida",TXTHORFIN.Text ); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex);

} } private void BTNBUSCAR_Click_1(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from materia where codigo='" + TXTCODMAT.Text + "'"; SqlCommand comando = new SqlCommand(uso_variables.sql, uso_variables.conexion); SqlDataReader leer = comando.ExecuteReader(); int renglon = 0; if (leer.Read()) { TXTCODMAT.Enabled = false; TXTNOMAT.Text = leer.GetString(1); TXTDESMAT.Text = leer.GetString(2); TXTDURAC.Enabled = true; TXTHORFIN.Text = leer.GetString(3); TXTHORINI.Text = leer.GetString(4); BTNGUARDAR.Enabled = false; BTNEDITAR.Enabled = true; BTNBORRAR.Enabled = true; } uso_variables.conexion.Close(); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNSALIR_Click(object sender, EventArgs e) { ind_cerrar = 1; this.Close(); } } } }

CÓDIGO DE LA VENTANA HORARIOS using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using CONTROL_DE_ASISTENCIA; using System.IO; namespace CONTROL_DE_ASISTENCIA { public partial class horarios : Form { clsvariables uso_variables=new clsvariables(); int ind_cerrar; public horarios() { InitializeComponent(); } private void horarios_Load(object sender, EventArgs e) { BTNNUEVO_Click(sender, e); // TODO: esta línea de código carga datos en la tabla 'control_de_asistenciaDataSet4.horarios' Puede moverla o quitarla según sea necesario. //this.horariosTableAdapter.Fill(this.control_de_asistenciaDataSet4.horarios); } private void horarios_FormClosing(object sender, FormClosingEventArgs e) { if (ind_cerrar == 0) this.Close(); } private void TXTCOD_MATERIA_keypress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { BTNBUSCAR_Click(sender, e); } } private void BTNGUARDAR_Click(object sender, EventArgs e) { /* TXTCODCICLO.Clear(); TXTCODMAT.Clear(); TXTDIA.Clear(); TXTHORSALIHORA.Clear(); TXTJORNADA.Clear(); TXTTOTAL.Clear(); */ try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada

SqlCommand comando = new SqlCommand("update horarios set, jornada=@jornada,hora_salida=@hora_salida,total=@total, dia=@dia, where cod_ciclo=@cod_ciclo, cod_materia=@cod_materia", uso_variables.conexion); comando.Parameters.AddWithValue("jornada", TXTJORNADA.Text); comando.Parameters.AddWithValue("cod_materia", TXTCODMAT.Text); comando.Parameters.AddWithValue("cod_ciclo", TXTCODCICLO.Text); comando.Parameters.AddWithValue("total",TXTTOTAL.Text); comando.Parameters.AddWithValue("dia", TXTDIA.Text); comando.Parameters.AddWithValue("hora_salida", TXTHORSALIHORA.Text); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNNUEVO_Click(object sender, EventArgs e) { try { TXTCODMAT.Clear(); TXTCODCICLO.Clear(); TXTDIA.Clear(); TXTHORSALIHORA.Clear(); TXTJORNADA.Clear(); TXTTOTAL.Clear(); BTNGUARDAR.Enabled = true; BTNEDITAR.Enabled = false; BTNBORRAR.Enabled = false; if (uso_variables.conexion.State==0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from ciclo"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); //carga los datos en el combo e inicializa sin seleccionar a ninguno //poniendo en index en -1 if (uso_variables.tabla.Rows.Count>0) { cmbciclos.DataSource = uso_variables.tabla; cmbciclos.DisplayMember = "nivel"; cmbciclos.ValueMember = "codigo"; cmbciclos.SelectedIndex = -1; } uso_variables.sql = "select * from materia order by codigo";

uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count > 0) { cmbmaterias.DataSource = uso_variables.tabla; cmbmaterias.DisplayMember = "nombre"; cmbmaterias.ValueMember = "codigo"; cmbmaterias.SelectedIndex = -1; } uso_variables.sql = "select * from horarios"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql,uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla=new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count==0) { dataGridView1.DataSource=null ; } else { dataGridView1.Columns.Clear(); dataGridView1.DataSource = uso_variables.tabla; } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNEDITAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); //abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("update horarios set jornada=@jornada,hora_salida=@hora_salida,total=@total,dia=@dia,where cod_materia=@cod_materia,cod_ciclo=@cod_ciclo", uso_variables.conexion); comando.Parameters.AddWithValue("cod_materia", TXTCODMAT.Text); comando.Parameters.AddWithValue("cod_ciclo",TXTCODCICLO.Text.); comando.Parameters.AddWithValue("jornada", TXTJORNADA.Text); comando.Parameters.AddWithValue("dia", TXTDIA.Text); comando.Parameters.AddWithValue("hora_salida", TXTHORSALIHORA.Text); comando.Parameters.AddWithValue("total", TXTTOTAL.Text); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close();

BTNNUEVO_Click(sender, e); } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBORRAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("delete horarios where cod_ciclo=@cod_ciclo,cod_marteria=@cod_materia", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("cod_ciclo", TXTCODCICLO ); comando.Parameters.AddWithValue("cod_materia", TXTCODMAT); comando.ExecuteNonQuery(); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBUSCAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from horarios where cod_ciclo='" + TXTCODCICLO.Text + "'"; uso_variables.sql="select*from horarios where cod_materia='"+ TXTCODMAT.Text+"'"; SqlCommand comando = new SqlCommand(uso_variables.sql, uso_variables.conexion); SqlDataReader leer = comando.ExecuteReader(); int renglon = 0; if (leer.Read()) { TXTCODCICLO.Enabled=false; TXTCODMAT.Enabled=false; TXTJORNADA.Text= leer.GetString(1); TXTDIA.Text= leer.GetString(2); TXTHORSALIHORA.Text=leer.GetString(3); TXTTOTAL.Enabled= true; BTNGUARDAR.Enabled = false;

BTNEDITAR.Enabled = true; BTNBORRAR.Enabled = true; } uso_variables.conexion.Close(); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNSALIR_Click(object sender, EventArgs e) { ind_cerrar = 1; this.Close(); } } }

CÓDIGO DE VENTANA CICLO using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using CONTROL_DE_ASISTENCIA; using System.IO; namespace CONTROL_DE_ASISTENCIA { public partial class _6ciclo : Form { clsvariables uso_variables = new clsvariables(); int ind_cerrar; public _6ciclo() { InitializeComponent(); } private void _6ciclo_Load(object sender, EventArgs e) { BTNNUEVO(sender, e); // TODO: esta línea de código carga datos en la tabla 'control_de_asistenciaDataSet3.ciclo' Puede moverla o quitarla según sea necesario. //this.cicloTableAdapter.Fill(this.control_de_asistenciaDataSet3.ciclo); } private void BTNNUEVO(object sender, EventArgs e) { throw new NotImplementedException(); } private void ciclo_FormClosing(object sender, FormClosingEventArgs e) { if (ind_cerrar == 0) this.Close(); } private void TXTCODCICLO_keypress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { BTNBUSCAR_Click(sender, e); } } private void BTNNUEVO_Click(object sender, EventArgs e) { try { TXTCODCICLO.Clear(); TXTNIVEL.Clear(); BTNGUARDAR.Enabled = true; BTNEDITAR.Enabled = false; BTNBORRAR.Enabled = false;

if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); uso_variables.sql = "select * from ciclo"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla = new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count == 0) { dataGridView1.DataSource = null; } else { dataGridView1.Columns.Clear(); dataGridView1.DataSource = uso_variables.tabla; } } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNGUARDAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("update ciclo set, nivel=@nivel, where codciclo=@codciclo", uso_variables.conexion); comando.Parameters.AddWithValue("nivel", TXTNIVEL.Text); comando.Parameters.AddWithValue("cod_ciclo", TXTCODCICLO.Text); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNEDITAR_Click(object sender, EventArgs e) {

try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); //abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("update ciclo set nivel=@nivel,where codciclo=@codciclo", uso_variables.conexion); comando.Parameters.AddWithValue("codciclo", TXTCODCICLO.Text); comando.Parameters.AddWithValue("nivel", TXTNIVEL.Text); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBORRAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("delete ciclo where codciclo=@codciclo,nivel=@nivel", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("codciclo", TXTCODCICLO); comando.ExecuteNonQuery(); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBUSCAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection();

uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from ciclo where codciclo='" + TXTCODCICLO.Text + "'"; SqlCommand comando = new SqlCommand(uso_variables.sql, uso_variables.conexion); SqlDataReader leer = comando.ExecuteReader(); int renglon = 0; if (leer.Read()) { TXTCODCICLO.Enabled = false; TXTNIVEL.Text = leer.GetString(1); BTNGUARDAR.Enabled = false; BTNEDITAR.Enabled = true; BTNBORRAR.Enabled = true; } uso_variables.conexion.Close(); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNSALIR_Click(object sender, EventArgs e) { ind_cerrar = 1; this.Close(); } } }

CÓDIGO DE VENTANA CARRERA using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using CONTROL_DE_ASISTENCIA; using System.IO; namespace CONTROL_DE_ASISTENCIA { public partial class _7carrera : Form { public object TXTCODMAT { get; set; }clsvariables uso_variables = new clsvariables(); int ind_cerrar; private object TXTCODCICLO; public _7carrera() { InitializeComponent(); } private void _7carrera_Load(object sender, EventArgs e) { BTNNUEVO_Click(sender, e); // TODO: esta línea de código carga datos en la tabla 'control_de_asistenciaDataSet4.horarios' Puede moverla o quitarla según sea necesario. //this.horariosTableAdapter.Fill(this.control_de_asistenciaDataSet4.horarios); } private void _7carrera_FormClosing(object sender, FormClosingEventArgs e) { if (ind_cerrar == 0) this.Close(); } private void TXTCODCILO_keypress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { BTNBUSCAR_Click(sender, e); } } private void BTNGUARDAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada

SqlCommand comando = new SqlCommand("update horarios set, jornada=@jornada,hora_salida=@hora_salida,total=@total, dia=@dia, where cod_ciclo=@cod_ciclo, cod_materia=@cod_materia", uso_variables.conexion); // comando.Parameters.AddWithValue("jornada", TXTJORNADA.Text); //comando.Parameters.AddWithValue("cod_materia", TXTCODMAT.Text); //comando.Parameters.AddWithValue("cod_ciclo", TXTCODCICLO.Text); // comando.Parameters.AddWithValue("total",TXTTOTAL.Text); // comando.Parameters.AddWithValue("dia", TXTDIA.Text); // comando.Parameters.AddWithValue("hora_salida", TXTHORSALIHORA.Text); comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNNUEVO_Click(object sender, EventArgs e) { try { TXTCODIGO.Clear(); TXTDESCRIP.Clear(); BTNGUARDAR.Enabled = true; BTNEDITAR.Enabled = false; BTNBORRAR.Enabled = false; if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from carrera"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla = new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); //carga los datos en el combo e inicializa sin seleccionar a ninguno //poniendo en index en -1 /*if (uso_variables.tabla.Rows.Count>0) { cmbciclos.DataSource = uso_variables.tabla; cmbciclos.DisplayMember = "nivel"; cmbciclos.ValueMember = "codigo"; cmbciclos.SelectedIndex = -1; }*/ uso_variables.sql = "select * from materia order by codigo"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla = new DataTable();

uso_variables.dataAdaptaer.Fill(uso_variables.tabla); /*if (uso_variables.tabla.Rows.Count > 0) { cmbmaterias.DataSource = uso_variables.tabla; cmbmaterias.DisplayMember = "nombre"; cmbmaterias.ValueMember = "codigo"; cmbmaterias.SelectedIndex = -1; }*/ uso_variables.sql = "select * from horarios"; uso_variables.dataAdaptaer = new SqlDataAdapter(uso_variables.sql, uso_variables.conexion);//enlazamos la consulta con la base de datos //generamos un comando para asociarlo con el data adpter //creamos el objeto data table uso_variables.tabla = new DataTable(); uso_variables.dataAdaptaer.Fill(uso_variables.tabla); if (uso_variables.tabla.Rows.Count == 0) { dataGridView1.DataSource = null; } else { dataGridView1.Columns.Clear(); dataGridView1.DataSource = uso_variables.tabla; } } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNEDITAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); //abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("update horarios set jornada=@jornada,hora_salida=@hora_salida,total=@total,dia=@dia,where cod_materia=@cod_materia,cod_ciclo=@cod_ciclo", uso_variables.conexion); /* comando.Parameters.AddWithValue("cod_materia", TXTCODMAT.Text); comando.Parameters.AddWithValue("cod_ciclo",TXTCODCICLO.Text.); comando.Parameters.AddWithValue("jornada", TXTJORNADA.Text); comando.Parameters.AddWithValue("dia", TXTDIA.Text); comando.Parameters.AddWithValue("hora_salida", TXTHORSALIHORA.Text); comando.Parameters.AddWithValue("total", TXTTOTAL.Text); */ comando.ExecuteNonQuery(); MessageBox.Show("Registro Modificado Satisfactoriamente", "Sistema"); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } }

catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBORRAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada SqlCommand comando = new SqlCommand("delete horarios where cod_ciclo=@cod_ciclo,cod_marteria=@cod_materia", uso_variables.conexion); //comando.Parameters.Add("@imagen", System.Data.SqlDbType.Image); comando.Parameters.AddWithValue("cod_ciclo", TXTCODCICLO); comando.Parameters.AddWithValue("cod_materia", TXTCODMAT); comando.ExecuteNonQuery(); uso_variables.conexion.Close(); BTNNUEVO_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNBUSCAR_Click(object sender, EventArgs e) { try { if (uso_variables.conexion.State == 0) { uso_variables.conexion = new SqlConnection(); uso_variables.conexion.ConnectionString = uso_variables.dataSource; uso_variables.conexion.Open(); }//abre la conexion si esta cerrada uso_variables.sql = "select * from carreras where codigo='" + TXTCODCICLO + "'"; SqlCommand comando = new SqlCommand(uso_variables.sql, uso_variables.conexion); SqlDataReader leer = comando.ExecuteReader(); int renglon = 0; if (leer.Read()) { TXTCODCICLO.ToString = true; BTNGUARDAR.Enabled = false; BTNEDITAR.Enabled = true; BTNBORRAR.Enabled = true; } uso_variables.conexion.Close(); } catch (Exception ex) { MessageBox.Show("Error, " + ex); } } private void BTNSALIR_Click(object sender, EventArgs e) { ind_cerrar = 1; this.Close(); } } }

CÓDIGO DE VENTANA REGISTRO using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CONTROL_DE_ASISTENCIA { public partial class _8registro : Form { public _8registro() { InitializeComponent(); } private void _8registro_Load(object sender, EventArgs e) { // TODO: esta línea de código carga datos en la tabla 'control_de_asistenciaDataSet6.registro' Puede moverla o quitarla según sea necesario. //this.registroTableAdapter.Fill(this.control_de_asistenciaDataSet6.registro); } private void BTNNUEVO_Click(object sender, EventArgs e) { TXTCODESTU.Clear(); TXTHORINGRE.Clear(); TXTHORSAL.Clear(); TXTRETRASO.Clear(); } } }

Programación de la pantalla inicial del sistema. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using CONTROL_DE_ASISTENCIA; namespace CONTROL_DE_ASISTENCIA { public partial class mdicontrol_asistencia : Form { public mdicontrol_asistencia() { InitializeComponent(); } private void estudiantesToolStripMenuItem_Click(object sender, EventArgs e) { estudiantes uso_estudiante = new estudiantes(); uso_estudiante.MdiParent = this; uso_estudiante.Show(); } private void terminarToolStripMenuItem_Click(object sender, System.EventArgs e) { Application.Exit(); } private void profesoresToolStripMenuItem_Click(object sender, System.EventArgs e) { profesores uso_profesores = new profesores(); uso_profesores.MdiParent = this; uso_profesores.Show(); } private void materiasToolStripMenuItem_Click(object sender, System.EventArgs e) { materias uso_materias = new materias(); uso_materias.MdiParent = this; uso_materias.Show(); } private void horariosToolStripMenuItem_Click(object sender, System.EventArgs e) { horarios uso_horarios = new horarios(); uso_horarios.MdiParent = this;

uso_horarios.Show(); } private void registrosToolStripMenuItem_Click(object sender, System.EventArgs e) { } }//fin class secundaria }//fin clase principal

Pantalla de profesores

Enla pantalla prfesores se encuentra la información básica del mismo ,

Pantalla de estudiantes

Pantalla de materias

Pantalla de horarios

Pantallas de ciclo

Pantalla de carreras

Pantalla de registros