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 ); } }
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 ); } }
public static void SetDefHemispheres( double lat, double lon ) { char defHemisphereNS = lat > 0 ? 'N' : 'S'; char defHemisphereEW = lon > 0 ? 'E' : 'W'; { TrackerDataSetTableAdapters.ProcsAdapter procAdapters = new FlyTrace.TrackerDataSetTableAdapters.ProcsAdapter( ); procAdapters.SetDefHemispheres( UserId, defHemisphereNS.ToString( ), defHemisphereEW.ToString( ) ); } lock ( UserProfiles ) { UserProfileData existingProfile; if ( UserProfiles.TryGetValue( UserId, out existingProfile ) ) { existingProfile.DefHemisphereNS = lat > 0 ? 'N' : 'S'; existingProfile.DefHemisphereEW = lon > 0 ? 'E' : 'W'; } } }