Ejemplo n.º 1
0
        public override void DoTask(TasksToDo task)
        {
            //ActionModel model = new ActionModel();
            if (task == TasksToDo.DownloadSingleAction)
            {
                try
                {
                    actionModel = GetSingleAction(DownloadActionName);
                }
                catch (Exception)
                {
                    NextProvider.DoTask(task);
                }

                if (actionModel.Name != null)
                {
                    Console.WriteLine($"Information downloaded from {ProviderName}");
                    Console.WriteLine($"Action name: {actionModel.Name} Date: {actionModel.Date} Maximum Price: {actionModel.MaximumPrice} Open Price: {actionModel.OpenPrice} Close Price: {actionModel.MinPrice} TKO: {actionModel.Tko} Trading Volume: {actionModel.TradingVolume}");
                    Logger.Instance.AppendLoggerMessage($"Information downloaded from: {ProviderName} Action Name: {actionModel.Name}");
                }
                else
                {
                    Console.WriteLine($"ERROR - {ProviderName} - dont have any information about this action or server not response");
                    Logger.Instance.AppendLoggerMessage($"ERROR - {ProviderName} - dont have any information about this action or server not response");
                    NextProvider.DoTask(task);
                }
            }
            else if (NextProvider != null)
            {
                NextProvider.DoTask(task);
            }
        }
Ejemplo n.º 2
0
        public override void DoTask(TasksToDo task)
        {
            if (task == TasksToDo.DownloadSingleAction)
            {
                HtmlDocument html = DownloadHtml(url);

                var model = GetSingleAction(DownloadActionName, html);
                Console.WriteLine($"Information downloaded from {ProviderName}");
                Console.WriteLine($"Action name: {model.Name} Date: {model.Date} Maximum Price: {model.MaximumPrice} Open Price: {model.OpenPrice} Close Price: {model.MinPrice} TKO: {model.Tko} Trading Volume: {model.TradingVolume}");
                Logger.Instance.AppendLoggerMessage($"Information downloaded from: {ProviderName} Action Name: {model.Name}");
            }
            else if (NextProvider != null)
            {
                NextProvider.DoTask(task);
                Logger.Instance.AppendLoggerMessage($"ERROR - {ProviderName} - dont have any information about this action or server not response");
            }
        }