Esempio n. 1
0
        /// <summary>
        /// Builds the pages from view reference.
        /// </summary>
        public override void BuildPagesFromViewReference()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("History"));

            this.TopLevelElement        = detailOrganizer;
            detailOrganizer.ExpandFound = true;
            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string headerName              = this.ViewReference.ContextValueForKey("HeaderName");
            IConfigurationUnitStore store  = ConfigurationUnitStore.DefaultStore;
            UPConfigHeader          header = store.HeaderByName(headerName);

            if (!string.IsNullOrEmpty(header.Label))
            {
                detailOrganizer.TitleText = header.Label;
            }

            this.ShouldShowTabsForSingleTab = false;
            UPHistorySearchPageModelController docPageModelController = new UPHistorySearchPageModelController(this.ViewReference);

            this.AddPageModelController(docPageModelController);
        }
        /// <summary>
        /// Builds the detail organizer pages.
        /// </summary>
        protected override void BuildDetailOrganizerPages()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Documemnts"));

            detailOrganizer.ExpandFound = true;
            this.TopLevelElement        = detailOrganizer;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string organizerColorKey            = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            detailOrganizer.SubtitleText = header != null ? header.Label : LocalizedString.TextProcessDocuments;

            this.ShouldShowTabsForSingleTab = false;
            DocumentPageModelController docPageModelController = new DocumentPageModelController(this.ViewReference);

            this.AddPageModelController(docPageModelController);
        }
        /// <summary>
        /// Builds SubViews for Headers
        /// </summary>
        /// <param name="dashboardOrganizer">
        /// UPMOrganizer
        /// </param>
        /// <param name="header">
        /// UPConfigHeader
        /// </param>
        private void BuildHeaderSubViews(UPMOrganizer dashboardOrganizer, UPConfigHeader header)
        {
            var count = header?.NumberOfSubViews ?? 0;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    var subViewDef           = header?.SubViewAtIndex(i);
                    var subViewViewReference = subViewDef?.ViewReference;
                    subViewViewReference = subViewViewReference?.ViewReferenceWith(RecordIdentification);
                    if (subViewViewReference == null)
                    {
                        continue;
                    }

                    var pageModelController = PageForViewReference(subViewViewReference);
                    if (pageModelController != null)
                    {
                        pageModelController.Page.Invalid   = true;
                        pageModelController.Page.LabelText = subViewDef.Label;
                        pageModelController.Page.Parent    = dashboardOrganizer;
                        AddPageModelController(pageModelController);
                        dashboardOrganizer.AddPage(pageModelController.Page);
                    }
                }
            }
        }
        /// <summary>
        /// Builds the detail organizer pages.
        /// </summary>
        public void BuildDetailOrganizerPages()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Details"));

            this.TopLevelElement        = detailOrganizer;
            detailOrganizer.ExpandFound = true;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string          configName          = this.ViewReference.ContextValueForKey("LayoutName");
            WebConfigLayout layout = configStore.WebConfigLayoutByName(configName);

            if (layout == null)
            {
                return;
            }

            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            if (header == null)
            {
                headerName = "SYSTEMINFO.Expand";
                header     = configStore.HeaderByName(headerName);
            }

            if (header != null)
            {
                detailOrganizer.SubtitleText = header.Label;
                this.AddActionButtonsFromHeaderRecordIdentification(header, null);
            }
            else
            {
                detailOrganizer.SubtitleText = LocalizedString.TextSettings;
                UPMOrganizerAction action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.edit"));
                action.SetTargetAction(this, this.SwitchToEdit);
                action.LabelText = LocalizedString.TextEdit;
                action.IconName  = "Button:Edit";
                this.AddOrganizerHeaderActionItem(action);
            }

            SettingsViewPageModelController detailPageModelController = new SettingsViewPageModelController(this.ViewReference);
            Page overviewPage = detailPageModelController.Page;

            this.AddPageModelController(detailPageModelController);
            detailOrganizer.AddPage(overviewPage);
        }
Esempio n. 5
0
        /// <summary>
        /// Adds the remaining page model controller.
        /// </summary>
        public void AddRemainingPageModelController()
        {
            this.created = true;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPConfigHeader          editHeader  = configStore.HeaderByNameFromGroup(this.IsNew ? "New" : "Update", this.ExpandConfig.HeaderGroupName) ??
                                                  configStore.HeaderByNameFromGroup("Edit", this.ExpandConfig.HeaderGroupName);

            if (editHeader != null && editHeader.SubViews.Count != 0)
            {
                Page rootPage = this.PageModelControllers[0].Page;
                if (string.IsNullOrEmpty(rootPage.LabelText) && !string.IsNullOrEmpty(editHeader.Label))
                {
                    this.PageModelControllers[0].Page.LabelText = editHeader.Label;
                }

                foreach (UPConfigHeaderSubView subView in editHeader.SubViews)
                {
                    ViewReference pageViewReference = this.CopyFieldDictionary != null
                        ? subView.ViewReference.ViewReferenceWith(new Dictionary <string, object> {
                        { "copyFields", this.CopyFieldDictionary }
                    })
                        : subView.ViewReference;

                    UPPageModelController pageModelController = pageViewReference.ViewName == "RecordView"
                        ? new EditPageModelController(pageViewReference.ViewReferenceWith(this.RecordIdentification))
                        : this.PageForViewReference(pageViewReference.ViewReferenceWith(this.RecordIdentification));

                    if (pageModelController != null)
                    {
                        if (pageModelController is SerialEntryPageModelController)
                        {
                            //pageModelController.AddObserverForKeyPathOptionsContext(this, "hasRunningChangeRequests", NSKeyValueObservingOptionNew, null);
                        }

                        pageModelController.Page.Invalid   = true;
                        pageModelController.Page.LabelText = subView.Label;
                        pageModelController.Delegate       = this;
                        this.AddPageModelController(pageModelController);
                        this.Organizer.AddPage(pageModelController.Page);

                        if (pageModelController is UPWebContentPageModelController)
                        {
                            if (((UPWebContentPageModelController)pageModelController).AllowsXMLExport)
                            {
                                UPMOrganizerAction exportXMLAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.exportXML"));
                                //exportXMLAction.SetTargetAction(pageModelController, ExportXML);
                                exportXMLAction.LabelText = "Export XML";
                                this.AddOrganizerHeaderActionItem(exportXMLAction);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        private void BuildPage()
        {
            this.recordIdentification = this.ViewReference.ContextValueForKey("RecordId");
            this.InfoAreaId           = this.recordIdentification.InfoAreaId();
            this.ConfigName           = this.ViewReference.ContextValueForKey("ConfigName");
            this.filterName           = this.ViewReference.ContextValueForKey("FilterName");
            string hideOnlineButtonString = this.ViewReference.ContextValueForKey("hideOnlineOfflineButton");

            this.hideOnlineButton = hideOnlineButtonString == "true";
            string fullTextSearchString = this.ViewReference.ContextValueForKey("FullTextSearch");

            this.fullTextSearch = !(string.IsNullOrEmpty(fullTextSearchString) || fullTextSearchString == "false");
            UPMDocumentPage page = (UPMDocumentPage)this.InstantiatePage();

            page.SearchType            = SearchPageSearchType.OfflineSearch;
            page.LabelText             = LocalizedString.TextProcessDocuments;
            page.Invalid               = true;
            page.AvailableOnlineSearch = !this.hideOnlineButton;
            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = ConfigurationUnitStore.DefaultStore.HeaderByName(headerName);
            }

            if (header != null)
            {
                page.LabelText = header.Label;
            }

            this.TopLevelElement = page;
            List <string> availableFilters = new List <string>();

            for (int i = 1; i <= 5; i++)
            {
                string availableFilterName = this.ViewReference.ContextValueForKey($"Filter{i}");
                if (!string.IsNullOrEmpty(availableFilterName))
                {
                    availableFilters.Add(availableFilterName);
                }
            }

            this.AddFilters(availableFilters);
            this.ApplyLoadingStatusOnPage(page);
        }
Esempio n. 7
0
        private void RefreshTableCaption()
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            var    crmStore         = UPCRMDataStore.DefaultStore;
            string tableCaptionName = this.ExpandConfig.TableCaptionName;

            if (string.IsNullOrEmpty(tableCaptionName))
            {
                tableCaptionName = this.InfoAreaId;
            }

            UPConfigTableCaption tableCaption = configStore.TableCaptionByName(tableCaptionName);
            string recordTableCaption         = tableCaption?.TableCaptionForRecordIdentification(this.RecordIdentification);

            if (string.IsNullOrEmpty(recordTableCaption) && !crmStore.RecordExistsOffline(this.RecordIdentification))
            {
                this.Organizer.TitleText = configStore.BasicTextByIndex(4);
                tableCaption?.RequestTableCaptionForRecordIdentification(this.RecordIdentification, this);
            }
            else
            {
                this.Organizer.TitleText = recordTableCaption;
            }

            string subTitleText = null;

            if (!string.IsNullOrEmpty(this.ExpandConfig.HeaderGroupName))
            {
                UPConfigHeader header = configStore.HeaderByNameFromGroup("Expand", this.ExpandConfig.HeaderGroupName);
                subTitleText = header?.Label;
            }

            if (string.IsNullOrEmpty(subTitleText))
            {
                InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.InfoAreaId);
                subTitleText = infoAreaConfig.SingularName;
                if (string.IsNullOrEmpty(subTitleText))
                {
                    subTitleText = crmStore.TableInfoForInfoArea(this.InfoAreaId).Label;
                }
            }

            this.Organizer.SubtitleText = subTitleText;
            this.InformAboutDidChangeTopLevelElement(this.Organizer, this.Organizer, null, UPChangeHints.ChangeHintsWithHint("TableCaptionChanged"));
        }
Esempio n. 8
0
        /// <summary>
        /// Adds Subview pages to UPMOrganizer
        /// </summary>
        /// <param name="expandHeader">
        /// <see cref="UPConfigHeader"/> configuration object
        /// </param>
        /// <param name="detailOrganizer">
        /// <see cref="UPMOrganizer"/> to add pages to
        /// </param>
        /// <param name="overviewPage">
        /// <see cref="Page"/> object to update LableText
        /// </param>
        private void UPMOrganizerAddPages(UPConfigHeader expandHeader, UPMOrganizer detailOrganizer, Page overviewPage)
        {
            var additionalParameters = new Dictionary <string, object> {
                { nameof(VirtualInfoAreaId), VirtualInfoAreaId }
            };

            if (expandHeader.SubViews != null)
            {
                foreach (UPConfigHeaderSubView subView in expandHeader.SubViews)
                {
                    if (subView.Options == "#")
                    {
                        overviewPage.LabelText = subView.Label;
                        continue;
                    }

                    UPPageModelController pageModelController = PageForViewReference(
                        subView.ViewReference?.ViewReferenceWith(additionalParameters).ViewReferenceWith(RecordIdentification));

                    if (pageModelController != null)
                    {
                        pageModelController.Page.Parent    = detailOrganizer;
                        pageModelController.Page.Invalid   = true;
                        pageModelController.Page.LabelText = subView.Label;
                        AddPageModelController(pageModelController);
                        if (pageModelController is UPWebContentPageModelController)
                        {
                            var webContentPageModelController = (UPWebContentPageModelController)pageModelController;
                            if (webContentPageModelController.AllowsXMLExport)
                            {
                                var exportXMLAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.exportXML"))
                                {
                                    LabelText = "Export XML"
                                };
                                AddOrganizerHeaderActionItem(exportXMLAction);
                            }
                        }

                        detailOrganizer.AddPage(pageModelController.Page);
                    }
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Builds the pages from view reference.
        /// </summary>
        public override void BuildPagesFromViewReference()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Details"));

            this.TopLevelElement = detailOrganizer;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.ConfigName = this.ViewReference.ContextValueForKey("LayoutName");
            WebConfigLayout layout = configStore.WebConfigLayoutByName(this.ConfigName);

            if (layout == null)
            {
                return;
            }

            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            detailOrganizer.TitleText = header != null ? header.Label : LocalizedString.TextSettings;

            EditSettingsPageModelController detailPageModelController = new EditSettingsPageModelController(this.ViewReference);
            Page overviewPage = detailPageModelController.Page;

            this.AddPageModelController(detailPageModelController);
            detailOrganizer.AddPage(overviewPage);
            this.AddOrganizerActions();
            detailOrganizer.ExpandFound = true;
        }
        /// <summary>
        /// Adds the page model controllers.
        /// </summary>
        public override void AddPageModelControllers()
        {
            this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId");
            this.RecordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(this.RecordIdentification);
            ViewReference viewReference = this.ViewReference;

            if (this.OfflineRequest != null)
            {
                if (this.RecordIdentification.Contains("new"))
                {
                    UPCRMRecord rootRecord = ((UPOfflineRecordRequest)this.OfflineRequest).FirstRecordWithInfoAreaId(this.RecordIdentification.InfoAreaId());
                    if (rootRecord != null)
                    {
                        viewReference             = new ViewReference(this.ViewReference, this.RecordIdentification, rootRecord.RecordIdentification, null);
                        this.RecordIdentification = rootRecord.RecordIdentification;
                    }
                }
            }

            UPMOrganizer editOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Edit"));

            this.TopLevelElement = editOrganizer;
            SerialEntryPageModelController tmpSerialEntryPageModelController = new SerialEntryPageModelController(viewReference, (UPOfflineSerialEntryRequest)this.OfflineRequest);

            //tmpSerialEntryPageModelController.AddObserverForKeyPathOptionsContext(this, "hasRunningChangeRequests", NSKeyValueObservingOptionNew, null);
            tmpSerialEntryPageModelController.Delegate = this;
            Page   overviewPage = tmpSerialEntryPageModelController.Page;
            string organizerHeaderText;
            string organizerDetailText = null;

            if (this.ExpandConfig != null)
            {
                UPConfigHeader header = ConfigurationUnitStore.DefaultStore.HeaderByNameFromGroup("Edit", this.ExpandConfig.HeaderGroupName);
                if (header != null)
                {
                    organizerDetailText = header.Label;
                    tmpSerialEntryPageModelController.Page.LabelText = organizerDetailText;
                }
            }

            if (string.IsNullOrEmpty(organizerDetailText))
            {
                if (!string.IsNullOrEmpty(this.InfoAreaId))
                {
                    organizerDetailText = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(this.InfoAreaId).Label;
                }
                else
                {
                    organizerDetailText = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(this.RecordIdentification.InfoAreaId()).Label;
                }
            }

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string rootRecordIdentification     = this.RecordIdentification;

            if (string.IsNullOrEmpty(rootRecordIdentification))
            {
                rootRecordIdentification = this.LinkRecordIdentification;
            }

            UPConfigTableCaption tableCaption = configStore.TableCaptionByName(rootRecordIdentification.InfoAreaId());
            string recordTableCaption         = null;

            if (tableCaption != null)
            {
                recordTableCaption = tableCaption.TableCaptionForRecordIdentification(rootRecordIdentification);
            }

            if (string.IsNullOrEmpty(recordTableCaption))
            {
                if (!string.IsNullOrEmpty(organizerDetailText))
                {
                    organizerHeaderText = organizerDetailText;
                    organizerDetailText = null;
                }
                else
                {
                    organizerHeaderText = rootRecordIdentification;
                }
            }
            else
            {
                organizerHeaderText = recordTableCaption;
            }

            this.Organizer.TitleText    = organizerHeaderText;
            this.Organizer.SubtitleText = organizerDetailText;
            this.AddPageModelController(tmpSerialEntryPageModelController);
            this.Organizer.AddPage(overviewPage);
            this.AddRemainingPageModelController();
            this.AddOrganizerActions();
            editOrganizer.ExpandFound = true;
        }