Esempio n. 1
0
        private void LoadCalendarDays()
        {
            DateTime OpenDate;
            String   SpecialItems = "";
            Boolean  IsCommodity  = false;

            pbCalendar1.Dates.Clear();
            pbCalendar2.Dates.Clear();
            pbCalendar3.Dates.Clear();
            pbCalendar4.Dates.Clear();
            clsDaysOpen.openWhere("date between '" + pbCalendar1.MinDate.Date + "' AND '" + pbCalendar1.MaxDate.Date + "'");
            for (int i = 0; i < clsDaysOpen.RowCount; i++)
            {
                OpenDate     = clsDaysOpen.DSet.Tables[0].Rows[i].Field <DateTime>("Date");
                SpecialItems = clsDaysOpen.DSet.Tables[0].Rows[i].Field <String>("SpecialItems");
                if (SpecialItems == null)
                {
                    SpecialItems = "";
                }
                else if (SpecialItems != "")
                {
                    SpecialItems = "Spcl";
                }
                IsCommodity = clsDaysOpen.DSet.Tables[0].Rows[i].Field <Boolean>("IsCommodity");
                AddDateToCalendar(OpenDate, IsCommodity, SpecialItems);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Goes through the top 20 dates, finds the one closest to today
        /// without going over and sets the SvcDate to that date
        /// </summary>
        private void findSvcDate()
        {
            DateTime svcDate = DateTime.Today;

            for (int i = clsDaysOpen.RowCount - 1; i > 0; i--)
            {
                DateTime currPointer = DateTime.Parse(clsDaysOpen.DSet.Tables[0].Rows[i]["Date"].ToString());
                if (currPointer <= DateTime.Today)
                {
                    svcDate = currPointer;
                }
            }

            clsDaysOpen.openWhere(" Date = '" + svcDate + "'");
            beginMonth = new DateTime(svcDate.Year, svcDate.Month, 1);
            endMonth   = new DateTime(svcDate.Year, svcDate.Month,
                                      DateTime.DaysInMonth(svcDate.Year, svcDate.Month));
        }