Beispiel #1
0
 /// <summary>
 /// 登陆验证
 /// </summary>
 /// <returns></returns>
 private bool LoginValidate()
 {
     try
     {
         string   message    = string.Empty;
         string   realName   = string.Empty;
         string   account    = txtAccount.Text.Trim();
         string   password   = txtPassord.Text.Trim();
         DateTime serverTime = DateTime.Now;
         PublicClass.StudentCode = account;
         PublicClass.StudentPwd  = password;
         RememberAccount(account, password);
         if (rdoOnline.Checked)
         {
             CreateService();
             realName = bService.GetUserInfo(account, password, out message, out serverTime);
             if (string.IsNullOrEmpty(realName))
             {
                 Msg.ShowError(message);
                 return(false);
             }
             PublicClass.ExamineeName = realName;
             Globals.ServerTime       = serverTime;
             InitialBaseData();
         }
         return(true);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(typeof(frmLogin), ex);
         CommonUtil.WriteLog(ex);
         PublicClass.ShowMessageOk(ex.Message);
         return(false);
     }
 }
Beispiel #2
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            var account  = string.Empty;
            var password = string.Empty;
            var remember = string.Empty;

            try
            {
                account         = UserConfigSettings.Instance.ReadSetting("账号");
                password        = UserConfigSettings.Instance.ReadSetting("密码");
                remember        = UserConfigSettings.Instance.ReadSetting("记住账号");
                txtAccount.Text = account;
                txtPassord.Text = DES.DecryStrHexUTF8(password, account);
                if (remember != "" && remember == "是")
                {
                    cbAccount.Checked = true;
                }
                else
                {
                    cbAccount.Checked = false;
                }
                rdoOnline.Checked = true;
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(frmLogin), ex);
                CommonUtil.WriteLog(ex);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 处理非UI线程异常
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex = e.ExceptionObject as Exception;

            LogHelper.WriteLog(e.GetType(), ex);
            CommonUtil.WriteLog(ex);
            Msg.ShowError(ex.Message);
        }
Beispiel #4
0
 /// <summary>
 /// 处理UI线程异常
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
 {
     LogHelper.WriteLog(e.GetType(), e.Exception);
     CommonUtil.WriteLog(e.Exception);
     Msg.ShowError(e.Exception.Message);
 }