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


C# Guid.GetType方法代码示例

本文整理汇总了C#中System.Guid.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.GetType方法的具体用法?C# Guid.GetType怎么用?C# Guid.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Guid的用法示例。


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

示例1: getEntity

        /// <summary>
        /// This method is used to get attributes from a specified entity. It returns Dictionary containing all the required attributes values.
        /// </summary>
        /// <param name="entityGuid">GUID of the entity</param>
        /// <param name="entityName_">The entity name type (contact,lead,...)</param>
        ///<param name="entityAttributes">The ArrayList containing the attributes names types you want to retrieve (firstname,lastname,...)</param>
        public Dictionary<string, string> getEntity(Guid entityGuid, string entityName_, ArrayList entityAttributes)
        {
            Dictionary<string, string> arrayData = new Dictionary<string, string>();
            try
            {
                isconnected();

                ArrayList arrayResults = new ArrayList();
                // Create the retrieve target.
                TargetRetrieveDynamic targetRetrieve = new TargetRetrieveDynamic();

                // Set the properties of the target.
                targetRetrieve.EntityName = entityName_;
                targetRetrieve.EntityId = entityGuid;

                // Create the request object.
                RetrieveRequest retrieve = new RetrieveRequest();
                ColumnSet col = new ColumnSet();

                // Set the properties of the request object.
                retrieve.Target = targetRetrieve;
                for (int i = 0; i < entityAttributes.Count; i++)
                {
                    col.AddColumn(entityAttributes[i].ToString());
                }

                retrieve.ColumnSet = col;

                // Indicate that the BusinessEntity should be retrieved as a
                // DynamicEntity.
                retrieve.ReturnDynamicEntities = true;

                // Execute the request.
                RetrieveResponse retrieved = (RetrieveResponse)m_crmService.Execute(retrieve);

                // Extract the DynamicEntity from the request.
                DynamicEntity entity = (DynamicEntity)retrieved.BusinessEntity;

                Microsoft.Crm.Sdk.CrmDateTime crmDateTimeVar = new Microsoft.Crm.Sdk.CrmDateTime();
                Microsoft.Crm.Sdk.CrmNumber crmNumberVar = new Microsoft.Crm.Sdk.CrmNumber();
                Picklist crmPickList = new Picklist();
                Guid crmGuid = new Guid();
                Microsoft.Crm.Sdk.Key keyVar = new Microsoft.Crm.Sdk.Key();
                Lookup lookupVar = new Lookup();
                Microsoft.Crm.Sdk.CrmBoolean boolVar = new Microsoft.Crm.Sdk.CrmBoolean();
                for (int i = 0; i < entityAttributes.Count; i++)
                {
                    if (entity.Properties.Contains(entityAttributes[i].ToString()))
                    {
                        if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(crmDateTimeVar.GetType()))
                        {
                            crmDateTimeVar = (Microsoft.Crm.Sdk.CrmDateTime)entity.Properties[entityAttributes[i].ToString()];
                            arrayData.Add(entityAttributes[i].ToString(),crmDateTimeVar.date.ToString());
                        }
                        else
                        {
                            if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(crmNumberVar.GetType()))
                            {
                                crmNumberVar = (Microsoft.Crm.Sdk.CrmNumber)entity.Properties[entityAttributes[i].ToString()];
                                arrayData.Add(entityAttributes[i].ToString(), crmNumberVar.Value.ToString());
                            }
                            else
                            {
                                if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(keyVar.GetType()))
                                {
                                    keyVar = (Microsoft.Crm.Sdk.Key)entity.Properties[entityAttributes[i].ToString()];
                                    arrayData.Add(entityAttributes[i].ToString(), keyVar.Value.ToString());
                                }
                                else
                                {
                                    if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(lookupVar.GetType()))
                                    {
                                        lookupVar = (Microsoft.Crm.Sdk.Lookup)entity.Properties[entityAttributes[i].ToString()];
                                        arrayData.Add(entityAttributes[i].ToString(), lookupVar.Value.ToString());
                                    }
                                    else
                                    {
                                        if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(boolVar.GetType()))
                                        {
                                            boolVar = (Microsoft.Crm.Sdk.CrmBoolean)entity.Properties[entityAttributes[i].ToString()];
                                            arrayData.Add(entityAttributes[i].ToString(), boolVar.Value.ToString());
                                        }
                                        else
                                        {
                                            if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(crmPickList.GetType()))
                                            {
                                                crmPickList = (Microsoft.Crm.Sdk.Picklist)entity.Properties[entityAttributes[i].ToString()];
                                                arrayData.Add(entityAttributes[i].ToString(), crmPickList.Value.ToString());
                                            }
                                            else
                                            {
                                                if (entity.Properties[entityAttributes[i].ToString()].GetType().Equals(crmGuid.GetType()))
                                                {
                                                    crmGuid = (Guid)entity.Properties[entityAttributes[i].ToString()];
//.........这里部分代码省略.........
开发者ID:JuustoMestari,项目名称:CRM,代码行数:101,代码来源:ESC_CRM.cs

示例2: TestWriteSessionId

        public void TestWriteSessionId()
        {
            Guid value = new Guid();
            var name = "test";
            var attribute = XFireAttributeFactory.Instance.GetAttribute(value.GetType());

            using (var ms = new MemoryStream())
            {
                using (var writer = new BinaryWriter(ms))
                {
                    attribute.WriteAll(writer, name, value);
                }

                var expected = ByteHelper.CombineByteArray(new byte[]{ 0x04, 0x74, 0x65, 0x73, 0x74, 0x03 }, value.ToByteArray());
                Assert.IsTrue(ms.ToArray().SequenceEqual(expected));
            }
        }
开发者ID:darcymiranda,项目名称:PFire,代码行数:17,代码来源:AttributeWriters.cs


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