コード例 #1
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (this.txtCedula.Text.Length == 0)//si la cedula esta vacia
            {
                MessageBox.Show("No hay cedula seleccionada");
                return; //abandonar
            }
            CapaDatos.Persona persona = new CapaDatos.Persona();
            persona.Cedula          = this.txtCedula.Text;
            persona.Apellidos       = this.txtApellidos.Text;
            persona.Nombres         = this.txtNombres.Text;
            persona.Sexo            = this.cmbSexo.Text;
            persona.Correo          = this.txtCorreo.Text;
            persona.estatura        = int.Parse(this.txtEstatura.Text);
            persona.Peso            = Decimal.Parse(this.txtPeso.Text);
            persona.fechaNacimiento = dtFechaNacimiento.Value;

            int x = CapaDatos.PersonaDAO.actualizar(persona);

            if (x > 0)
            {
                this.cargarComboEstudiante(); //refresque el cuadro combinado de estudiantes
                MessageBox.Show("Registro actualizado con exito");
            }
            else
            {
                MessageBox.Show("No se pudo actualizar el registro");
            }
        }
コード例 #2
0
        public void toolStripButtonGuardar_Click(object sender, EventArgs e)
        {
            if (this.mCedula.Length > 0)
            {
                CapaDatos.Persona persona = new CapaDatos.Persona();

                persona.Cedula          = mCedula;
                persona.Apellidos       = this.txtApellidos.Text;
                persona.Nombres         = this.txtNombres.Text;
                persona.Correo          = this.txtCorreo.Text;
                persona.Sexo            = this.cmbSexo.Text;
                persona.Estatura        = int.Parse(this.txtEstatura.Text);
                persona.Peso            = Decimal.Parse(this.txtPeso.Text);
                persona.FEchaNacimiento = dtFechaNacimiento.Value;

                int x = CapaDatos.PersonaDAO.actualizar(persona);

                if (x > 0)
                {
                    MessageBox.Show("Registro actualizado..");
                }

                else
                {
                    MessageBox.Show("No se pudo actualizar el registro");
                }
            }
        }
コード例 #3
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (this.txtCedula.Text.Length == 0)
            {
                MessageBox.Show("No hay cedula seleccionada");
                return;
            }
            CapaDatos.Persona persona = new CapaDatos.Persona();
            persona.Cedula          = this.txtCedula.Text;
            persona.Apellidos       = this.txtApellidos.Text;
            persona.Nombres         = this.txtNombres.Text;
            persona.Sexo            = this.cmbSexo.Text;
            persona.Correo          = this.txtCorreo.Text;
            persona.Estatura        = int.Parse(this.txtEstatura.Text);
            persona.Peso            = decimal.Parse(this.txtPeso.Text);
            persona.FechaNacimiento = dtFechaNacimiento.Value;


            int x = CapaDatos.PersonaDAO.actualizar(persona);

            if (x > 0)
            {
                this.cargarComboEstudiantes();
                MessageBox.Show("Registro Aactualizar con exito!");
            }

            else
            {
                MessageBox.Show("No se pudo actualizar el registro!");
            }
        }
コード例 #4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            // Faltaría agregar validaciones
            try
            {
                CapaDatos.Persona persona = new CapaDatos.Persona();
                persona.Cedula          = this.txtCedula.Text;
                persona.Apellidos       = this.txtApellidos.Text;
                persona.Nombres         = this.txtNombres.Text;
                persona.Sexo            = this.cmbSexo.Text;
                persona.FechaNacimiento = dtFechaNacimiento.Value;
                persona.Correo          = this.txtCorreo.Text;
                persona.Estatura        = int.Parse(this.txtEstatura.Text);
                persona.Peso            = Decimal.Parse(this.txtPeso.Text);

                int x = CapaDatos.PersonaDAO.crear(persona);
                if (x > 0)
                {
                    MessageBox.Show("Registro agregado con éxito...");
                }
                else
                {
                    MessageBox.Show("No se pudo agregar el registro...");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
コード例 #5
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            string cedula = this.cmbCedula.SelectedValue.ToString();

            CapaDatos.Persona p = new CapaDatos.Persona();
            p = CapaDatos.PersonaDAO.GetPersona(cedula);

            //cargar datos en los cuadros de texto
            this.txtCedula.Text    = p.Cedula;
            this.txtApellidos.Text = p.Apellidos;
            this.txtNombres.Text   = p.Nombres;
        }
コード例 #6
0
        private void FrmActualizar_Load(object sender, EventArgs e)
        {
            //MessageBox.Show("La cedula es: " + this.mCedula);
            this.txtCedula.Text = mCedula;
            CapaDatos.Persona persona = new CapaDatos.Persona();

            persona = CapaDatos.PersonaDAO.GetPersona(mCedula);
            this.txtApellidos.Text       = persona.Apellidos;
            this.txtNombres.Text         = persona.Nombres;
            this.cmbSexo.Text            = persona.Sexo;
            this.dtFechaNacimiento.Value = persona.FEchaNacimiento;
            this.txtCorreo.Text          = persona.Correo;
            this.txtEstatura.Text        = persona.Estatura.ToString();
            this.txtPeso.Text            = persona.Peso.ToString();
        }
コード例 #7
0
        private void frmActualizar_Load(object sender, EventArgs e)
        {
            this.txtCedula.Text = mCedula;
            CapaDatos.Persona p = new CapaDatos.Persona();
            p = CapaDatos.PersonaDAO.GetPersona(mCedula);

            //cargar datos en los cuadros de texto
            this.txtCedula.Text          = p.Cedula;
            this.txtApellidos.Text       = p.Apellidos;
            this.txtNombres.Text         = p.Nombres;
            this.cmbSexo.Text            = p.Sexo;
            this.dtFechaNacimiento.Value = Convert.ToDateTime(p.FechaNacimiento);
            this.txtEstatura.Text        = p.Estatura.ToString();
            this.txtPeso.Text            = p.Peso.ToString();
            this.txtCorreo.Text          = p.Correo;
        }
コード例 #8
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            string cedula = this.cmbCedula.SelectedValue.ToString();

            CapaDatos.Persona p = new CapaDatos.Persona();
            p = CapaDatos.PersonaDAO.GetPersona(cedula);

            //cargar datos en los cuadros de texto
            this.txtCedula.Text          = p.Cedula;
            this.txtApellidos.Text       = p.Apellidos;
            this.txtNombres.Text         = p.Nombres;
            this.cmbSexo.Text            = p.Sexo;
            this.dtFechaNacimiento.Value = Convert.ToDateTime(p.FechaNacimiento);
            this.txtEstatura.Text        = p.Estatura.ToString();
            this.txtPeso.Text            = p.Peso.ToString();
            this.txtCorreo.Text          = p.Correo;
        }
コード例 #9
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (this.txtCedula.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debes ingresar la cedula");
                this.txtCedula.Focus();
                return;
            }
            if (this.txtApellidos.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debes ingresar los apellidos");
                this.txtApellidos.Focus();
                return;
            }
            if (this.txtNombres.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debes ingresar sus nombres");
                this.txtNombres.Focus();
                return;
            }
            if (this.cmbSexo.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debe seleccionar su sexo");
                this.cmbSexo.Focus();
                return;
            }

            if (this.txtCorreos.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debe ingresar el correo");
                this.txtCorreos.Focus();
                return;
            }
            if (this.txtEstaturas.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debe su estatura");
                this.txtEstaturas.Focus();
                return;
            }
            if (this.txtPeso.Text.Length == 0)
            {
                MessageBox.Show("Por Favor debe ingresar su peso");
                this.txtPeso.Focus();
                return;
            }

            try
            {
                CapaDatos.Persona persona = new CapaDatos.Persona();
                persona.Cedula          = this.txtCedula.Text;
                persona.Apellidos       = this.txtApellidos.Text;
                persona.Nombres         = this.txtNombres.Text;
                persona.Sexo            = this.cmbSexo.Text;
                persona.FechaNacimiento = dtFechaNacimiento.Value;
                persona.Correo          = this.txtCorreos.Text;
                persona.Estatura        = int.Parse(this.txtEstaturas.Text);
                persona.Peso            = Decimal.Parse(this.txtPeso.Text);


                int x = CapaDatos.PersonaDAO.crear(persona);

                if (x > 0)
                {
                    MessageBox.Show("Se agrego correctamente...");
                }
                else
                {
                    MessageBox.Show("No se pudo agregar el registro...");
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
コード例 #10
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                CapaDatos.Persona persona = new CapaDatos.Persona();
                persona.Cedula          = this.txtCedula.Text;
                persona.Apellidos       = this.txtApellido.Text;
                persona.Nombres         = this.txtNombre.Text;
                persona.Sexo            = this.cmbSexo.Text;
                persona.fechaNacimiento = tdFechaNacimiento.Value;
                persona.Correo          = this.txtCorreo.Text;
                persona.estatura        = int.Parse(this.txtEstatura.Text);
                persona.Peso            = Decimal.Parse(this.txtPeso.Text);

                int x = CapaDatos.PersonaDAO.crear(persona);
                if (x > 0)
                {
                    MessageBox.Show("Persona agregado con exito");
                }
                else
                {
                    MessageBox.Show("No se pudo agregar el registro....");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            if (this.txtCedula.Text.Length == 0)
            {
                MessageBox.Show("Ingresa la cedula");
                this.txtCedula.Focus();
                return;
            }
            if (this.txtApellido.Text.Length == 0)
            {
                MessageBox.Show("Ingresa el apellido");
                this.txtApellido.Focus();
                return;
            }
            if (this.txtNombre.Text.Length == 0)
            {
                MessageBox.Show("Ingresa el nombre");
                this.txtNombre.Focus();
                return;
            }
            if (this.cmbSexo.Text.Length == 0)
            {
                MessageBox.Show("Ingresa el sexo");
                this.cmbSexo.Focus();
                return;
            }
            if (this.txtCorreo.Text.Length == 0)
            {
                MessageBox.Show("Ingresa el correo");
                this.txtCorreo.Focus();
                return;
            }
            if (this.txtEstatura.Text.Length == 0)
            {
                MessageBox.Show("Ingresa la estatura");
                this.txtEstatura.Focus();
                return;
            }
            if (this.txtPeso.Text.Length == 0)
            {
                MessageBox.Show("Ingresa el peso");
                this.txtPeso.Focus();
                return;
            }

            /*//faltar validaciones
             * CapaDatos.Persona persona = new CapaDatos.Persona();
             * persona.Cedula = this.txtCedula.Text;
             * persona.Apellidos = this.txtApellido.Text;
             * persona.Nombres = this.txtNombre.Text;
             * persona.Sexo = this.cmbSexo.Text;
             * persona.fechaNacimiento = tdFechaNacimiento.Value;
             * persona.Correo = this.txtCorreo.Text;
             * persona.estatura = int.Parse(this.txtEstatura.Text);
             * persona.Peso = Decimal.Parse(this.txtPeso.Text);
             *
             * int x = CapaDatos.PersonaDAO.crear(persona);
             * if (x > 0)
             *  MessageBox.Show("Persona agregado con exito");
             * else
             *  MessageBox.Show("No se pudo agregar el registro....");*/
        }
コード例 #11
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                CapaDatos.Persona persona = new CapaDatos.Persona();
                persona.Cedula          = this.txtCedula.Text;
                persona.Apellidos       = this.txtApellidos.Text;
                persona.Nombres         = this.txtNombres.Text;
                persona.Sexo            = this.cmbSexo.Text;
                persona.FEchaNacimiento = this.dtFechaNacimiento.Value;
                persona.Correo          = this.txtCorreo.Text;
                persona.Estatura        = int.Parse(this.txtEstatura.Text);
                persona.Peso            = Decimal.Parse(this.txtPeso.Text);

                int x = CapaDatos.PersonaDAO.crear(persona);
                if (x > 0)
                {
                    MessageBox.Show("Registro agregado con exito...");
                }
                else
                {
                    MessageBox.Show("No se peude agregar al registro...");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }


            //Validaciones
            if (this.txtCedula.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese su cedula");
                this.txtCedula.Focus();
                return;
            }
            if (this.txtApellidos.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese sus apellidos");
                this.txtApellidos.Focus();
                return;
            }
            if (this.txtNombres.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese sus nombres");
                this.txtNombres.Focus();
                return;
            }
            if (this.cmbSexo.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese su sexo");
                this.cmbSexo.Focus();
                return;
            }

            if (this.txtCorreo.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese su correo");
                this.txtCorreo.Focus();
                return;
            }
            if (this.txtEstatura.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese su estatura");
                this.txtEstatura.Focus();
                return;
            }
            if (this.txtPeso.Text.Length == 0)
            {
                MessageBox.Show("Please ingrese su peso");
                this.txtPeso.Focus();
                return;
            }
        }