/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override UPMElement UpdatedElement(UPMElement element) { UPMInBoxPage oldPage = (UPMInBoxPage)this.TopLevelElement; UPMInBoxPage page = new UPMInBoxPage(StringIdentifier.IdentifierWithStringId("Inbox")) { UploadFieldGroup = oldPage.UploadFieldGroup, FileNameEditField = oldPage.FileNameEditField, SkipUploadIfPossible = oldPage.SkipUploadIfPossible }; UPInboxFileManager manager = UPInboxFileManager.CurrentInboxFileManager(); List <UPInboxFile> files = manager.AllInboxFiles(); foreach (UPInboxFile inboxFile in files) { UPMInboxFile upmInboxFile = ModelInboxFileFromInboxFile(inboxFile); page.AddChild(upmInboxFile); } this.TopLevelElement = page; this.SortFilesByDate(); page.Invalid = false; this.InformAboutDidChangeTopLevelElement(page, page, null, null); return(element); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override UPMElement UpdatedElement(UPMElement element) { if (element is Page) { return(this.UpdatedElementForPage((Page)element)); } return(element); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { if (element is Page) { this.OrganizerError = this.Delegate?.PageModelControllerContextValueForKey(this, "organizerError") as Exception; return(this.UpdatedElementForPage((UPMWebContentPage)element)); } return(null); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { if (element is UPMCircleOfInfluencePage) { element.Invalid = true; return(this.UpdatePage((UPMCircleOfInfluencePage)element)); } return(null); }
/// <inheritdoc/> public override UPMElement UpdatedElement(UPMElement element) { if (element is Page) { return(this.UpdatedElementForPage((UPMGridPage)element)); } if (element is UPMAnalysisResultRowGroup) { return(UpdatedElementForResultRowGroup((UPMAnalysisResultRowGroup)element)); } return(element); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { if (element is UPMOrganizer) { this.AlternateExpandChecker = null; this.LinkReader = null; this.Tiles = null; this.TilesName = null; this.CopyFields = null; this.PageModelControllers.Clear(); List <UPMElement> newActions = null; foreach (UPMOrganizerAction action in this.LeftNavigationBarItems) { if (action.Identifier.IdentifierAsString == "CloseOrganizerAction") { newActions = new List <UPMElement> { action }; } } if (newActions != null) { this.LeftNavigationBarItems = newActions; } else { this.LeftNavigationBarItems.Clear(); } this.RightNaviagtionBarItems.Clear(); this.OrganizerHeaderQuickActionItems?.Clear(); this.OrganizerHeaderActionItems.Clear(); this.SaveActionItems.Clear(); this.BuildDetailOrganizerPages(); } return(null); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> public override UPMElement UpdatedElement(UPMElement element) { var page = element as Page; return(page != null?this.UpdatedElementForPage(page) : element); }
/// <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); }
/// <summary> /// Updates the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { var page = element as UPMSearchPage; return(page != null?this.UpdatePage(page) : null); }
/// <summary> /// Returns changed records. /// </summary> /// <returns></returns> public override List <UPCRMRecord> ChangedRecords() { List <UPCRMRecord> changedRecords = new List <UPCRMRecord>(); UPMObjectivesPage page = (UPMObjectivesPage)this.Page; foreach (UPMObjectivesSection section in page.Children) { foreach (UPMObjective item in section.Children) { UPObjectivesItem crmItem = item.ObjectiveItem; if (item.DoneField.Changed) { if (crmItem != null) { crmItem.Completed = item.DoneField.BoolValue; } } int editFieldIndex = 0; for (int elementIndex = 0; elementIndex < item.Fields.Count; elementIndex++) { UPMElement element = item.Fields[elementIndex]; if (element is UPMEditField) { UPMEditField editField = (UPMEditField)element; if (editField.Changed) { List <UPEditFieldContext> fieldContextList = this.editPageContext.EditFields.Values.ToList(); foreach (UPEditFieldContext fieldContext in fieldContextList) { if (fieldContext.EditField == editField) { crmItem?.SetValueForAdditionalFieldPosition(fieldContext.Value ?? string.Empty, editFieldIndex); } } } editFieldIndex++; } else if (element is UPMStringField) { editFieldIndex++; } } List <UPCRMRecord> itemChangedRecords = crmItem?.ChangedRecords(); if (itemChangedRecords != null) { changedRecords.AddRange(itemChangedRecords); } } } foreach (UPObjectivesItem deletedItem in this.DeletedItems) { List <UPCRMRecord> itemChangedRecords = deletedItem.ChangedRecords(); if (itemChangedRecords != null) { changedRecords.AddRange(deletedItem.ChangedRecords()); } } return(changedRecords.Count == 0 ? null : changedRecords); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { return((UPMDataSyncPage)this.TopLevelElement); }