private void OnCrashesRemove(Crash CrashInstance) { Buggs_Crash BuggCrash = Buggs_Crashes.FirstOrDefault(BuggCrashInstance => BuggCrashInstance.BuggId == Id && BuggCrashInstance.CrashId == CrashInstance.Id); Buggs_Crashes.Remove(BuggCrash); SendPropertyChanged(null); }
/// <summary> /// Associate a crash with a Bugg. /// </summary> /// <param name="Bugg">The Bugg to add the crash reference to.</param> /// <param name="CurrentCrash">The crash to add to the Bugg.</param> /// <returns>true if a new relationship was added, false otherwise.</returns> public bool LinkCrashToBugg(Bugg Bugg, Crash CurrentCrash) { try { // Make sure we don't already have this relationship if (Context.Buggs_Crashes.Where(BuggInstance => BuggInstance.CrashId == CurrentCrash.Id && BuggInstance.BuggId == Bugg.Id).Count() < 1) { // We don't so create the relationship Buggs_Crash NewBugg = new Buggs_Crash(); NewBugg.CrashId = CurrentCrash.Id; NewBugg.BuggId = Bugg.Id; Context.Buggs_Crashes.InsertOnSubmit(NewBugg); return(true); } } catch (Exception Ex) { Debug.WriteLine("Exception in LinkCrashToBugg: " + Ex.ToString()); } return(false); }
private void detach_Buggs_Crashes(Buggs_Crash entity) { this.SendPropertyChanging(); entity.Bugg = null; }
private void attach_Buggs_Crashes(Buggs_Crash entity) { this.SendPropertyChanging(); entity.Bugg = this; }
partial void DeleteBuggs_Crash(Buggs_Crash instance);
partial void UpdateBuggs_Crash(Buggs_Crash instance);
partial void InsertBuggs_Crash(Buggs_Crash instance);
/// <summary> /// Associate a crash with a Bugg. /// </summary> /// <param name="Bugg">The Bugg to add the crash reference to.</param> /// <param name="CurrentCrash">The crash to add to the Bugg.</param> /// <returns>true if a new relationship was added, false otherwise.</returns> public bool LinkCrashToBugg( Bugg Bugg, Crash CurrentCrash ) { try { // Make sure we don't already have this relationship if( BuggsDataContext.Buggs_Crashes.Where( BuggInstance => BuggInstance.CrashId == CurrentCrash.Id && BuggInstance.BuggId == Bugg.Id ).Count() < 1 ) { // We don't so create the relationship Buggs_Crash NewBugg = new Buggs_Crash(); NewBugg.CrashId = CurrentCrash.Id; NewBugg.BuggId = Bugg.Id; BuggsDataContext.Buggs_Crashes.InsertOnSubmit( NewBugg ); return true; } } catch( Exception Ex ) { Debug.WriteLine( "Exception in LinkCrashToBugg: " + Ex.ToString() ); } return false; }