Exemple #1
0
        public InitDataLoad LoadInitData(string filePath)
        {
            InitDataLoad initDataLoad = new InitDataLoad();
            XmlDocument  xmldoc       = getXmldoc(filePath);

            XmlNodeList initNodeList                   = getXmlNodeList(xmldoc, XMLMainCategories.InitData);
            XmlNodeList productsNodeList               = getXmlNodeList(xmldoc, XMLMainCategories.ProductsList);
            XmlNodeList suppliersNodeList              = getXmlNodeList(xmldoc, XMLMainCategories.SuppliersList);
            XmlNodeList customerOrderNodeList          = getXmlNodeList(xmldoc, XMLMainCategories.CustomersOrderList);
            XmlNodeList fucureCustomerOrderNodeList    = getXmlNodeList(xmldoc, XMLMainCategories.FutureCustomersOrderList);
            XmlNodeList supploersOrderNodeList         = getXmlNodeList(xmldoc, XMLMainCategories.SuppliersOrderList);
            XmlNodeList WarehouseInitInventoryNodeList = getXmlNodeList(xmldoc, XMLMainCategories.WarehouseInitInventory);
            XmlNodeList tooltypeyNodeList              = getXmlNodeList(xmldoc, XMLMainCategories.ToolTypeList);


            initDataLoad.InitParameters             = InitDataParser.Parse(initNodeList);
            initDataLoad.MetaData.ToolTypeMetaData  = ToolTypeParser.parse(tooltypeyNodeList);
            initDataLoad.MetaData.ProductsMetaData  = ProductParser.Parse(productsNodeList, initDataLoad);
            initDataLoad.MetaData.SuppliersMetaData = SuppliersParser.Parse(suppliersNodeList, initDataLoad);

            initDataLoad.InitLists.InitCustomersOrderList       = OrderParser.Parse(customerOrderNodeList, initDataLoad, Order.OrderTypeEnum.CustomerOrder);
            initDataLoad.InitLists.InitFutureCustomersOrderList = OrderParser.Parse(fucureCustomerOrderNodeList, initDataLoad, Order.OrderTypeEnum.CustomerOrder);
            initDataLoad.InitLists.InitPurchaseOrders           = OrderParser.Parse(supploersOrderNodeList, initDataLoad, Order.OrderTypeEnum.SupplierOrder);
            initDataLoad.InitParameters.InitWarehouseInventory  = WarehouseInitInventoryParser.Parse(WarehouseInitInventoryNodeList, initDataLoad);


            ///rebuild parser
            initDataLoad.InitLists.InitToolsList           = loadTool(initDataLoad);
            initDataLoad.InitLists.InitProductionOrderList = generateProductionOrderList(initDataLoad);
            ////



            return(initDataLoad);
        }
Exemple #2
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);
                }
            }
        }