Пример #1
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 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)
            {
            }
        }