Exemple #1
0
        public Report(string account, DateTime startDate)
        {
            _account   = account;
            _startDate = startDate;
            string query = getQueryWithAccount();

            query += @" and e.timestamp >= " + _db.getSqlDateTime(startDate);
            query += @" order by e.timestamp, o.id";
            DataTable dt = _db.runQuery(query);

            _endDate = DateTime.MaxValue;
            processRawData(dt);
        }
Exemple #2
0
        public static void createEIAEvents()
        {
            Dictionary <DateTime, DateTime> mappings = new Dictionary <DateTime, DateTime>();

            mappings.Add(new DateTime(2015, 10, 14, 10, 30, 0), new DateTime(2015, 10, 15, 11, 0, 0));  //Columbus
            mappings.Add(new DateTime(2015, 11, 11, 10, 30, 0), new DateTime(2015, 10, 15, 11, 0, 0));  //Veterans
            mappings.Add(new DateTime(2016, 1, 20, 10, 30, 0), new DateTime(2016, 1, 21, 11, 0, 0));    //Martin Luther King Jr.
            mappings.Add(new DateTime(2016, 2, 17, 10, 30, 0), new DateTime(2016, 2, 18, 11, 0, 0));    //Presidents
            mappings.Add(new DateTime(2016, 6, 1, 10, 30, 0), new DateTime(2016, 6, 2, 11, 0, 0));      //Memorial
            mappings.Add(new DateTime(2016, 7, 6, 10, 30, 0), new DateTime(2016, 7, 7, 11, 0, 0));      //Independence
            mappings.Add(new DateTime(2016, 9, 7, 10, 30, 0), new DateTime(2016, 9, 8, 11, 0, 0));      //Labor
            mappings.Add(new DateTime(2016, 10, 12, 10, 30, 0), new DateTime(2016, 10, 13, 11, 0, 0));  //Columbus
            mappings.Add(new DateTime(2016, 12, 28, 10, 30, 0), new DateTime(2016, 12, 29, 11, 0, 0));  //Christmas
            mappings.Add(new DateTime(2017, 1, 4, 10, 30, 0), new DateTime(2017, 1, 5, 11, 0, 0));      //New Year's
            mappings.Add(new DateTime(2017, 1, 18, 10, 30, 0), new DateTime(2017, 1, 19, 11, 0, 0));    //Martin Luther king
            mappings.Add(new DateTime(2017, 2, 22, 10, 30, 0), new DateTime(2017, 2, 23, 11, 0, 0));    //President's
            mappings.Add(new DateTime(2017, 5, 31, 10, 30, 0), new DateTime(2017, 6, 1, 11, 0, 0));     //Memorial
            mappings.Add(new DateTime(2017, 7, 5, 10, 30, 0), new DateTime(2017, 7, 6, 11, 0, 0));      //Independence
            mappings.Add(new DateTime(2017, 9, 6, 10, 30, 0), new DateTime(2017, 9, 7, 11, 0, 0));      //Labor
            mappings.Add(new DateTime(2017, 10, 11, 10, 30, 0), new DateTime(2017, 10, 12, 11, 0, 0));  //Columbus
            mappings.Add(new DateTime(2017, 12, 27, 10, 30, 0), new DateTime(2017, 12, 28, 11, 0, 0));  //Christmas
            mappings.Add(new DateTime(2018, 1, 3, 10, 30, 0), new DateTime(2018, 1, 4, 11, 0, 0));      //New Year's

            DateTime startDate = new DateTime(2015, 10, 14);
            DateTime endDate   = new DateTime(2018, 1, 5);
            DBAccess db        = DBAccess.instance;

            db.runNonQuery("delete from events where name='EIA Report'");
            List <DateTime> dates = new List <DateTime>();
            DateTime        d     = startDate.Date;

            while (d.DayOfWeek != DayOfWeek.Wednesday)
            {
                d = d.AddDays(1);
            }
            d = d.AddHours(10);
            d = d.AddMinutes(30);
            while (d.Date <= endDate)
            {
                dates.Add(mappings.ContainsKey(d) ? mappings[d] : d);
                d = d.AddDays(7);
            }
            foreach (DateTime dt in dates)
            {
                db.runNonQuery("insert into events values ('EIA Report', " + db.getSqlDateTime(dt) + ",'')");
            }
        }