Пример #1
0
        //obce
        private static List <Autocomplete> LoadCities()
        {
            string sql     = $@"select Jmeno, ICO, KrajId 
                             from Firma 
                            where IsInRS = 1 
                              AND LEN(ico) = 8
                              AND Stav_subjektu = 1 
                              AND Typ={(int)Firma.TypSubjektuEnum.Obec};";
            var    results = DirectDB.GetList <string, string, string>(sql)
                             .AsParallel()
                             .SelectMany(f =>
            {
                var synonyms = new Autocomplete[2];
                synonyms[0]  = new Autocomplete()
                {
                    Id           = $"ico:{f.Item2}",
                    Text         = f.Item1,
                    Type         = "obec",
                    Description  = FixKraj(f.Item3),
                    Priority     = 2,
                    ImageElement = "<i class='fas fa-industry-alt'></i>"
                };

                synonyms[1]        = (Autocomplete)synonyms[0].MemberwiseClone();
                string synonymText = Regex.Replace(f.Item1,
                                                   @"^(Město|Městská část|Městys|Obec|Statutární město) ?",
                                                   "",
                                                   RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
                synonyms[1].Text = synonymText;
                return(synonyms);
            }).ToList();

            return(results);
        }
Пример #2
0
        //používá se v administraci eventů pro naše politiky
        public static IEnumerable <Autocomplete> GenerateAutocompleteFirmyOnly()
        {
            string sql     = "select distinct Jmeno, ICO from Firma where LEN(ico) = 8 AND Kod_PF > 110;";
            var    results = DirectDB.GetList <string, string>(sql)
                             .Select(f => new Autocomplete()
            {
                Id   = f.Item2,
                Text = f.Item1
            }).ToList();

            return(results);
        }
Пример #3
0
        private static List <Autocomplete> LoadSynonyms()
        {
            string sql     = $@"select text, query, type, priority, imageElement, description from AutocompleteSynonyms where active=1;";
            var    results = DirectDB.GetList <string, string, string, int, string, string>(sql)
                             .AsParallel()
                             .Select(f => new Autocomplete()
            {
                Id           = $"{f.Item2}",
                Text         = f.Item1,
                Type         = f.Item3,
                Description  = FixKraj(f.Item6),
                Priority     = f.Item4,
                ImageElement = f.Item5
            }).ToList();

            return(results);
        }
Пример #4
0
        private static List <Autocomplete> LoadCompanies()
        {
            // Kod_PF < 110  - cokoliv co nejsou fyzické osoby, podnikatelé
            // Podnikatelé nejsou zařazeni, protože je jich poté moc a vznikají tam duplicity

            string sql     = "select Jmeno, ICO from Firma where IsInRS = 1 AND LEN(ico) = 8 AND Kod_PF > 110;";
            var    results = DirectDB.GetList <string, string>(sql)
                             .Select(f => Firma.FromIco(f.Item2))
                             .AsParallel()
                             .Select(f => new Autocomplete()
            {
                Id           = $"ico:{f.ICO}",
                Text         = f.Jmeno,
                Type         = f.JsemOVM() ? "úřad" : "firma",
                Description  = FixKraj(f.KrajId),
                ImageElement = "<i class='fas fa-industry-alt'></i>"
            }).ToList();

            return(results);
        }
Пример #5
0
        //úřady
        private static List <Autocomplete> LoadAuthorities()
        {
            string sql     = $@"select Jmeno, ICO, KrajId 
                             from Firma 
                            where IsInRS = 1 
                              AND LEN(ico) = 8 
                              AND Kod_PF > 110
                              AND Typ={(int)Firma.TypSubjektuEnum.Ovm};";
            var    results = DirectDB.GetList <string, string, string>(sql)
                             .AsParallel()
                             .Select(f => new Autocomplete()
            {
                Id           = $"ico:{f.Item2}",
                Text         = f.Item1,
                Type         = "úřad",
                Description  = FixKraj(f.Item3),
                Priority     = 2,
                ImageElement = "<i class='fas fa-university'></i>"
            }).ToList();

            return(results);
        }
Пример #6
0
        //firmy
        private static List <Autocomplete> LoadCompanies()
        {
            // Kod_PF < 110  - cokoliv co nejsou fyzické osoby, podnikatelé
            // Podnikatelé nejsou zařazeni, protože je jich poté moc a vznikají tam duplicity
            string sql     = $@"select Jmeno, ICO, KrajId 
                             from Firma 
                            where LEN(ico) = 8 
                              AND Kod_PF > 110
                              AND (Typ is null OR Typ={(int)Firma.TypSubjektuEnum.Soukromy});";
            var    results = DirectDB.GetList <string, string, string>(sql)
                             .AsParallel()
                             .Select(f => new Autocomplete()
            {
                Id           = $"ico:{f.Item2}",
                Text         = f.Item1,
                Type         = "firma",
                Description  = FixKraj(f.Item3),
                Priority     = 0,
                ImageElement = "<i class='fas fa-industry-alt'></i>"
            }).ToList();

            return(results);
        }