コード例 #1
0
        /*********************************/
        /*********GUARDAR EDITAR**********/
        /*********************************/

        private void btnguardar_Click(object sender, EventArgs e)
        {
            frmDocentes Docentes = Owner as frmDocentes;

            objlogPersonas.EdadDocente(dtNacimiento.Value);

            string validacionE = validaCampos();

            if (validacionE == "OK")

            {
                idPersonaBuscar = Convert.ToInt32(txt_id_Docente.Text);

                string   nombreE     = txtNombre.Text.Trim();
                string   apellidosE  = txtApellidos.Text.Trim();
                string   documentoE  = txtDocumento.Text.Trim();
                DateTime nacimientoE = dtNacimiento.Value.Date;

                string calleE    = txtCalle.Text.Trim();
                string numeroE   = txtNumero.Text.Trim();
                string cpostalE  = txtCPostal.Text.Trim();
                string pisoE     = txtPiso.Text.Trim();
                string dptoE     = txtDepto.Text.Trim();
                string barrioE   = txtBarrio.Text.Trim();
                string telefonoE = txtTelefono.Text.Trim();
                string celularE  = txtCelular.Text.Trim();
                string emailE    = txtEmail.Text.Trim();

                entPersona personaEditar = new entPersona();

                string genero;
                if (cbGenero.SelectedItem == null)
                {
                    genero = "";
                }
                else
                {
                    genero = cbGenero.SelectedItem.ToString();
                }

                personaEditar.PER_ID         = Convert.ToInt32(idPersonaBuscar);
                personaEditar.PER_NOMBRE     = nombreE;
                personaEditar.PER_APELLIDO   = apellidosE;
                personaEditar.PER_DOCUMENTO  = Convert.ToInt32(documentoE);
                personaEditar.PER_GENERO     = genero;
                personaEditar.PER_FECHA_NAC  = nacimientoE;
                personaEditar.PER_TELEFONO   = telefonoE;
                personaEditar.PER_TELEFONO_2 = celularE;
                personaEditar.PER_EMAIL      = emailE;

                string resultadoE = objlogPersonas.editarPersona(personaEditar);

                entDomicilio domicilioEditar = new entDomicilio();

                domicilioEditar.DOM_PER_ID = idPersonaBuscar;
                domicilioEditar.DOM_CALLE  = calleE;
                domicilioEditar.DOM_NUMERO = Convert.ToInt32(numeroE);
                if (string.IsNullOrWhiteSpace(pisoE.Trim()) == true)
                {
                }
                else
                {
                    domicilioEditar.DOM_PISO = Convert.ToInt32(pisoE);
                }

                domicilioEditar.DOM_DPTO   = dptoE;
                domicilioEditar.DOM_BARRIO = barrioE;
                domicilioEditar.DOM_CP     = Convert.ToInt32(cpostalE);

                resultadoE = objlogDomicilio.editarDomicilio(domicilioEditar);

                if (resultadoE == "OK")
                {
                    string CARGO;

                    if (Cbocargo.SelectedItem == null)
                    {
                        CARGO = "";
                    }
                    else
                    {
                        CARGO = Cbocargo.SelectedItem.ToString();
                        if (CARGO == "TITULAR")
                        {
                            CARGO = "TITULAR";
                        }
                        else
                        {
                            CARGO = "SUPLENTE";
                        }
                    }

                    string turno;

                    if (cbTurno.SelectedItem == null)
                    {
                        turno = "";
                    }
                    else
                    {
                        turno = cbTurno.SelectedItem.ToString();

                        if (turno == "MAÑANA")
                        {
                            turno = "MANANA";
                        }
                        else
                        {
                            turno = "TARDE";
                        }
                    }
                    string id_sala;

                    if (cbSala.SelectedItem == null)
                    {
                        id_sala = "";
                    }
                    else
                    {
                        id_sala = cbSala.SelectedValue.ToString();
                    }

                    if (turno == cbTurno.Text && id_sala == cbSala.Text)
                    {
                        MessageBox.Show("Se ha ingresado el registro con éxito.", "Ingresado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    //else
                    //{

                    entGrupoSala grupoSalaEditar = new entGrupoSala();
                    grupoSalaEditar.GRS_PER_ID = Convert.ToInt32(idPersonaBuscar);
                    grupoSalaEditar.GRS_SAL_ID = Convert.ToInt32(id_sala);
                    grupoSalaEditar.GRS_CARGO  = CARGO.ToString();
                    resultadoE = objlogSalas.editarGrupoSala(grupoSalaEditar);
                    if (resultadoE == "OK")
                    {
                        MessageBox.Show("Se actualizado ok el registro.", "Ingresado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }

                    else
                    {
                        MessageBox.Show("El cupo de docente en la sala y turno seleccionados ya esta completo", "Salir", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        cbTurno.SelectedIndex = -1;
                        cbSala.SelectedIndex  = -1;
                    }  //}
                }
                else
                {
                    MessageBox.Show("NO OLVIDE INGRESAR " + validacionE + ".", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            string      id_salaE    = cbSala.SelectedValue.ToString();
            string      turno       = cbTurno.SelectedItem.ToString();
            DateTime    dt_nac      = dtNacimiento.Value;
            string      validacion  = validaCampos();
            logPersonas logPersonas = new logPersonas();

            string resultado_val_salas = logPersonas.Validar_Salas(dt_nac, id_salaE, turno);

            if (validacion == "OK" && resultado_val_salas == "OK")
            {
                //-------- EDITA PERSONA

                string   nombreE     = txtNombre.Text.Trim();
                string   apellidosE  = txtApellidos.Text.Trim();
                string   documentoE  = txtDocumento.Text.Trim();
                DateTime nacimientoE = dtNacimiento.Value.Date;


                string calleE    = txtCalle.Text.Trim();
                string numeroE   = txtNumero.Text.Trim();
                string cpostalE  = txtCPostal.Text.Trim();
                string pisoE     = txtPiso.Text.Trim();
                string dptoE     = txtDepto.Text.Trim();
                string barrioE   = txtBarrio.Text.Trim();
                string telefonoE = txtTelefono.Text.Trim();
                string celularE  = txtCelular.Text.Trim();
                string emailE    = txtEmail.Text.Trim();


                entPersona personaEditar = new entPersona();

                string genero;

                if (cbGenero.SelectedItem == null)
                {
                    genero = "";
                }
                else
                {
                    genero = cbGenero.SelectedItem.ToString();
                }


                personaEditar.PER_ID         = Convert.ToInt32(idPersonaSelect);
                personaEditar.PER_NOMBRE     = nombreE;
                personaEditar.PER_APELLIDO   = apellidosE;
                personaEditar.PER_DOCUMENTO  = Convert.ToInt32(documentoE);
                personaEditar.PER_GENERO     = genero;//cbGenero.SelectedValue.ToString(); //revisar
                personaEditar.PER_FECHA_NAC  = nacimientoE;
                personaEditar.PER_TELEFONO   = telefonoE;
                personaEditar.PER_TELEFONO_2 = celularE;
                personaEditar.PER_EMAIL      = emailE;


                int vacante = Convert.ToInt32(txtLegajo.Text);
                if (vacante == 0)
                {
                    txtLegajo.Style = MetroFramework.MetroColorStyle.Red;
                    txtLegajo.Focus();

                    MessageBox.Show("No existen vacantes para el turno y sala elegida. Por favor elija otro turno.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    string resultadoE = metPers.editarPersona(personaEditar);

                    //-------- EDITA DOMICILIO
                    entDomicilio domicilioEditar = new entDomicilio();

                    domicilioEditar.DOM_PER_ID = Convert.ToInt32(idPersonaSelect);
                    domicilioEditar.DOM_CALLE  = calleE;
                    domicilioEditar.DOM_NUMERO = Convert.ToInt32(numeroE);
                    if (string.IsNullOrWhiteSpace(pisoE.Trim()) == true)
                    {
                    }
                    else
                    {
                        domicilioEditar.DOM_PISO = Convert.ToInt32(pisoE);
                    }


                    domicilioEditar.DOM_DPTO   = dptoE;
                    domicilioEditar.DOM_BARRIO = barrioE;
                    domicilioEditar.DOM_CP     = Convert.ToInt32(cpostalE);

                    resultadoE = metDomic.editarDomicilio(domicilioEditar);

                    //-------- EDITA SALA

                    entGrupoSala grupoSalaEditar = new entGrupoSala();

                    grupoSalaEditar.GRS_PER_ID = Convert.ToInt32(idPersonaSelect);
                    grupoSalaEditar.GRS_SAL_ID = Convert.ToInt32(id_salaE);

                    resultadoE = metSala.editarGrupoSala(grupoSalaEditar);

                    if (resultadoE == "OK")
                    {
                        MessageBox.Show("Se han editado los datos con éxito.", "Ingresado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
            }
            else if (resultado_val_salas != "OK")
            {
                MessageBox.Show(resultado_val_salas);
                cbSala.SelectedIndex = -1;
                cbSala.Style         = MetroFramework.MetroColorStyle.Red;
                cbSala.Focus();
                lblSala.Text      = "Por favor, seleccione una sala";
                lblSala.ForeColor = Color.Red;
            }
            else
            {
                MessageBox.Show("No olvide ingresar " + validacion + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            string validacionE = validaCampos();

            if (validacionE == "OK")
            {
                //-------- EDITA PERSONA

                string   nombreE     = txtNombre.Text.Trim();
                string   apellidosE  = txtApellidos.Text.Trim();
                string   documentoE  = txtDocumento.Text.Trim();
                DateTime nacimientoE = dtNacimiento.Value.Date;


                string calleE    = txtCalle.Text.Trim();
                string numeroE   = txtNumero.Text.Trim();
                string cpostalE  = txtCPostal.Text.Trim();
                string pisoE     = txtPiso.Text.Trim();
                string dptoE     = txtDepto.Text.Trim();
                string barrioE   = txtBarrio.Text.Trim();
                string telefonoE = txtTelefono.Text.Trim();
                string celularE  = txtCelular.Text.Trim();
                string emailE    = txtEmail.Text.Trim();

                string id_salaE;

                if (cbSala.SelectedItem == null)
                {
                    id_salaE = "";
                }
                else
                {
                    id_salaE = cbSala.SelectedValue.ToString();
                }

                entPersona personaEditar = new entPersona();

                string genero;

                if (cbGenero.SelectedItem == null)
                {
                    genero = "";
                }
                else
                {
                    genero = cbGenero.SelectedItem.ToString();
                }


                personaEditar.PER_ID         = Convert.ToInt32(idPersonaSelect);
                personaEditar.PER_NOMBRE     = nombreE;
                personaEditar.PER_APELLIDO   = apellidosE;
                personaEditar.PER_DOCUMENTO  = Convert.ToInt32(documentoE);
                personaEditar.PER_GENERO     = genero;//cbGenero.SelectedValue.ToString(); //revisar
                personaEditar.PER_FECHA_NAC  = nacimientoE;
                personaEditar.PER_TELEFONO   = telefonoE;
                personaEditar.PER_TELEFONO_2 = celularE;
                personaEditar.PER_EMAIL      = emailE;

                string resultadoE = metPers.editarPersona(personaEditar);

                //-------- EDITA DOMICILIO
                entDomicilio domicilioEditar = new entDomicilio();

                domicilioEditar.DOM_PER_ID = Convert.ToInt32(idPersonaSelect);
                domicilioEditar.DOM_CALLE  = calleE;
                domicilioEditar.DOM_NUMERO = Convert.ToInt32(numeroE);
                if (string.IsNullOrWhiteSpace(pisoE.Trim()) == true)
                {
                }
                else
                {
                    domicilioEditar.DOM_PISO = Convert.ToInt32(pisoE);
                }


                domicilioEditar.DOM_DPTO   = dptoE;
                domicilioEditar.DOM_BARRIO = barrioE;
                domicilioEditar.DOM_CP     = Convert.ToInt32(cpostalE);

                resultadoE = metDomic.editarDomicilio(domicilioEditar);

                //-------- EDITA SALA

                entGrupoSala grupoSalaEditar = new entGrupoSala();

                grupoSalaEditar.GRS_PER_ID = Convert.ToInt32(idPersonaSelect);
                grupoSalaEditar.GRS_SAL_ID = Convert.ToInt32(id_salaE);

                resultadoE = metSala.editarGrupoSala(grupoSalaEditar);

                if (resultadoE == "OK")
                {
                    MessageBox.Show("Se han editado los datos con éxito.", "Ingresado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("No olvide ingresar " + validacionE + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }