private void OnUserChanged() { Issues.Clear(); string name = this.User; Issues fetchedIssues = new Issues(); var issuesList = fetchedIssues.FetchIssues(name); // returns the list of Issues in a type of --> IQueryable<Issue> foreach (var issue in issuesList) { Issues.Add(issue); } }
private async Task <bool> OnRefreshContent() { Issues.Clear(); if (LocationId <= 0 || App.Client.LoggedIn == false) { await App.Client.ShowSelectLocation(); LocationId = App.Client.GetCurrentLocationId(); return(false); } return(await Task.Run( () => { try { UserDialogs.Instance.ShowLoading("Loading events...", MaskType.Clear); var items = App.Client.GetIssues(LocationId); foreach (IssueModel Item in items) { Issues.Add(Item); } RefeshNeeded = false; UserDialogs.Instance.HideLoading(); return true; } catch (UnauthorizedException exception) { Debug.WriteLine(exception); RefeshNeeded = false; UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert( "Not Unauthorized\nLogin with another account or change location"); return false; } catch (Exception exception) { Debug.WriteLine(exception + "Unknown error while retrieving data"); RefeshNeeded = false; UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Failed. Unknown error while getting issues.."); return false; } })); }
private void CheckTasks() { ProcessMatrix matrix = Process.Matrix; this.Tasks = 0; foreach (Activity activity in Process.Activities) { if (activity.Type.Equals(ActivityType.Implementation)) { this.Tasks++; int index = Process.GetActivityIndexById(activity.Id); int taskTargets = 0; for (int i = 0; i < matrix.Size; i++) { taskTargets += matrix.Array[index, i]; } int taskSources = 0; for (int i = 0; i < matrix.Size; i++) { taskSources += matrix.Array[i, index]; } if (taskTargets == 0) { Issues.Add(new Issue() { Element = activity, Message = String.Format(Messages.TARGET_TASKS, activity.Name, Process.Name) }); } if (taskSources == 0) { Issues.Add(new Issue() { Element = activity, Message = String.Format(Messages.SOURCE_TASKS, activity.Name, Process.Name) }); } } } }
/// <summary> /// Constructor creates BadRequestException from collection of error strings. /// </summary> /// <param name="errorMessages">Collection of error strings that are used to initialize OperationOutcomeIssue collection. /// Must be non-null and non-empty</param> public BadRequestException(ICollection<string> errorMessages) : base(((Func<string>)(() => { Debug.Assert(errorMessages != null, "Parameter errorMessages must not be null."); Debug.Assert(errorMessages == null || errorMessages.Any(), "Parameter errorMessages must not be empty."); return (errorMessages == null || errorMessages.Count < 2) ? errorMessages.First() : "Multiple bad request errors."; // "Multiple bad request errors." message is used only internally, no need to add it to the Resources.resx file. }))()) { foreach (string errorMessage in errorMessages) { Issues.Add(new OperationOutcomeIssue( OperationOutcomeConstants.IssueSeverity.Error, OperationOutcomeConstants.IssueType.Invalid, errorMessage)); } }
public void CreateNewIssue() { var issueId = Issues.Any() ? Issues.Max(i => i.Id) + 1 : 1; var newIssue = new Issue(issueId) { Author = Environment.UserName, DateCreated = DateTime.Now, }; var issueVm = CreateIssueVm(newIssue); issueVm.IsLoaded = true; issueVm.IsDirty = true; Issues.Add(issueVm); ActiveIssue = issueVm; }
public TransactionFailedException(string message, HttpStatusCode httpStatusCode, List <OperationOutcomeIssue> operationOutcomeIssues = null) : base(message) { Debug.Assert(!string.IsNullOrEmpty(message), "Exception message should not be empty"); ResponseStatusCode = httpStatusCode; Issues.Add(new OperationOutcomeIssue( OperationOutcomeConstants.IssueSeverity.Error, OperationOutcomeConstants.IssueType.Processing, message)); if (operationOutcomeIssues != null) { operationOutcomeIssues.ForEach(x => Issues.Add(x)); } }
/// <summary> /// Initializes a new instance of the <see cref="FhirTransactionFailedException"/> class. /// Exception related to the processing of a FHIR transaction bundle. /// </summary> /// <param name="message">The exception message.</param> /// <param name="httpStatusCode">The status code to report to the user.</param> /// <param name="operationOutcomeIssues">A list of issues to include in the operation outcome.</param> public FhirTransactionFailedException(string message, HttpStatusCode httpStatusCode, IReadOnlyList <OperationOutcomeIssue> operationOutcomeIssues = null) : base(message) { Debug.Assert(!string.IsNullOrEmpty(message), "Exception message should not be empty"); ResponseStatusCode = httpStatusCode; Issues.Add(new OperationOutcomeIssue( OperationOutcomeConstants.IssueSeverity.Error, OperationOutcomeConstants.IssueType.Processing, message)); if (operationOutcomeIssues != null) { foreach (var issue in operationOutcomeIssues) { Issues.Add(issue); } } }
private void Initialize(LogTimeMessage arguments) { Issues.Clear(); var issuesFromProject = arguments.UserProject.Issues; foreach (var issue in issuesFromProject) { Issues.Add(issue); } SelectedIssue = Issues.FirstOrDefault(); var activities = arguments.UserProject.Activities; Activities.Clear(); foreach (var activity in activities) { Activities.Add(activity); } SelectedDate = arguments.Period.StartDate; Period = arguments.Period; }
public void AddIssue(int?id, string message, Exception exception, ValidationIssueType type) { if (type == ValidationIssueType.Error) { Issues.Add(new ValidationError() { ID = id, Message = message, Exception = exception }); } else { Issues.Add(new ValidationWarning() { ID = id, Message = message, Exception = exception }); } }
public ResourceNotValidException(IEnumerable <ValidationFailure> validationFailures) { EnsureArg.IsNotNull(validationFailures, nameof(validationFailures)); foreach (var failure in validationFailures) { if (failure is FhirValidationFailure fhirValidationFailure) { Issues.Add(fhirValidationFailure.IssueComponent); } else { Issues.Add(new OperationOutcome.IssueComponent { Severity = OperationOutcome.IssueSeverity.Error, Code = OperationOutcome.IssueType.Invalid, Diagnostics = failure.ErrorMessage, }); } } }
private void CheckIntermediateEvents() { ProcessMatrix matrix = Process.Matrix; this.IntermediateEvents = 0; foreach (Activity activity in Process.Activities) { if (activity.Type.Equals(ActivityType.IntermediateEvent)) { this.IntermediateEvents++; int index = Process.GetActivityIndexById(activity.Id); int intermediateEventTargets = 0; for (int i = 0; i < matrix.Size; i++) { intermediateEventTargets += matrix.Array[index, i]; } int intermediateEventSources = 0; for (int i = 0; i < matrix.Size; i++) { intermediateEventSources += matrix.Array[i, index]; } if (intermediateEventTargets == 0 || intermediateEventSources == 0) { Issues.Add(new Issue() { Element = activity, Message = String.Format(Messages.INTERMEDIATE_EVENTS, activity.Name, Process.Name) }); } } } }
public ResourceNotValidException(IEnumerable <ValidationFailure> validationFailures) { EnsureArg.IsNotNull(validationFailures, nameof(validationFailures)); foreach (var failure in validationFailures) { if (failure is FhirValidationFailure fhirValidationFailure) { if (fhirValidationFailure.IssueComponent != null) { Issues.Add(fhirValidationFailure.IssueComponent); } } else { Issues.Add(new OperationOutcomeIssue( OperationOutcomeConstants.IssueSeverity.Error, OperationOutcomeConstants.IssueType.Invalid, failure.ErrorMessage)); } } }
private void CheckProcessFlow() { ProcessMatrix matrix = Process.Matrix; this.Gateways = 0; foreach (Activity activity in Process.Activities) { if (activity.Type.Equals(ActivityType.Route)) { this.Gateways++; } } foreach (Activity activity in Process.Activities) { if (activity.Type.Equals(ActivityType.Implementation)) { int index = Process.GetActivityIndexById(activity.Id); int taskTargets = 0; for (int i = 0; i < matrix.Size; i++) { taskTargets += matrix.Array[index, i]; } if (taskTargets > 1) { Issues.Add(new Issue() { Element = activity, Message = String.Format(Messages.PROCESS_FLOW, Process.Name) }); } } } }
public void AddIssue(IIssue issue) { Issues.Add(issue); issue.Deleted += () => OnIssueDeleted(issue); }
public void AddIssue(Format parent, string issue, int startIndex, int endIndex) { Issues.Add(new ParsingIssue(issue, startIndex, endIndex - startIndex)); }
public void AddIssue(int VisitorId, int BookId, System.DateTime IssueDate) { Issues.Add(new Issue(VisitorId, BookId, IssueDate)); }
public IssueListViewModel() { if (Issues == null) { Issues = new ObservableCollection <AddIssueViewModel>(); } Task.Run(async() => { try { var issues = new List <Models.Issues>(); issues.Add(new Models.Issues { IssueId = 7, IssuesTitle = "asdf", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Invalid" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Solved" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); //var issues = await _issuesAPI //.GetIssues(Application.Current.Properties["token"].ToString()); foreach (var issue in issues) { var i = new AddIssueViewModel { IssueId = issue.IssueId, //IssuesCategoriesId = issue.IssuesCategoriesId, //IssuesDescription = issue.IssuesDescription, //IssuesExpectedBehavior = issue.IssuesExpectedBehavior, //IssuesPriorityId = issue.IssuesPriorityId, //IssuesProjectsId = issue.IssuesProjectsId, //IssuesSeverityId = issue.IssuesSeverityId, //AttachmentsView = issue.AttachmentsView, //Comments = issue.Comments, //IssuesStatusesId = issue.IssuesStatusesId, IssuesStatusesTitle = issue.IssuesStatusesTitle, IssuesTitle = issue.IssuesTitle }; i.StatusColor = IssueStatusColor(i.IssuesStatusesTitle); Issues.Add(i); } } catch (Exception) { } }); SearchCommand = new Command(async() => { try { if (TokenAPI.CheckTokenValidation(Application.Current.Properties["token"].ToString())) { Issues.Clear(); //var issues = await _issuesAPI //.SearchIssues(Application.Current.Properties["token"].ToString(), EntryContext); var issues = new List <Models.Issues>(); issues.Add(new Models.Issues { IssuesTitle = "asdf3", IssuesStatusesTitle = "Invalid" }); issues.Add(new Models.Issues { IssuesTitle = "asdf3", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "a2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); foreach (var issue in issues) { var i = new AddIssueViewModel { IssueId = issue.IssueId, //IssuesCategoriesId = issue.IssuesCategoriesId, //IssuesDescription = issue.IssuesDescription, //IssuesExpectedBehavior = issue.IssuesExpectedBehavior, //IssuesPriorityId = issue.IssuesPriorityId, //IssuesProjectsId = issue.IssuesProjectsId, //IssuesSeverityId = issue.IssuesSeverityId, //AttachmentsView = issue.AttachmentsView, //Comments = issue.Comments, //IssuesStatusesId = issue.IssuesStatusesId, IssuesStatusesTitle = issue.IssuesStatusesTitle, IssuesTitle = issue.IssuesTitle }; i.StatusColor = IssueStatusColor(i.IssuesStatusesTitle); Issues.Add(i); } } } catch (Exception) { } }); }
public void MergeBcfFile(IEnumerable <BcfFile> bcfFiles) { try { foreach (var bcf in bcfFiles) { foreach (var mergedIssue in bcf.Issues) { //it's a new issue if (!Issues.Any(x => x.Topic != null && mergedIssue.Topic != null && x.Topic.Guid == mergedIssue.Topic.Guid)) { string sourceDir = Path.Combine(bcf.TempPath, mergedIssue.Topic.Guid); string destDir = Path.Combine(TempPath, mergedIssue.Topic.Guid); Directory.Move(sourceDir, destDir); //update path set for binding foreach (var view in mergedIssue.Viewpoints) { view.SnapshotPath = Path.Combine(TempPath, mergedIssue.Topic.Guid, view.Snapshot); } Issues.Add(mergedIssue); } //it exists, let's loop comments and views else { var issue = Issues.First(x => x.Topic.Guid == mergedIssue.Topic.Guid); var newComments = mergedIssue.Comment.Where(x => issue.Comment.All(y => y.Guid != x.Guid)).ToList(); if (newComments.Any()) { foreach (var newComment in newComments) { issue.Comment.Add(newComment); } } //sort comments issue.Comment = new ObservableCollection <Comment>(issue.Comment.OrderByDescending(x => x.Date)); var newViews = mergedIssue.Viewpoints.Where(x => issue.Viewpoints.All(y => y.Guid != x.Guid)).ToList(); if (newViews.Any()) { foreach (var newView in newViews) { //to avoid conflicts in case both contain a snapshot.png or viewpoint.bcfv //img to be merged string sourceFile = newView.SnapshotPath; //assign new safe name based on guid newView.Snapshot = newView.Guid + ".png"; //set new temp path for binding newView.SnapshotPath = Path.Combine(TempPath, issue.Topic.Guid, newView.Snapshot); //assign new safe name based on guid newView.Viewpoint = newView.Guid + ".bcfv"; File.Move(sourceFile, newView.SnapshotPath); issue.Viewpoints.Add(newView); } } } } Utils.DeleteDirectory(bcf.TempPath); } HasBeenSaved = false; } catch (System.Exception ex1) { MessageBox.Show("exception: " + ex1); } }
public void RaiseIssue(Issue issue) { Issues.Add(issue); }
public void Apply(IssueCreated @event) { var(issueId, description) = @event; Issues.Add(issueId, new Issue(issueId, description)); }