Ejemplo n.º 1
0
        /// <summary>
        /// Adds the no conflicts found page.
        /// </summary>
        /// <param name="conflictPage">The conflict page.</param>
        public void AddNoConflictsFoundPage(UPMSyncConflictsPage conflictPage)
        {
            UPMInfoMessageStatus infoMessageStatus = new UPMInfoMessageStatus(StringIdentifier.IdentifierWithStringId("noConflictsFoundIdentifier"));
            UPMStringField       statusField       = new UPMStringField(StringIdentifier.IdentifierWithStringId("noConflictsFoundFieldIdentifier"));

            statusField.FieldValue = LocalizedString.Localize(
                LocalizationKeys.TextGroupBasic,
                this.ShowAllOfflineRequests ? LocalizationKeys.KeyBasicSyncConflictsNoOfflineRecordsFound : LocalizationKeys.KeyBasicSyncConflictsNoConflictsFound);

            infoMessageStatus.DetailMessageField = statusField;
            conflictPage.Status = infoMessageStatus;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds the page.
        /// </summary>
        public void BuildPage()
        {
            UPMSyncConflictsPage page           = new UPMSyncConflictsPage(StringIdentifier.IdentifierWithStringId("SyncConflictsPage"));
            UPMProgressStatus    progressStatus = new UPMProgressStatus(StringIdentifier.IdentifierWithStringId("savingIdentifier"));
            UPMStringField       statusField    = new UPMStringField(StringIdentifier.IdentifierWithStringId("statusFieldIdentifier"));

            statusField.FieldValue            = LocalizedString.TextLoadingData;
            progressStatus.StatusMessageField = statusField;
            page.Status          = progressStatus;
            page.Invalid         = true;
            this.TopLevelElement = page;
        }
Ejemplo n.º 3
0
        /// <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);
        }