Esempio n. 1
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"));
        }