Ejemplo n.º 1
0
        public void GetAllNamesTest()
        {
            var supplier = TestSupplier.CreateNaked();
            var price    = supplier.Prices[0];

            priceItem = price.Costs.First().PriceItem;
            var format = price.Costs.Single().PriceItem.Format;

            format.PriceFormat   = PriceFormatType.NativeDelim;
            format.Delimiter     = ";";
            format.FName1        = "F2";
            format.FFirmCr       = "F3";
            format.FQuantity     = "F5";
            format.FRequestRatio = "F6";
            var costFormRule = price.Costs.Single().FormRule;

            costFormRule.FieldName = "F4";

            session.Save(price);
            Close();

            File.Copy(Path.GetFullPath(@"..\..\Data\222.txt"), Path.Combine(basepath, priceItem.Id + ".txt"));

            var item  = PriceProcessItem.GetProcessItem(priceItem.Id);
            var names = item.GetAllNames();

            Assert.That(names.Count(), Is.EqualTo(35));
        }
        public void Setup()
        {
            prices = new List <TestPrice>();
            using (new SessionScope()) {
                var supplier = TestSupplier.Create();
                var price    = supplier.Prices[0];
                var cost     = price.Costs[0];
                cost.Name = "116";
                priceItem = cost.PriceItem;
                priceItem.Format.PriceFormat = PriceFormatType.FarmaimpeksXml;
                price.SaveAndFlush();
                prices.Add(price);

                price.CreateAssortmentBoundSynonyms("Аспирин-С №10 таб.шип.", "Bayer AG, Франция");
                price.CreateAssortmentBoundSynonyms("Абактал 400мг №10 таб.п/о", "Lek, Словения");

                price = new TestPrice(supplier)
                {
                    CostType      = CostType.MultiColumn,
                    ParentSynonym = price.Id,
                };
                cost      = price.Costs[0];
                cost.Name = "2";
                price.SaveAndFlush();
                supplier.Maintain();
                prices.Add(price);
            }
        }
Ejemplo n.º 3
0
        protected void CheckErrorMessage(TestPriceItem priceItem, string etalonMessage)
        {
            var query   = String.Format(@"select ShortErrorMessage from `logs`.downlogs where PriceItemId = {0}", priceItem.Id);
            var message = String.Empty;

            With.Connection(connection => { message = MySqlHelper.ExecuteScalar(connection, query).ToString(); });
            Assert.That(message.Contains(etalonMessage), Is.True);
        }
Ejemplo n.º 4
0
        public void Setup()
        {
            data = new DataTable();
            data.Columns.Add("MNFGRNX");
            data.Columns.Add("MNFNX");
            data.Columns.Add("MNFNMR");
            data.Columns.Add("COUNTRYR");
            data.Columns.Add("DRUGTXT");
            data.Columns.Add("SERNM");
            data.Columns.Add("LETTERSNR");
            data.Columns.Add("LETTERSDT", typeof(DateTime));
            data.Columns.Add("LABNMR");
            data.Columns.Add("QUALNMR");

            data.Rows.Add(null, null,
                          "Биохимик ОАО", null,
                          "Диклофенак р-р для в/м введ 25 мг/мл  (ампулы) 3 мл №10",
                          "171209",
                          "04И-851/10",
                          "02/09/2010",
                          null,
                          "Отзыв предприятием-производителем. Описание.Цветность.");

            data.Rows.Add(null, null,
                          "Уралбиофарм ОАО", null,
                          "Мукалтин табл. 50мг (упак. ячейковые контурные) № 10",
                          "151109",
                          "04И-849/10",
                          "02/09/2010",
                          null,
                          "Описание. Средняя масса. Отклонение от средней массы.");

            var supplier = TestSupplier.CreateNaked(session);

            price           = supplier.Prices[0];
            price.PriceType = PriceType.Assortment;
            priceItem       = price.Costs[0].PriceItem;
            var format = priceItem.Format;

            format.PriceFormat = PriceFormatType.NativeDbf;
            format.FName1      = "DRUGTXT";
            format.FFirmCr     = "MNFNMR";
            format.FCode       = "SERNM";
            format.FCodeCr     = "LETTERSNR";
            format.FNote       = "LETTERSDT";
            format.FDoc        = "QUALNMR";
            session.Save(price);
            session.Save(format);

            realPrice           = session.Load <Price>(price.Id);
            realPrice.IsRejects = true;
            session.Save(realPrice);

            price.CreateAssortmentBoundSynonyms(session,
                                                "Диклофенак р-р для в/м введ 25 мг/мл (ампулы) 3 мл №10", "Биохимик ОАО");
        }
        protected void CreatePrice()
        {
            supplier  = TestSupplier.CreateNaked(session);
            price     = supplier.Prices[0];
            priceItem = price.Costs.First().PriceItem;
            Configure(price);

            session.Save(supplier);
            Flush();
        }
Ejemplo n.º 6
0
        public void DeleteCostColumn()
        {
            TestPrice price;

            using (var scope = new TransactionScope(OnDispose.Rollback)) {
                price = CreateTestSupplierWithPrice();
                scope.VoteCommit();
            }
            var prices = FillPrices();
            var rows   = prices.Select(String.Format("PFirmCode = {0}", price.Supplier.Id));

            Assert.That(rows.Count(), Is.EqualTo(2));
            rows = prices.Select(String.Format("PFirmCode = {0} and PCostType = 1 and PIsParent = 0", price.Supplier.Id));
            Assert.That(rows.Count(), Is.EqualTo(1));
            rows[0].Delete();

            var changes = prices.GetChanges();

            With.Transaction((c, t) => {
                var mcmdDPrice = new MySqlCommand();
                var daPrice    = new MySqlDataAdapter();

                mcmdDPrice.CommandText = "usersettings.DeleteCost";
                mcmdDPrice.CommandType = CommandType.StoredProcedure;
                mcmdDPrice.Parameters.Clear();
                mcmdDPrice.Parameters.Add("?inCostCode", MySqlDbType.Int64, 0, "PCostCode");
                mcmdDPrice.Parameters["?inCostCode"].Direction = ParameterDirection.Input;

                mcmdDPrice.Connection = c;
                daPrice.DeleteCommand = mcmdDPrice;
                daPrice.TableMappings.Clear();
                daPrice.TableMappings.Add("Table", prices.TableName);

                daPrice.Update(changes);
                prices.AcceptChanges();
            });


            using (var scope = new TransactionScope(OnDispose.Rollback)) {
                var resprice = TestPrice.Find(price.Id);
                Assert.That(resprice.Costs.Count, Is.EqualTo(1));

                var cost = TestPriceCost.TryFind(costForDelete.Id);
                Assert.That(cost, Is.EqualTo(null));

                var item = TestPriceItem.TryFind(costForDelete.PriceItem.Id);
                Assert.That(item, Is.EqualTo(null));

                var source = TestPriceSource.TryFind(costForDelete.PriceItem.Source.Id);
                Assert.That(source, Is.EqualTo(null));

                var format = TestFormat.TryFind(costForDelete.PriceItem.Format.Id);
                Assert.That(format, Is.EqualTo(null));
            }
        }
        public void SetUp()
        {
            var supplier = TestSupplier.CreateNaked();

            _price           = supplier.Prices[0];
            _price.PriceType = PriceType.Assortment;
            Save(_price);
            _priceItem = _price.Costs[0].PriceItem;
            _priceItem.Format.PriceFormat = PriceFormatType.FarmaimpeksOKPFormalizer;
            Save(_priceItem);
        }
        public void SetUp()
        {
            TestHelper.RecreateDirectories();
            priceProcessor = factory.CreateChannel();

            supplier = TestSupplier.Create();

            var price = supplier.Prices[0];

            price.SetFormat(PriceFormatType.NativeDbf);
            priceItem = price.Costs[0].PriceItem;
            source    = priceItem.Source;
            priceItem.Format.Save();
        }
        protected TestFormat Configure(TestPrice okpPrice)
        {
            priceItem = okpPrice.Costs[0].PriceItem;
            var rules = priceItem.Format;

            rules.PriceFormat       = PriceFormatType.NativeDelim;
            rules.Delimiter         = ";";
            rules.FName1            = "F1";
            rules.FFirmCr           = "F2";
            rules.FQuantity         = "F3";
            rules.FOptimizationSkip = "F6";

            okpPrice.Costs.Single().FormRule.FieldName = "F4";
            return(rules);
        }
Ejemplo n.º 10
0
        public void Setup()
        {
            TestHelper.RecreateDirectories();

            supplier                     = TestSupplier.Create();
            priceItem                    = supplier.Prices[0].Costs[0].PriceItem;
            source                       = priceItem.Source;
            source.SourceType            = PriceSourceType.Http;
            source.PricePath             = "www.ru";
            source.PriceMask             = "index.html";
            source.ExtrMask              = "index.html";
            priceItem.Format.PriceFormat = PriceFormatType.NativeDbf;
            priceItem.Format.Save();

            handler = new T();

            handler.CreateDirectoryPath();
        }
Ejemplo n.º 11
0
        public void Respect_file_extension()
        {
            var supplier = TestSupplier.CreateNaked();
            var price    = supplier.Prices[0];

            priceItem = price.Costs.First().PriceItem;
            var format = price.Costs.Single().PriceItem.Format;

            format.PriceFormat = PriceFormatType.UniversalXml;
            session.Save(price);
            Close();

            File.Copy(Path.GetFullPath(@"..\..\Data\222.txt"), Path.Combine(basepath, priceItem.Id + ".txt"));
            File.Copy(Path.GetFullPath(@"..\..\Data\Respect_file_extension.xml"), Path.Combine(basepath, priceItem.Id + ".xml"));
            var item  = PriceProcessItem.GetProcessItem(priceItem.Id);
            var names = item.GetAllNames();

            Assert.That(names.Count(), Is.EqualTo(2));
        }
        public void Setup()
        {
            xml = @"<Price>
	<Item>
		<Code>109054</Code>
		<Product>Маска трехслойная на резинках медицинская Х3 Инд. уп. И/м</Product>
		<Producer>Вухан Лифарма Кемикалз Ко</Producer>
		<Volume>400</Volume>
		<Quantity>296</Quantity>
		<Period>01.01.2013</Period>
		<VitallyImportant>0</VitallyImportant>
		<NDS>10</NDS>
		<RequestRatio>20</RequestRatio>
		<Cost>
			<Id>PRICE6</Id>
			<Value>10.0</Value>
			<MinOrderCount>20</MinOrderCount>
		</Cost>
		<Cost>
			<Id>PRICE1</Id>
			<Value>10.0</Value>
			<MinOrderCount>20</MinOrderCount>
		</Cost>
	</Item>
</Price>
";

            var supplier = TestSupplier.Create(session);

            price     = supplier.Prices[0];
            priceItem = price.Costs[0].PriceItem;
            var format = priceItem.Format;

            format.PriceFormat = PriceFormatType.UniversalXml;
            format.Save();

            price.CreateAssortmentBoundSynonyms("Маска трехслойная на резинках медицинская Х3 Инд. уп. И/м", "Вухан Лифарма Кемикалз Ко");
            price.Save();
        }
Ejemplo n.º 13
0
        public TestPrice CreateTestSupplierWithPrice()
        {
            var priceItem = new TestPriceItem {
                Source = new TestPriceSource {
                    SourceType = PriceSourceType.Email,
                },
                Format = new TestFormat(),
            };

            var priceItem2 = new TestPriceItem {
                Source = new TestPriceSource {
                    SourceType = PriceSourceType.Email,
                },
                Format = new TestFormat(),
            };

            var supplier = TestSupplier.CreateNaked();
            var price    = supplier.Prices[0];

            price.CostType  = CostType.MultiFile;
            price.PriceName = "test";
            price.Costs.Clear();

            var cost = price.NewPriceCost(priceItem, "");

            cost.Name = "test base";
            price.RegionalData[0].BaseCost = cost;

            costForDelete      = price.NewPriceCost(priceItem2, "");
            costForDelete.Name = "test";

            price.Costs[0].PriceItem.Format.PriceFormat = PriceFormatType.NativeDbf;
            price.Costs[1].PriceItem.Format.PriceFormat = PriceFormatType.NativeDbf;

            price.SaveAndFlush();

            return(price);
        }