public void consolidar(BD_ADMIS_DatosPersonales DatosPer, BD_ADMIS_ContactoEmergencia Contacto, BD_ADMIS_DatosTutor Tutor) { //CargarFormulario(); Exportar_Reporte1(DatosPer.PrimerApellido + " " + DatosPer.SegundoApellido + " " + DatosPer.Nombres); axVarSes.Escribe("strCrearNuevoFamiliar", string.Empty); axVarSes.Escribe("strCrearNuevoAlumno", string.Empty); axVarSes.Escribe("strNSAlumno", string.Empty); axVarSes.Escribe("strNSFamiliar", string.Empty); }
protected void evaluarLlenado() { long aux = 0; Match me = Regex.Match(axVarSes.Lee <string>("strPersonaRegistrar"), "(\\d+)"); if (me.Success) { aux += Convert.ToInt64(me.Value); } if ((!string.IsNullOrEmpty(axVarSes.Lee <string>("strPersonaRegistrar"))) && (aux > 0) && (axVarSes.Lee <string>("strOperacion").Equals("1"))) { BD_ADMIS_DatosPersonales libDatosPer = new BD_ADMIS_DatosPersonales(); libDatosPer.StrConexion = axVarSes.Lee <string>("strConexion"); libDatosPer.NumSecDatosPer = Convert.ToInt64(axVarSes.Lee <string>("strPersonaRegistrar")); libDatosPer.Ver(); tbPrimerApellido.Text = libDatosPer.PrimerApellido; tbSegundoApellido.Text = libDatosPer.SegundoApellido; ddlLocalidadZona.SelectedValue = libDatosPer.NumSecLocalidadDomicilio.ToString(); ddlLugarInscripcion.SelectedValue = libDatosPer.NumSecUbicacionInscripcion.ToString(); tbNombres.Text = libDatosPer.Nombres; tbDocIdentidad.Text = libDatosPer.DocIdentidad; ddlTipoDocIdentidad.SelectedValue = libDatosPer.TipoDocIdentidad.ToString(); ddlGenero.SelectedValue = libDatosPer.Genero.ToString(); ddlGrupoSangre.SelectedValue = libDatosPer.GrupoSangre.ToString(); ddlEstadoCivil.SelectedValue = libDatosPer.EstadoCivil.ToString(); ddlDiscapacidad.SelectedValue = libDatosPer.TipoDiscapacidad.ToString(); tbCalleAvenida.Text = libDatosPer.AvenidaCalle; tbNumeroDom.Text = libDatosPer.Numero; tbZona.Text = libDatosPer.Zona; tbNombreEdificio.Text = libDatosPer.Edificio; tbPiso.Text = libDatosPer.Piso; tbNumeroDepto.Text = libDatosPer.Depto; tbTelefonoDomicilio.Text = libDatosPer.Telefono.ToString(); tbCelular.Text = libDatosPer.Celular.ToString(); libDatosPer.Celular = tbCelular.Text; tbEmail.Text = libDatosPer.Email; ddlViveCon.SelectedValue = libDatosPer.ViveCon.ToString(); tbFechaNac.Text = libDatosPer.FechaNacimiento; ddlAreaNacimiento.SelectedValue = libDatosPer.AreaNacimiento.ToString(); BD_Localidades liblocalidades = new BD_Localidades(); liblocalidades.StrConexion = axVarSes.Lee <string>("strConexion"); liblocalidades.NumSec = libDatosPer.NumSecLocalidadNac; string auxestado = liblocalidades.EstadoLocalidad(); BD_Estados libestados = new BD_Estados(); libestados.StrConexion = axVarSes.Lee <string>("strConexion"); libestados.NumSec = Convert.ToInt64(auxestado); ddlPaisNac.SelectedValue = libestados.PaisEstado(); CargarDdlEstadosNac(ddlPaisNac.SelectedValue); if (ddlEstadoNac.Items.Count > 0) { ddlEstadoNac.SelectedValue = auxestado; } CargarDdlLocalidadesNac(ddlEstadoNac.SelectedValue); if (ddlCiudadNac.Items.Count > 0) { ddlCiudadNac.SelectedValue = libDatosPer.NumSecLocalidadNac.ToString(); } ddlNacionalidad.SelectedValue = libDatosPer.NumSecNacionalidad.ToString(); tbObservaciones.Text = libDatosPer.Observaciones; liblocalidades.NumSec = libDatosPer.NumSecLocalidadBachillerato; auxestado = liblocalidades.EstadoLocalidad(); libestados.NumSec = Convert.ToInt64(auxestado); ddlPaisBach.SelectedValue = libestados.PaisEstado(); CargarDdlEstadosBach(ddlPaisBach.SelectedValue); if (ddlEstadoBach.Items.Count > 0) { ddlEstadoBach.SelectedValue = auxestado; } CargarDdlLocalidadesBach(ddlEstadoBach.SelectedValue); if (ddlCiudadBach.Items.Count > 0) { ddlCiudadBach.SelectedValue = libDatosPer.NumSecLocalidadBachillerato.ToString(); } CargarDdlColegios(); if (ddlColegio.Items.Count > 0) { ddlColegio.SelectedValue = libDatosPer.NumSecColegio.ToString(); } ddlAnio.SelectedValue = libDatosPer.AnioBachillerato.ToString(); ddlTipoColegio.SelectedValue = libDatosPer.TipoColegio.ToString(); ddlAreaColegio.SelectedValue = libDatosPer.AreaColegio.ToString(); ddlTurno.SelectedValue = libDatosPer.Turno.ToString(); ddlCarreras.SelectedValue = libDatosPer.NumSecSubdepartamento.ToString(); BD_ADMIS_DatosTutor libtutor = new BD_ADMIS_DatosTutor(); libtutor.StrConexion = axVarSes.Lee <string>("strConexion"); libtutor.NumSecDatosPer = libDatosPer.NumSecDatosPer; libtutor.Ver(); ddlParentesco.SelectedValue = libtutor.TipoTutor.ToString(); tbPrimerApTutor.Text = libtutor.PrimerApellido; tbSegundoApTutor.Text = libtutor.SegundoApellido; tbNombreTutor.Text = libtutor.Nombres; tbDocIdentidadTutor.Text = libtutor.DocIdentidad; ddlTipoDocIdentidadTutor.SelectedValue = libtutor.TipoDocIdentidad.ToString(); ddlGeneroTutor.SelectedValue = libtutor.Genero.ToString(); tbCalleAvenidaTutor.Text = libtutor.AvenidaCalle; tbNumeroDomTutor.Text = libtutor.Numero; tbZonaTutor.Text = libtutor.Zona; tbTelefonoTutor.Text = libtutor.Telefono.ToString(); tbCelularTutor.Text = libtutor.Celular; tbEmailTutor.Text = libtutor.Email; tbInstitucionLaboralTutor.Text = libtutor.InstitucionTrabajo; tbCargoTutor.Text = libtutor.Cargo; tbTelefonoOficina.Text = libtutor.TelefonoTrabajo; tbEdificioTutor.Text = libtutor.Edificio; tbDeptoTutor.Text = libtutor.Depto; if (libtutor.AutSeguimiento == 1) { rbSi.Checked = true; } if (libtutor.AutSeguimiento == 0) { rbNo.Checked = true; } BD_ADMIS_ContactoEmergencia libContacto = new BD_ADMIS_ContactoEmergencia(); libContacto.StrConexion = axVarSes.Lee <string>("strConexion"); libContacto.NumSecDatosPer = libDatosPer.NumSecDatosPer; libContacto.Ver(); tbNombreCompleto.Text = libContacto.NombreCompleto; tbTelefonoContacto1.Text = libContacto.TelefonoContacto1; tbTelefonoContacto2.Text = libContacto.TelefonoContacto2; CargarDdlPensums(); } else { CargarDdlEstadosBach(ddlPaisBach.SelectedValue); ddlEstadoBach.SelectedValue = "1"; // por defecto carga la paz CargarDdlLocalidadesBach(ddlEstadoBach.SelectedValue); ddlCiudadBach.SelectedValue = "1"; // por defecto carga la paz CargarDdlColegios(); CargarDdlEstadosNac(ddlPaisNac.SelectedValue); ddlEstadoNac.SelectedValue = "1"; // por defecto carga la paz CargarDdlLocalidadesNac(ddlEstadoNac.SelectedValue); ddlCiudadNac.SelectedValue = "1"; // por defecto carga la paz } }
protected void btnEnviar_Click(object sender, EventArgs e) { pnMensajeError.Visible = false; pnMensajeOK.Visible = false; BD_ADMIS_DatosPersonales libDatosPer = new BD_ADMIS_DatosPersonales(); libDatosPer.StrConexion = axVarSes.Lee <string>("strConexion"); if (axVarSes.Lee <string>("strOperacion").Equals("0")) { libDatosPer.GenerarNS(); } else { libDatosPer.NumSecDatosPer = Convert.ToInt64(axVarSes.Lee <string>("strPersonaRegistrar")); } libDatosPer.PrimerApellido = tbPrimerApellido.Text.ToUpper(); libDatosPer.SegundoApellido = tbSegundoApellido.Text.ToUpper(); libDatosPer.Nombres = tbNombres.Text.ToUpper(); libDatosPer.DocIdentidad = tbDocIdentidad.Text; libDatosPer.TipoDocIdentidad = Convert.ToInt16(ddlTipoDocIdentidad.SelectedValue); libDatosPer.Genero = Convert.ToInt16(ddlGenero.SelectedValue); libDatosPer.GrupoSangre = Convert.ToInt16(ddlGrupoSangre.SelectedValue); libDatosPer.EstadoCivil = Convert.ToInt16(ddlEstadoCivil.SelectedValue); libDatosPer.TipoDiscapacidad = Convert.ToInt16(ddlDiscapacidad.SelectedValue); libDatosPer.AvenidaCalle = tbCalleAvenida.Text; libDatosPer.Numero = tbNumeroDom.Text; libDatosPer.Zona = tbZona.Text; libDatosPer.Edificio = tbNombreEdificio.Text; libDatosPer.Piso = tbPiso.Text; libDatosPer.Depto = tbNumeroDepto.Text; libDatosPer.AreaNacimiento = Convert.ToInt16(ddlAreaNacimiento.SelectedValue); Match me = Regex.Match(tbTelefonoDomicilio.Text, "(\\d+)"); if (me.Success) { libDatosPer.Telefono = Convert.ToInt32(me.Value); } if (!string.IsNullOrEmpty(tbCelular.Text)) { libDatosPer.Celular = tbCelular.Text; } libDatosPer.Email = tbEmail.Text; libDatosPer.ViveCon = Convert.ToInt16(ddlViveCon.SelectedValue); libDatosPer.FechaNacimiento = Convert.ToDateTime(tbFechaNac.Text.Trim()).ToString("dd/MM/yyyy"); libDatosPer.NumSecNacionalidad = Convert.ToInt64(ddlNacionalidad.SelectedValue); libDatosPer.Observaciones = tbObservaciones.Text; libDatosPer.NumSecLocalidadNac = Convert.ToInt64(ddlCiudadNac.SelectedValue); libDatosPer.NumSecLocalidadBachillerato = Convert.ToInt64(ddlCiudadBach.SelectedValue); libDatosPer.NumSecColegio = Convert.ToInt64(ddlColegio.SelectedValue); libDatosPer.AnioBachillerato = Convert.ToInt32(ddlAnio.SelectedValue); libDatosPer.TipoColegio = Convert.ToInt16(ddlTipoColegio.SelectedValue); libDatosPer.AreaColegio = Convert.ToInt16(ddlAreaColegio.SelectedValue); libDatosPer.Turno = Convert.ToInt16(ddlTurno.SelectedValue); libDatosPer.NumSecSubdepartamento = Convert.ToInt64(ddlCarreras.SelectedValue); libDatosPer.NumSecSemestre = 0; libDatosPer.NumSecPersona = 0; libDatosPer.UsuarioRegistro = axVarSes.Lee <string>("UsuarioLogin"); BD_ADMIS_DatosTutor libtutor = new BD_ADMIS_DatosTutor(); libtutor.StrConexion = axVarSes.Lee <string>("strConexion"); libtutor.TipoTutor = Convert.ToInt16(ddlParentesco.SelectedValue); libtutor.NumSecDatosPer = libDatosPer.NumSecDatosPer; libtutor.PrimerApellido = tbPrimerApTutor.Text; libtutor.SegundoApellido = tbSegundoApTutor.Text; libtutor.Nombres = tbNombreTutor.Text; libtutor.DocIdentidad = tbDocIdentidadTutor.Text; libtutor.TipoDocIdentidad = Convert.ToInt16(ddlTipoDocIdentidadTutor.SelectedValue); libtutor.Genero = Convert.ToInt16(ddlGeneroTutor.SelectedValue); libtutor.AvenidaCalle = tbCalleAvenidaTutor.Text; libtutor.Numero = tbNumeroDomTutor.Text; libtutor.Zona = tbZonaTutor.Text; libtutor.Edificio = tbEdificioTutor.Text; libtutor.Depto = tbDeptoTutor.Text; me = Regex.Match(tbTelefonoTutor.Text, "(\\d+)"); if (me.Success) { libtutor.Telefono = Convert.ToInt32(me.Value); } if (!string.IsNullOrEmpty(tbCelularTutor.Text)) { libtutor.Celular = tbCelularTutor.Text; } libtutor.Email = tbEmailTutor.Text; libtutor.InstitucionTrabajo = tbInstitucionLaboralTutor.Text; libtutor.Cargo = tbCargoTutor.Text; libtutor.TelefonoTrabajo = tbTelefonoOficina.Text; if (rbSi.Checked) { libtutor.AutSeguimiento = 1; } if (rbNo.Checked) { libtutor.AutSeguimiento = 0; } libtutor.NumSecPersona = 0; libtutor.UsuarioRegistro = axVarSes.Lee <string>("UsuarioLogin"); BD_ADMIS_ContactoEmergencia libContacto = new BD_ADMIS_ContactoEmergencia(); libContacto.StrConexion = axVarSes.Lee <string>("strConexion"); libContacto.NumSecDatosPer = libDatosPer.NumSecDatosPer; libContacto.NombreCompleto = tbNombreCompleto.Text; if (!string.IsNullOrEmpty(tbTelefonoContacto1.Text)) { libContacto.TelefonoContacto1 = tbTelefonoContacto1.Text; } if (!string.IsNullOrEmpty(tbTelefonoContacto2.Text)) { libContacto.TelefonoContacto2 = tbTelefonoContacto2.Text; } consolidar(libDatosPer, libContacto, libtutor); }
protected void btnEnviar_Click(object sender, EventArgs e) { BD_ADMIS_DatosPersonales libDatosPer = new BD_ADMIS_DatosPersonales(); libDatosPer.StrConexion = axVarSes.Lee <string>("strConexion"); if (axVarSes.Lee <string>("strOperacion").Equals("0")) { libDatosPer.GenerarNS(); } else { libDatosPer.NumSecDatosPer = Convert.ToInt64(axVarSes.Lee <string>("strPersonaRegistrar")); } libDatosPer.PrimerApellido = tbPrimerApellido.Text; libDatosPer.SegundoApellido = tbSegundoApellido.Text; libDatosPer.Nombres = tbNombres.Text; libDatosPer.DocIdentidad = tbDocIdentidad.Text; libDatosPer.TipoDocIdentidad = Convert.ToInt16(ddlTipoDocIdentidad.SelectedValue); libDatosPer.Genero = Convert.ToInt16(ddlGenero.SelectedValue); libDatosPer.GrupoSangre = Convert.ToInt16(ddlGrupoSangre.SelectedValue); libDatosPer.EstadoCivil = Convert.ToInt16(ddlEstadoCivil.SelectedValue); libDatosPer.TipoDiscapacidad = Convert.ToInt16(ddlDiscapacidad.SelectedValue); libDatosPer.AvenidaCalle = tbCalleAvenida.Text; libDatosPer.Numero = tbNumeroDom.Text; libDatosPer.Zona = tbZona.Text; libDatosPer.Edificio = tbNombreEdificio.Text; libDatosPer.Piso = tbPiso.Text; libDatosPer.Depto = tbNumeroDepto.Text; libDatosPer.Telefono = Convert.ToInt32(tbTelefonoDomicilio.Text); libDatosPer.Celular = tbCelular.Text; libDatosPer.Email = tbEmail.Text; libDatosPer.ViveCon = Convert.ToInt16(ddlViveCon.SelectedValue); libDatosPer.FechaNacimiento = Convert.ToDateTime(tbFechaNac.Text.Trim()).ToString("dd/MM/yyyy"); libDatosPer.NumSecNacionalidad = Convert.ToInt64(ddlNacionalidad.SelectedValue); libDatosPer.NumSecLocalidadNac = Convert.ToInt64(ddlCiudadNac.SelectedValue); libDatosPer.NumSecLocalidadBachillerato = Convert.ToInt64(ddlCiudadBach.SelectedValue); libDatosPer.NumSecColegio = Convert.ToInt64(ddlColegio.SelectedValue); libDatosPer.AnioBachillerato = Convert.ToInt32(ddlAnio.SelectedValue); libDatosPer.TipoColegio = Convert.ToInt16(ddlTipoColegio.SelectedValue); libDatosPer.AreaColegio = Convert.ToInt16(ddlAreaColegio.SelectedValue); libDatosPer.Turno = Convert.ToInt16(ddlTurno.SelectedValue); libDatosPer.Estado = 1; libDatosPer.NumSecSubdepartamento = Convert.ToInt64(ddlCarreras.SelectedValue); libDatosPer.NumSecSemestre = 0; libDatosPer.NumSecPersona = 0; libDatosPer.UsuarioRegistro = axVarSes.Lee <string>("UsuarioLogin"); BD_ADMIS_DatosTutor libtutor = new BD_ADMIS_DatosTutor(); libtutor.StrConexion = axVarSes.Lee <string>("strConexion"); libtutor.NumSecDatosPer = libDatosPer.NumSecDatosPer; libtutor.PrimerApellido = tbPrimerApTutor.Text; libtutor.SegundoApellido = tbSegundoApTutor.Text; libtutor.Nombres = tbNombreTutor.Text; libtutor.DocIdentidad = tbDocIdentidadTutor.Text; libtutor.TipoDocIdentidad = Convert.ToInt16(ddlTipoDocIdentidadTutor.SelectedValue); libtutor.Genero = Convert.ToInt16(ddlGeneroTutor.SelectedValue); libtutor.AvenidaCalle = tbCalleAvenidaTutor.Text; libtutor.Numero = tbNumeroDomTutor.Text; libtutor.Zona = tbZonaTutor.Text; libtutor.Telefono = Convert.ToInt32(tbTelefonoTutor.Text); libtutor.Celular = tbCelularTutor.Text; libtutor.Email = tbEmailTutor.Text; libtutor.InstitucionTrabajo = tbInstitucionLaboralTutor.Text; libtutor.Cargo = tbCargoTutor.Text; libtutor.TelefonoTrabajo = tbTelefonoOficina.Text; if (rbSi.Checked) { libtutor.AutSeguimiento = 1; } if (rbNo.Checked) { libtutor.AutSeguimiento = 0; } libtutor.NumSecPersona = 0; libtutor.UsuarioRegistro = axVarSes.Lee <string>("UsuarioLogin"); BD_ADMIS_ContactoEmergencia libContacto = new BD_ADMIS_ContactoEmergencia(); libContacto.StrConexion = axVarSes.Lee <string>("strConexion"); libContacto.NumSecDatosPer = libDatosPer.NumSecDatosPer; libContacto.NombreCompleto = tbNombreCompleto.Text; libContacto.TelefonoContacto1 = tbTelefonoContacto1.Text; libContacto.TelefonoContacto2 = tbTelefonoContacto2.Text; libContacto.UsuarioRegistro = axVarSes.Lee <string>("UsuarioLogin"); string[] sqls = new string[10]; int numsqls = 0; if (axVarSes.Lee <string>("strRol").Equals("1")) { if (axVarSes.Lee <string>("strOperacion").Equals("0")) { sqls[0] = libDatosPer.CadsqlInsert(); numsqls++; sqls[1] = libtutor.cadSqlInsertar(); numsqls++; sqls[2] = libContacto.cadSqlInsertar(); numsqls++; } else { if (axVarSes.Lee <string>("strOperacion").Equals("1")) { sqls[0] = libDatosPer.CadsqlActualizar(); numsqls++; sqls[1] = libtutor.cadSqlActualizar(); numsqls++; sqls[2] = libContacto.cadSqlActualizar(); numsqls++; } } } else { if (axVarSes.Lee <string>("strOperacion").Equals("0")) { sqls[0] = libDatosPer.CadsqlInsert(); numsqls++; sqls[1] = libtutor.cadSqlInsertar(); numsqls++; sqls[2] = libContacto.cadSqlInsertar(); numsqls++; } } if (libDatosPer.InsertarVarios(sqls, numsqls)) { axVarSes.Escribe("strMensajeExito", "Registro exitoso."); Response.Redirect("ADMIS_FormRegistro.aspx"); } else { pnMensajeError.Visible = true; pnMensajeOK.Visible = false; lblMensajeError.Text = "No se pudo almacenar el formulario. " + libDatosPer.Mensaje; } }