Пример #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool cancelarEvento = false;

            try
            {
                HelperValidaciones helperValidaciones = new HelperValidaciones(this.errorProvider1);
                helperValidaciones.ValidarCampoObligatorio((Control)txtUser, labelControl1.Text);
                helperValidaciones.ValidarCampoObligatorio((Control)txtPass, labelControl2.Text);

                if (!helperValidaciones.EsValido())
                {
                    cancelarEvento = true;
                    return;
                }

                Cursor.Current = Cursors.WaitCursor;
                SplashScreenManager.ShowForm(typeof(WaitFormSeguridad), true, true);

                if (ConfigurationManager.AppSettings["UrlSeguridad"] != null)
                {
                    LoginRemoto();
                }
                else
                {
                    LoginLocal();
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (DataPortalException ex)
            {
                if (ex.BusinessException.GetType() == typeof(UsuarioNoActivoException) ||
                    ex.BusinessException.GetType() == typeof(UsuarioSinClaveException))
                {
                    CargaActivacionUsuario(ex.BusinessException.Message);
                }
                else
                {
                    XtraMessageBox.Show(
                        ex.BusinessException.Message,
                        Text,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    RegistrarLog(ex);
                }
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
                if (ex.InnerException != null)
                {
                    msg = ex.InnerException.Message;
                }

                XtraMessageBox.Show(
                    msg,
                    Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                RegistrarLog(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                if (cancelarEvento == false)
                {
                    SplashScreenManager.CloseForm();
                }
            }
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool cancelarEvento = false;
            try
            {
                HelperValidaciones helperValidaciones = new HelperValidaciones(this.errorProvider1);
                helperValidaciones.ValidarCampoObligatorio((Control)txtUser, labelControl1.Text);
                helperValidaciones.ValidarCampoObligatorio((Control)txtPass, labelControl2.Text);

                if (!helperValidaciones.EsValido())
                {
                    cancelarEvento = true;
                    return;
                }

                Cursor.Current = Cursors.WaitCursor;
                SplashScreenManager.ShowForm(typeof(WaitFormSeguridad), true, true);

                if (ConfigurationManager.AppSettings["UrlSeguridad"] != null)
                    LoginRemoto();
                else
                    LoginLocal();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (DataPortalException ex)
            {
                if (ex.BusinessException.GetType() == typeof(UsuarioNoActivoException)
                    || ex.BusinessException.GetType() == typeof(UsuarioSinClaveException))
                    CargaActivacionUsuario(ex.BusinessException.Message);
                else
                {
                    XtraMessageBox.Show(
                        ex.BusinessException.Message,
                        Text,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    RegistrarLog(ex);
                }
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
                if (ex.InnerException != null)
                    msg = ex.InnerException.Message;

                XtraMessageBox.Show(
                    msg,
                    Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                RegistrarLog(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                if (cancelarEvento == false)
                    SplashScreenManager.CloseForm();
            }
        }