public void Update(INN inn, ApiMethod method, XmlDocument doc) { cleared = false; Inn = inn; this.method = method; document = doc; }
public void Clear(INN inn, ApiMethod method) { foreach (var cache in caches) { cache.Clear(inn, method); } }
public static INN CreateUnsafe(string str) { var req = new INN(); req.isOGRN = str.Length > 12; req.value = str; return(req); }
public static bool TryParse(string str, out INN req) { req = new INN(); if (!InnCheckSum(str)) { return(false); } req.isOGRN = str.Length > 12; req.value = str; return(true); }
public bool TryGetXml(INN inn, ApiMethod method, out XmlDocument document) { if (!cleared && Inn == inn && method == this.method) { document = this.document; return(true); } document = new XmlDocument(); return(false); }
public bool TryGetXml(INN inn, ApiMethod method, out XmlDocument document) { document = new XmlDocument(); var path = $"{cacheFolder}/{inn}.{method}"; if (!File.Exists(path)) { return(false); } document.Load(path); return(true); } //TODO cache fluency
public Company CreateFromInn(INN inn) { try { Exception = null; return(new Company(inn, paramDict, manager, enableScore)); } catch (Exception e) { Exception = e;//TODO make better message system return(new Company(inn, paramDict, manager, false)); } }
internal Company(INN inn, Dictionary <string, CompanyParameter> paramDict, FocusKeyManager manager = null, bool scoringNeeded = true) { //TODO remove singleton manager = manager ?? Settings.DefaultManager; access = manager.Access; scorer = manager.Scorer; Inn = inn; this.paramDict = paramDict; Score = -1; if (scoringNeeded) { MakeScore(); } }
public bool TryGetXml(INN inn, ApiMethod method, out XmlDocument document) { for (int i = 0; i < caches.Count; i++) { if (caches[i].TryGetXml(inn, method, out document)) { for (int j = 0; j < i; j++) { caches[j].Update(inn, method, document); } return(true); } } if (!source.TryGetXml(inn, method, out document)) { return(false); } foreach (var cache in caches) { cache.Update(inn, method, document); } return(true); }
public void Clear(INN inn, ApiMethod method) { File.Delete($"{cacheFolder}/{inn}.{method}"); }
} //TODO cache fluency public void Update(INN inn, ApiMethod method, XmlDocument doc) { doc.Save($"{cacheFolder}/{inn}.{method}"); }
public void Clear(INN inn, ApiMethod method) { cleared = true; }
public void Clear(INN inn, ApiMethod method) { }
public void Update(INN inn, ApiMethod method, XmlDocument doc) { }
public bool TryGetXml(INN inn, ApiMethod method, out XmlDocument document) { document = new XmlDocument(); return(!availableMethods.Contains(method)); }
public bool TryGetXml(INN inn, ApiMethod method, out XmlDocument document) { return(TryGetXml( $"https://focus-api.kontur.ru/api3/{GetMethodName(method)}?key={focusKey}&{inn.URL()}&xml", out document)); }