当前位置: 首页>>代码示例>>C#>>正文


C# AttributeValue类代码示例

本文整理汇总了C#中AttributeValue的典型用法代码示例。如果您正苦于以下问题:C# AttributeValue类的具体用法?C# AttributeValue怎么用?C# AttributeValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AttributeValue类属于命名空间,在下文中一共展示了AttributeValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestCreateAttributeValueWithNullDisplayValue

        public void TestCreateAttributeValueWithNullDisplayValue()
        {
            AttributeValue attributeValue = new AttributeValue("Value", null);

            Assert.AreEqual<string>("Value", attributeValue.Value);
            Assert.AreEqual<string>("Value", attributeValue.DisplayValue);
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:7,代码来源:AttributeValueTests.cs

示例2: Save

        /// <summary>
        /// Saves the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="personId">The person identifier.</param>
        /// <returns></returns>
        public override bool Save( AttributeValue item, int? personId )
        {
            if ( item.Attribute != null )
            {
                // ensure that the BinaryFile.IsTemporary flag is set to false for any BinaryFiles that are associated with this record
                var fieldTypeImage = Rock.Web.Cache.FieldTypeCache.Read( Rock.SystemGuid.FieldType.IMAGE.AsGuid() );
                var fieldTypeBinaryFile = Rock.Web.Cache.FieldTypeCache.Read( Rock.SystemGuid.FieldType.BINARY_FILE.AsGuid() );

                if ( item.Attribute.FieldTypeId == fieldTypeImage.Id || item.Attribute.FieldTypeId == fieldTypeBinaryFile.Id )
                {
                    int? binaryFileId = item.Value.AsInteger();
                    if ( binaryFileId.HasValue )
                    {
                        BinaryFileService binaryFileService = new BinaryFileService( this.RockContext );
                        var binaryFile = binaryFileService.Get( binaryFileId.Value );
                        if ( binaryFile != null && binaryFile.IsTemporary )
                        {
                            binaryFile.IsTemporary = false;
                        }
                    }
                }
            }

            return base.Save( item, personId );
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:31,代码来源:AttributeValueService.Partial.cs

示例3: TestChangingAttributeValueProperties

        public void TestChangingAttributeValueProperties()
        {
            AttributeValue attribute = new AttributeValue("Value");
            object oldValue = null;
            object newValue = null;
            string propertyChanged = string.Empty;

            attribute.PropertyChanged += (object sender, PropertyChangedEventArgs<object> e) =>
            {
                propertyChanged = e.PropertyName;
                oldValue = e.OldValue;
                newValue = e.NewValue;
            };

            // Change Value
            EnqueueCallback(() => attribute.Value = "New Value");
            EnqueueConditional(() => propertyChanged != string.Empty);
            EnqueueCallback(() => Assert.AreEqual<string>("Value", propertyChanged));
            EnqueueCallback(() => Assert.AreEqual<string>("Value", (string)oldValue));
            EnqueueCallback(() => Assert.AreEqual<string>("New Value", (string)newValue));
            EnqueueCallback(() => propertyChanged = string.Empty);

            // Change DisplayValue
            EnqueueCallback(() => attribute.DisplayValue = "New Display Value");
            EnqueueConditional(() => propertyChanged != string.Empty);
            EnqueueCallback(() => Assert.AreEqual<string>("DisplayValue", propertyChanged));
            EnqueueCallback(() => Assert.AreEqual<string>(null, (string)oldValue));
            EnqueueCallback(() => Assert.AreEqual<string>("New Display Value", (string)newValue));
            EnqueueCallback(() => propertyChanged = string.Empty);

            EnqueueTestComplete();
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:32,代码来源:AttributeValueTests.cs

示例4: Execute

        /// <summary>
        /// Executes the specified workflow.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="action">The action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        public override bool Execute( RockContext rockContext, WorkflowAction action, Object entity, out List<string> errorMessages )
        {
            errorMessages = new List<string>();

            if ( entity is Model.BinaryFile )
            {
               var binaryFile = (Model.BinaryFile) entity;
                if ( binaryFile.BinaryFileType.Guid != new Guid( SystemGuid.BinaryFiletype.CHECKIN_LABEL ) )
                {
                    errorMessages.Add( "Binary file is not a check-in label" );
                    action.AddLogEntry( "Binary file is not a check-in label", true );
                    return false;
                }

                StringBuilder sb = new StringBuilder();

                var contentString = binaryFile.ContentsToString();
                foreach ( Match match in Regex.Matches(
                    contentString,
                    @"(?<=\^FD)[^\^FS]*(?=\^FS)" ) )
                {
                    sb.AppendFormat( "{0}^|", match.Value );
                }

                binaryFile.LoadAttributes();

                var attributeValue = new AttributeValue();
                attributeValue.Value = sb.ToString();

                binaryFile.AttributeValues["MergeCodes"] = attributeValue;
                binaryFile.SaveAttributeValues( rockContext );
            }

            return true;
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:43,代码来源:ParseZebraLabel.cs

示例5: MakeDecision

 public AttributeValue MakeDecision(AttributeValue[] Data, bool Print = false)
 {
     Dictionary<AttributeValue, int> P = new Dictionary<AttributeValue, int>();
     foreach (DecisionTree D in _Trees)
     {
         AttributeValue V = D.MakeDecision(Data, Print);
         bool Found = false;
         foreach (AttributeValue Key in P.Keys.ToList())
         {
             if (Key.CompareTo(V) == 0)
             {
                 P[Key]++;
                 Found = true;
             }
         }
         if (!Found)
         {
             P.Add(V, 1);
         }
     }
     AttributeValue M = null;
     int N = 0;
     foreach(KeyValuePair<AttributeValue, int> p in P)
     {
         if (p.Value > N)
         {
             N = p.Value;
             M = p.Key;
         }
     }
     return M;
 }
开发者ID:lawrencewade,项目名称:cs440,代码行数:32,代码来源:Forest.cs

示例6: ResolveAttributeValue

		public ResolveResult ResolveAttributeValue(XamlContext context, AttributeValue value, out string typeNameString)
		{
			typeNameString = value.IsString
				? value.StringValue
				: GetTypeNameFromTypeExtension(value.ExtensionValue, context);
			return ResolveExpression(typeNameString, context);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:XamlResolver.cs

示例7: AddEntry

 public void AddEntry(AttributeValue[] Entry)
 {
     for (int i = 0; i < Entry.Length;++i)
     {
         _Values[i].Add(Entry[i]);
     }
 }
开发者ID:lawrencewade,项目名称:cs440,代码行数:7,代码来源:DataSet.cs

示例8: Execute

        /// <summary> 
        /// Job that updates the JobPulse setting with the current date/time.
        /// This will allow us to notify an admin if the jobs stop running.
        /// 
        /// Called by the <see cref="IScheduler" /> when a
        /// <see cref="ITrigger" /> fires that is associated with
        /// the <see cref="IJob" />.
        /// </summary>
        public virtual void Execute(IJobExecutionContext context)
        {
            using ( new Rock.Data.UnitOfWorkScope() )
            {
                AttributeService attribService = new AttributeService();
                AttributeValueService attributeValueService = new AttributeValueService();

                Rock.Core.Attribute jobPulseAttrib = attribService.GetGlobalAttribute( "JobPulse" );
                Rock.Core.AttributeValue jobPulseAttribValue = jobPulseAttrib.AttributeValues.FirstOrDefault();

                // create attribute value if one does not exist
                if ( jobPulseAttribValue == null )
                {
                    jobPulseAttribValue = new AttributeValue();
                    jobPulseAttribValue.AttributeId = jobPulseAttrib.Id;
                    attributeValueService.Add( jobPulseAttribValue, null );
                }

                // store todays date and time
                jobPulseAttribValue.Value = DateTime.Now.ToString();

                // save attribute
                attributeValueService.Save( jobPulseAttribValue, null );
            }
        }
开发者ID:ChuckWare,项目名称:Rock-ChMS,代码行数:33,代码来源:JobPulse.cs

示例9: SatisfiesCondition

        private bool SatisfiesCondition(AttributeValue value)
        {
            if (m_bSearchForKey)
            {
                if (m_bFullText)
                {
                    if (!value.Key.Contains(m_sSearchKey))
                        return false;
                }
                else if (value.Key != m_sSearchKey)
                    return false;
            }

            if (m_bSearchForValue)
            {
                if (value.DataType != AttributeDataType.String)
                    return false;
                if (m_bFullText)
                {
                    if (!(value.Data as string).Contains(m_sSearchValue))
                        return false;
                }
                else if ((value.Data as string) != m_sSearchValue)
                    return false;
            }
            return true;
        }
开发者ID:micheleissa,项目名称:dow2-toolbox,代码行数:27,代码来源:RBFSearchForm.cs

示例10: getDetailProbability

 public double getDetailProbability(AttributeValue ATTRIBUTE_VALUE = AttributeValue.IsTrue)
 {
     string value;
     switch (ATTRIBUTE_VALUE)
     {
         case AttributeValue.IsFalse:
             value = "False";
             break;
         case AttributeValue.IsMissing:
             value = "Missing";
             break;
         case AttributeValue.IsNull:
             value = "0";
             break;
         case AttributeValue.IsTrue:
         default:
             value = "True";
             break;
     }
     try
     {
         return Node.DecisionTreeNodeDistributions.First(nd => nd.ATTRIBUTE_VALUE == value).PROBABILITY;
     }
     catch (Exception)
     {
         return 0;
     }
 }
开发者ID:khanhduy94,项目名称:jobzoom,代码行数:28,代码来源:DecisionTreeAnalysisResult.cs

示例11: TestAddingExistingAttribute

        public void TestAddingExistingAttribute()
        {
            bool exceptionThrown;
            AttributeCollection attributes = new AttributeCollection();
            AttributeValue newAttributeValue = new AttributeValue("Test Value");

            // Add attribute and attribute value
            attributes.Add("Test", newAttributeValue);

            Assert.AreEqual<string>(newAttributeValue.Value, attributes["Test"].Value);

            AttributeValue existingAttributeValue = new AttributeValue("Test Value");

            try
            {
                attributes.Add("Test", existingAttributeValue);
                exceptionThrown = false;
            }
            catch (ArgumentException)
            {
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown);
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:25,代码来源:AttributeCollectionTests.cs

示例12: Discriminator

 public Discriminator(int Index, AttributeValue Split, bool Equality)
 {
     _Index = Index;
     _Split = Split;
     _Equality = Equality;
     if (Split == null) _Function = delegate(AttributeValue[] E) { return E[_Index]; };
     else _Function = delegate(AttributeValue[] E) { return new BooleanValue(E[_Index].CompareTo(Split) == (Equality ? 0: -1));};
 }
开发者ID:lawrencewade,项目名称:cs440,代码行数:8,代码来源:Discriminator.cs

示例13: StringEqualIgnoreCaseMatch

 public StringEqualIgnoreCaseMatch(
     AttributeDesignator designator, 
     AttributeValue value)
     : base("urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case", 
           designator, 
           value)
 {
 }
开发者ID:patrickhuber,项目名称:Oriz,代码行数:8,代码来源:StringEqualIgnoreCaseMatch.cs

示例14: AttributeEventArgs

 public AttributeEventArgs(Attribute _attribute, AttributeValue _newValue, AttributeValue _oldValue, NotifyCollectionChangedAction _action)
     : base()
 {
     this.attribute = _attribute;
     this.newValue = _newValue;
     this.oldValue = _oldValue;
     this.action = _action;
 }
开发者ID:senfo,项目名称:snaglV2,代码行数:8,代码来源:AttributeEventArgs.cs

示例15: assertCharacterValue

 private void assertCharacterValue(AttributeValue attr, char value)
 {
     Assert.IsInstanceOfType(attr.getValue(), typeof(PrimitiveObjectBlock));
     PrimitiveObjectBlock pob = (PrimitiveObjectBlock)attr.getValue();
     Assert.IsInstanceOfType(pob.getSimpleValue(), typeof(CharacterValue));
     CharacterValue actual = (CharacterValue)pob.getSimpleValue();
     Character expected = new Character(value);
     Assert.AreEqual(actual.getValue(), expected);
 }
开发者ID:ZJU-BME-VICO,项目名称:openehr-ikvm,代码行数:9,代码来源:SimpleValuesTest.cs


注:本文中的AttributeValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。