public ActionResult Detail(string Id) { var apires = Framework.ApiAuth.IsApiAuth(this, parameters: new Framework.ApiCall.CallParameter[] { new Framework.ApiCall.CallParameter("Detail", Id) }); if (apires.Authentificated) { if (string.IsNullOrWhiteSpace(Id)) { return(View("Error404")); } var model = HlidacStatu.Lib.Data.Smlouva.Load(Id); if (model == null) { return(View("Error404")); } var smodel = Smlouva.ExportToJson(model, !string.IsNullOrWhiteSpace(Request.QueryString["nice"]), apires.ApiCall.UserRoles.Contains("Admin")); return(Content(smodel, "application/json")); } else { Response.StatusCode = 401; return(Json(new { error = "Unauthorized" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditClassification(string id, string typ1, string typ2) { var smlouva = Smlouva.Load(id); if (smlouva is null) { return(NotFound()); } List <int> typeVals = new List <int>(); if (int.TryParse(typ1, out int t1)) { typeVals.Add(t1); } if (int.TryParse(typ2, out int t2)) { typeVals.Add(t2); } if (typeVals.Count > 0) { smlouva.OverrideClassification(typeVals.ToArray(), this.User.Identity.Name); } return(Redirect(smlouva.GetUrl(true))); }
public ActionResult Detail(string Id) { if (Framework.ApiAuth.IsApiAuth(this, parameters: new Framework.ApiCall.CallParameter[] { new Framework.ApiCall.CallParameter("Detail", Id) }).Authentificated) { if (string.IsNullOrWhiteSpace(Id)) { return(View("Error404")); } var model = HlidacStatu.Lib.ES.Manager.Load(Id); if (model == null) { return(View("Error404")); } model = Smlouva.PrepareForDump(model); if (Request.QueryString["nice"] != null && (Request.QueryString["nice"].ToLower() == "true" || Request.QueryString["nice"] == "1")) { return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented), "application/json")); } else { return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.None), "application/json")); } } else { Response.StatusCode = 401; return(Json(new { error = "Unauthorized" }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// import from sheet Smlouva /// </summary> /// <param name="excel_con"></param> private void ImportSmlouva(OleDbConnection excel_con) { DataTable dtExcelData = new DataTable(); dtExcelData.Columns.AddRange(new DataColumn[6] { new DataColumn("Id", typeof(int)), new DataColumn("PoskytovatelZdravotnichSluzebId", typeof(int)), new DataColumn("PojistovnaId", typeof(int)), new DataColumn("TypSmlouvy", typeof(string)), new DataColumn("DatumOd", typeof(DateTime)), new DataColumn("DatumDo", typeof(DateTime)) }); using (OleDbDataAdapter oda = new OleDbDataAdapter("SELECT * FROM [Smlouva$]", excel_con)) { oda.Fill(dtExcelData); foreach (DataRow row in dtExcelData.Rows) { int typSmlouvyId = _dataConnector.GetTypSmlouvy((string)row["TypSmlouvy"], (DateTime)row["DatumOd"]).Id; Smlouva smlouva = new Smlouva() { PoskytovatelZdravotnichSluzebId = (int)row["PoskytovatelZdravotnichSluzebId"], PojistovnaId = (int)row["PojistovnaId"], TypSmlouvyId = typSmlouvyId, DatumOd = (DateTime)row["DatumOd"], DatumDo = row.IsNull("DatumDo") ? null : (DateTime?)row["DatumDo"] }; _dataConnector.CreateSmlouva(smlouva); } } }
public override string GetFullPath(Smlouva obj, string prilohaUrl) { if (string.IsNullOrEmpty(prilohaUrl) || obj == null) { return(string.Empty); } return(this.GetFullDir(obj) + Encode(prilohaUrl)); }
public ActionResult EditSmlouva(string Id, FormCollection form) { string oldJson = form["oldJson"]; string newJson = form["jsonRaw"]; Smlouva s = Newtonsoft.Json.JsonConvert.DeserializeObject <Smlouva>(newJson); s.Save(); return(Redirect("Index")); }
public override string GetRelativePath(Smlouva obj, string prilohaUrl) { if (string.IsNullOrEmpty(prilohaUrl) || obj == null) { return(string.Empty); } return(this.GetRelativeDir(obj) + Encode(prilohaUrl)); //return base.GetRelativePath(obj, Devmasters.Crypto.Hash.ComputeHash(prilohaUrl)); }
public void Update(ref Smlouva item) { //return; //DOTO //check missing DS/ICO UpdateSubj(item.Platce, item, "platce"); UpdateSubj(item.VkladatelDoRejstriku, item, "platce"); for (int i = 0; i < item.Prijemce.Count(); i++) { UpdateSubj(item.Prijemce[i], item, $"platce[{i}]"); } }
public ActionResult ZmenaSmluvnichStran(string id, FormCollection form) { ViewBag.SmlouvaId = id; if (string.IsNullOrEmpty(form["platce"]) || string.IsNullOrEmpty(form["prijemce"]) ) { ModelState.AddModelError("Check", "Nastav smluvni strany"); return(View()); } Smlouva s = Smlouva.Load(id); if (s == null) { ModelState.AddModelError("Check", "smlouva neexistuje"); return(View()); } else { HlidacStatu.Plugin.Enhancers.ManualChanges mch = new Plugin.Enhancers.ManualChanges(); var allSubjList = s.Prijemce.ToList(); allSubjList.Insert(0, s.Platce); var platce = allSubjList[Convert.ToInt32(form["platce"])]; List <Smlouva.Subjekt> prijemci = new List <Smlouva.Subjekt>(); var iprijemci = form["prijemce"].Split(',').Select(m => Convert.ToInt32(m)); foreach (var i in iprijemci) { prijemci.Add(allSubjList[i]); } mch.UpdateSmluvniStrany(ref s, platce, prijemci.ToArray()); List <Lib.Issues.Issue> issues = new List <Lib.Issues.Issue>(); foreach (var ia in Lib.Issues.Util.GetIssueAnalyzers()) { var iss = ia.FindIssues(s); if (iss != null) { issues.AddRange(iss); } } s.Issues = issues.ToArray(); s.Save(); return(Redirect(s.GetUrl(true))); } }
public bool Update(ref Smlouva item) { //return; //DOTO //check missing DS/ICO bool changed = false; changed = changed | UpdateSubj(item.Platce, item, "platce"); changed = changed | UpdateSubj(item.VkladatelDoRejstriku, item, "platce"); for (int i = 0; i < item.Prijemce.Count(); i++) { changed = changed | UpdateSubj(item.Prijemce[i], item, $"platce[{i}]"); } return(changed); }
public ActionResult EditClassification(string id) { if (string.IsNullOrWhiteSpace(id)) { return(RedirectToAction(nameof(HomeController.Index), nameof(HomeController))); } var smlouva = Smlouva.Load(id); if (smlouva is null) { return(RedirectToAction(nameof(HomeController.Index), nameof(HomeController))); } return(View(smlouva)); }
public ActionResult EditClassification(string id) { if (string.IsNullOrWhiteSpace(id)) { return(NotFound()); } var smlouva = Smlouva.Load(id); if (smlouva is null) { return(NotFound()); } return(View(smlouva)); }
public ActionResult CheckText(string smlouvaid) { HlidacStatu.Lib.Issues.IIssueAnalyzer textCheck = new HlidacStatu.Plugin.IssueAnalyzers.Text(); Smlouva s = HlidacStatu.Lib.ES.Manager.Load(smlouvaid); if (s != null) { if (s.Prilohy != null && s.Prilohy.Count() > 0) { var newIss = s.Issues.Where(m => m.IssueTypeId != 200).ToList(); newIss.AddRange(textCheck.FindIssues(s)); s.Issues = newIss.ToArray(); HlidacStatu.Lib.ES.Manager.Save(s); } } return(Content("OK")); }
public ActionResult Detail(string _id) { string Id = _id; var apires = Framework.ApiAuth.IsApiAuth(this, parameters: new Framework.ApiCall.CallParameter[] { new Framework.ApiCall.CallParameter("Detail", Id) }); if (apires.Authentificated) { if (string.IsNullOrWhiteSpace(Id)) { return(View("Error404")); } var model = HlidacStatu.Lib.Data.Smlouva.Load(Id); if (model == null) { return(View("Error404")); } var smodel = Smlouva.Export(model, allData: apires.ApiCall.UserRoles.Contains("Admin"), docsContent: true ); var s = Newtonsoft.Json.JsonConvert.SerializeObject( smodel, new Newtonsoft.Json.JsonSerializerSettings() { Formatting = (Request.QueryString["nice"] == "1" ? Newtonsoft.Json.Formatting.Indented : Newtonsoft.Json.Formatting.None), //NullValueHandling = NullValueHandling.Ignore, ContractResolver = new HlidacStatu.Util.FirstCaseLowercaseContractResolver() } ); return(Content(s, "application/json")); } else { Response.StatusCode = 401; return(Json(new { error = "Unauthorized" }, JsonRequestBehavior.AllowGet)); } }
public void Update(ref Smlouva item) { //return; //DOTO //check missing DS/ICO Lib.Data.Smlouva.Subjekt subj = item.Platce; //check formal valid ICO string ico = subj.ico; if (!string.IsNullOrEmpty(ico) && !Devmasters.Core.TextUtil.IsNumeric(ico)) { //neco spatne v ICO ico = System.Text.RegularExpressions.Regex.Replace(ico.ToUpper(), @"[^0-9\-.,]", string.Empty); item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Opraveno IČO subjektu", "", "platce.ico", subj.ico, ico, this)); subj.ico = ico; } if (string.IsNullOrEmpty(subj.ico) && !string.IsNullOrEmpty(subj.datovaSchranka)) { HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromDS(subj.datovaSchranka, true); if (Firma.IsValid(f)) { item.Platce.ico = f.ICO; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", "platce.ico", "", f.ICO, this)); } } else if (!string.IsNullOrEmpty(subj.ico) && string.IsNullOrEmpty(subj.datovaSchranka)) { HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromIco(subj.ico, true); if (Firma.IsValid(f) && f.DatovaSchranka != null && f.DatovaSchranka.Length > 0) { item.Platce.datovaSchranka = f.DatovaSchranka[0]; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", "platce.datovaSchranka", "", f.DatovaSchranka[0], this)); } } else if (string.IsNullOrEmpty(subj.ico) && string.IsNullOrEmpty(subj.datovaSchranka) && !string.IsNullOrEmpty(subj.nazev)) { //based on name //simple compare now if (Lib.Data.Firma.Koncovky.Any(m => subj.nazev.Contains(m))) { Lib.Data.Firma f = Lib.Data.Firma.FromName(subj.nazev, true); if (Firma.IsValid(f)) { item.Platce.ico = f.ICO; item.Platce.datovaSchranka = f.DatovaSchranka.Length > 0 ? f.DatovaSchranka[0] : ""; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", "Platce.ico", "", f.ICO, this)); if (f.DatovaSchranka.Length > 0) { item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", "Platce.datovaSchranka", "", f.DatovaSchranka[0], this)); } } else { //malinko uprav nazev, zrus koncovku aposledni carku string modifNazev = Lib.Data.Firma.JmenoBezKoncovky(subj.nazev); f = Lib.Data.Firma.FromName(modifNazev, true); if (Firma.IsValid(f)) { item.Platce.ico = f.ICO; item.Platce.datovaSchranka = f.DatovaSchranka.Length > 0 ? f.DatovaSchranka[0] : ""; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", "Platce.ico", "", f.ICO, this)); if (f.DatovaSchranka.Length > 0) { item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", "Platce.datovaSchranka", "", f.DatovaSchranka[0], this)); } } } } } if (string.IsNullOrEmpty(subj.nazev) && !string.IsNullOrEmpty(subj.ico)) { //dopln chybejici jmeno a adresu HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromIco(subj.ico, true); if (Firma.IsValid(f)) { subj.nazev = f.Jmeno; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněn Název subjektu", "", "Platce.nazev", "", f.ICO, this)); } } for (int i = 0; i < item.Prijemce.Count(); i++) { Smlouva.Subjekt ss = item.Prijemce[i]; ico = ss.ico; if (!string.IsNullOrEmpty(ico) && !Devmasters.Core.TextUtil.IsNumeric(ico)) { //neco spatne v ICO ico = System.Text.RegularExpressions.Regex.Replace(ico.ToUpper(), @"[^A-Z0-9\-.,]", string.Empty); item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Opraveno IČO subjektu", "", "item.Prijemce[" + i.ToString() + "].ico", ss.ico, ico, this)); ss.ico = ico; } if (string.IsNullOrEmpty(ss.ico) && !string.IsNullOrEmpty(ss.datovaSchranka)) { HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromDS(ss.datovaSchranka, true); if (Firma.IsValid(f)) { item.Prijemce[i].ico = f.ICO; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO smluvní strany", "", "Prijemce[" + i.ToString() + "].ico", "", f.ICO, this)); } } else if (!string.IsNullOrEmpty(ss.ico) && string.IsNullOrEmpty(ss.datovaSchranka)) { HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromIco(ss.ico, true); if (Firma.IsValid(f) && f.DatovaSchranka != null && f.DatovaSchranka.Length > 0) { item.Prijemce[i].datovaSchranka = f.DatovaSchranka[0]; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka smluvní strany", "", "item.Prijemce[" + i.ToString() + "].datovaSchranka", "", f.DatovaSchranka[0], this)); } } else if (string.IsNullOrEmpty(ss.ico) && string.IsNullOrEmpty(ss.datovaSchranka) && !string.IsNullOrEmpty(ss.nazev)) { //based on name //simple compare now if (Lib.Data.Firma.Koncovky.Any(m => ss.nazev.Contains(m))) { Lib.Data.Firma f = Lib.Data.Firma.FromName(ss.nazev, true); if (Firma.IsValid(f)) { item.Prijemce[i].ico = f.ICO; item.Prijemce[i].datovaSchranka = f.DatovaSchranka.Length > 0 ? f.DatovaSchranka[0] : ""; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO smluvní strany", "", "item.Prijemce[" + i.ToString() + "].ico", "", f.ICO, this)); if (f.DatovaSchranka.Length > 0) { item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka smluvní strany", "", "item.Prijemce[" + i.ToString() + "].datovaSchranka", "", f.DatovaSchranka[0], this)); } } else { //malinko uprav nazev, zrus koncovku aposledni carku string modifNazev = Lib.Data.Firma.JmenoBezKoncovky(ss.nazev); f = Lib.Data.Firma.FromName(modifNazev, true); if (Firma.IsValid(f)) { item.Prijemce[i].ico = f.ICO; item.Prijemce[i].datovaSchranka = f.DatovaSchranka.Length > 0 ? f.DatovaSchranka[0] : ""; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", "item.Prijemce[" + i.ToString() + "].ico", "", f.ICO, this)); if (f.DatovaSchranka.Length > 0) { item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", "item.Prijemce[" + i.ToString() + "].datovaSchranka", "", f.DatovaSchranka[0], this)); } } } } } if (string.IsNullOrEmpty(ss.nazev) && !string.IsNullOrEmpty(ss.ico)) { //dopln chybejici jmeno a adresu HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromIco(ss.ico, true); if (Firma.IsValid(f)) { item.Prijemce[i].nazev = f.Jmeno; item.Enhancements = item.Enhancements.AddOrUpdate(new Enhancement("Doplněn název subjektu", "", "Platce.Prijemce[" + i.ToString() + "].nazev", "", f.Jmeno, this)); } } } }
public string GetRelativePath(Smlouva obj, Smlouva.Priloha priloha) { return(this.GetRelativePath(obj, priloha.odkaz)); }
public override string GetRelativeDir(Smlouva obj) { return(base.GetRelativeDir(obj) + obj.Id + "\\"); }
public IEnumerable <SmlouvyForIndex> GetSmlouvy(string query) { Func <int, int, Nest.ISearchResponse <Lib.Data.Smlouva> > searchFunc = (size, page) => { return(Lib.ES.Manager.GetESClient().Search <Lib.Data.Smlouva>(a => a .Size(size) .Source(ss => ss.Excludes(sml => sml.Field(ff => ff.Prilohy))) .From(page * size) .Query(q => Lib.Data.Smlouva.Search.GetSimpleQuery(query)) .Scroll("1m") )); }; List <smlouvaStat> smlStat = new List <smlouvaStat>(); Searching.Tools.DoActionForQuery <Lib.Data.Smlouva>(Lib.ES.Manager.GetESClient(), searchFunc, (h, o) => { Smlouva s = h.Source; if (s != null) { foreach (var prij in s.Prijemce) { if (prij.ico == s.Platce.ico) { continue; } Firma f = Firmy.Get(prij.ico); if (f.Valid && f.PatrimStatuAlespon25procent()) { continue; } string dodavatel = prij.ico; if (string.IsNullOrWhiteSpace(dodavatel)) { dodavatel = prij.nazev; } if (string.IsNullOrWhiteSpace(dodavatel)) { dodavatel = "neznamy"; } smlStat.Add(new smlouvaStat() { Id = s.Id, IcoDodavatele = dodavatel, CastkaSDPH = Math.Abs((decimal)s.CalculatedPriceWithVATinCZK / (decimal)s.Prijemce.Length), Podepsano = s.datumUzavreni, Rok = s.datumUzavreni.Year, ULimitu = s.Hint?.SmlouvaULimitu ?? 0, Obory = s.GetRelevantClassification() .OrderByDescending(oo => oo.ClassifProbability) .Select(m => m.TypeValue).ToArray() });; } } return(new Devmasters.Batch.ActionOutputData()); }, null, null, null, false, blockSize: 100); IEnumerable <SmlouvyForIndex> smlouvy = smlStat .Select(m => new SmlouvyForIndex(m.IcoDodavatele, m.CastkaSDPH, m.ULimitu, m.Obory)) .OrderByDescending(m => m.HodnotaSmlouvy) //just better debug .ToArray(); //just better debug return(smlouvy); }
public bool UpdateSubj(Smlouva.Subjekt subj, Smlouva _item, string path) { bool changed = false; var zahr = Util.DataValidators.ZahranicniAdresa(subj.adresa); if (!string.IsNullOrEmpty(zahr) && !string.IsNullOrEmpty(subj.ico)) { var currPref = Devmasters.RegexUtil.GetRegexGroupValue(subj.ico, @"^(?<pref>\w{2}-).{1,}", "pref"); if (string.IsNullOrEmpty(currPref)) { //NENI PREFIX, DOPLN HO string newico = zahr + "-" + subj.ico; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněno zahraniční ID subjektu. Doplněn prefix před ID firmy", "", path + ".ico", newico, subj.ico, this)); subj.ico = newico; changed = true; } else if (currPref != zahr) { //je jiny PREFIX, uprav ho string newico = zahr + subj.ico.Substring(2); _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Upraveno zahraniční ID subjektu. Doplněn prefix před ID firmy", "", path + ".ico", zahr + "-" + subj.ico, subj.ico, this)); subj.ico = newico; changed = true; } } else { var currPref2 = Devmasters.RegexUtil.GetRegexGroupValue(subj.ico, @"^(?<pref>\w{2}-).{1,}", "pref"); if (!string.IsNullOrEmpty(currPref2) && subj.ico != null) { subj.ico = subj.ico.Replace(currPref2, ""); changed = true; } } //check formal valid ICO string ico = subj.ico; if (!string.IsNullOrEmpty(ico) && !Devmasters.TextUtil.IsNumeric(ico) && Util.DataValidators.IsZahranicniAdresa(subj.adresa) == false ) { //neco spatne v ICO ico = System.Text.RegularExpressions.Regex.Replace(ico.ToUpper(), @"[^0-9\-.,]", string.Empty); if (Util.DataValidators.CheckCZICO(ico)) { _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Opraveno IČO subjektu", "", path + ".ico", subj.ico, ico, this)); subj.ico = ico; changed = true; } } if (string.IsNullOrEmpty(subj.ico) && !string.IsNullOrEmpty(subj.datovaSchranka) && Util.DataValidators.IsZahranicniAdresa(subj.adresa) == false ) { HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromDS(subj.datovaSchranka, true); if (Firma.IsValid(f)) { subj.ico = f.ICO; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", path + ".ico", "", f.ICO, this)); changed = true; } } else if (!string.IsNullOrEmpty(subj.ico) && string.IsNullOrEmpty(subj.datovaSchranka)) { HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromIco(subj.ico, true); if (Firma.IsValid(f) && f.DatovaSchranka != null && f.DatovaSchranka.Length > 0) { subj.datovaSchranka = f.DatovaSchranka[0]; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", path + ".datovaScranka", "", f.DatovaSchranka[0], this)); changed = true; } } else if (string.IsNullOrEmpty(subj.ico) && string.IsNullOrEmpty(subj.datovaSchranka) && !string.IsNullOrEmpty(subj.nazev) && Util.DataValidators.IsZahranicniAdresa(subj.adresa) == false ) { //based on name //simple compare now if (Lib.Data.Firma.Koncovky.Any(m => subj.nazev.Contains(m))) { Lib.Data.Firma f = Lib.Data.Firma.FromName(subj.nazev, true); if (Firma.IsValid(f)) { subj.ico = f.ICO; subj.datovaSchranka = f.DatovaSchranka.Length > 0 ? f.DatovaSchranka[0] : ""; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", path + ".ico", "", f.ICO, this)); if (f.DatovaSchranka.Length > 0) { _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", path + ".datovaSchranka", "", f.DatovaSchranka[0], this)); } changed = true; } else { //malinko uprav nazev, zrus koncovku aposledni carku string modifNazev = Lib.Data.Firma.JmenoBezKoncovky(subj.nazev); f = Lib.Data.Firma.FromName(modifNazev, true); if (Firma.IsValid(f)) { subj.ico = f.ICO; subj.datovaSchranka = f.DatovaSchranka.Length > 0 ? f.DatovaSchranka[0] : ""; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněno IČO subjektu", "", path + ".ico", "", f.ICO, this)); if (f.DatovaSchranka.Length > 0) { _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněna datová schránka subjektu", "", path + ".datovaSchranka", "", f.DatovaSchranka[0], this)); } changed = true; } } } } if (string.IsNullOrEmpty(subj.nazev) && !string.IsNullOrEmpty(subj.ico)) { //dopln chybejici jmeno HlidacStatu.Lib.Data.Firma f = HlidacStatu.Lib.Data.Firma.FromIco(subj.ico, true); if (Firma.IsValid(f)) { subj.nazev = f.Jmeno; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněn Název subjektu", "", path + ".nazev", "", f.ICO, this)); changed = true; } } if (string.IsNullOrEmpty(subj.adresa) && !string.IsNullOrEmpty(subj.ico)) { //dopln chybejici jmeno var fm = HlidacStatu.Lib.Data.External.Merk.FromIcoFull(subj.ico); if (fm != null) { subj.adresa = fm.address.street + " " + fm.address.number + ", " + fm.address.municipality; _item.Enhancements = _item.Enhancements.AddOrUpdate(new Enhancement("Doplněna adresa subjektu", "", path + ".nazev", "", subj.ico, this)); changed = true; } } return(changed); }