當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。