Changeset 913 for Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs
- Timestamp:
- Aug 17, 2010, 8:50:19 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs
r908 r913 670 670 // Week start based on thread locale 671 671 int nStartWeekDay = (int)System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.FirstDayOfWeek; 672 // Current Day 672 673 int nWeekDay = (int) SelectedDate.DayOfWeek; //0 == Sunday 673 674 … … 676 677 TimeSpan ts = new TimeSpan(nWeekDay - nOff,0,0,0); //d,h,m,s 677 678 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. 679 684 { 680 685 ts = new TimeSpan(0,23,59,59); 681 686 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 695 709 bool bRet = (( WeekStartDay.Date != OldStartDay.Date) || (WeekEndDay.Date != OldEndDay.Date)); 696 710 return bRet;
Note:
See TracChangeset
for help on using the changeset viewer.