private void bGuardar_Click(object sender, EventArgs e) { if (FuncionesBoludas.policia(gbDatos.Controls)){ integrante = new Integrante(tbNombre.Text, tbApellido.Text, tbDireccion.Text, tbMail.Text, cmbTipoDNI.Text, Convert.ToInt64(tbNumeroDni.Text), Convert.ToInt64(tbTelefono.Text), (EstadoCivil)cmbEstadoCivil.SelectedItem, (cmbSexo.SelectedText == "Masculino") ? "M" : "F", tbNombreUsuario.Text, cbConyuge.Checked, dtpFechaNacimiento.Value, tbContrasegna.Text, (int)nFamiliares.Value); DialogResult = DialogResult.OK; } }
private void EditAfiliado_Load(object sender, EventArgs e) { //--Llenar y cargar en comboBox's estadosCiviles.FillWithAll(); cmbEstadoCivil.Items.AddRange(estadosCiviles.ToList()); planes.FillWithAll(); cmbPlanMedico.Items.AddRange(planes.ToList()); //--Si no es nueva, poner los datos a modificar en los textBox if (!nueva) { if (orden > 1) bAgregarACargo.Enabled = false; else bCambiarGrupo.Enabled = false; tbNombre.Text = nombre; tbApellido.Text = apellido; tbDireccion.Text = direccion; cmbTipoDNI.Text = tipoDocumento; tbNumeroDni.Text = numeroDocumento.ToString(); tbTelefono.Text = telefono.ToString(); tbMail.Text = mail; tbNombreUsuario.Text = nombreUsuario; if (sexo == "M") cmbSexo.SelectedItem = "Masculino"; if (sexo == "F") cmbSexo.SelectedItem = "Femenino"; dtpFechaNacimiento.Value = fechaNacimiento; tbContrasegna.Text = "****"; cmbEstadoCivil.SelectedItem = estadoCivil; cmbPlanMedico.SelectedItem = planMedico; //Tengo que hacerlos invisibles aca, porque sino salta el evento tbRazon.Visible = false; label13.Visible = false; //--Traer los integrantes del grupo foreach (DataRow dr in DB.ExecuteReader( "SELECT * FROM " + DB.schema + "vAfiliado va WHERE va.afi_grupoFamiliar = " + grupoFamiliar.grupo).Rows) { //--Crea el integrante que trajo y lo agrega al listbox Integrante integrante = new Integrante(dr); lbIntegrantes.Items.Add(integrante); //--Si algún integrante es conyuge, marca la flag if (Convert.ToInt32(dr["afi_orden"]) == 2) tieneConyuge = true; } } }
private void bCambiarGrupo_Click(object sender, EventArgs e) { CambiarGrupo formCamb = new CambiarGrupo(grupoFamiliar, afiliadoID); formCamb.ShowDialog(); if (formCamb.DialogResult == DialogResult.OK) { if (!formCamb.nueva) { //--Traer los integrantes del grupo foreach (DataRow dr in DB.ExecuteReader( "SELECT * FROM " + DB.schema + "vAfiliado va WHERE va.afi_grupoFamiliar = " + grupoFamiliar.grupo + " ORDER BY va.afi_grupoFamiliar ASC").Rows) { //--Crea el integrante que trajo y lo agrega al listbox Integrante integrante = new Integrante(dr); lbIntegrantes.Items.Add(integrante); //--Si algún integrante es conyuge, marca la flag if (Convert.ToInt32(dr["afi_orden"]) == 2) tieneConyuge = true; //--Bloquear agregar integrantes bAgregarACargo.Enabled = false; } } else bAgregarACargo.Enabled = true; DialogResult = DialogResult.OK; } }