CRM obtains the value of the corresponding type based on the property.

Source: Internet
Author: User
/// <Summary> /// end attribute type, return the property value // </Summary> /// <Param name = "property"> </param> /// <returns> </returns> private string getpropertyvalue (property) {try {type thetype = property. getType (); If (thetype = (New stringproperty ()). getType () {// string stringproperty theobject = (stringproperty) property; return theobject. value;} If (thetype = (New lookupproperty ()). getType () {// reference lookupproperty theobject = (lookupproperty) property; return theobject. value. name;} If (thetype = (New crmmoneyproperty ()). getType () {// money crmmoneyproperty theobject = (crmmoneyproperty) property; return theobject. value. formattedvalue;} If (thetype = (New crmnumberproperty ()). getType () {// integer number crmnumberproperty theobject = (crmnumberproperty) property; return theobject. value. value. tostring ();} If (thetype = (New crmbooleanproperty ()). getType () {// bool type 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 type crmdatetimeproperty theobject = (crmdatetimeproperty) property; return theobject. value. date;} If (thetype = (New crmdecimalproperty ()). getType () {// decimal 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 () {// self-built ownerproperty theobject = (ownerproperty) property; return theobject. value. name;} If (thetype ==( new stateproperty ()). getType () {// status stateproperty theobject = (stateproperty) property; return theobject. value;} If (thetype = (New keyproperty ()). getType () {// primary key type keyproperty theobject = (keyproperty) property; return theobject. value. value. tostring ();} If (thetype = (New dynamicentityarrayproperty ()). getType () {// primary key type dynamicentityarrayproperty theobject = (dynamicentityarrayproperty) property; Return "The dynamicentityarrayproperty data type cannot be parsed. Please goCode Add the corresponding explanation in! ";} Throw new exception (" This data type cannot be parsed. Please add an explanation in the code! ") ;}Catch (exception ex) {Throw ex ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.