Symphony Framework
Symphony Data v3.2
Symphony Templates > Symphony Data v3.2
Template file name Symphony_Data_v3_2.tpl

The Symphony_Data (version 3.2) provides the ability to create a powerful repository based Symphony Data Object class.

The generated class utilizes the powerful BaseDataObject class within the Symphony.Conductor.Model namespace.  The generated class exposes the individual fields from the Synergy Repository as Synergy types.  These types may need to be converted to native .Net types using the Symphony.Conductor.Converters classes.

The classes generated by this template are compatible with the Symphony_Style template. 

Symphony Data Objects provide a number of powerful capabilities including:

The generated classes are designed to be used in Synergy .Net developments.  They are primarily designed to support development of Synergy UI Toolkit replacement WPF modules.
It is recommended that your generated code from the Symphony_Data template is created into a project sub-folder called Data.
 CodeGen Template Tokens
Token Comments
NAMESPACE Define the namespace within which the generated class will be placed (-n option).
 Symphony Tokens
             

Symphony tokens are applied to fields in the repository in the Long Description.  They allow for additional field processing by CodeGen.  You must define both the token and value, enclosed within <> brackets.  For example <SYMPHONY_MAX_DISPLAY_LENGTH=100>

You can define any number of Symphony tokens in the long description.  There is no separation character required.

   
Token Comments
RPSDATAFILES Optionally define the repository main and text files, comma separated.
 CodeGen Command Examples
Data object
codegen e -r -s PART -t Symphony_Data_v3_2 -o %ROOT%ControlLibrary\Data -n ControlLibrary.Data

 

Define alternate repository files
set CUSTOMRPS=SYMPHONYRPS:rpsmain.ism,SYMPHONYRPS:rpstext.ism
codegen e -r -s PART -t Symphony_Data_v3_2 -o %ROOT%ControlLibrary\Data -n ControlLibrary.Data -ut RPSDATAFILES=CUSTOMRPS

 Example
;;****************************************************************************
;; WARNING: This code was code generated. Any changes that you
;;          make to this code will be overwritten if the code is regenerated!
;;
;; Template author: Richard C. Morris : RCP Consultants.
;;
;; Template Name:   Symphony Framework : SYMPHONY_DATA_V3_2.tpl
;;
;;***************************************************************************
import System
import System.Collections
import System.Collections.Generic
import System.Collections.ObjectModel
import System.Collections.Specialized
import System.Text
import System.Runtime.InteropServices
import System.IO

import Symphony.Conductor.Model
import Symphony.Conductor.Converters

import System.Reflection
import System.Runtime.Serialization
import Newtonsoft.Json


namespace ControlLibrary.Data

    ;;define a structure that we can use around the applicaiton

    structure STRPart
        .include 'part' repository  , norecord, prefix = "str_"
    endstructure

    {JsonObject(MemberSerialization.OptIn)}
    public partial class Part_Data extends Symphony.Conductor.Model.DataObjectBase

        private cls structure clsstrPart
.align
            public csId, String
.align
            public csGroupid, String
.align
            public csSupplierid, String
.align
            public csDescription, String
.align
            public csTechnical_info, String
.align
            public csQuantity, Int32
.align
            public csCost_price, Decimal
.align
            public csPart_status, Int32
        endstructure
        
        public static SynergyMemberInfo, @List<System.Reflection.MemberInfo>

        public const RPSStructureName    ,String    ,"PART"
        public const RPSStructureSize    ,Int32    ,700

        private part_main    ,STRPart

        private mDoneSynergyRecordValue    ,boolean
        
        ;;use symphony converters
        private mDateConveter   ,@SynergyDecimalDateConverter ,new SynergyDecimalDateConverter()
        private mAlphaConveter    ,@SynergyAlphaConverter ,new SynergyAlphaConverter()
        private mDecimalConveter  ,@SynergyDecimalConverter ,new SynergyDecimalConverter()
        private mImpliedDecimalConveter ,@SynergyImpliedDecimalConverter  ,new SynergyImpliedDecimalConverter()
        private mIntegerConveter  ,@SynergyIntConverter ,new SynergyIntConverter()
        private mAlphaYNConveter    ,@SynergyAlphaYNConverter, new SynergyAlphaYNConverter()

        static method Part_Data
            endparams
        proc
            data objectType = ^typeof(Part_Data)
            SynergyMemberInfo = new List<System.Reflection.MemberInfo>() {
            &    ^as(RuntimeReflectionExtensions.GetRuntimeProperty(objectType, "SerializableSynergyRecord"), @System.Reflection.MemberInfo)
            & }
            defineSerialiazableDataElements()

            mStaticFieldList = new List<BaseFieldInformation>()
            mStaticFieldDictionary = new Dictionary<string, int>()
            mStaticFieldNameList = new List<String>()
            mStaticFieldHeadingList = new List<String>()

            
            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "ID", "Id",  "", "",
            &    "", "ID", 1, 20,
            &    0, 0, 0, 0,
            &    "ALPHA", true, 0, 0)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "GROUPID", "Groupid",  "Change_Group_Id", "",
            &    "", "GROUPID", 21, 20,
            &    0, 0, 0, 0,
            &    "ALPHA", true, 0, 0)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "SUPPLIERID", "Supplierid",  "Change_Supplier_Id", "",
            &    "", "SUPPLIERID", 41, 20,
            &    0, 0, 0, 0,
            &    "ALPHA", true, 0, 0)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "DESCRIPTION", "Description",  "", "",
            &    "", "DESCRIPTION", 61, 50,
            &    0, 0, 0, 0,
            &    "ALPHA", true, 0, 0)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "TECHNICAL_INFO", "Technical_info",  "", "",
            &    "", "TECHNICAL_INFO", 111, 500,
            &    0, 0, 0, 0,
            &    "ALPHA", false, 0, 0)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "QUANTITY", "Quantity",  "", "",
            &    "", "QUANTITY", 611, 4,
            &    0, 0, 0, 0,
            &    "INTEGER", false, 0, 2147483647)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "COST_PRICE", "Cost_price",  "", "",
            &    "", "COST_PRICE", 615, 10,
            &    0, 0, 0, 0,
            &    "IMPLIED", false, 0, 99999999.99)

            
            staticSetFieldInfo(mStaticFieldList, mStaticFieldDictionary, "PART_STATUS", "Part_status",  "", "",
            &    "", "PART_STATUS", 625, 1,
            &    0, 0, 0, 0,
            &    "DECIMAL", false, 0, 2)


            mStaticFieldNameList.Add("Id")
            mStaticFieldHeadingList.Add("Part ID")
            mStaticFieldNameList.Add("Groupid")
            mStaticFieldHeadingList.Add("Group ID")
            mStaticFieldNameList.Add("Supplierid")
            mStaticFieldHeadingList.Add("Supplier ID")
            mStaticFieldNameList.Add("Description")
            mStaticFieldHeadingList.Add("Description")
            mStaticFieldNameList.Add("Technical_info")
            mStaticFieldHeadingList.Add("Technical Description")
            mStaticFieldNameList.Add("Quantity")
            mStaticFieldHeadingList.Add("Quantity")
            mStaticFieldNameList.Add("Cost_price")
            mStaticFieldHeadingList.Add("Cost price")
            mStaticFieldNameList.Add("Part_status")
            mStaticFieldHeadingList.Add("Status")

            mreturn
        endmethod
        
        private partial static method defineSerialiazableDataElements, void
        endmethod

        ;;; <summary>
        ;;;  Constructor, initialise the base fields
        ;;; </summary>
        public method Part_Data
            endparams
            parent()
        proc
            mDoneSynergyRecordValue = true
            doingClearFocus = false

            configureFieldInfo()
            setFieldNames()
            InitData()
            mDoneSynergyRecordValue = false
            extendedConstructor()
        endmethod

        ;;; <summary>
        ;;; Alternate constructor, accepts the inital value to assign to the object
        ;;; </summary>
        ;;; <param name="synRec">Provide the data to load into the _DATAOBJECT_</param>
        public method Part_Data
            in req synRec       ,String
            endparams
            parent()
        proc
            mDoneSynergyRecordValue = true
            doingClearFocus = false

            mIsNew = false
            configureFieldInfo()
            setFieldNames()
            part_main = synRec
            extendedConstructor()
        endmethod

        ;;; <summary>
        ;;; Alternate constructor, accepts the inital value to assign to the object
        ;;; </summary>
        ;;; <param name="synRec">Provide the data to load into the _DATAOBJECT_</param>
        public method Part_Data
            in req synRec       ,STRPart
            endparams
            parent()
        proc
            mDoneSynergyRecordValue = true
            doingClearFocus = false

            mIsNew = false
            configureFieldInfo()
            setFieldNames()
            part_main = synRec
            extendedConstructor()
        endmethod

        ;;; <summary>
        ;;; Alternate constructor, accepts the inital value to assign to the object.
        ;;; Also accepts the boolean value to assign to the ObjectRaisesPropertyChanged property.
        ;;; </summary>
        ;;; <param name="synRec">Provide the data to load into the _DATAOBJECT_</param>
        ;;; <param name="notifyUI">values passed onto the ObjectRaisesPropertyChanged property.</param>
        public method Part_Data
            in req synRec       ,String
            in req notifyUI        ,DataObjectNotificationState
            endparams
            parent()
        proc
            mDoneSynergyRecordValue = true
            doingClearFocus = false

            ObjectRaisesPropertyChanged = notifyUI
            mIsNew = false
            configureFieldInfo()
            setFieldNames()
            part_main = synRec
            extendedConstructor()
        endmethod

        ;;; <summary>
        ;;; Alternate constructor, accepts the inital value to assign to the object.
        ;;; Also accepts the boolean value to assign to the ObjectRaisesPropertyChanged property.
        ;;; </summary>
        ;;; <param name="synRec">Provide the data to load into the _DATAOBJECT_</param>
        ;;; <param name="notifyUI">values passed onto the ObjectRaisesPropertyChanged property.</param>
        public method Part_Data
            in req synRec       ,STRPart
            in req notifyUI        ,DataObjectNotificationState
            endparams
            parent()
        proc
            mDoneSynergyRecordValue = true
            doingClearFocus = false

            ObjectRaisesPropertyChanged = notifyUI
            mIsNew = false
            configureFieldInfo()
            setFieldNames()
            part_main = synRec
            extendedConstructor()
        endmethod

        ;;Set up the arrays of field details
        private method configureFieldInfo    ,void
            endparams
        proc
            
            mfieldArray = mStaticFieldList
            mfieldDictionary = mStaticFieldDictionary

        endmethod

        private static mStaticFieldList            ,@List<BaseFieldInformation>
        private static mStaticFieldDictionary    ,@Dictionary<string, int>
        private static mStaticFieldNameList        ,@List<String>
        private static mStaticFieldHeadingList    ,@List<String>

        ;;Set up the arrays of field names and headings
        private method setFieldNames    ,void
            endparams
        proc

            mFieldNames = mStaticFieldNameList
            mFieldHeadings = mStaticFieldHeadingList
            
        endmethod

        ;;Expose fields as properties for data binding
        
        ;;Id
        public property Id, a20
            method get
            proc
                mreturn %atrim(part_main.STR_Id)
            endmethod
            method set
            proc
                    if (part_main.STR_Id .nes. value)
                begin
                                        part_main.STR_Id = value
                    ValidateEnteredData(1)
                    RaisePropertyChanged("Id")
                end
            endmethod
        endproperty
        ;;Groupid
        public property Groupid, a20
            method get
            proc
                mreturn %atrim(part_main.STR_Groupid)
            endmethod
            method set
            proc
                    if (part_main.STR_Groupid .nes. value)
                begin
                                        part_main.STR_Groupid = value
                    ValidateEnteredData(2)
                    RaisePropertyChanged("Groupid")
                end
            endmethod
        endproperty
        ;;Supplierid
        public property Supplierid, a20
            method get
            proc
                mreturn %atrim(part_main.STR_Supplierid)
            endmethod
            method set
            proc
                    if (part_main.STR_Supplierid .nes. value)
                begin
                                        part_main.STR_Supplierid = value
                    ValidateEnteredData(3)
                    RaisePropertyChanged("Supplierid")
                end
            endmethod
        endproperty
        ;;Description
        public property Description, a50
            method get
            proc
                mreturn %atrim(part_main.STR_Description)
            endmethod
            method set
            proc
                    if (part_main.STR_Description .nes. value)
                begin
                                        part_main.STR_Description = value
                    ValidateEnteredData(4)
                    RaisePropertyChanged("Description")
                end
            endmethod
        endproperty
        ;;Technical_info
        public property Technical_info, a500
            method get
            proc
                mreturn %atrim(part_main.STR_Technical_info)
            endmethod
            method set
            proc
                    if (part_main.STR_Technical_info .nes. value)
                begin
                                        part_main.STR_Technical_info = value
                    ValidateEnteredData(5)
                    RaisePropertyChanged("Technical_info")
                end
            endmethod
        endproperty
        ;;Quantity
        public property Quantity, i4
            method get
            proc
                mreturn part_main.STR_Quantity
            endmethod
            method set
            proc
                if (part_main.STR_Quantity .ne. value)
                begin
                                        part_main.STR_Quantity = value
                    ValidateEnteredData(6)
                    RaisePropertyChanged("Quantity")
                end
            endmethod
        endproperty
        ;;Cost_price
        public property Cost_price, d10.2
            method get
            proc
                mreturn part_main.STR_Cost_price
            endmethod
            method set
            proc
                if (part_main.STR_Cost_price .ne. value)
                begin
                                        part_main.STR_Cost_price = value
                    ValidateEnteredData(7)
                    RaisePropertyChanged("Cost_price")
                end
            endmethod
        endproperty
        ;;Part_status
        public property Part_status, d1
            method get
            proc
                mreturn part_main.STR_Part_status
            endmethod
            method set
            proc
                if (part_main.STR_Part_status .ne. value)
                begin
                                        part_main.STR_Part_status = value
                    ValidateEnteredData(8)
                    RaisePropertyChanged("Part_status")
                end
            endmethod
        endproperty
            
        ;;; <summary>
        ;;; Expose the complete synergy record
        ;;; </summary>
        public override property SynergyRecord, String
            method get
            proc
                mreturn (String)Part_main
            endmethod
            method set
            proc
                if (!mDoneSynergyRecordValue)
                    OriginalSynergyRecord = value

                mDoneSynergyRecordValue = true
                
                setUsed()
                Part_main = value

                ;;Signal that all fields have changed
                
                SetFieldValid("Id")
                                    if (mValidateSynergyData) ValidateEnteredData(1)
                SetFieldValid("Groupid")
                                    if (mValidateSynergyData) ValidateEnteredData(2)
                SetFieldValid("Supplierid")
                                    if (mValidateSynergyData) ValidateEnteredData(3)
                SetFieldValid("Description")
                                    if (mValidateSynergyData) ValidateEnteredData(4)
                SetFieldValid("Technical_info")
                                    if (mValidateSynergyData) ValidateEnteredData(5)
                SetFieldValid("Quantity")
                                    if (mValidateSynergyData) ValidateEnteredData(6)
                SetFieldValid("Cost_price")
                                    if (mValidateSynergyData) ValidateEnteredData(7)
                SetFieldValid("Part_status")
                                    if (mValidateSynergyData) ValidateEnteredData(8)
                RaisePropertyChanged(^null)
                RaiseSynergyRecordChanged()
            endmethod
        endproperty

        ;;; <summary>
        ;;; Allow the host to initialise all fields.
        ;;; </summary>
        public override method InitData ,void
        proc
            init Part_main

            RaisePropertyChanged(^null)
            parent.InitData()
        endmethod

        ;;; <summary>
        ;;; Allow the host to validate all fields. Each field will fire the validation method.
        ;;; </summary>
        public override method InitialValidateData, void
            endparams
        proc
            
                            ValidateEnteredData(1)
            RaisePropertyChanged("Id")
                            ValidateEnteredData(2)
            RaisePropertyChanged("Groupid")
                            ValidateEnteredData(3)
            RaisePropertyChanged("Supplierid")
                            ValidateEnteredData(4)
            RaisePropertyChanged("Description")
                            ValidateEnteredData(5)
            RaisePropertyChanged("Technical_info")
                            ValidateEnteredData(6)
            RaisePropertyChanged("Quantity")
                            ValidateEnteredData(7)
            RaisePropertyChanged("Cost_price")
                            ValidateEnteredData(8)
            RaisePropertyChanged("Part_status")

        endmethod

        ;;; <summary>
        ;;; Indicate from the UI which field now has focus. This then signals the
        ;;; CurrentFieldInfo change event so the UI can get the current field details
        ;;; </summary>
        ;;; <param name="fieldName">Name of field with focus</param>
        public override method SetFieldFocusFlag    ,void
            in req fieldName                        ,String
            endparams
        proc
            using fieldName select
            
            
            ("ID"), mCurrentField = 1
            
            ("GROUPID"), mCurrentField = 2
            
            ("SUPPLIERID"), mCurrentField = 3
            
            ("DESCRIPTION"), mCurrentField = 4
            
            ("TECHNICAL_INFO"), mCurrentField = 5
            
            ("QUANTITY"), mCurrentField = 6
            
            ("COST_PRICE"), mCurrentField = 7
            
            ("PART_STATUS"), mCurrentField = 8
            (),
                mCurrentField = 0
            endusing
            RaisePropertyChanged("CurrentFieldInfo")
        endmethod

        ;;; <summary>
        ;;; Expose information about the current field
        ;;; </summary>
        ;;; <returns>Current field information</returns>
        public property CurrentFieldInfo    ,String
            method get
            proc
                using mCurrentField select
                
                
                (1),    mreturn "Product unique identifier                                                       "
                
                (2),    mreturn "Product group link                                                              "
                
                (3),    mreturn "Primary supplier link                                                           "
                
                (4),    mreturn "Product description                                                             "
                
                (5),    mreturn "Technical information                                                           "
                
                (6),    mreturn "Stock holding quantity                                                          "
                
                (7),    mreturn "Unit cost price                                                                 "
                
                (8),    mreturn "Current availability status                                                     "
                (), mreturn ""  ;;if incorrect field value or not configured, ensure we clear the return value
                endusing
            endmethod
        endproperty

        ;;Expose properties to indicate whether fields are enabled
        
        

        public property IdIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(1)
            endmethod
            method set
            proc
                SetFieldEnabledState(1, value)
                RaiseNonRPSPropertyChanged("IdIsEnabled")
            endmethod
        endproperty
        

        public property GroupidIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(2)
            endmethod
            method set
            proc
                SetFieldEnabledState(2, value)
                RaiseNonRPSPropertyChanged("GroupidIsEnabled")
            endmethod
        endproperty
        

        public property SupplieridIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(3)
            endmethod
            method set
            proc
                SetFieldEnabledState(3, value)
                RaiseNonRPSPropertyChanged("SupplieridIsEnabled")
            endmethod
        endproperty
        

        public property DescriptionIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(4)
            endmethod
            method set
            proc
                SetFieldEnabledState(4, value)
                RaiseNonRPSPropertyChanged("DescriptionIsEnabled")
            endmethod
        endproperty
        

        public property Technical_infoIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(5)
            endmethod
            method set
            proc
                SetFieldEnabledState(5, value)
                RaiseNonRPSPropertyChanged("Technical_infoIsEnabled")
            endmethod
        endproperty
        

        public property QuantityIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(6)
            endmethod
            method set
            proc
                SetFieldEnabledState(6, value)
                RaiseNonRPSPropertyChanged("QuantityIsEnabled")
            endmethod
        endproperty
        

        public property Cost_priceIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(7)
            endmethod
            method set
            proc
                SetFieldEnabledState(7, value)
                RaiseNonRPSPropertyChanged("Cost_priceIsEnabled")
            endmethod
        endproperty
        

        public property Part_statusIsEnabled, Boolean
            method get
            proc
                mreturn GetFieldEnabledState(8)
            endmethod
            method set
            proc
                SetFieldEnabledState(8, value)
                RaiseNonRPSPropertyChanged("Part_statusIsEnabled")
            endmethod
        endproperty

        ;;Expose properties to indicate whether fields are focussed
        private mIdIsFocused    ,Boolean
        public property IdIsFocused, Boolean
            method get
            proc
                mreturn mIdIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mIdIsFocused = value
                RaiseNonRPSPropertyChanged("IdIsFocused")
            endmethod
        endproperty
        private mGroupidIsFocused    ,Boolean
        public property GroupidIsFocused, Boolean
            method get
            proc
                mreturn mGroupidIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mGroupidIsFocused = value
                RaiseNonRPSPropertyChanged("GroupidIsFocused")
            endmethod
        endproperty
        private mSupplieridIsFocused    ,Boolean
        public property SupplieridIsFocused, Boolean
            method get
            proc
                mreturn mSupplieridIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mSupplieridIsFocused = value
                RaiseNonRPSPropertyChanged("SupplieridIsFocused")
            endmethod
        endproperty
        private mDescriptionIsFocused    ,Boolean
        public property DescriptionIsFocused, Boolean
            method get
            proc
                mreturn mDescriptionIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mDescriptionIsFocused = value
                RaiseNonRPSPropertyChanged("DescriptionIsFocused")
            endmethod
        endproperty
        private mTechnical_infoIsFocused    ,Boolean
        public property Technical_infoIsFocused, Boolean
            method get
            proc
                mreturn mTechnical_infoIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mTechnical_infoIsFocused = value
                RaiseNonRPSPropertyChanged("Technical_infoIsFocused")
            endmethod
        endproperty
        private mQuantityIsFocused    ,Boolean
        public property QuantityIsFocused, Boolean
            method get
            proc
                mreturn mQuantityIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mQuantityIsFocused = value
                RaiseNonRPSPropertyChanged("QuantityIsFocused")
            endmethod
        endproperty
        private mCost_priceIsFocused    ,Boolean
        public property Cost_priceIsFocused, Boolean
            method get
            proc
                mreturn mCost_priceIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mCost_priceIsFocused = value
                RaiseNonRPSPropertyChanged("Cost_priceIsFocused")
            endmethod
        endproperty
        private mPart_statusIsFocused    ,Boolean
        public property Part_statusIsFocused, Boolean
            method get
            proc
                mreturn mPart_statusIsFocused
            endmethod
            method set
            proc
                clearFocus()
                mPart_statusIsFocused = value
                RaiseNonRPSPropertyChanged("Part_statusIsFocused")
            endmethod
        endproperty

        ;;Expose properties to indicate whether fields are read only
        
        

        public property IdIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(1)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(1, value)
                RaiseNonRPSPropertyChanged("IdIsReadOnly")
            endmethod
        endproperty
        

        public property GroupidIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(2)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(2, value)
                RaiseNonRPSPropertyChanged("GroupidIsReadOnly")
            endmethod
        endproperty
        

        public property SupplieridIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(3)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(3, value)
                RaiseNonRPSPropertyChanged("SupplieridIsReadOnly")
            endmethod
        endproperty
        

        public property DescriptionIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(4)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(4, value)
                RaiseNonRPSPropertyChanged("DescriptionIsReadOnly")
            endmethod
        endproperty
        

        public property Technical_infoIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(5)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(5, value)
                RaiseNonRPSPropertyChanged("Technical_infoIsReadOnly")
            endmethod
        endproperty
        

        public property QuantityIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(6)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(6, value)
                RaiseNonRPSPropertyChanged("QuantityIsReadOnly")
            endmethod
        endproperty
        

        public property Cost_priceIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(7)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(7, value)
                RaiseNonRPSPropertyChanged("Cost_priceIsReadOnly")
            endmethod
        endproperty
        

        public property Part_statusIsReadOnly, Boolean
            method get
            proc
                mreturn GetFieldReadOnlyState(8)
            endmethod
            method set
            proc
                SetFieldReadOnlyState(8, value)
                RaiseNonRPSPropertyChanged("Part_statusIsReadOnly")
            endmethod
        endproperty

        private doingClearFocus    ,Boolean

        private method clearFocus, void
            endparams
        proc
            if (!doingClearFocus)
            begin
                doingClearFocus = true
                if (IdIsFocused) IdIsFocused = false
                if (GroupidIsFocused) GroupidIsFocused = false
                if (SupplieridIsFocused) SupplieridIsFocused = false
                if (DescriptionIsFocused) DescriptionIsFocused = false
                if (Technical_infoIsFocused) Technical_infoIsFocused = false
                if (QuantityIsFocused) QuantityIsFocused = false
                if (Cost_priceIsFocused) Cost_priceIsFocused = false
                if (Part_statusIsFocused) Part_statusIsFocused = false
                doingClearFocus = false
            end
        endmethod

        public method FieldErrorDetails    ,void
            in req fldName                ,String
            in req errorText            ,String
            endparams
        proc
            setErrorDetails(fldName, errorText)
            RaisePropertyChanged(fldName)
        endmethod

        public method FieldValidDetails    ,void
            in req fldName                ,String
            endparams
        proc
            SetFieldValid(fldName)
            RaisePropertyChanged(fldName)
        endmethod

        public override method CompareObjects    ,int
            in req obj1                            ,@Object
            in req obj2                            ,@Object
            in req colName                        ,String
            in req sortDir                        ,Symphony.Conductor.Framework.SynergySortOrder
            endparams

            record
                result        ,int
            endrecord
        proc
            using colName select
            ("Id"),
            begin
                if (((Part_Data)obj1).Id == ((Part_Data)obj2).Id) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Id > ((Part_Data)obj2).Id) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Groupid"),
            begin
                if (((Part_Data)obj1).Groupid == ((Part_Data)obj2).Groupid) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Groupid > ((Part_Data)obj2).Groupid) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Supplierid"),
            begin
                if (((Part_Data)obj1).Supplierid == ((Part_Data)obj2).Supplierid) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Supplierid > ((Part_Data)obj2).Supplierid) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Description"),
            begin
                if (((Part_Data)obj1).Description == ((Part_Data)obj2).Description) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Description > ((Part_Data)obj2).Description) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Technical_info"),
            begin
                if (((Part_Data)obj1).Technical_info == ((Part_Data)obj2).Technical_info) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Technical_info > ((Part_Data)obj2).Technical_info) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Quantity"),
            begin
                if (((Part_Data)obj1).Quantity == ((Part_Data)obj2).Quantity) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Quantity > ((Part_Data)obj2).Quantity) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Cost_price"),
            begin
                if (((Part_Data)obj1).Cost_price == ((Part_Data)obj2).Cost_price) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Cost_price > ((Part_Data)obj2).Cost_price) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            ("Part_status"),
            begin
                if (((Part_Data)obj1).Part_status == ((Part_Data)obj2).Part_status) then
                    result = 0
                else
                begin
                    if (((Part_Data)obj1).Part_status > ((Part_Data)obj2).Part_status) then
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Ascending) then
                            result = -1
                        else
                            result = 1
                    end
                    else
                    begin
                        if (sortDir == Symphony.Conductor.Framework.SynergySortOrder.Descending) then
                            result = -1
                        else
                            result = 1
                    end
                end
            end
            (),
                result = this.CustomCompareObjects(obj1, obj2, colName, sortDir)
            endusing

            mreturn result
        endmethod
        
.region "Serialization over Symphony Bridge"
        
        
        {JsonProperty}
        public property SerializableSynergyRecord, [#]byte
            method get
            proc
                data tmpSTR    ,clsstrPart
                tmpSTR.csId = (string)mAlphaConveter.Convert(part_main.STR_id, ^null, ^null, ^null)
                tmpSTR.csGroupid = (string)mAlphaConveter.Convert(part_main.STR_groupid, ^null, ^null, ^null)
                tmpSTR.csSupplierid = (string)mAlphaConveter.Convert(part_main.STR_supplierid, ^null, ^null, ^null)
                tmpSTR.csDescription = (string)mAlphaConveter.Convert(part_main.STR_description, ^null, ^null, ^null)
                tmpSTR.csTechnical_info = (string)mAlphaConveter.Convert(part_main.STR_technical_info, ^null, ^null, ^null)
                tmpSTR.csQuantity = (int)mIntegerConveter.Convert(part_main.STR_quantity, ^null, ^null, ^null)
                tmpSTR.csCost_price = (decimal)mImpliedDecimalConveter.Convert(part_main.STR_cost_price, ^null, ^null, ^null)
                tmpSTR.csPart_status = (int)mIntegerConveter.Convert(part_main.STR_part_status, ^null, ^null, ^null)
                mreturn structureToByteArray(tmpSTR)
            endmethod
            method set
            proc
                data tmpSTR    ,clsstrPart
                tmpSTR = byteArrayToStructure(value)
                part_main.STR_Id = (a)mAlphaConveter.ConvertBack(tmpSTR.csId, ^null, ^null, ^null)
                part_main.STR_Groupid = (a)mAlphaConveter.ConvertBack(tmpSTR.csGroupid, ^null, ^null, ^null)
                part_main.STR_Supplierid = (a)mAlphaConveter.ConvertBack(tmpSTR.csSupplierid, ^null, ^null, ^null)
                part_main.STR_Description = (a)mAlphaConveter.ConvertBack(tmpSTR.csDescription, ^null, ^null, ^null)
                part_main.STR_Technical_info = (a)mAlphaConveter.ConvertBack(tmpSTR.csTechnical_info, ^null, ^null, ^null)
                part_main.STR_Quantity = (i)mIntegerConveter.ConvertBack(tmpSTR.csQuantity, ^null, ^null, ^null)
                part_main.STR_Cost_price = (id)mImpliedDecimalConveter.ConvertBack(tmpSTR.csCost_price, ^null, ^null, ^null)
                part_main.STR_Part_status = (d)((i)mIntegerConveter.ConvertBack(tmpSTR.csPart_status, ^null, ^null, ^null))
            endmethod
        endproperty
            
        private static method structureToByteArray    ,[#]byte
            tmpSTRUCT                ,clsstrPart
            endparams
        proc
            data stream    ,@MemoryStream , new MemoryStream()
            begin
                disposable data writer ,@BinaryWriter , new BinaryWriter(stream)
                writer.Write(tmpSTRUCT.csId)
                writer.Write(tmpSTRUCT.csGroupid)
                writer.Write(tmpSTRUCT.csSupplierid)
                writer.Write(tmpSTRUCT.csDescription)
                writer.Write(tmpSTRUCT.csTechnical_info)
                writer.Write(tmpSTRUCT.csQuantity.ToString())
                writer.Write(tmpSTRUCT.csCost_price.ToString())
                writer.Write(tmpSTRUCT.csPart_status.ToString())
            end
            mreturn stream.ToArray()
        endmethod
        
        private static method byteArrayToStructure    ,clsstrPart
            bytearray, [#]byte  
            endparams
        proc
            data tmpString    ,string
            data tmpSTRUCT    ,clsstrPart
            data stream    ,@MemoryStream    ,new MemoryStream(byteArray)
            begin
                disposable data reader    ,@BinaryReader    ,new BinaryReader(stream)
                tmpSTRUCT.csId = reader.ReadString()
                tmpSTRUCT.csGroupid = reader.ReadString()
                tmpSTRUCT.csSupplierid = reader.ReadString()
                tmpSTRUCT.csDescription = reader.ReadString()
                tmpSTRUCT.csTechnical_info = reader.ReadString()
                tmpString = reader.ReadString()
                tmpSTRUCT.csQuantity = Convert.ToInt32(tmpString)
                tmpString = reader.ReadString()
                tmpSTRUCT.csCost_price = Convert.ToDecimal(tmpString)
                tmpString = reader.ReadString()
                tmpSTRUCT.csPart_status = Convert.ToInt32(tmpString)
            end

            mreturn tmpSTRUCT
        endmethod
        
        public override property StructureSize    ,Int32
            method get
            proc
                mreturn RPSStructureSize
            endmethod
        endproperty

.endregion
        
    endclass
endnamespace

See Also

Reference