protected void changeTaskMultiView_Click( object sender, EventArgs e ) { CheckReadOnly( ); if ( this.eventMultiView.GetActiveView( ) == this.eventShowView ) { this.eventMultiView.SetActiveView( this.eventEditView ); } else { if ( sender == this.updateAssignedTaskLinkButton ) { TrackerDataSetTableAdapters.ProcsAdapter procsAdapter = new FlyTrace.TrackerDataSetTableAdapters.ProcsAdapter( ); int? eventId = int.Parse( this.assignedTaskDdl.SelectedValue ); if ( eventId.Value == 0 ) { // 0 means 'None', i.e. NULL eventId = null; } else if ( eventId.Value < 0 ) // less then zero means "Create new event and assign it to the group { procsAdapter.CreateEvent( Global.UserId, ref eventId ); if ( !eventId.HasValue ) throw new ApplicationException( "CreateEvent returned unexpected result: NULL" ); } // Now assign the event to the group (or clear EventId field in DB if eventId is null) procsAdapter.AssignEventToGroup( eventId, GroupId ); } this.eventMultiView.SetActiveView( this.eventShowView ); } }
protected void changeSimpleTaskMultiView_Click( object sender, EventArgs e ) { CheckReadOnly( ); if ( this.simpleTaskMultiView.GetActiveView( ) == this.simpleTaskShowView ) { this.simpleTaskMultiView.SetActiveView( this.simpleTaskEditView ); this.showTaskCheckBox.Checked = AssignedTaskId.HasValue && DefEventId.HasValue && AssignedTaskId.Value == DefEventId.Value; } else { if ( sender == this.updateSimpleTaskButton ) { TrackerDataSetTableAdapters.ProcsAdapter procsAdapter = new FlyTrace.TrackerDataSetTableAdapters.ProcsAdapter( ); int? defaultEventId = null; if ( this.showTaskCheckBox.Checked ) { procsAdapter.EnsureDefaultTask( Global.UserId, ref defaultEventId ); } procsAdapter.AssignEventToGroup( defaultEventId, GroupId ); AssignedTaskId = defaultEventId; } this.simpleTaskMultiView.SetActiveView( this.simpleTaskShowView ); } }