예제 #1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            ConsultaBD consultaralumnos = new ConsultaBD();

              DataTable DT = consultaralumnos.listarAlumnos(txtBuscar.Text);

              if (DT.Rows.Count > 0)
              {

                  limpiartextbox();
                  dgwBuscarAlumnos.DataSource = DT;

                  txtCodigo.Text = DT.Rows[0]["Codigo"].ToString();
                  txtNombres.Text = DT.Rows[0]["Nombre"].ToString();
                  txtApellidos.Text = DT.Rows[0]["Apellido"].ToString();
                  txtDNI.Text = DT.Rows[0]["DNI"].ToString();
                  txtFechaDeNacimiento.Text = DT.Rows[0]["Fec_Nac"].ToString();
                  txtSexo.Text = DT.Rows[0]["Sexo"].ToString();
                  txtCarrera.Text = DT.Rows[0]["Carrera"].ToString();
                  txtFechaDeIngreso.Text = DT.Rows[0]["Fec_Ingreso"].ToString();

                  btnInsertar.Enabled = false;
                  btnActualizar.Enabled = true;
                  btnEliminar.Enabled = true;

              }
              else
              {

                  MessageBox.Show ("No se encontraron resultados para su busqueda");

              }
        }
예제 #2
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            ConsultaBD ActualizarAlumno = new ConsultaBD();

            MemoryStream streamactualizar = new MemoryStream();

            //Grabamos la imagen el objeto stream
            picFoto.Image.Save(streamactualizar, System.Drawing.Imaging.ImageFormat.Jpeg);

            //Esta parte es importante ya que convertimos la imagen a bytes
            byte[] picactualizar = streamactualizar.ToArray();

            if (ActualizarAlumno.ActualizarAlumno(txtCodigo.Text, txtNombres.Text, txtApellidos.Text, txtDNI.Text, txtFechaDeNacimiento.Text, txtSexo.Text, txtCarrera.Text, txtFechaDeIngreso.Text, picactualizar) == true)
            {

                limpiargridview();
                limpiartextbox();

                  ConsultaBD consultaralumnosaaaa = new ConsultaBD();

                  DataTable DTr = consultaralumnosaaaa.listarAlumnos(txtBuscar.Text);

                  dgwBuscarAlumnos.DataSource = DTr;

                  txtCodigo.Text = DTr.Rows[0]["Codigo"].ToString();
                  txtNombres.Text = DTr.Rows[0]["Nombre"].ToString();
                  txtApellidos.Text = DTr.Rows[0]["Apellido"].ToString();
                  txtDNI.Text = DTr.Rows[0]["DNI"].ToString();
                  txtFechaDeNacimiento.Text = DTr.Rows[0]["Fec_Nac"].ToString();
                  txtSexo.Text = DTr.Rows[0]["Sexo"].ToString();
                  txtCarrera.Text = DTr.Rows[0]["Carrera"].ToString();
                  txtFechaDeIngreso.Text = DTr.Rows[0]["Fec_Ingreso"].ToString();

                MessageBox.Show("El actualizacion del nuevo alumno se realizo corectamente");
            }
            else
            {
                MessageBox.Show("Existe un error en la actualizacion");
            }
        }
예제 #3
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            ConsultaBD InsertarNuevoAlumno = new ConsultaBD();

            MemoryStream stream = new MemoryStream();

            //Grabamos la imagen el objeto stream
            picFoto.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);

            //Esta parte es importante ya que convertimos la imagen a bytes
            byte[] pic = stream.ToArray();

            if (InsertarNuevoAlumno.InsertarAlumno( txtCodigo.Text, txtNombres.Text, txtApellidos.Text, txtDNI.Text, txtFechaDeNacimiento.Text, txtSexo.Text, txtCarrera.Text, txtFechaDeIngreso.Text,pic) == true)
            {

                MessageBox.Show("El insercion del nuevo alumno se realizo corectamente");
            }
            else
            {
                MessageBox.Show("Existe un error en la insercion");
            }
        }
예제 #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            ConsultaBD EliminarAlumno = new ConsultaBD();
            if (EliminarAlumno.EliminarAlumno ( txtCodigo.Text) == true)
            {

                limpiargridview();

                limpiartextbox();
                DeshabilitarTextbox();
                MessageBox.Show("La eliminacion de datos se realizo corectamente");

            }
            else
            {
                MessageBox.Show("Existe un error en la eliminacion de datos");
            }
        }