예제 #1
0
 protected override void SaveWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (ValidateFields())
     {
         var userName = tbUserName.Text;
         var password = pbPassword.Password;
         if (UsersService.IsLocked(userName, password))
         {
             LogsService.Instanse.Insert(new Log {
                 HostTable = (short)HostTable.Login,
                 Details   = Log.LoginLockedDetailer(userName, password)
             });
             Global.LoginLocked(this);
             ResetFields();
         }
         else if (UsersService.Validate(userName, password))
         {
             LogsService.Instanse.Insert(new Log {
                 HostTable = (short)HostTable.Login,
                 Details   = Log.LoggedInDetailer(userName, password)
             });
             Close();
         }
         else
         {
             LogsService.Instanse.Insert(new Log {
                 HostTable = (short)HostTable.Login,
                 Details   = Log.LoginFailedDetailer(userName, password)
             });
             Global.LoginFailed(this);
             ResetFields();
         }
     }
 }