예제 #1
0
        static void Main(string[] args)
        {
            string  path  = @"D:\sorter\source\fullcatalog.yml";
            IdStore store = new IdStore();

            using (Stream fs = File.Open(path, FileMode.Open, FileAccess.ReadWrite))
            {
                XmlReader rdr = XmlReader.Create(fs);
                store.GetOfferList(rdr);
                foreach (string key in store.CategoryAndOffers.Keys)
                {
                    foreach (var item in store.CategoryAndOffers[key])
                    {
                        Console.WriteLine(key + "   " + item); ///
                    }
                }
            }
            Console.WriteLine("end");
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            string course = "0,033";

            FurcomModel            fur        = new FurcomModel(@"D:\FurcomBase.xml");
            GammaModel             gam        = new GammaModel(@"D:\testbig.yml");
            PriceCheckerController controller = new PriceCheckerController(fur, gam);

            Console.WriteLine("Введите путь к счету");
            string filepath = Console.ReadLine();

            Console.WriteLine("Введите пeть куда сохранить счет");
            string pathtosave = Console.ReadLine();

            controller.MakeTheCheckedBill(@filepath, course, @pathtosave);



            string  pathToCategories = "";
            string  result           = "";
            IdStore store            = new IdStore();

            while (true)
            {
                Console.WriteLine("a - получить список категорий ; s - получить эксель для загрузку в joomla ");
                Console.WriteLine("Введите букву");
                string choosenLiter = Console.ReadLine();

                switch (choosenLiter)
                {
                case "a":
                    Console.WriteLine("введите путь к данным с категориями");
                    pathToCategories = @Console.ReadLine();
                    Console.WriteLine("где сохранить документ эксель (путь+название.xlsx)");
                    result = @Console.ReadLine();
                    store.ExtractIdData(pathToCategories);
                    FileInfo categoryfile = new FileInfo(result);
                    store.CreateListOfCategoriesPath(categoryfile);
                    break;

                case "s":
                    Console.WriteLine("введите путь к данным с категориями");
                    pathToCategories = @Console.ReadLine();
                    Console.WriteLine("введите путь к данным без категорий(только товары)");
                    string pathToOffers = @Console.ReadLine();
                    Console.WriteLine("где сохранить документ эксель (путь+название.xlsx)");
                    result = @Console.ReadLine();
                    store.ExtractIdData(pathToCategories);
                    ProductExtractor extr = new ProductExtractor(store);
                    extr.Extract(pathToOffers);
                    extr.RemoveUnavalaibleProducts();
                    // из эксел файла я беру offerid и название товара без цвет
                    // в yml  есть только название товара с цветом agregatename = offerid + (offername - color).
                    extr.GetAggregateName(@"D:\c# excel\solution\sorterNew-master\yml\newfull.xlsx");
                    extr.GetCategories();
                    ExcelManipulator creator = new ExcelManipulator(extr.Offers);
                    creator.SaveToExcellForJoomla(result);
                    break;

                default:
                    break;
                }
            }

            //string path2 = @"D:\c# excel\solution\sorterNew-master\yml\full.yml";
            //IdStore store = new IdStore();
            //string path3 = @"D:\c# excel\solution\sorterNew-master\yml\fullcatalog.yml";
            // store.ExtractIdData(path3);
            //FileInfo categoryfile = new FileInfo(@"D:\c# excel\solution\sorterNew-master\yml\categoryfile.xlsx");
            //store.CreateListOfCategoriesPath(categoryfile);



            //ProductExtractor extr = new ProductExtractor(store);
            //extr.Extract(path2);
            //extr.RemoveUnavalaibleProducts();
            //extr.GetAggregateName(@"D:\c# excel\solution\sorterNew-master\yml\newfull.xlsx"); // было savetry.xlsx
            //extr.GetCategories();
            //ExcelManipulator creator = new ExcelManipulator(extr.Offers);
            //string MyFile = @"D:\c# excel\target.xlsx";
            // creator.SaveToExcellForJoomla(MyFile);
            //Console.WriteLine("end");
            Console.ReadLine();
        }
 }                                     //= new List<string>();
 public ProductExtractor(IdStore idstore)
 {
     _idstore = idstore;
     Log      = new List <string>();
 }