private void TxtBoxIDLeave(object sender, EventArgs e)
        {
            try
            {
                if (!this.Visible)
                {
                    return;
                }

                List <Compañia> salida = (from c in lst where c.NumeroCedula == this.txtBoxID.Text select c).Take(1).ToList <Compañia>();

                if (salida.Count != 0)
                {
                    CargarCompaniaFormulario(salida[0]);
                }
                else
                {
                    if (!VerificaString.VerificarID(txtBoxID.Text, (TipoID)lstTipoId.SelectedIndex + 1, out String mensaje))
                    {
                        MessageBox.Show(mensaje, TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        txtErorId.Visible = true;
                    }
                    else
                    {
                        txtErorId.Visible = false;
                    }
                }
            }

            catch (Exception)
            {
            }
        }
예제 #2
0
        //static HttpClient client = new HttpClient();

        public Boolean Insert(Compañia t, Usuario user, Compañia copiarDe, out String mensaje)
        {
            try
            {
                ///Mandemos estas verificaciones a la capa entida
                if (!VerificaString.VerificarID(t.NumeroCedula, t.TipoId, out mensaje))
                {
                    return(false);
                }
                if (!VerificaString.IsNullOrWhiteSpace(t.Nombre, "Nombre", out mensaje))
                {
                    return(false);
                }
                if (!VerificaString.ValidarEmail(t.Correo))
                {
                    mensaje = "Formato de correo invalido";
                    return(false);
                }

                if (compañiaDao.Insert(t, user, copiarDe, out mensaje))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
                return(false);
            }
        }
 private void TxtBoxMailLeave(object sender, EventArgs e)
 {
     if (this.Visible)
     {
         if (!VerificaString.ValidarEmail(txtBoxMail.Text))
         {
             MessageBox.Show("Correo electronico no valido", TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtErrorCorreo.Visible = true;
         }
         else
         {
             txtErrorCorreo.Visible = false;
         }
     }
 }
 private void TxtBoxNombreLeave(object sender, EventArgs e)
 {
     if (this.Visible)
     {
         if (!VerificaString.IsNullOrWhiteSpace(txtBoxNombre.Text, "Nombre", out String mensaje))
         {
             MessageBox.Show(mensaje, TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtErrorNombre.Visible = true;
         }
         else
         {
             txtErrorNombre.Visible = false;
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Verifica que el username pueda ser asignado
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TxtBoxUsuario_Leave(object sender, EventArgs e)
 {
     if (this.Visible && txtBoxUsuario.Enabled)
     {
         if (usuarioCL.VerificarUserName(txtBoxUsuario.Text) || !VerificaString.IsNullOrWhiteSpace(txtBoxUsuario.Text, "nombre de usuario", out String mensaje))
         {
             MessageBox.Show("Nombre de usuario no valido", TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtErrorUserName.Visible = true;
         }
         else
         {
             txtErrorUserName.Visible = false;
         }
     }
 }
        private void TipoIdSelectedIndexChanged(object sender, EventArgs e)
        {
            //if (Convert.ToString((((DataRowView)lstTipoId.SelectedItem).Row.ItemArray)[0]) == "CEDULA JURIDICA")
            this.LimpiarFormulario();
            if (lstTipoId.SelectedIndex != 0)
            {
                txtOp1.Text = "Primer Apellido:";
                txtOp2.Text = "Segundo Apellido:";
            }
            else
            {
                txtOp1.Text = "Representante Legal:";
                txtOp2.Text = "ID Representante Legal:";
            }


            txtBoxID.Enabled = true;
            txtBoxID.Mask    = VerificaString.MascaraIdentificacion((TipoID)lstTipoId.SelectedIndex + 1);
        }
예제 #7
0
 /// <summary>
 /// Verifica el número de cédula del usuario
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TxtBoxID_Leave(object sender, EventArgs e)
 {
     if (this.Visible && txtBoxID.Enabled)
     {
         if (!VerificaString.IsNullOrWhiteSpace(txtBoxID.Text, "Identificación", out String mensaje))
         {
             MessageBox.Show("Formato de cédula no valido", TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtErrorCedula.Visible = true;
         }
         else if ((ListUsuarios.Where(x => x.MyCedula == txtBoxID.Text).Count()) > 0)
         {
             MessageBox.Show("Esta número de identificación se encuentra ocupado", TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtErrorCedula.Visible = true;
         }
         else
         {
             txtErrorCedula.Visible = false;
         }
     }
 }