AgGateway.ADAPT.ISOv4Plugin.Models.TaskDataDocument.LoadFromFile C# (CSharp) Method

LoadFromFile() public method

public LoadFromFile ( string taskDataFile ) : bool
taskDataFile string
return bool
        public bool LoadFromFile(string taskDataFile)
        {
            if (!LoadXmlFile(taskDataFile))
                return false;

            if (!VerifyIsoVersion())
                return false;

            LinkedIds = LinkListLoader.Load(this);
            Units = UnitLoader.Load(this);
            Customers = CustomerLoader.Load(this);
            Farms = FarmLoader.Load(this);
            Crops = CropLoader.Load(this);
            Fields = FieldLoader.Load(this);
            Products = ProductLoader.Load(this);
            ProductMixes = ProductMixLoader.Load(this);
            Workers = WorkerLoader.Load(this);
            Comments = CommentLoader.Load(this);
            Tasks = TaskLoader.Load(this);

            RasterPrescriptions = PrescriptionLoader.Load(this);
            Machines = DeviceLoader.Load(this);

            return true;
        }

Usage Example

Exemplo n.º 1
0
        public void CropWithMissingRequiredInfoTest()
        {
            var crops = new List<String>
            {
                TestData.TestData.Crop4,
                TestData.TestData.Crop5,
                TestData.TestData.Crop6,
            };

            for (int i = 0; i < crops.Count; i++)
            {
                // Setup
                var taskDocument = new TaskDataDocument();
                var path = Path.Combine(_directory, String.Format("crop{0}.xml", i));
                File.WriteAllText(path, crops[i]);

                // Act
                var result = taskDocument.LoadFromFile(path);

                // Verify
                Assert.IsTrue(result);
                Assert.IsNotNull(taskDocument.Crops);
                Assert.AreEqual(0, taskDocument.Crops.Count);
            }
        }
All Usage Examples Of AgGateway.ADAPT.ISOv4Plugin.Models.TaskDataDocument::LoadFromFile