Beispiel #1
0
        static void Main(string[] args)
        {
            IParser ourParser = new Converter.Converter();
            string  path      = AppDomain.CurrentDomain.BaseDirectory;
            OptionsManager <DataAccessOptions> optionsManager = new OptionsManager <DataAccessOptions>(path, ourParser);
            LoggingOptions loggingOptions = new LoggingOptions();

            // Getting options using OptionsManager.
            loggingOptions.ConnectionOptions = optionsManager.GetOptions <ConnectionOptions>() as ConnectionOptions;
            SendingOptions    sendingOptions    = optionsManager.GetOptions <SendingOptions>() as SendingOptions;
            ConnectionOptions connectionOptions = optionsManager.GetOptions <ConnectionOptions>() as ConnectionOptions;
            ILogger           logger            = new Logger.Logger(loggingOptions, ourParser);

            ServiceLayer.ServiceLayer sl = new ServiceLayer.ServiceLayer(connectionOptions, ourParser);
            logger.Log(optionsManager.log);

            // Getting info from DB.
            logger.Log("Pulling of the data has been started...");
            var people = sl.GetPersonInfoList(200);

            logger.Log("Pulling of the data has been done successfully!");

            // Creating XMl file.
            XmlGenerator.XmlGenerator generator = new XmlGenerator.XmlGenerator(sendingOptions);
            generator.CreateXML(people);
            logger.Log("Xml file was created successfully");
        }
Beispiel #2
0
        static async Task Main(string[] args)
        {
            IParser parser = new Converter.Converter();
            string  path   = AppDomain.CurrentDomain.BaseDirectory;
            OptionsManager <DataAccessOptions> optionsManager = new OptionsManager <DataAccessOptions>(path, parser);
            LoggingOptions loggingOptions = new LoggingOptions();

            loggingOptions.ConnectionOptions = optionsManager.GetOptions <ConnectionOptions>() as ConnectionOptions;
            SendingOptions    sendingOptions    = optionsManager.GetOptions <SendingOptions>() as SendingOptions;
            ConnectionOptions connectionOptions = optionsManager.GetOptions <ConnectionOptions>() as ConnectionOptions;
            ILogger           logger            = new Logger.Logger(loggingOptions, parser);

            ServiceLayer.ServiceLayer sl = new ServiceLayer.ServiceLayer(connectionOptions, parser);
            List <PersonInfo>         people;

            XmlGenerator.XmlGenerator generator = new XmlGenerator.XmlGenerator(sendingOptions);

            logger.Log(optionsManager.log);

            var watch = System.Diagnostics.Stopwatch.StartNew();

            logger.Log("Pulling of the data has been started...");
            Console.WriteLine("Pulling of the data has been started...");
            people = await sl.GetPersonInfoListAsync(5000);

            Console.WriteLine("Pulling of the data has been done successfully!");
            watch.Stop();
            Console.WriteLine($"Total execution time: {watch.ElapsedMilliseconds}");
            logger.Log("Pulling of the data has been done successfully!");
            generator.CreateXML(people);
            logger.Log("Xml file was created successfully");
            Console.ReadLine();
        }
        /// <summary>
        /// Creates a new LogicLayer.
        /// </summary>
        /// <param name="sl">ServiceLayer component.</param>
        /// <param name="r">RobotCellLayer component.</param>
        /// <param name="da">DataAccess component.</param>
        public LogicLayer(CommService sl, RobotCell r, DA da)
        {
            const string fName = nameof(LogicLayer);

            Log.DebugEx(fName, "Construction BusinessLogic layer..");
            _service = sl;
            _robot   = r;
            _da      = da;
        }
Beispiel #4
0
        public void InitClasses()
        {
            ser = new ServiceLayer.ServiceLayer();
            rob = new RobotCellLayer.RobotCellLayer();
            da  = new DataAccess.DataAccess();
            rob.AddRobot("SIM", "SIM");
            logic = new LogicLayer.LogicLayer(ser, rob, da);

            var shelf = new Bottleshelf(10, 0);

            shelf.AddBottle(new Bottle("Vodka"));
            shelf.AddBottle(new Bottle("Vesi"));
            shelf.AddBottle(new Bottle("Mehu"));
            var queue = new OrderQueue();

            var kv = new Drink("Kossuvissy");

            Assert.IsTrue(kv.AddPortion("Vodka", 4));
            Assert.IsTrue(kv.AddPortion("Vesi", 10));

            var mehu = new Drink("Mehu");

            Assert.IsTrue(mehu.AddPortion("Mehu", 10));

            queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 1, 1, kv), 10));
            queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 2, 4, mehu), 10));
            queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 3, 3, kv), 10));
            queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 4, 1, kv), 10));

            var startarg = new StartArguments();

            startarg.BackupShelf  = shelf;
            startarg.Mode         = RunMode.Simulation;
            startarg.Beer         = false;
            startarg.Drinks       = true;
            startarg.Sparkling    = false;
            startarg.IdleActivity = new Activity(ActivityType.ProcessOrders);
            startarg.BacckupQueue = queue;

            var init = Task.Run(() => logic.Initialize(startarg, new CancellationToken()));

            init.Wait();
            Assert.IsTrue(init.Result);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            IConverter converter = new Converter.Converter();
            string     based     = AppDomain.CurrentDomain.BaseDirectory;
            OptionsManager <DataAccessOptions> optionsManager = new OptionsManager <DataAccessOptions>(based, converter);
            LoggingOptions    loggingOptions    = optionsManager.GetOptions <LoggingOptions>() as LoggingOptions;
            SendingOptions    sendingOptions    = optionsManager.GetOptions <SendingOptions>() as SendingOptions;
            ConnectionOptions connectionOptions = optionsManager.GetOptions <ConnectionOptions>() as ConnectionOptions;

            ServiceLayer.ServiceLayer sl     = new ServiceLayer.ServiceLayer(converter, connectionOptions);
            Logger.Logger             logger = new Logger.Logger(connectionOptions, converter);
            List <Human> people;

            logger.Log(optionsManager.logs);
            people = sl.GetHumanList(100);
            XmlGenerator generator = new XmlGenerator(sendingOptions);

            generator.CreateXML(people);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Configuration config;

            try
            {
                var configurationManager = new ConfigurationManager.ConfigurationManager(@"‪C:\Users\daniel\Desktop\config.json");
                config = configurationManager.GetConfiguration();
            }
            catch
            {
                config = new Configuration();
            }
            ServiceLayer.ServiceLayer sl   = new ServiceLayer.ServiceLayer($"Server={config.server};Database={config.dataBase};Trusted_Connection={config.trustedConnection};");
            List <Person>             list = sl.GetListOfPeople();

            XDocument xDoc = ListToXDoc(list);

            xDoc.Save(Path.Combine(config.ftpServer, "persons.xml"));
        }
Beispiel #7
0
 public DataAccess(ServiceLayer.ServiceLayer serviceLayer = null)
 {
     _service = serviceLayer;
 }