/// <summary> /// Vyhledá firmu dle ičo v ares službě. /// </summary> /// <param name="ico">ičo hledané firmy.</param> /// <returns>Výsledek hledání.</returns> private odpoved_basic getFirmsFromAresAPI(string ico) { // sestavení dotazu dotaz dotaz = new dotaz(); dotaz.Items = new object[] { ico }; dotaz.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.ICO }; Ares_dotazy aresDotazy = new Ares_dotazy(); aresDotazy.Dotaz = new dotaz[] { dotaz }; aresDotazy.dotaz_typ = ares_dotaz_typ.Basic; aresDotazy.answerNamespaceRequired = url; // dotaz na službu Ares_odpovedi aresOdpovedi = httpSoapBasicClient.GetXmlFile(aresDotazy); // výsledek return(aresOdpovedi.Odpoved[0]); }
public BasicResultModel GetCompanyByTaxId(string taxId) { Logger.Debug($"{CorrelationId} - Request Basic Data for taxId:{taxId} started"); Stopwatch watch = Stopwatch.StartNew(); Ares_odpovedi aresResponse = WebRequestHelper.XmlWebRequestSequence <Ares_odpovedi>( PrepareUrl(new Dictionary <string, string> { { "ico", taxId } }) ); Logger.Debug($"{CorrelationId} - Got Response from ARES. Time:{watch.Elapsed}"); watch.Restart(); BasicResultModel result = BaseMapper.MapBasicData(aresResponse); Logger.Debug($"{CorrelationId} - ARES response mapped. Time:{watch.Elapsed}"); return(result); }
public ESResultModel Search(string taxId = "", string name = "", string city = "") { Logger.Debug($"{CorrelationId} - Request with query:{{taxId:{taxId}, name: {name}, city: {city}}} started"); Stopwatch timer = Stopwatch.StartNew(); string url = PrepareUrl(new Dictionary <string, string> { { "ico", taxId }, { "obch_jm", name }, { "obec", city } }); Logger.Debug($"{CorrelationId} - Generated Url for ES request: {url}"); Ares_odpovedi aresResponse = WebRequestHelper.XmlWebRequestSequence <Ares_odpovedi>( url); Logger.Debug($"{CorrelationId} - Got response from ARES. Time:{timer.Elapsed}"); timer.Restart(); ESResultModel result = BaseMapper.MapESData(aresResponse); Logger.Debug($"{CorrelationId} - Ares response mapped. Time:{timer.Elapsed}"); return(result); }
public RegistryResultModel GetCompanyData(string taxId = "", bool extended = false) { Logger.Debug($"{CorrelationId} - Request Registry Data for taxId:{taxId} started"); Stopwatch watch = Stopwatch.StartNew(); string url = PrepareUrl(new Dictionary <string, string> { { "ico", taxId } }); Logger.Debug($"{CorrelationId} - Url generated for taxId:{taxId} is {url}"); Ares_odpovedi result = WebRequestHelper.XmlWebRequestSequence <Ares_odpovedi>( url); Logger.Debug($"{CorrelationId} - Got Response from ARES. Time:{watch.Elapsed}"); watch.Restart(); RegistryResultModel model = extended ? BaseMapper.MapExtendedRegistryData(result) : BaseMapper.MapRegistryData(result); Logger.Debug($"{CorrelationId} - ARES response mapped. Time:{watch.Elapsed}"); return(model); }
public ESResultModel GetCompanyByTaxId(string taxId) { Logger.Debug($"{CorrelationId} - Request for taxId:{taxId} started"); Stopwatch timer = Stopwatch.StartNew(); Ares_odpovedi ares = taxId.Length != 8 ? null : WebRequestHelper.XmlWebRequestSequence <Ares_odpovedi>(BaseUrl + "?ico=" + taxId); ESResultModel result; if (ares != null && ares.Odpoved.Help == null) { result = new ESResultModel { ItemsFound = Convert.ToInt16(ares.Odpoved.Pocet_zaznamu), Items = ares.Odpoved.V.S.Select(x => new ESCompanyModel { Address = x.Jmn, Name = x.Ojm, TaxId = x.Ico }).ToList() }; } else if (ares?.Odpoved.Help != null) { Logger.Debug($"{CorrelationId} - ARES response contains Help node. taxId:{taxId}. HelpMsg:{ares.Odpoved.Help.R}"); result = new ESResultModel { ItemsFound = 0, Items = null, Errors = ares.Odpoved.Help.R }; } else { return(null); } Logger.Debug($"{CorrelationId} - Request finished, Time: {timer.Elapsed}"); return(result); }