Example #1
0
        public static List <RegionalData> GetRegionalDataList()
        {
            List <RegionalData> sampleCompanies = new List <RegionalData>();

            string baseDirectory = HostingEnvironment.MapPath("/Installation/regional");

            if (string.IsNullOrWhiteSpace(baseDirectory))
            {
                return(sampleCompanies);
            }

            string[] directories = Directory.GetDirectories(baseDirectory);

            foreach (string directory in directories)
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(directory);

                if (CultureInfo.GetCultures(CultureTypes.SpecificCultures).Any(culture => culture.Name == directoryInfo.Name))
                {
                    FileInfo[] files = directoryInfo.GetFiles("*.sql");

                    foreach (var file in files)
                    {
                        string culture  = directoryInfo.Name;
                        string fileName = Path.GetFileNameWithoutExtension(file.Name);
                        string filePath = file.FullName.Replace(baseDirectory, "").Replace("\\", "/").Replace(".sql", "");

                        RegionalData sample = new RegionalData(culture, fileName, filePath);
                        sampleCompanies.Add(sample);
                    }
                }
            }

            return(sampleCompanies);
        }
        public static List<RegionalData> GetRegionalDataList()
        {
            List<RegionalData> sampleCompanies = new List<RegionalData>();

            string baseDirectory = HostingEnvironment.MapPath("/Installation/regional");
            if (string.IsNullOrWhiteSpace(baseDirectory))
            {
                return sampleCompanies;
            }

            string[] directories = Directory.GetDirectories(baseDirectory);

            foreach (string directory in directories)
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(directory);

                if (CultureInfo.GetCultures(CultureTypes.SpecificCultures).Any(culture => culture.Name == directoryInfo.Name))
                {
                    FileInfo[] files = directoryInfo.GetFiles("*.sql");

                    foreach (var file in files)
                    {
                        string culture = directoryInfo.Name;
                        string fileName = Path.GetFileNameWithoutExtension(file.Name);
                        string filePath = file.FullName.Replace(baseDirectory, "").Replace("\\", "/").Replace(".sql", "");

                        RegionalData sample = new RegionalData(culture, fileName, filePath);
                        sampleCompanies.Add(sample);
                    }
                }
            }

            return sampleCompanies;
        }