protected void OnTimesheetsSelectedIndexChanged(object sender, EventArgs e) { if (m_timesheetsListView.SelectedItems.Count == 0) { m_calendar.BoldedDates = null; return; } else { ListViewItem listViewItem = m_timesheetsListView.SelectedItems[0]; if (!(listViewItem.Tag is Timesheet)) { return; } else { Timesheet timesheet = (Timesheet)listViewItem.Tag; Collection <DateTime> dates = new Collection <DateTime>(); DateTime date = timesheet.StartDate.Date; DateTime endDate = timesheet.EndDate.Date; while (date <= endDate) { dates.Add(date); date = date.AddDays(1); } m_calendar.BoldedDates = dates.ToArray(); IEnumerable <TimesheetDetailContainer> timesheetDetailContainers = m_detailContainer.Controls.OfType <TimesheetDetailContainer>(); if (timesheetDetailContainers.Count() > 0) { TimesheetDetailContainer timesheetDetailContainer = timesheetDetailContainers.First(); if (timesheetDetailContainer != null) { timesheetDetailContainer.ScrollInToView(timesheet, true); } } } } }
private void LoadTimesheetsDetail() { m_detailContainer.Controls.Clear(); TimesheetDetailContainer timesheetDetailContainer = new TimesheetDetailContainer(); m_detailContainer.Controls.Add(timesheetDetailContainer); timesheetDetailContainer.Dock = DockStyle.Fill; timesheetDetailContainer.UpdateMonthlyTimesheets(m_monthlyTimesheets); timesheetDetailContainer.TimesheetDetailUpdatingEvent += new EventHandler <TimesheetDetailListView.TimesheetDetailEventArgs>( delegate(object sender, TimesheetDetailListView.TimesheetDetailEventArgs e) { m_apply.Enabled = true; } ); timesheetDetailContainer.TimesheetDetailUpdatedEvent += new EventHandler <TimesheetDetailListView.TimesheetDetailEventArgs>( delegate(object sender, TimesheetDetailListView.TimesheetDetailEventArgs e) { UpdateTimesheetListViewItem(e.Timesheet); UpdateTimesheetTotalsListViewItem(); UpdateMonthlyTimesheetCalculations(); UpdateYearlyTimesheetCalculations(); } ); }