コード例 #1
0
        public IList <string> GetAllNames()
        {
            IList <string> names;
            var            tempPath = Path.GetTempPath() + (int)DateTime.Now.TimeOfDay.TotalMilliseconds + "_" +
                                      PriceItemId.ToString() + "\\";
            var tempFileName = tempPath + PriceItemId + Path.GetExtension(FilePath);

            if (Directory.Exists(tempPath))
            {
                global::Common.Tools.FileHelper.DeleteDir(tempPath);
            }
            Directory.CreateDirectory(tempPath);
            try {
                try {
                    var workPrice = PricesValidator.Validate(FilePath, tempFileName, (uint)PriceItemId);
                    workPrice.Downloaded = Downloaded;
                    names = workPrice.GetAllNames();
                }
                catch (WarningFormalizeException) {
                    return(null);
                }
            }
            finally {
                Directory.Delete(tempPath, true);
            }

            return(names);
        }
コード例 #2
0
        private void Formalize()
        {
            FlushAndCommit();
            var file = Path.GetTempFileName();

            Dbf.Save(data, file);
            var formalizer = PricesValidator.Validate(file, Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()),
                                                      priceItem.Id);

            formalizer.Formalize();
        }
コード例 #3
0
        private void AssertFormalization()
        {
            CreateDefaultSynonym();
            formalizer = PricesValidator.Validate(file, "test1" + Path.GetExtension(file), priceItem.Id);
            Formalize();

            var cores = session.Query <TestCore>().Where(c => c.Price == price).ToList();

            Assert.That(cores.Count, Is.EqualTo(3));
            Assert.That(cores[0].ProductSynonym.Name, Is.EqualTo("9 МЕСЯЦЕВ КРЕМ Д/ПРОФИЛАКТИКИ И КОРРЕКЦИИ РАСТЯЖЕК 150МЛ"));
            Assert.That(cores[0].OptimizationSkip, Is.True);
        }
コード例 #4
0
        private void Formalize()
        {
            FlushAndCommit();

            file = Path.GetTempFileName();
            File.WriteAllText(file, xml);
            var formalizer = PricesValidator.Validate(file, Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()),
                                                      priceItem.Id);

            formalizer.Downloaded = true;
            formalizer.Formalize();
        }
        public void FormalizeTest()
        {
            Reopen();
            var formalizer = PricesValidator.Validate(@"..\..\Data\FarmimpeksOKP.xml", Path.GetTempFileName(), _priceItem.Id);

            formalizer.Formalize();
            formalizer.Formalize();

            var cores = session.Query <TestCore>().Where(c => c.Price.Id == _price.Id).ToList();

            Assert.That(cores.Count, Is.EqualTo(4));
            Assert.That(cores.Any(c => c.CodeOKP == 931201));
        }
コード例 #6
0
        private void Formalize(string file)
        {
            var formalizer = PricesValidator.Validate(Path.Combine(@"..\..\Data\", file), Path.GetTempFileName(), priceItem.Id);

            formalizer.Formalize();
        }