Esempio n. 1
0
        static void workInit()
        {
            StockQuery query = new StockQuery();
            List<Task> taskList = new List<Task>();

            taskList.Add(new Task(() => { query.QueryDaliyWork(); }));
            foreach (var item in taskList)
            {
                item.Start();
            }
            Task.WaitAll(taskList.ToArray());
        }
Esempio n. 2
0
        static void dailyInit()
        {
            StockQuery query = new StockQuery();
            List<Task> taskList = new List<Task>();

            taskList.Add(new Task(() => { query.QueryBroker(); }));
            taskList.Add(new Task(() => { query.QueryBrokerBranch(); }));
            taskList.Add(new Task(() => { query.QueryCompany(); }));

            foreach (var item in taskList)
            {
                item.Start();
            }

            Task.WaitAll(taskList.ToArray());

            taskList.Clear();
            taskList.Add(new Task(() => { query.QueryDaliyWork(); }));

            foreach (var item in taskList)
            {
                item.Start();
            }

            Task.WaitAll(taskList.ToArray());
        }
Esempio n. 3
0
        private void MainWork_DoWork(object sender, DoWorkEventArgs e)
        {
            StockQuery query = new StockQuery();
            List<Task> taskList = new List<Task>();

            // 檢查是否為交易日

            // Step 1. Query Basic Data
            taskList.Add(new Task(() => { query.QueryBroker(); }));
            taskList.Add(new Task(() => { query.QueryBrokerBranch(); }));
            taskList.Add(new Task(() => { query.QueryCompany(); }));

            foreach (var item in taskList)
            {
                item.Start();
            }

            Task.WaitAll(taskList.ToArray());
            taskList.Clear();

            // Step 2. Query Stock Summary
            taskList.Add(new Task(() => { query.QueryDaliyWork(); }));

            foreach (var item in taskList)
            {
                item.Start();
            }

            Task.WaitAll(taskList.ToArray());

            // Check Progress
            // Daily Settlement
            // Daily Rate
            // Weekly Rate
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            MyEnum workType;
            StockQuery query = new StockQuery();

            if (args.Length > 0)
            {
                Logger("---------------START---------------");
                if (Enum.TryParse(args[0], true, out workType) == true)
                {
                    switch (workType)
                    {
                        case MyEnum.Stage1:
                            StockUtility util = new StockUtility();

                            Logger("Reset");
                            util.Reset();

                            //Logger("QueryBroker");
                            //query.QueryBroker();

                            //Logger("QueryBrokerBranch");
                            //query.QueryBrokerBranch();

                            //Logger("QueryCompany");
                            //query.QueryCompany();

                            Logger("QueryDaliyWork");
                            query.QueryDaliyWork();

                            Logger("QueryStockWarrant");
                            query.QueryStockWarrant();
                            break;

                        case MyEnum.Stage1A:
                            Logger("QueryDaliyWork");
                            query.QueryDaliyWork();

                            Logger("QueryStockWarrant");
                            query.QueryStockWarrant();
                            break;

                        case MyEnum.Stage2:
                        case MyEnum.Stage2A:
                            DetailQuery();
                            break;

                        case MyEnum.Stage3:
                        case MyEnum.Stage3A:
                            Logger("QueryOTC");
                            query.QueryOTC();

                            Logger("QueryOTCWarrant");
                            query.QueryOTCWarrant(DateTime.Now);
                            break;

                        default:
                            break;
                    }
                }
                Logger("----------------END----------------");
            }
        }
Esempio n. 5
0
 private void InitWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     StockQuery query = new StockQuery();
     switch ((int)e.Argument)
     {
         case 0:
             InitWorker.ReportProgress(0, "BasicData Start");
             query.QueryBroker();
             query.QueryBrokerBranch();
             query.QueryCompany();
             //
             query.QueryDaliyWork();
             query.QueryStockWarrant();
             InitWorker.ReportProgress(0, "BasicData Done");
             break;
         case 1:
             InitWorker.ReportProgress(0, "StockData Start");
             query.QueryDaliyWork();
             query.QueryStockWarrant();
             InitWorker.ReportProgress(0, "StockData Done");
             break;
         default:
             break;
     }
 }