public bool AddUseCaseIntern(UseCase useCase) { if (UseCases == null) { UseCases = new ObservableCollection <UseCase>(); } if (UseCases.Contains(useCase)) { return(false); } UseCases.Add(useCase); return(true); }
public void PrepareData(IEnumerable <XMLParse.EAScenario> result) { var currentDate = DateTime.Now; try { foreach (var scenario in result) { var db = new DatabaseOperations(); scenario.Timestamp = currentDate; scenario.PreviousVersionId = db.GetActive_EAscenarios(Project) .Where(s => s.ProjectId == scenario.ProjectId && s.XmiId == scenario.XmiId) .Select(s => s.Id) .FirstOrDefault(); Scenarios.Add(DataMapper.MapEAScenario(scenario)); foreach (var useCase in scenario.UseCase) { useCase.Id = Guid.NewGuid(); useCase.Timestamp = currentDate; useCase.EAScenarioId = scenario.Id; UseCases.Add(useCase); } foreach (var step in scenario.Steps) { step.Id = Guid.NewGuid(); step.Timestamp = currentDate; step.EAScenarioId = scenario.Id; step.PreviousVersionId = db.GetActive_Steps() .Where(s => s.EAScenarioId == scenario.Id && s.Guid == step.Id) .Select(s => s.Id) .FirstOrDefault(); Steps.Add(step); } } InsertEAData(); } catch (Exception e) { MessageBox.Show( "W aplikacji wystąpił błąd!\n" + e, "Błąd!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); throw; } }
/// <summary> /// Adds a new use case /// </summary> /// <param name="useCase"></param> /// <returns></returns> private UMLUseCase AddUseCase(UMLUseCase useCase) { foreach (UMLUseCase u in UseCases) { //if (useCase.Name == u.Name && useCase.Owner == u.Owner) if (useCase.Name == u.Name) { u.Owner = useCase.Owner; u.Collaborations = useCase.Collaborations; return(u); } } UseCases.Add(useCase); return(useCase); }
public void AddUseCase(UseCase useCase) { var repeatedCrud = UseCases.Where(k => k.Type == useCase.Type); if (repeatedCrud.Count() > 0 && (useCase.Type == UseCase.UseCaseTypes.Create || useCase.Type == UseCase.UseCaseTypes.DeleteByPk || useCase.Type == UseCase.UseCaseTypes.DeleteByUn || useCase.Type == UseCase.UseCaseTypes.RetrieveByPk || useCase.Type == UseCase.UseCaseTypes.RetrieveByUn || useCase.Type == UseCase.UseCaseTypes.Update)) { throw new Exception("Repeated use case"); } UseCases.Add(useCase); }