예제 #1
0
        internal override void updateReferencesAfterDeserialize(SFRefereceResolver i_ReferenceResolver, bool i_ShouldAddToRelatedLists = true)
        {
            JToken objectJson = removeObjectJTokenFromAdditionalDictionary("ServiceTerritory");

            ServiceTerritory = DeserializationUtils.GetSingleObjectReference <ServiceTerritory>(ServiceTerritoryId, objectJson, i_ReferenceResolver);

            objectJson = removeObjectJTokenFromAdditionalDictionary("ParentWorkOrderLineItem");
            ParentWorkOrderLineItem = DeserializationUtils.GetSingleObjectReference <WorkOrderLineItem>(ParentWorkOrderLineItemId, objectJson, i_ReferenceResolver);

            objectJson            = removeObjectJTokenFromAdditionalDictionary("RootWorkOrderLineItem");
            RootWorkOrderLineItem = DeserializationUtils.GetSingleObjectReference <WorkOrderLineItem>(RootWorkOrderLineItemId, objectJson, i_ReferenceResolver);

            objectJson = removeObjectJTokenFromAdditionalDictionary("WorkOrder");
            WorkOrder  = DeserializationUtils.GetSingleObjectReference <WorkOrder>(WorkOrderId, objectJson, i_ReferenceResolver);

            objectJson = removeObjectJTokenFromAdditionalDictionary("WorkType");
            WorkType   = DeserializationUtils.GetSingleObjectReference <WorkType>(WorkTypeId, objectJson, i_ReferenceResolver);

            VisitingHours__r = DeserializationUtils.GetSingleObjectReference <OperatingHours>(VisitingHours__c, i_ReferenceResolver);
            VisitingHours__r = DeserializationUtils.CreateEmptyReferenceFromId(VisitingHours__c, VisitingHours__r, i_ReferenceResolver);

            DeserializationUtils.ProcessRelatedObjectsCollection(skillRequirementsCollection, i_ReferenceResolver);
            skillRequirementsCollection = null;

            base.updateReferencesAfterDeserialize(i_ReferenceResolver);
        }
예제 #2
0
        internal virtual void updateReferencesAfterDeserialize(SFRefereceResolver i_ReferenceResolver, bool i_ShouldAddToRelatedLists = true)
        {
            if (m_JSONAdditionalData != null)
            {
                foreach (KeyValuePair <string, JToken> nonSchemaProperty in m_JSONAdditionalData)
                {
                    switch (nonSchemaProperty.Value.Type)
                    {
                    case JTokenType.Boolean:
                        BooleanFields[nonSchemaProperty.Key] = nonSchemaProperty.Value.Value <bool?>();
                        break;

                    case JTokenType.Float:
                    case JTokenType.Integer:
                        NumericFields[nonSchemaProperty.Key] = nonSchemaProperty.Value.Value <double?>();
                        break;

                    case JTokenType.Object:
                        JToken junctionToken = nonSchemaProperty.Value;
                        RelatedObjectCollection <sObject> deserializedJunctions = junctionToken.ToObject <RelatedObjectCollection <sObject> >();
                        DeserializationUtils.ProcessRelatedObjectsCollection(deserializedJunctions, i_ReferenceResolver);
                        JunctionFields[nonSchemaProperty.Key] = deserializedJunctions.records;
                        break;

                    case JTokenType.Date:
                        DateFields[nonSchemaProperty.Key] = nonSchemaProperty.Value.Value <DateTime?>();
                        break;

                    case JTokenType.String:
                        StringFields[nonSchemaProperty.Key] = nonSchemaProperty.Value.Value <string>();
                        break;
                    }
                }
            }
        }
예제 #3
0
        internal override void updateReferencesAfterDeserialize(SFRefereceResolver i_ReferenceResolver, bool i_ShouldAddToRelatedLists = true)
        {
            JToken objectJson = removeObjectJTokenFromAdditionalDictionary("ServiceCrew");

            ServiceCrew = DeserializationUtils.GetSingleObjectReference <ServiceCrew>(ServiceCrewId, objectJson, i_ReferenceResolver);
            if (ServiceCrew != null)
            {
                ServiceCrew.ServiceResources.Add(this);
            }

            DeserializationUtils.ProcessRelatedObjectsCollection(serviceTerritoriesCollection, i_ReferenceResolver);
            ServiceTerritoriesByType     = ServiceTerritories.ToLookup(stm => stm.TerritoryType);
            serviceTerritoriesCollection = null;

            DeserializationUtils.ProcessRelatedObjectsCollection(serviceResourceCapacitiesCollection, i_ReferenceResolver);
            serviceResourceCapacitiesCollection = null;

            DeserializationUtils.ProcessRelatedObjectsCollection(serviceResourceSkillsCollection, i_ReferenceResolver);
            serviceResourceSkillsCollection = null;

            DeserializationUtils.ProcessRelatedObjectsCollection(serviceCrewMembersCollection, i_ReferenceResolver);
            serviceCrewMembersCollection = null;

            DeserializationUtils.ProcessRelatedObjectsCollection(resourceShiftsCollection, i_ReferenceResolver);
            resourceShiftsCollection = null;

            base.updateReferencesAfterDeserialize(i_ReferenceResolver);
        }
        internal override void updateReferencesAfterDeserialize(SFRefereceResolver i_ReferenceResolver, bool i_ShouldAddToRelatedLists = true)
        {
            DeserializationUtils.ProcessRelatedObjectsCollection(scheduling_Policy_GoalsCollection, i_ReferenceResolver);
            scheduling_Policy_GoalsCollection = null;

            DeserializationUtils.ProcessRelatedObjectsCollection(scheduling_Policy_Work_RuleCollection, i_ReferenceResolver);
            scheduling_Policy_Work_RuleCollection = null;

            base.updateReferencesAfterDeserialize(i_ReferenceResolver);
        }
예제 #5
0
        internal override void updateReferencesAfterDeserialize(SFRefereceResolver i_ReferenceResolver, bool i_ShouldAddToRelatedLists = true)
        {
            JToken objectJson = removeObjectJTokenFromAdditionalDictionary("WorkType");

            WorkType = DeserializationUtils.GetSingleObjectReference <WorkType>(WorkTypeId, objectJson, i_ReferenceResolver);

            objectJson       = removeObjectJTokenFromAdditionalDictionary("ServiceTerritory");
            ServiceTerritory = DeserializationUtils.GetSingleObjectReference <ServiceTerritory>(ServiceTerritoryId, objectJson, i_ReferenceResolver);

            objectJson = removeObjectJTokenFromAdditionalDictionary("ParentRecord");
            switch (ParentRecordType)
            {
            case "WorkOrder":
                ParentRecord = DeserializationUtils.GetSingleObjectReference <WorkOrder>(ParentRecordId, objectJson, i_ReferenceResolver);
                break;

            case "WorkOrderLineItem":
                ParentRecord = DeserializationUtils.GetSingleObjectReference <WorkOrderLineItem>(ParentRecordId, objectJson, i_ReferenceResolver);
                break;
            }

            DeserializationUtils.ProcessRelatedObjectsCollection(assignedResourcesCollection, i_ReferenceResolver);
            assignedResourcesCollection = null;

            Type myType = GetType();

            string propertyName = "Scheduling_Policy_Used__r";

            propertyName = DeserializationUtils.GetPropertyName(myType.GetProperty(propertyName), propertyName);
            objectJson   = removeObjectJTokenFromAdditionalDictionary(propertyName);
            Scheduling_Policy_Used__r = DeserializationUtils.GetSingleObjectReference <Scheduling_Policy__c>(Scheduling_Policy_Used__c, objectJson, i_ReferenceResolver);

            propertyName = "Related_Service__r";
            propertyName = DeserializationUtils.GetPropertyName(myType.GetProperty(propertyName), propertyName);

            objectJson         = removeObjectJTokenFromAdditionalDictionary(propertyName);
            Related_Service__r = DeserializationUtils.GetSingleObjectReference <ServiceAppointment>(Related_Service__c, objectJson, i_ReferenceResolver);

            if (IsScheduled)
            {
                ScheduledSTM = ServiceResources.First().ServiceResource.GetServiceTerritoryMemberByDateTime(SchedStartTime.Value);
            }

            base.updateReferencesAfterDeserialize(i_ReferenceResolver);
        }