Ignore:
Timestamp:
Aug 17, 2010, 8:50:19 AM (14 years ago)
Author:
Sam Habiel
Message:

CGAVDocument contains changes for start day of grid based on weekday locale and colummns
CGAVView: Shortcut keys; correct updating when number of columns is changed in grid
CGDocument: changes for start day of grid. Modified algorithm.
DAccessTemplate: Takes any weekday now for applying a template, not just Monday. Then calculation of start day is done in CGAVView based on locale in the same algorithm that the rest of the GUI uses.
DAppointPage: Now says Mobile/Cell instead of Cell Phone.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs

    r908 r913  
    670670            // Week start based on thread locale
    671671            int nStartWeekDay = (int)System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
     672            // Current Day
    672673            int nWeekDay = (int) SelectedDate.DayOfWeek; //0 == Sunday
    673674
     
    676677                        TimeSpan ts = new TimeSpan(nWeekDay - nOff,0,0,0); //d,h,m,s
    677678
    678                         if (m_nColumnCount == 1)
     679            // if ts is negative, we will jump to the next week in the logic.
     680            // to show the correct week, add 7. Confusing, I know.
     681            if (ts < new TimeSpan() ) ts = ts + new TimeSpan(7,0,0,0);
     682
     683                        if (m_nColumnCount == 1) // if one column start and end on the same day.
    679684                        {
    680685                                ts = new TimeSpan(0,23,59,59);
    681686                                WeekStartDay = SelectedDate;
    682                         }
    683                         else
    684                         {
    685                                 WeekStartDay = SelectedDate - ts;
    686                                 if (m_nColumnCount == 7)
    687                                 {
    688                                         ts = new TimeSpan(1,0,0,0);
    689                                         WeekStartDay -= ts;
    690                                 }
    691                                 int nEnd = (m_nColumnCount == 7) ? 1 : 3;
    692                                 ts = new TimeSpan((7* nWeeks) - nEnd, 23, 59,59);
    693                         }
    694                         WeekEndDay = WeekStartDay + ts;
     687                WeekEndDay = WeekStartDay + ts;
     688                        }
     689            else if (m_nColumnCount == 5 || m_nColumnCount == 0) // if 5 column start (or default) at the 2nd day of this week and end in 4:23:59:59 days.
     690            {
     691                // if picked day is start of week (Sunday in US), start in the next day since that's the first day of work week
     692                // else, just substract the calculated time span to get to the start of week (first work day)
     693                WeekStartDay = (nWeekDay == nStartWeekDay) ? SelectedDate + new TimeSpan(1,0,0,0): SelectedDate - ts;
     694                // End day calculation
     695                int nEnd = 3;
     696                ts = new TimeSpan((7 * nWeeks) - nEnd, 23, 59, 59);
     697                WeekEndDay = WeekStartDay + ts;
     698            }
     699            else // if 7 column start at the 1st day of this week and end in 6:23:59:59 days.
     700            {
     701                // if picked day is start of week, use that. Otherwise, go to the fist work day and substract one to get to start of week.
     702                WeekStartDay = (nWeekDay == nStartWeekDay) ? SelectedDate : SelectedDate - ts - new TimeSpan(1,0,0,0);
     703                // End day calculation
     704                int nEnd = 1;
     705                ts = new TimeSpan((7 * nWeeks) - nEnd, 23, 59, 59);
     706                WeekEndDay = WeekStartDay + ts;
     707            }
     708
    695709                        bool bRet = (( WeekStartDay.Date != OldStartDay.Date) || (WeekEndDay.Date != OldEndDay.Date));
    696710                        return bRet;
Note: See TracChangeset for help on using the changeset viewer.