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;
                }
                
            }
    
  • 相关阅读:
    【云图】如何制作附近实体店的地图?-微信微博支付宝
    【云图】如何设置支付宝里的家乐福全国连锁店地图?
    【云图】如何设置微信里的全国实体店地图?
    【云图】如何制作官网上的实体店分布图?
    MYSQL 锁机制 分析
    数据结构-线性表-栈-递归
    mysql 异步执行 query //@todo
    C语言操作mysql
    linux gcc头文件搜索路径
    LINUX下动态库及版本号控制
  • 原文地址:https://www.cnblogs.com/hellohongfu/p/1950552.html
Copyright © 2011-2022 走看看