コード例 #1
0
        // Events
        // --------------------------------------------------------------------------
        #region Events
        protected void OnListViewMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (m_listView.SelectedIndices.Count > 0)
            {
                TimesheetDate timesheetDate = (TimesheetDate)m_listView.SelectedItems[0].Tag;
                if (!timesheetDate.IsValidDate || timesheetDate.Timesheet.TimesheetSent)
                {
                    // If the Timesheet has been sent, or, if it is an invali date, do not allow updates.
                    return;
                }
                else
                {
                    TimesheetDateEditForm form = new TimesheetDateEditForm(timesheetDate);
                    if (form.ShowDialog(this) == DialogResult.OK)
                    {
                        if (form.ValuesChanged)
                        {
                            if (this.TimesheetDetailUpdatingEvent != null)
                            {
                                TimesheetDetailEventArgs args = new TimesheetDetailEventArgs(this.Timesheet);
                                this.TimesheetDetailUpdatingEvent(this, args);
                            }

                            // Suspend the changed events because we're going to make the calls to update our
                            // Timesheet and Timesheet detail manually.
                            timesheetDate.SuspendChangedEvent(true);
                            timesheetDate.BillableHours = form.BillableHours;
                            timesheetDate.DayType       = form.DayType;
                            timesheetDate.Notes         = form.Notes;
                            timesheetDate.SuspendChangedEvent(false);

                            UpdateTimesheetDetailListViewItem(timesheetDate);
                            ResizeTimesheetDetailListViewColumns();

                            if (this.TimesheetDetailUpdatedEvent != null)
                            {
                                TimesheetDetailEventArgs args = new TimesheetDetailEventArgs(this.Timesheet);
                                this.TimesheetDetailUpdatedEvent(this, args);
                            }
                        }
                    }
                }
            }
            #endregion          // Events
        }
コード例 #2
0
		// Events
		// --------------------------------------------------------------------------
		#region Events
		protected void OnListViewMouseDoubleClick(object sender, MouseEventArgs e) {
			if (m_listView.SelectedIndices.Count > 0) {				
				TimesheetDate timesheetDate = (TimesheetDate)m_listView.SelectedItems[0].Tag;
				if (!timesheetDate.IsValidDate || timesheetDate.Timesheet.TimesheetSent) {
					// If the Timesheet has been sent, or, if it is an invali date, do not allow updates.
					return;
				} else {
					TimesheetDateEditForm form = new TimesheetDateEditForm(timesheetDate);
					if (form.ShowDialog(this) == DialogResult.OK) {
						if (form.ValuesChanged) {
							if (this.TimesheetDetailUpdatingEvent != null) {
								TimesheetDetailEventArgs args = new TimesheetDetailEventArgs(this.Timesheet);
								this.TimesheetDetailUpdatingEvent(this, args);
							}

							// Suspend the changed events because we're going to make the calls to update our
							// Timesheet and Timesheet detail manually.
							timesheetDate.SuspendChangedEvent(true);
							timesheetDate.BillableHours = form.BillableHours;							
							timesheetDate.DayType = form.DayType;
							timesheetDate.Notes = form.Notes;
							timesheetDate.SuspendChangedEvent(false);

							UpdateTimesheetDetailListViewItem(timesheetDate);
							ResizeTimesheetDetailListViewColumns();

							if (this.TimesheetDetailUpdatedEvent != null) {
								TimesheetDetailEventArgs args = new TimesheetDetailEventArgs(this.Timesheet);
								this.TimesheetDetailUpdatedEvent(this, args);
							}
						}
					}
				}
			} 
		#endregion	// Events
		}