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之图像处理(2)
    FIR滤波器(1)- 基础知识
    图像融合
    IEEE Floating Point Standard (IEEE754浮点数表示法标准)
    ISE 中使用system generate
    System Generator入门
    System Generator入门笔记
    2019 Multi-University Training Contest 7 Kejin Player Final Exam
    Sequence POJ
    POJ
  • 原文地址:https://www.cnblogs.com/hellohongfu/p/1950552.html
Copyright © 2011-2022 走看看