Exemple #1
0
 public static IEnumerable<ISOGrid> ReadXML(XmlNodeList nodes)
 {
     List<ISOGrid> items = new List<ISOGrid>();
     foreach (XmlNode node in nodes)
     {
         items.Add(ISOGrid.ReadXML(node));
     }
     return items;
 }
Exemple #2
0
 public static ISOGrid ReadXML(XmlNode node)
 {
     ISOGrid grid = new ISOGrid();
     grid.GridMinimumNorthPosition = node.GetXmlNodeValueAsDecimal("@A");
     grid.GridMinimumEastPosition = node.GetXmlNodeValueAsDecimal("@B");
     grid.GridCellNorthSize = node.GetXmlNodeValueAsDouble("@C");
     grid.GridCellEastSize = node.GetXmlNodeValueAsDouble("@D");
     grid.GridMaximumColumn = node.GetXmlNodeValueAsUInt("@E");
     grid.GridMaximumRow = node.GetXmlNodeValueAsUInt("@F");
     grid.Filename = node.GetXmlNodeValue("@G");
     grid.Filelength = node.GetXmlNodeValueAsNullableUInt("@H");
     grid.GridType = node.GetXmlNodeValueAsByte("@I");
     grid.TreatmentZoneCode = node.GetXmlNodeValueAsNullableByte("@J");
     return grid;
 }
        public static ISOTask ReadXML(XmlNode taskNode)
        {
            ISOTask task = new ISOTask();

            task.TaskID                        = taskNode.GetXmlNodeValue("@A");
            task.TaskDesignator                = taskNode.GetXmlNodeValue("@B");
            task.CustomerIdRef                 = taskNode.GetXmlNodeValue("@C");
            task.FarmIdRef                     = taskNode.GetXmlNodeValue("@D");
            task.PartFieldIdRef                = taskNode.GetXmlNodeValue("@E");
            task.ResponsibleWorkerIdRef        = taskNode.GetXmlNodeValue("@F");
            task.TaskStatusInt                 = taskNode.GetXmlNodeValueAsInt("@G");
            task.DefaultTreatmentZoneCode      = taskNode.GetXmlNodeValueAsNullableInt("@H");
            task.PositionLostTreatmentZoneCode = taskNode.GetXmlNodeValueAsNullableInt("@I");
            task.OutOfFieldTreatmentZoneCode   = taskNode.GetXmlNodeValueAsNullableInt("@J");

            //Treatment Zones
            XmlNodeList tznNodes = taskNode.SelectNodes("TZN");

            if (tznNodes != null)
            {
                task.TreatmentZones.AddRange(ISOTreatmentZone.ReadXML(tznNodes));
            }

            //Times
            XmlNodeList timNodes = taskNode.SelectNodes("TIM");

            if (timNodes != null)
            {
                task.Times.AddRange(ISOTime.ReadXML(timNodes));
            }

            //Worker Allocations
            XmlNodeList wanNodes = taskNode.SelectNodes("WAN");

            if (wanNodes != null)
            {
                task.WorkerAllocations.AddRange(ISOWorkerAllocation.ReadXML(wanNodes));
            }

            //Device Allocations
            XmlNodeList danNodes = taskNode.SelectNodes("DAN");

            if (danNodes != null)
            {
                task.DeviceAllocations.AddRange(ISODeviceAllocation.ReadXML(danNodes));
            }

            //Connections
            XmlNodeList cnnNodes = taskNode.SelectNodes("CNN");

            if (cnnNodes != null)
            {
                task.Connections.AddRange(ISOConnection.ReadXML(cnnNodes));
            }

            //Product Allocations
            XmlNodeList panNodes = taskNode.SelectNodes("PAN");

            if (panNodes != null)
            {
                task.ProductAllocations.AddRange(ISOProductAllocation.ReadXML(panNodes));
            }

            //Data Log Triggers
            XmlNodeList dltNodes = taskNode.SelectNodes("DLT");

            if (dltNodes != null)
            {
                task.DataLogTriggers.AddRange(ISODataLogTrigger.ReadXML(dltNodes));
            }

            //Comment Allocations
            XmlNodeList canNodes = taskNode.SelectNodes("CAN");

            if (canNodes != null)
            {
                task.CommentAllocations.AddRange(ISOCommentAllocation.ReadXML(canNodes));
            }

            //Grid
            XmlNode grdNode = taskNode.SelectSingleNode("GRD");

            if (grdNode != null)
            {
                task.Grid = ISOGrid.ReadXML(grdNode);
            }

            //TimeLogs
            XmlNodeList tlgNodes = taskNode.SelectNodes("TLG");

            if (tlgNodes != null)
            {
                task.TimeLogs.AddRange(ISOTimeLog.ReadXML(tlgNodes));
            }

            //Guidance Allocations
            XmlNodeList ganNodes = taskNode.SelectNodes("GAN");

            if (ganNodes != null)
            {
                task.GuidanceAllocations.AddRange(ISOGuidanceAllocation.ReadXML(ganNodes));
            }

            //OperTechPractice
            XmlNode otpNode = taskNode.SelectSingleNode("OTP");

            if (otpNode != null)
            {
                task.OperationTechPractice = ISOOperTechPractice.ReadXML(otpNode);
            }

            return(task);
        }