/// <summary> /// Edits the conflict for conflict. /// </summary> /// <param name="syncConflict">The synchronize conflict.</param> public void EditConflictForConflict(UPMSyncConflict syncConflict) { UPMSyncConflictWithContext syncConflictWithContext = (UPMSyncConflictWithContext)syncConflict; syncConflictWithContext.OfflineRequest.ConflictHandlingMode = true; UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromOfflineRequest(syncConflictWithContext.OfflineRequest); if (organizerModelController != null) { this.SyncConflictsPage.Invalid = true; this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController, MultiOrganizerMode.StayInCurrentOrganizer); } }
/// <summary> /// Does the discard. /// </summary> private void DoDiscard() { UPMSyncConflictWithContext syncConflictWithContext = (UPMSyncConflictWithContext)this.discardedSyncConflict; if (syncConflictWithContext.OfflineRequest.DeleteRequest(true) != 0) { SimpleIoc.Default.GetInstance <ILogger>().LogError("Offline request could not be deleted because of database error"); } else { this.SyncConflictsPage.RemoveConflict(this.discardedSyncConflict); if (this.SyncConflictsPage.NumberOfSyncConflicts == 0) { this.AddNoConflictsFoundPage(this.SyncConflictsPage); } this.InformAboutDidChangeTopLevelElement(this.TopLevelElement, this.TopLevelElement, new List <IIdentifier> { this.discardedSyncConflict.Identifier }, UPChangeHints.ChangeHintsWithHint("DiscardConflict")); Messenger.Default.Send(SyncManagerMessage.Create(SyncManagerMessageKey.NumberOfConflictsChanged)); } }
/// <summary> /// Reports the error for conflict. /// </summary> /// <param name="syncConflict">The synchronize conflict.</param> public void ReportErrorForConflict(UPMSyncConflict syncConflict) { UPMSyncConflictWithContext syncConflictWithContext = (UPMSyncConflictWithContext)syncConflict; this.SendReportForOfflineRequest(syncConflictWithContext.OfflineRequest); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { UPMSyncConflictsPage page = new UPMSyncConflictsPage(StringIdentifier.IdentifierWithStringId("SyncConflictsPage")); page.SyncConflictEmail = ConfigurationUnitStore.DefaultStore.ConfigValue("Sync.ConflictEmailAddress"); IOfflineStorage offlineStorage = UPOfflineStorage.DefaultStorage; var offlineRequests = this.ShowAllOfflineRequests ? offlineStorage.OfflineRequests : offlineStorage.ConflictRequests; if (offlineRequests == null || offlineRequests.Count == 0) { this.AddNoConflictsFoundPage(page); return(page); } foreach (UPOfflineRequest request in offlineRequests) { IIdentifier identifier; if (!string.IsNullOrEmpty(request.IdentifyingRecordIdentification)) { identifier = new RecordIdentifier(request.IdentifyingRecordIdentification); } else { identifier = StringIdentifier.IdentifierWithStringId($"request_{request.RequestNr}"); } UPMSyncConflictWithContext syncConflict = new UPMSyncConflictWithContext(identifier); request.LoadFromOfflineStorage(); syncConflict.OfflineRequest = request; syncConflict.CanBeFixed = request.FixableByUser; syncConflict.CanBeReported = !string.IsNullOrEmpty(page.SyncConflictEmail) && syncConflict.OfflineRequest.HasXml; if (!string.IsNullOrEmpty(request.ImageName)) { //SyncConflict.Icon = UIImage.ImageNamed(request.ImageName); // CRM-5007 } UPMStringField titleLineField = new UPMStringField(null); titleLineField.StringValue = request.TitleLine; syncConflict.MainField = titleLineField; string detailsLine = request.DetailsLine; if (!string.IsNullOrEmpty(detailsLine)) { UPMStringField detailsLineField = new UPMStringField(null); detailsLineField.StringValue = detailsLine; syncConflict.DetailField = detailsLineField; } if (!this.ShowAllOfflineRequests) { UPMErrorStatus error = UPMErrorStatus.ErrorStatusWithMessageDetails(request.Error, request.Response); syncConflict.AddStatus(error); } List <UPOfflineRequest> dependingRequests = request.DependentRequests; if (dependingRequests != null) { foreach (UPOfflineRequest dependentRequest in dependingRequests) { string description = $"{dependentRequest.TitleLine}-{dependentRequest.DetailsLine}"; UPMWarnStatus warning = UPMWarnStatus.WarnStatusWithMessageDetails(description, null); syncConflict.AddStatus(warning); } } page.AddSyncConflict(syncConflict); } if (this.oldNumberOfConflicts >= 0 && this.oldNumberOfConflicts != offlineRequests.Count) { Messenger.Default.Send(SyncManagerMessage.Create(SyncManagerMessageKey.NumberOfConflictsChanged)); } this.oldNumberOfConflicts = offlineRequests.Count; return(page); }