Ejemplo n.º 1
0
        private void btn_Guardar_Click(object sender, EventArgs e)

        {
            FRM_Clientes frm = new FRM_Clientes( );

            try
            {
                string a = cEDULATextBox.Text;
                if (cEDULATextBox.Text.Length == 10)
                {
                    string c = Metodos.ValidarCedula(a).ToString( );
                    if (c == cEDULATextBox.Text.Substring(9, 1))
                    {
                        Metodos.textoVACIOS(cEDULATextBox, errorProvider1, "Correcto");
                        if (pRIMER_APELLIDOTextBox.Text.Length > 0 || sEGUNDO_APELLIDOTextBox.Text.Length > 0 || pRIMER_NOMBRETextBox.Text.Length > 0 || sEGUNDO_NOMBRETextBox.Text.Length > 0 || dIRECCION_NUMEROTextBox.Text.Length > 0 || dIRECCION_CALLETextBox.Text.Length > 0 || nUMERO_CELULARTextBox.Text.Length > 0 || nUMERO_TELEFONOTextBox.Text.Length > 0)
                        {
                            guardarDATOS_PERSONAS( );
                            if (MessageBox.Show("GUARDADO CON EXITO", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                            }
                            frm.ShowDialog( );

                            enabledTRUE( );
                        }
                        else
                        {
                            if (MessageBox.Show("Hay campos vacios", "AVISO", MessageBoxButtons.OK,
                                                MessageBoxIcon.Stop) == DialogResult.Yes)
                            {
                            }
                            Metodos.textoVACIObad(cEDULATextBox, errorProvider1, "Ingrese la cédula");
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("No existe su numero de cédula: " + cEDULATextBox.Text, "AVISO", MessageBoxButtons.OK,
                                            MessageBoxIcon.Stop) == DialogResult.Yes)
                        {
                        }
                    }
                }
                else
                {
                    if (MessageBox.Show("Hay campos vacios", "AVISO", MessageBoxButtons.OK,
                                        MessageBoxIcon.Stop) == DialogResult.Yes)
                    {
                    }
                    Metodos.textoVACIObad(cEDULATextBox, errorProvider1, "Ingrese la cédula");
                }
            }
            catch (Exception)
            {
                if (MessageBox.Show("Hay campos vacios", "AVISO", MessageBoxButtons.OK,
                                    MessageBoxIcon.Stop) == DialogResult.Yes)
                {
                }
                Metodos.textoVACIObad(cEDULATextBox, errorProvider1, "Ingrese la cédula");
            }
        }
Ejemplo n.º 2
0
        private void cEDULATextBox_Validated(object sender, EventArgs e)
        {
            string a = cEDULATextBox.Text;

            if (cEDULATextBox.Text.Length == 10)
            {
                string c = Metodos.ValidarCedula(a).ToString( );
                if (c == cEDULATextBox.Text.Substring(9, 1))
                {
                    if (validar_existencia(cEDULATextBox) == cEDULATextBox.Text)
                    {
                        enabledFALSEcedula( );
                        Metodos.textoVACIObad1(cEDULATextBox, errorProvider1, "Cédula ya existe");
                    }
                    else
                    {
                        Metodos.textoVACIOS(cEDULATextBox, errorProvider1, "Correcto");
                        enabledTRUEcedula( );
                    }
                }
                else
                {
                    Metodos.textoVACIObad(cEDULATextBox, errorProvider1, "Cédula no existe");
                    enabledFALSEcedula( );
                    if (MessageBox.Show("No existe su numero de cédula: " + cEDULATextBox.Text, "AVISO", MessageBoxButtons.OK,
                                        MessageBoxIcon.Stop) == DialogResult.Yes)
                    {
                    }
                }
            }
            else
            {
                enabledFALSEcedula( );
                Metodos.textoVACIObad(cEDULATextBox, errorProvider1, "La cédula es corta o excedio\n Verifique");
                if (MessageBox.Show("La cédula es corta o excedio la cantidad\n Verifique " + cEDULATextBox.Text, "AVISO", MessageBoxButtons.OK,
                                    MessageBoxIcon.Stop) == DialogResult.Yes)
                {
                }
            }
        }