Esempio n. 1
0
        private void initializeTableObjectForBatch(XmlNode tableNode)
        {
            DCODataRetrieverWithoutDoc dCODataRetriever = new DCODataRetrieverWithoutDoc();

            string filename = (string)Globals.Instance.GetData(Constants.forLoopString.CURRENTFILE);

            if (!string.IsNullOrEmpty(filename))
            {
                // when association is at batch level its mandatory to specify table name
                if (tableNode.Attributes != null && tableNode.Attributes.Count > 0 &&
                    !string.IsNullOrEmpty(tableNode.Attributes["tablename"].Value))
                {
                    //the table objects of the specified table name that are present across multiple pages
                    //of the file are fetched
                    tableDCOs.AddRange(
                        dCODataRetriever.getTablesForFile(filename, tableNode.Attributes["tablename"].Value));
                    if (tableDCOs.Count == 0)
                    {
                        ExportCore.WriteLog(tableNode.Attributes["tablename"]
                                            + " table is not found in document " + DCO.ID);
                    }
                }
                else
                {
                    string message = "Its mandatory to specify the table name when the for-each-rows" +
                                     " tag is associated at batch level.";
                    ExportCore.WriteLog(message);
                    new SmartExportException(message);
                }
            }
        }
        public void processNodes()
        {
            DCODataRetrieverWithoutDoc dCODataRetriever = new DCODataRetrieverWithoutDoc();

            if (CurrentDCO.ObjectType() == Constants.Batch)
            {
                dCODataRetriever.createFilePageMap();
            }
            // Loop through the template and accumulate the output
            while (templateParser.HasNextNode())
            {
                XmlNode currentNode = templateParser.GetNextNode();
                switch (templateParser.GetNodeType(currentNode))
                {
                case NodeType.Header:
                    dataElement.setIsHeader(true);
                    dataElement.EvaluateData(currentNode);
                    dataElement.setIsHeader(false);
                    break;

                case NodeType.Data:
                    dataElement.EvaluateData(currentNode);
                    break;

                case NodeType.If:
                    conditionEvaluator.EvaluateCondition(currentNode);
                    break;

                case NodeType.ForEach:
                    loopEvaluator.EvaluateLoop(currentNode);
                    break;

                case NodeType.ForEachRows:
                    table.FetchTable(currentNode);
                    break;

                default:
                    if (currentNode.NodeType == XmlNodeType.Element)
                    {
                        ExportCore.WriteLog("Node type [" + ((XmlElement)currentNode).Name + "] not supported. Will be ignored");
                    }
                    break;
                }
            }
        }