public void SetSize() { QScreen.SetResolution(920, 630, false); }
/// <summary> /// Проверяет, авторизован ли пользователь /// </summary> public bool CheckAuthorization() { if (_httpContext.Session == null) { return(false); } if (_configuration.IgnoreQPSecurityChecker) { return(true); } if (_httpContext.Session.Get(AuthenticationKey) != null) { var uid = _httpContext.Session.GetInt32(DBConnector.LastModifiedByKey); if (uid > 0) { return(true); } } if (_configuration.UseFake) { _httpContext.Session.Set(AuthenticationKey, BitConverter.GetBytes(true)); _httpContext.Session.SetInt32(DBConnector.LastModifiedByKey, _configuration.FakeData.UserId); _httpContext.Session.SetString(UserLanguageKey, _configuration.FakeData.LangName); return(true); } if (_uow.Connection == null) { return(false); } var dBConnector = new DBConnector(_uow.Connection); var qScreen = new QScreen(dBConnector); var userId = qScreen.AuthenticateForCustomTab(dBConnector, _webAppQpHelper.BackendSid); var result = userId > 0; if (result) { try { var userInfo = GetUserInfo(userId, dBConnector); if (userInfo != null && userInfo.Rows.Count > 0) { var lang = userInfo.Rows[0][UserLanguageFieldName].ToString(); int.TryParse(lang, out int langId); string langName = ((QpLanguage)Enum.Parse(typeof(QpLanguage), langId.ToString())).GetDescription(); _httpContext.Session.SetString(UserLanguageKey, langName); } } catch (Exception ex) { _logger.LogError(ex.Message, ex); _httpContext.Session.SetString(UserLanguageKey, QpLanguage.Default.GetDescription()); } _httpContext.Session.Set(AuthenticationKey, BitConverter.GetBytes(result)); _httpContext.Session.SetInt32(DBConnector.LastModifiedByKey, userId); } return(result); }