コード例 #1
0
        public static IEnumerable <ISODeviceAllocation> ReadXML(XmlNodeList nodes)
        {
            List <ISODeviceAllocation> items = new List <ISODeviceAllocation>();

            foreach (XmlNode node in nodes)
            {
                items.Add(ISODeviceAllocation.ReadXML(node));
            }
            return(items);
        }
コード例 #2
0
        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);
        }