AgGateway.ADAPT.ISOv4Plugin.Loaders.AllocationTimestampLoader.Load C# (CSharp) Метод

Load() публичный статический Метод

public static Load ( XmlNode inputNode ) : AgGateway.ADAPT.ApplicationDataModel.Common.TimeScope
inputNode System.Xml.XmlNode
Результат AgGateway.ADAPT.ApplicationDataModel.Common.TimeScope
        public static TimeScope Load(XmlNode inputNode)
        {
            var timeStampNode = inputNode.SelectSingleNode("ASP");
            if (timeStampNode == null)
                return null;

            // Required attributes
            var startTimeValue = timeStampNode.GetXmlNodeValue("@A");
            var typeValue = timeStampNode.GetXmlNodeValue("@D");
            if (string.IsNullOrEmpty(startTimeValue) ||
                string.IsNullOrEmpty(typeValue))
                return null;

            var timeStamp1 = ParseDateTime(startTimeValue);
            if (timeStamp1 == null)
                return null;

            var timeStamp2 = ParseDateTime(timeStampNode.GetXmlNodeValue("@B"));
            if (timeStamp2 == null)
            {
                var duration = ParseDuration(timeStampNode.GetXmlNodeValue("@C"));
                if (duration.HasValue)
                    timeStamp2 = timeStamp1.Value.Add(duration.Value);
            }

            var location = LoadLocation(timeStampNode.SelectSingleNode("PTN"));

            return new TimeScope
            {
                TimeStamp1 = timeStamp1,
                TimeStamp2 = timeStamp2,
                Location1 = location,
                Location2 = location,
                DateContext = typeValue == "1" ? DateContextEnum.ProposedStart : DateContextEnum.ActualStart,
                Duration = timeStamp1.GetValueOrDefault() - timeStamp2.GetValueOrDefault(),
            };
        }

Usage Example

Пример #1
0
        private void LoadCommentAllocations(XmlNode inputNode)
        {
            Note note = null;

            var commentId = inputNode.GetXmlNodeValue("@A");

            if (!string.IsNullOrEmpty(commentId))
            {
                note = LoadCodedComment(inputNode, commentId);
            }
            else
            {
                note = new Note {
                    Description = inputNode.GetXmlNodeValue("@C")
                }
            };

            if (note == null)
            {
                return;
            }

            var noteTimeStamp = AllocationTimestampLoader.Load(inputNode);

            note.TimeStamps.Add(noteTimeStamp);
            if (noteTimeStamp != null && noteTimeStamp.Location1 != null)
            {
                note.SpatialContext = noteTimeStamp.Location1.Position;
            }

            _allocations.Add(note);
        }
All Usage Examples Of AgGateway.ADAPT.ISOv4Plugin.Loaders.AllocationTimestampLoader::Load