private Boolean existeRut() { ServiceLOCParticipante.WebServiceLOCParticipanteSoapClient auxService = new ServiceLOCParticipante.WebServiceLOCParticipanteSoapClient(); ServiceLOCParticipante.Participante auxParticipante = new ServiceLOCParticipante.Participante(); bool auxExiste; auxParticipante.Rut_Participante1 = this.txtRutParticipante.Text; if (Convert.ToString(auxService.buscarRut(auxParticipante).Rut_Participante1) == txtRutParticipante.Text) { auxExiste = true; } else { auxExiste = false; } return(auxExiste); }
private void BtnEliminar_Click(object sender, EventArgs e) { ServiceLOCParticipante.WebServiceLOCParticipanteSoapClient auxService = new ServiceLOCParticipante.WebServiceLOCParticipanteSoapClient(); ServiceLOCParticipante.Participante auxParticipante = new ServiceLOCParticipante.Participante(); int idP; try { idP = Convert.ToInt32(dataGridParticipante.CurrentRow.Cells[0].Value); auxParticipante.Id_Participante1 = idP; auxService.eliminarParticipanteService(auxParticipante); MessageBox.Show("Datos Eliminados", "Mensaje de sistema"); } catch (Exception ex) { MessageBox.Show("Datos no Eliminados debido a que no selecciono la celda correcta " + ex.Message, " Mensaje Del Sistema "); } }
private void BtoAgregarP_Click(object sender, EventArgs e) { ServiceLOCParticipante.WebServiceLOCParticipanteSoapClient auxService = new ServiceLOCParticipante.WebServiceLOCParticipanteSoapClient(); ServiceLOCParticipante.Participante auxParticipante = new ServiceLOCParticipante.Participante(); ServiceLOCParticipante.Comuna auxComuna = new ServiceLOCParticipante.Comuna(); ServiceLOCParticipante.Sexo auxSexo = new ServiceLOCParticipante.Sexo(); ServiceLOCParticipante.Estado_Participante auxEstado = new ServiceLOCParticipante.Estado_Participante(); if (txtRutParticipante.Text.Length < 11 && txtRutParticipante.Text.Length > 8) { if (txtNombreParticipante.Text.Length < 15 && txtNombreParticipante.Text.Length > 3) { if (txtApellidoParterno.Text.Length < 15 && txtApellidoParterno.Text.Length > 2) { if (txtApellidoMaterno.Text.Length < 15 && txtApellidoMaterno.Text.Length > 2) { if (cboComuna.SelectedIndex + 1 > 0) { if (cboSexo.SelectedIndex + 1 > 0) { if (dateTimeNacimiento.Value < DateTime.Today) { if (cboEstadoParticipante.SelectedIndex + 1 > 0) { if (existeRut() == false) { try { auxParticipante.Rut_Participante1 = this.txtRutParticipante.Text; auxParticipante.Nombre_Participante1 = this.txtNombreParticipante.Text; auxParticipante.Apellido_Patreno_Participante1 = this.txtApellidoParterno.Text; auxParticipante.Apellido_Materno_Participante1 = this.txtApellidoMaterno.Text; auxParticipante.Fecha_Nacimiento_Participante1 = dateTimeNacimiento.Value; auxComuna.Id_Comuna1 = cboComuna.SelectedIndex + 1; auxSexo.Id_Sexo1 = cboSexo.SelectedIndex + 1; auxEstado.Id_Estado_Comuna1 = cboEstadoParticipante.SelectedIndex + 1; auxService.agregarParticipanteService(auxParticipante, auxComuna, auxSexo, auxEstado); MessageBox.Show("Datos guardados", "Mensaje de sistema"); } catch (Exception ex) { MessageBox.Show("Datos no guardados" + ex.Message, "Mensaje de sistema"); } } else { MessageBox.Show("Datos no guardados", "El rut que intenta guardar ya existe"); } } else { MessageBox.Show("Debe seleccionar estado de participante"); } } else { MessageBox.Show("Debe ingresar una fecha de nacimiento valida"); } } else { MessageBox.Show("Debe seleccionar sexo"); } } else { MessageBox.Show("Debe seleccionar una Comuna"); } } else { MessageBox.Show("Apellido de Participante debe ser de entre 2 y 50 caracteres"); } } else { MessageBox.Show("Apellido de Participante debe ser de entre 2 y 50 caracteres"); } } else { MessageBox.Show("Nombre de Participante debe ser entre 2 y 50 caracteres"); } } else { MessageBox.Show("Rut de Participante debe ser entre 9 y 10 caracteres"); } }