private void button1_Click(object sender, EventArgs e)
 {
     MetodosCandidato g = new MetodosCandidato();
     g.ActualizarCand(ID, textBox1.Text, textBox2.Text, textBox5.Text, maskedTextBox1.Text, comboBox1.SelectedItem.ToString(), pictureBox1);
     mc = new MetodosComunes();
     mc.DetallesCandidato(ID, textBox1, textBox2, textBox3, textBox4, textBox5, maskedTextBox1, maskedTextBox2, pictureBox1);
 }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (nombre.Text.Length == 0 || apellido.Text.Length == 0 || fechaNac.Text.Trim().Length<10 || dir.Text.Length==0)
            {
                MessageBox.Show("Complete los campos obligatorios");
            }
            else if (cbxEspc.SelectedIndex == -1 || procedencia.Text.Length == 0 || colorpelo.SelectedIndex == -1 || colorojos.SelectedIndex==-1 || (radioButton1.Checked == false && radioButton2.Checked == false))
            {
                MessageBox.Show("Complete la información del perfil", "Información");

            }
            else if (pictureBox1.Image == null)
            {
                MessageBox.Show("Debe cargar una foto al perfil", "Información");
            }
            else
            {
                if (tipo.Text == "Adulto" && ced.Text.Length == 0)
                {
                    MessageBox.Show("Digite la información de la cédula", "",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (tipo.Text == "Niño")
                {
                    try

                    {
                        int experiencia = 1;
                        string s = "";

                        if (radioButton3.Checked == true) { experiencia = 1; }
                        else
                            if (radioButton4.Checked == true) { experiencia = 0; }

                        if (radioButton1.Checked == true) { s = "Masculino"; }
                        else
                            if (radioButton2.Checked == true) { s = "Femenino"; }

                    MetodosCandidato g = new MetodosCandidato();
                    MessageBox.Show(g.InsertarCandidato(nombre.Text, apellido.Text, dir.Text, tel.Text, tipo.Text, fechaNac.Text, procedencia.Text, s, cbxEspc.SelectedItem.ToString(), colorpelo.SelectedItem.ToString(), colorojos.SelectedItem.ToString(), experiencia, pictureBox1));

                    MessageBox.Show("Recuerde registrar al padre/tutor del niño\n"
                            + "De manera obligatoria cada niño tiene que registrar\n"
                            +"la información del padre o tutor", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        button1.Enabled = false;
                        button2.Enabled = false;
                        button3.Enabled = false;
                        button4.Enabled = false;
                        button6.Enabled = true;
                        nombre.Enabled = false;
                        apellido.Enabled = false;
                        fechaNac.Enabled = false;
                        dir.Enabled = false;
                        tel.Enabled = false;
                        tipo.Enabled = false;
                        cbxEspc.Enabled = false;
                        procedencia.Enabled = false;
                        colorpelo.Enabled = false;
                        colorojos.Enabled = false;
                        radioButton1.Enabled = false;
                        radioButton2.Enabled = false;
                        radioButton3.Enabled = false;
                        radioButton4.Enabled = false;

                    }
                    catch (SqlException ex) { MessageBox.Show(ex.Message); }

                }
                else if (tipo.Text == "Adulto" && ced.Text.Length != 0)
                {
                    try
                    {

                        int experiencia = 1;
                        string s = "";

                        MetodosCandidato g = new MetodosCandidato();
                        MetodosComunes mc = new MetodosComunes();

                        if (radioButton3.Checked == true) { experiencia = 1; }
                        else
                            if (radioButton4.Checked == true) { experiencia = 0; }

                        if (radioButton1.Checked == true) { s = "Masculino"; }
                        else
                            if (radioButton2.Checked == true) { s = "Femenino"; }

                        MessageBox.Show(g.InsertarCandidatoAdulto(nombre.Text, apellido.Text, dir.Text, tel.Text, tipo.Text, fechaNac.Text, ced.Text, procedencia.Text, s, cbxEspc.SelectedItem.ToString(), colorpelo.SelectedItem.ToString(), colorojos.SelectedItem.ToString(), experiencia, pictureBox1), "Información",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                        mc.LimpiarCampos(nombre, apellido, dir);
                        colorpelo.SelectedIndex = -1;
                        colorojos.SelectedIndex = -1;
                        procedencia.Clear();
                        cbxEspc.SelectedIndex = -1;
                        radioButton1.Checked = false;
                        radioButton2.Checked = false;
                        radioButton3.Checked = false;
                        radioButton4.Checked = true;

                        tipo.Clear();
                        tel.Clear();
                        ced.Clear();
                        fechaNac.Clear();
                        pictureBox1.Image = null;

                    }
                    catch (SqlException ex) { MessageBox.Show(ex.Message); }

                }//if abstracto
            }//if principal del botón
        }