Exemple #1
0
        private static string getNameByIco(string key)
        {
            var o = Firma.FromIco(key);

            if (o == null)
            {
                return(key);
            }
            if (o.Valid == false)
            {
                return(key);
            }
            return(o.Jmeno);
        }
Exemple #2
0
        public static Firma FromDS(string ds, bool getMissingFromExternal = false)
        {
            Firma f = External.FirmyDB.FromDS(ds);

            if (!Firma.IsValid(f) && getMissingFromExternal)
            {
                var d = External.DatoveSchranky.ISDS.GetSubjektyForDS(ds);
                if (d != null)
                {
                    return(Firma.FromIco(d.ICO, getMissingFromExternal));
                }
            }

            return(f);
        }
Exemple #3
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);
        }
Exemple #4
0
        private static Firma getByIco(string key)
        {
            var o = Firma.FromIco(key);

            return(o ?? nullObj);
        }