public virtual void UpdateMonthlyTimesheets(MonthlyTimesheets monthlyTimesheets)
        {
            this.Clear();

            // Note: Must populate property MonthlyTimesheets AFTER Clear() is called because
            // Clear() nulls out MonthlyTimesheets.
            this.MonthlyTimesheets = monthlyTimesheets;

            int y = 0;

            foreach (Timesheet timesheet in this.MonthlyTimesheets)
            {
                TimesheetDetailListView timesheetDetailListView = new TimesheetDetailListView(timesheet);

                timesheetDetailListView.TimesheetDetailUpdatingEvent +=
                    new EventHandler <TimesheetDetailListView.TimesheetDetailEventArgs>(this.OnTimesheetUpdating);
                timesheetDetailListView.TimesheetDetailUpdatedEvent +=
                    new EventHandler <TimesheetDetailListView.TimesheetDetailEventArgs>(this.OnTimesheetUpdated);

                Controls.Add(timesheetDetailListView);

                timesheetDetailListView.Dock     = DockStyle.Top;
                timesheetDetailListView.Location = new Point(0, y + 1);

                timesheetDetailListView.BringToFront();

                y += timesheetDetailListView.Height;
            }

            this.AutoScroll   = true;
            this.AutoSize     = true;
            this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
 public void SelectTimesheet(bool select)
 {
     if (select)
     {
         this.BackColor = TimesheetDetailListView.SelectedColor;
     }
     else
     {
         this.BackColor = TimesheetDetailListView.GetDefaultTimesheetBackColor(this.Timesheet);
     }
 }
        /// <summary>
        /// Scrolls the Timesheet in to view.
        /// </summary>
        /// <param name="timesheet">The Timesheet to scroll in to view.</param>
        public void ScrollInToView(Timesheet timesheet, bool selectTimesheet)
        {
            this.AutoScroll = false;

            TimesheetDetailListView timesheetDetailListView = GetTimesheetDetailListView(timesheet);
            Point point = this.ScrollToControl(timesheetDetailListView);

            this.AutoScrollPosition = point;
            this.TopLevelControl.AutoScrollOffset = point;
            this.SetDisplayRectLocation(point.X, point.Y);

            this.AutoScroll = true;

            if (selectTimesheet)
            {
                this.SelectTimesheet(timesheet);
            }
        }
        // Construction/Initialization
        // --------------------------------------------------------------------------
        #region Construction/Initialization
        public TimesheetDetailListView(Timesheet timesheet)
        {
            InitializeComponent();

            this.Timesheet = timesheet;

            InitializeListView();

            // Scroll options...
            this.AutoSize     = true;
            this.AutoSizeMode = AutoSizeMode.GrowAndShrink;

            // Header...
            if (timesheet.IsSplitTimesheet)
            {
                m_header.Text = string.Format("Week {0} ({1} through {2}, {3} of 2)",
                                              timesheet.WeekNumber,
                                              Dates.GetMMDDYYYY(timesheet.StartDate.Date),
                                              Dates.GetMMDDYYYY(timesheet.EndDate.Date),
                                              timesheet.SplitIndex
                                              );
            }
            else
            {
                m_header.Text = string.Format("Week {0} ({1} through {2})",
                                              timesheet.WeekNumber,
                                              Dates.GetMMDDYYYY(timesheet.StartDate.Date),
                                              Dates.GetMMDDYYYY(timesheet.EndDate.Date)
                                              );
            }

            // Background color...
            if (this.Timesheet.IsSplitTimesheet)
            {
                this.BackColor = TimesheetDetailListView.SplitColor;
            }
            else
            {
                this.BackColor = TimesheetDetailListView.GetDefaultTimesheetBackColor(this.Timesheet);
            }
        }
 protected void OnTimesheetUpdating(object sender, TimesheetDetailListView.TimesheetDetailEventArgs e)
 {
     if (this.TimesheetDetailUpdatingEvent != null) {
         this.TimesheetDetailUpdatingEvent(this, e);
     }
 }
        public virtual void UpdateMonthlyTimesheets(MonthlyTimesheets monthlyTimesheets)
        {
            this.Clear();

            // Note: Must populate property MonthlyTimesheets AFTER Clear() is called because
            // Clear() nulls out MonthlyTimesheets.
            this.MonthlyTimesheets = monthlyTimesheets;

            int y = 0;

            foreach (Timesheet timesheet in this.MonthlyTimesheets) {
                TimesheetDetailListView timesheetDetailListView = new TimesheetDetailListView(timesheet);

                timesheetDetailListView.TimesheetDetailUpdatingEvent +=
                    new EventHandler<TimesheetDetailListView.TimesheetDetailEventArgs>(this.OnTimesheetUpdating);
                timesheetDetailListView.TimesheetDetailUpdatedEvent +=
                    new EventHandler<TimesheetDetailListView.TimesheetDetailEventArgs>(this.OnTimesheetUpdated);

                Controls.Add(timesheetDetailListView);

                timesheetDetailListView.Dock = DockStyle.Top;
                timesheetDetailListView.Location = new Point(0, y + 1);

                timesheetDetailListView.BringToFront();

                y += timesheetDetailListView.Height;
            }

            this.AutoScroll = true;
            this.AutoSize = true;
            this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
        /// <summary>
        /// Updates the Timesheet.
        /// </summary>
        /// <param name="timesheet">The Timesheet to be updated.</param>
        /// <remarks>Call this member when a Timesheet has been or needs to be updated so that the changes
        /// are reflected in the UI.</remarks>
        public void UpdateTimesheet(Timesheet timesheet)
        {
            TimesheetDetailListView timesheetDetailListView = GetTimesheetDetailListView(timesheet);

            timesheetDetailListView.UpdateTimesheet();
        }