Exemplo n.º 1
0
        public void CreateXMLScenario(CSVScenarioFilePath cSVScenarioFilePath)
        {
            XmlDocument    doc            = new XmlDocument();
            XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            XmlElement     root           = doc.CreateElement(LoadData.XMLMainCategories.dataset.ToString());

            doc.InsertBefore(xmlDeclaration, doc.DocumentElement);
            doc.AppendChild(root);

            doc = InitDataParser.InitDataCSVToXML(doc, cSVScenarioFilePath.InitData);
            doc = ToolTypeParser.ToolTypeCSVToXML(doc, cSVScenarioFilePath.ToolTypeList);
            doc = ProductParser.ProductClassCSVToXML(doc, cSVScenarioFilePath.ProductsList);
            doc = WarehouseInitInventoryParser.WarehouseInitInventoryCSVToXML(doc, cSVScenarioFilePath.WarehouseInitInventory);
            doc = SuppliersParser.SuppliersCSVToXML(doc, cSVScenarioFilePath.SuppliersList);
            doc = OrderParser.OrderCSVToXML(doc, cSVScenarioFilePath.CustomersOrderList, XMLMainCategories.CustomersOrderList);
            doc = OrderParser.OrderCSVToXML(doc, cSVScenarioFilePath.FutureCustomersOrderList, XMLMainCategories.FutureCustomersOrderList);
            doc = OrderParser.OrderCSVToXML(doc, cSVScenarioFilePath.SuppliersOrderList, XMLMainCategories.SuppliersOrderList);



            FileManager fileManager    = new FileManager();
            string      fileResultpath = fileManager.saveFilePathXML();

            if (!string.IsNullOrEmpty(fileResultpath))
            {
                using (var writer = new XmlTextWriter(fileResultpath, Encoding.UTF8)
                {
                    Formatting = Formatting.Indented
                })
                {
                    doc.WriteTo(writer);
                }
            }
        }