コード例 #1
0
 public void Update(INN inn, ApiMethod method, XmlDocument doc)
 {
     cleared     = false;
     Inn         = inn;
     this.method = method;
     document    = doc;
 }
コード例 #2
0
 public void Clear(INN inn, ApiMethod method)
 {
     foreach (var cache in caches)
     {
         cache.Clear(inn, method);
     }
 }
コード例 #3
0
        public static INN CreateUnsafe(string str)
        {
            var req = new INN();

            req.isOGRN = str.Length > 12;
            req.value  = str;
            return(req);
        }
コード例 #4
0
 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);
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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
コード例 #7
0
 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));
     }
 }
コード例 #8
0
ファイル: Company.cs プロジェクト: Avel7884/FocusScoring
 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();
     }
 }
コード例 #9
0
        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);
        }
コード例 #10
0
 public void Clear(INN inn, ApiMethod method)
 {
     File.Delete($"{cacheFolder}/{inn}.{method}");
 }
コード例 #11
0
        }  //TODO cache fluency

        public void Update(INN inn, ApiMethod method, XmlDocument doc)
        {
            doc.Save($"{cacheFolder}/{inn}.{method}");
        }
コード例 #12
0
 public void Clear(INN inn, ApiMethod method)
 {
     cleared = true;
 }
コード例 #13
0
 public void Clear(INN inn, ApiMethod method)
 {
 }
コード例 #14
0
 public void Update(INN inn, ApiMethod method, XmlDocument doc)
 {
 }
コード例 #15
0
 public bool TryGetXml(INN inn, ApiMethod method, out XmlDocument document)
 {
     document = new XmlDocument();
     return(!availableMethods.Contains(method));
 }
コード例 #16
0
 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));
 }