Exemplo n.º 1
0
        private static void ReadExcel()
        {
            var repo = new YieldRepository(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sample.xlsx"));


            var date = new DateTime(2015, 4, 2);

            var meetings = repo.GetCopomMeetings(date).ToArray();

            Debug.Assert(meetings.Length == 22);


            var di1s = repo.GetDI1s(date).ToArray();

            Debug.Assert(di1s.Length == 37);


            var from = date;
            var to   = date.AddDays(1);
            int days = repo.GetNetworkDays(from, to);

            Debug.Assert(days == 1);


            var yields = repo.BuildYield(date).ToArray();

            Debug.Assert(yields.Length == meetings.Length + di1s.Length + 1);
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            ReadExcel();

            //var repo = new YieldRepository(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sample.xlsx"));
            var repo = new YieldRepository("sample.xlsx");

            while (Console.ReadLine() != "q")
            {
                var clock  = Stopwatch.StartNew();
                var yields = repo.BuildYield(new DateTime(2015, 4, 2)).ToArray();

                Console.WriteLine($"ElapsedMilliseconds={clock.ElapsedMilliseconds}");
                //MinimizeSimple();

                var form = new Form();
                var grid = new DataGridView();
                form.Controls.Add(grid);
                grid.Dock = DockStyle.Fill;
                grid.AutoGenerateColumns = true;
                grid.DataSource          = yields;
                grid.ClipboardCopyMode   = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
                form.ShowDialog();
            }
        }