protected override void RemoveItem(int index) { CaseViewModel caseToRemove = this[index]; _master.Remove(caseToRemove.RecordId); base.RemoveItem(index); if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.Confirmed) { Confirmed.Remove(caseToRemove); } if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.Probable) { Probable.Remove(caseToRemove); } if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.Suspect) { Suspect.Remove(caseToRemove); } if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.NotCase) { NotCase.Remove(caseToRemove); } caseToRemove.EpiCaseDefinitionChanging -= item_EpiCaseDefinitionChanging; caseToRemove.CaseIDChanging -= item_CaseIDChanging; caseToRemove.CaseSecondaryIDChanging -= item_CaseIDChanging; caseToRemove.MarkedForRemoval -= item_MarkedForRemoval; caseToRemove.Inserted -= item_Inserted; caseToRemove.Updated -= item_Updated; caseToRemove.ViewerClosed -= item_ViewerClosed; caseToRemove.SwitchToLegacyEnter -= item_SwitchToLegacyEnter; }
private void item_EpiCaseDefinitionChanging(object sender, Events.EpiCaseDefinitionChangingEventArgs e) { CaseViewModel caseVM = sender as CaseViewModel; if (caseVM != null) { if (e.PreviousDefinition == EpiCaseClassification.Confirmed) { Confirmed.Remove(caseVM); } else if (e.PreviousDefinition == EpiCaseClassification.Probable) { Probable.Remove(caseVM); } else if (e.PreviousDefinition == EpiCaseClassification.Suspect) { Suspect.Remove(caseVM); } else if (e.PreviousDefinition == EpiCaseClassification.NotCase) { NotCase.Remove(caseVM); } if (e.NewDefinition == EpiCaseClassification.Confirmed) { Confirmed.Add(caseVM); } else if (e.NewDefinition == EpiCaseClassification.Probable) { Probable.Add(caseVM); } else if (e.NewDefinition == EpiCaseClassification.Suspect) { Suspect.Add(caseVM); } else if (e.NewDefinition == EpiCaseClassification.NotCase) { NotCase.Add(caseVM); } } }