Exemplo n.º 1
0
 public void Include(EntityData otherData)
 {
     Alerts.AddRange(otherData.Alerts);
     EmailAlertRecipients.AddRange(otherData.EmailAlertRecipients);
     SmsAlertRecipients.AddRange(otherData.SmsAlertRecipients);
     AlertReports.AddRange(otherData.AlertReports);
     AlertRules.AddRange(otherData.AlertRules);
     ApplicationLanguages.AddRange(otherData.ApplicationLanguages);
     ContentLanguages.AddRange(otherData.ContentLanguages);
     Countries.AddRange(otherData.Countries);
     DataCollectors.AddRange(otherData.DataCollectors);
     Districts.AddRange(otherData.Districts);
     GatewaySettings.AddRange(otherData.GatewaySettings);
     HeadManagerConsents.AddRange(otherData.HeadManagerConsents);
     HealthRisks.AddRange(otherData.HealthRisks);
     HealthRiskLanguageContents.AddRange(otherData.HealthRiskLanguageContents);
     Localizations.AddRange(otherData.Localizations);
     LocalizedTemplates.AddRange(otherData.LocalizedTemplates);
     NationalSocieties.AddRange(otherData.NationalSocieties);
     Notifications.AddRange(otherData.Notifications);
     Projects.AddRange(otherData.Projects);
     SupervisorUserProjects.AddRange(otherData.SupervisorUserProjects);
     ProjectHealthRisks.AddRange(otherData.ProjectHealthRisks);
     RawReports.AddRange(otherData.RawReports);
     Regions.AddRange(otherData.Regions);
     Reports.AddRange(otherData.Reports);
     Users.AddRange(otherData.Users);
     UserNationalSocieties.AddRange(otherData.UserNationalSocieties);
     Villages.AddRange(otherData.Villages);
     Zones.AddRange(otherData.Zones);
 }
Exemplo n.º 2
0
        public async Task <IActionResult> OnGet()
        {
            if (User?.Identity?.IsAuthenticated == true)
            {
                var user = _dataService.GetUserByName(User.Identity.Name);
                if (user is null)
                {
                    await _signInManager.SignOutAsync();

                    return(RedirectToPage());
                }

                if (_appConfig.Require2FA && !user.TwoFactorEnabled)
                {
                    return(RedirectToPage("TwoFactorRequired"));
                }

                var organizationCount = _dataService.GetOrganizationCount();
                RegistrationAvailable = _appConfig.MaxOrganizationCount < 0 || organizationCount < _appConfig.MaxOrganizationCount;

                var org = _dataService.GetOrganizationById(user.OrganizationID);
                IsNewVersionAvailable = await _upgradeService.IsNewVersionAvailable();

                DefaultPrompt = _dataService.GetDefaultPrompt(User.Identity.Name);
                var groups = _dataService.GetDeviceGroups(User.Identity.Name);
                if (groups?.Any() == true)
                {
                    DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));
                }
                var alerts = _dataService.GetAlerts(user.Id);
                if (alerts.Any())
                {
                    Alerts.AddRange(alerts);
                }

                Motd = _appConfig.MessageOfTheDay;
            }
            else
            {
                DefaultPrompt = _dataService.GetDefaultPrompt();
            }

            return(Page());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnGet()
        {
            if (User?.Identity?.IsAuthenticated == true)
            {
                var user = DataService.GetUserByName(User.Identity.Name);
                if (user is null)
                {
                    await SignInManager.SignOutAsync();

                    return(RedirectToPage());
                }

                if (AppConfig.Require2FA && !user.TwoFactorEnabled)
                {
                    return(RedirectToPage("TwoFactorRequired"));
                }

                DefaultPrompt = DataService.GetDefaultPrompt(User.Identity.Name);
                var groups = DataService.GetDeviceGroups(User.Identity.Name);
                if (groups?.Any() == true)
                {
                    DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));
                }
                var alerts = DataService.GetAlerts(user.Id);
                if (alerts.Any())
                {
                    Alerts.AddRange(alerts);
                }
            }
            else
            {
                DefaultPrompt = DataService.GetDefaultPrompt();
            }

            return(Page());
        }