コード例 #1
0
        /// <summary>
        /// Create a change that modifies the business name
        /// </summary>
        private void CreateBusinessNameChange(Feature feature, Constraint constraint)
        {
            #region Business Name Change
            // 1. Validate constraint if possible
            BusinessNameConstraintAnnotation bnc = new BusinessNameConstraintAnnotation();
            var stConstraint = constraint.Value as ConstraintValue <String>;
            if (stConstraint.Original != null && !stConstraint.Original.Equals(feature.BusinessName))
            {
                Trace.WriteLine(String.Format("Delta: Business name constraint original text does not match actual business name on feature '{0}'", feature.Name), "warn");
            }

            // 2. Check for duplicates
            if (feature.Annotations.Exists(o => o is BusinessNameConstraintAnnotation && (o as BusinessNameConstraintAnnotation).RealmCode == this.m_deltaSet.Realm.Code))
            {
                Trace.WriteLine(String.Format("Delta: Business name constraint has already been applied to '{0}'", feature.Name), "error");
                return;
            }

            // 3. Append constraint
            feature.Annotations.Add(new BusinessNameConstraintAnnotation()
            {
                RealmCode  = this.m_deltaSet.Realm.Code,
                NewValue   = stConstraint.New,
                ChangeType = ChangeType.Edit,
                RealmName  = this.m_deltaSet.MetaData.Description
            });
            #endregion
        }
コード例 #2
0
ファイル: DeltaEngine.cs プロジェクト: oneminot/everest
        /// <summary>
        /// Create a change that modifies the business name
        /// </summary>
        private void CreateBusinessNameChange(Feature feature, Constraint constraint)
        {
            #region Business Name Change
            // 1. Validate constraint if possible
            BusinessNameConstraintAnnotation bnc = new BusinessNameConstraintAnnotation();
            var stConstraint = constraint.Value as ConstraintValue<String>;
            if (stConstraint.Original != null && !stConstraint.Original.Equals(feature.BusinessName))
                Trace.WriteLine(String.Format("Delta: Business name constraint original text does not match actual business name on feature '{0}'", feature.Name), "warn");

            // 2. Check for duplicates
            if (feature.Annotations.Exists(o => o is BusinessNameConstraintAnnotation && (o as BusinessNameConstraintAnnotation).RealmCode == this.m_deltaSet.Realm.Code))
            {
                Trace.WriteLine(String.Format("Delta: Business name constraint has already been applied to '{0}'", feature.Name), "error");
                return;
            }

            // 3. Append constraint
            feature.Annotations.Add(new BusinessNameConstraintAnnotation()
            {
                RealmCode = this.m_deltaSet.Realm.Code,
                NewValue = stConstraint.New,
                ChangeType = ChangeType.Edit,
                RealmName = this.m_deltaSet.MetaData.Description
            });
            #endregion
        }