• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AttributeValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestAddingAttributeWithValue

        public void TestAddingAttributeWithValue()
        {
            AttributeCollection attributes = new AttributeCollection();
            AttributeValue comparisonAttributeValue = new AttributeValue("Value");

            attributes.Add("Name", comparisonAttributeValue);

            Assert.AreEqual<string>(comparisonAttributeValue.Value, attributes["Name"].Value);
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:9,代码来源:AttributeCollectionTests.cs


示例17: assertDateValue

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


示例18: assertBooleanValue

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


示例19: TestAttributeAccessor

        public void TestAttributeAccessor()
        {
            GlobalAttributeCollection globalAttributeCollection = GlobalAttributeCollection.GetInstance("SnagL");
            Attribute attribute = new Attribute("SnagL");
            AttributeValue original = new AttributeValue("SnagL");

            globalAttributeCollection.Clear();
            globalAttributeCollection.Add(attribute, original);
            Assert.IsTrue(globalAttributeCollection[attribute].Contains("SnagL"));
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:10,代码来源:GlobalAttributeCollectionTests.cs


示例20: ValidatePlay

        public bool ValidatePlay(Card DownCard, Card Played, Player played)
        {
            AttributeValue[] Entry = new AttributeValue[5];
            Entry[0] = new IntegerValue(DownCard.Number);
            Entry[1] = new IntegerValue(DownCard.Suit);
            Entry[2] = new IntegerValue(Played.Number);
            Entry[3] = new IntegerValue(Played.Suit);
            Entry[4] = new BooleanValue(false);

            if (_Forest == null) return true;
            else return Convert.ToBoolean(_Forest.MakeDecision(Entry).ToString());
        }
开发者ID:lawrencewade,项目名称:cs440,代码行数:12,代码来源:MaoAI.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AttributedType类代码示例发布时间:2022-05-24
下一篇:
C# AttributeType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap