zoukankan      html  css  js  c++  java
  • CRM 根据属性获取相应类型的值

    /// <summary>
            /// 结束属性类型,并将属性值返回
            /// </summary>
            /// <param name="property"></param>
            /// <returns></returns>
            private string GetPropertyValue(Property property)
            {
                try
                {
                    Type theType = property.GetType();
                    if (theType == (new StringProperty()).GetType())
                    { //字符串
                        StringProperty theObject = (StringProperty)property;
                        return theObject.Value;
                    }
                    if (theType == (new LookupProperty()).GetType())
                    {    //引用
                        LookupProperty theObject = (LookupProperty)property;
                        return theObject.Value.name;
                    }
                    if (theType == (new CrmMoneyProperty()).GetType())
                    {    //金钱
                        CrmMoneyProperty theObject = (CrmMoneyProperty)property;
                        return theObject.Value.formattedvalue;
                    }
                    if (theType == (new CrmNumberProperty ()).GetType())
                    {    //整形数字
                        CrmNumberProperty theObject = (CrmNumberProperty)property;
                        return theObject.Value.Value.ToString() ;
                    }
    
                    if (theType == (new CrmBooleanProperty ()).GetType())
                    {    //bool型
                        CrmBooleanProperty theObject = (CrmBooleanProperty)property;
                        return theObject.Value.name;
                    }
                    if (theType == (new PicklistProperty ()).GetType())
                    {    //Picklist型
                        PicklistProperty theObject = (PicklistProperty)property;
                        return theObject.Value.name;
                    }
                    if (theType == (new CrmDateTimeProperty ()).GetType())
                    {    //datetime型
                        CrmDateTimeProperty theObject = (CrmDateTimeProperty)property;
                        return theObject.Value.date;
                    }
                    if (theType == (new CrmDecimalProperty()).GetType())
                    {    //十进数型
                        CrmDecimalProperty theObject = (CrmDecimalProperty)property;
                        return theObject.Value.Value.ToString ();
                    }
                    if (theType == (new CrmFloatProperty()).GetType())
                    {    //浮点数型
                        CrmFloatProperty theObject = (CrmFloatProperty)property;
                        return theObject.Value.Value.ToString();
                    }
                    if (theType == (new OwnerProperty ()).GetType())
                    {    //自我型
                        OwnerProperty theObject = (OwnerProperty)property;
                        return theObject.Value .name ;
                    }
                    if (theType == (new StateProperty ()).GetType())
                    {    //状态型
                        StateProperty theObject = (StateProperty)property;
                        return theObject.Value;
                    }
                    if (theType == (new KeyProperty ()).GetType())
                    {    //主键型
                        KeyProperty theObject = (KeyProperty)property;
                        return theObject.Value.Value.ToString ();
                    }
                    if (theType == (new DynamicEntityArrayProperty()).GetType())
                    {    //主键型
                        DynamicEntityArrayProperty theObject = (DynamicEntityArrayProperty)property;
                        return "无法解析DynamicEntityArrayProperty数据类型,请在代码中添加相应的解释!";
                    }
                    throw new Exception("无法解析此数据类型,请在代码中添加相应的解释!");
                }
                catch (Exception ex)
                {
                    
                    throw ex;
                }
                
            }
    
  • 相关阅读:
    【Matlab】把一年中的某一天(从1月1日起)换算成日期
    【工具】用hexo搭建博客
    【工具】文献分析工具histcite的简单使用
    【工具】用PPT排版打印海报时图片分辨率问题
    【工具】PPT插入高清图片保存后图片变模糊的解决方法
    【工具】排版软件TeX Live 2016的简单使用
    【工具】文字识别软件(OCR) ABBYY Finereader 11简单使用
    【Matlab】编程风格摘录
    【信号】用matlab实现一维信号的高斯滤波
    【GMT5】用GMT绘制测高卫星Topex_Poseidon_Jason的地面轨迹
  • 原文地址:https://www.cnblogs.com/hellohongfu/p/1950552.html
Copyright © 2011-2022 走看看