예제 #1
0
        protected override bool OnProcessUpdateProperties()
        {
            if (this.localTerm.TermKind == LocalTermKind.NormalTerm)
            {
                // If TermKind=NormalTerm, then this instance is intended to be the source term.
                // If it's not, we need to fix that.
                if (!this.clientTerm.IsSourceTerm)
                {
                    this.clientTerm.SourceTerm.ReassignSourceTerm(this.clientTerm);
                }
            }

            string customSortOrder = this.localTerm.CustomSortOrder.AsTextForServer;

            this.UpdateIfChanged(
                () => this.clientTerm.CustomSortOrder != customSortOrder,
                () => this.clientTerm.CustomSortOrder = customSortOrder
                );

            bool isAvailableForTagging = this.localTerm.IsAvailableForTagging;

            this.UpdateIfChanged(
                () => this.clientTerm.IsAvailableForTagging != isAvailableForTagging,
                () => this.clientTerm.IsAvailableForTagging = isAvailableForTagging
                );

            TermContainerUploader.UpdatePropertyBag(
                this.clientTerm.LocalCustomProperties,
                (name) => this.clientTerm.DeleteLocalCustomProperty(name),
                (name, value) => this.clientTerm.SetLocalCustomProperty(name, value),
                this.localTerm.LocalCustomProperties);

            if (this.localTerm.TermKind == LocalTermKind.NormalTerm)
            {
                bool isDeprecated = this.localTerm.IsDeprecated;
                this.UpdateIfChanged(
                    () => this.clientTerm.IsDeprecated != isDeprecated,
                    () => this.clientTerm.Deprecate(isDeprecated)
                    );

                string owner = this.localTerm.Owner;
                this.UpdateIfChanged(
                    () => this.clientTerm.Owner != owner,
                    () => this.clientTerm.Owner = owner
                    );

                TermContainerUploader.UpdatePropertyBag(
                    this.clientTerm.CustomProperties,
                    (name) => this.clientTerm.DeleteCustomProperty(name),
                    (name, value) => this.clientTerm.SetCustomProperty(name, value),
                    this.localTerm.CustomProperties);

                this.UpdateLabels();
                this.UpdateDescriptions();
            }

            return(true);
        }
예제 #2
0
        protected override bool OnProcessUpdateProperties()
        {
            this.SetClientWorkingLanguageToDefault();

            // (localized names handled below)
            string nameWithDefaultLcid = this.localTermSet.Name;

            this.UpdateIfChanged(
                () => this.clientTermSet.Name != nameWithDefaultLcid,
                () => this.clientTermSet.Name = nameWithDefaultLcid
                );

            string contact = this.localTermSet.Contact;

            this.UpdateIfChanged(
                () => this.clientTermSet.Contact != contact,
                () => this.clientTermSet.Contact = contact
                );

            string customSortOrder = this.localTermSet.CustomSortOrder.AsTextForServer;

            this.UpdateIfChanged(
                () => this.clientTermSet.CustomSortOrder != customSortOrder,
                () => this.clientTermSet.CustomSortOrder = customSortOrder
                );

            string description = this.localTermSet.Description;

            this.UpdateIfChanged(
                () => this.clientTermSet.Description != description,
                () => this.clientTermSet.Description = description
                );

            bool isAvailableForTagging = this.localTermSet.IsAvailableForTagging;

            this.UpdateIfChanged(
                () => this.clientTermSet.IsAvailableForTagging != isAvailableForTagging,
                () => this.clientTermSet.IsAvailableForTagging = isAvailableForTagging
                );

            bool isOpenForTermCreation = this.localTermSet.IsOpenForTermCreation;

            this.UpdateIfChanged(
                () => this.clientTermSet.IsOpenForTermCreation != isOpenForTermCreation,
                () => this.clientTermSet.IsOpenForTermCreation = isOpenForTermCreation
                );

            string owner = this.localTermSet.Owner;

            this.UpdateIfChanged(
                () => this.clientTermSet.Owner != owner,
                () => this.clientTermSet.Owner = owner
                );

            bool changedWorkingLanguage = false;

            foreach (var localizedNameQuery in this.localizedNameQueries)
            {
                string localizedName = this.localTermSet.GetNameWithDefault(localizedNameQuery.Lcid);
                if (localizedNameQuery.Name != localizedName)
                {
                    this.ClientTermStore.WorkingLanguage = localizedNameQuery.Lcid;
                    changedWorkingLanguage  = true;
                    this.clientTermSet.Name = localizedName;
                }
            }
            if (changedWorkingLanguage)
            {
                this.ClientTermStore.WorkingLanguage = this.Controller.DefaultLanguageLcid;
            }

            TermContainerUploader.UpdatePropertyBag(
                this.clientTermSet.CustomProperties,
                (name) => this.clientTermSet.DeleteCustomProperty(name),
                (name, value) => this.clientTermSet.SetCustomProperty(name, value),
                this.localTermSet.CustomProperties);

            this.UpdateStakeholders();

            return(true);
        }