Exemple #1
0
        protected DaAuthorizationFacade GetAuthorizationFacade()
        {
            var userManager             = new DaUserManager(new DaUserRepository(DaSecurityFacadeTestSuite.IdentityDbContext));
            var tenantManager           = new DaTenantManager(new DaTenantRepository(DaSecurityFacadeTestSuite.EnterpriseSecurityDbContext));
            var appManager              = new DaAppManager(new DaAppRepository(DaSecurityFacadeTestSuite.EnterpriseSecurityDbContext));
            var featureManager          = new DaFeatureManager(new DaFeatureRepository(DaSecurityFacadeTestSuite.EnterpriseSecurityDbContext));
            var userAgreementManager    = new DaUserAgreementManager(new DaUserAgreementRepository(DaSecurityFacadeTestSuite.EnterpriseSecurityDbContext));
            var subscriptionPlanManager = new DaSubscriptionPlanManager(new DaSubscriptionPlanRepository(DaSecurityFacadeTestSuite.EnterpriseSecurityDbContext));
            var subscriptionManager     = new DaSubscriptionManager(new DaSubscriptionRepository(DaSecurityFacadeTestSuite.EnterpriseSecurityDbContext));

            var currencyManager       = new DaCurrencyManager(new DaCurrencyRepository(DaSecurityFacadeTestSuite.ListsDbContext));
            var countryManager        = new DaCountryManager(new DaCountryRepository(DaSecurityFacadeTestSuite.ListsDbContext));
            var timeZoneManager       = new DaTimeZoneManager(new DaTimeZoneRepository(DaSecurityFacadeTestSuite.ListsDbContext));
            var systemLanguageManager = new DaSystemLanguageManager(new DaSystemLanguageRepository(DaSecurityFacadeTestSuite.ListsDbContext));

            return(new DaAuthorizationFacade(userManager, tenantManager, appManager, featureManager, userAgreementManager, subscriptionPlanManager, subscriptionManager, currencyManager, countryManager, timeZoneManager, systemLanguageManager));
        }
Exemple #2
0
        public static void CreateDefaultLists()
        {
            var currenciesManager = new DaCurrencyManager(new DaCurrencyRepository(ListsDbContext));
            var currencies        = currenciesManager.FindAll();

            if (currencies == null || currencies.Count <= 0)
            {
                var currenciesList      = NMoneys.Currency.FindAll().Distinct();
                var processedCurrencies = new List <string>();

                foreach (var c in currenciesList)
                {
                    var processedCurrency = processedCurrencies.Where(m => m == c.EnglishName).ToList();

                    if (processedCurrency == null || processedCurrency.Count <= 0)
                    {
                        currenciesManager.Create(new List.Culture.DaCurrency()
                        {
                            Name           = c.EnglishName,
                            NativeName     = c.NativeName,
                            CurrencyCode   = c.AlphabeticCode,
                            CurrencySymbol = c.IsoSymbol,
                            IsActive       = true
                        });

                        processedCurrencies.Add(c.EnglishName);
                    }
                }
            }

            var countryManager = new DaCountryManager(new DaCountryRepository(ListsDbContext));
            var countries      = countryManager.FindAll();

            if (countries == null || countries.Count <= 0)
            {
                var countriesList = GetCountries();

                foreach (var c in countriesList)
                {
                    countryManager.Create(c);
                }
            }

            var timeZonesManager = new DaTimeZoneManager(new DaTimeZoneRepository(ListsDbContext));
            var timeZones        = timeZonesManager.FindAll();

            if (timeZones == null || timeZones.Count <= 0)
            {
                foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
                {
                    timeZonesManager.Create(new List.Culture.DaTimeZone()
                    {
                        SystemTimeZoneId           = z.Id,
                        Name                       = z.StandardName,
                        DisplayName                = z.DisplayName,
                        DaylightName               = z.DaylightName,
                        SupportsDaylightSavingTime = z.SupportsDaylightSavingTime,
                        IsActive                   = true
                    });
                }
            }

            var dateFormatsManager = new DaDateFormatManager(new DaDateFormatRepository(ListsDbContext));
            var dateFormats        = dateFormatsManager.FindAll();

            if (dateFormats == null || dateFormats.Count <= 0)
            {
                // Fil up date formats
            }

            var sysLanguagesManager = new DaSystemLanguageManager(new DaSystemLanguageRepository(ListsDbContext));
            var sysLanguages        = sysLanguagesManager.FindAll();

            if (sysLanguages == null || sysLanguages.Count <= 0)
            {
                var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);

                foreach (CultureInfo culture in cultures)
                {
                    if (!string.IsNullOrEmpty(culture.Name))
                    {
                        sysLanguagesManager.Create(new List.Culture.DaSystemLanguage()
                        {
                            Name        = culture.Name,
                            DisplayName = culture.DisplayName,
                            IsActive    = true
                        });
                    }
                }
            }
        }