///       <summary>
        ///       Returns the sepcified list of table DCO objects if it is present in the document.
        ///       <param name="page">DCO objects the corresponds to the current page that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>The sepcified table DCO object if it is present in the page</returns>
        public List <IDCO> getTablesForDocument(IDCO document, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            List <IDCO> tables = new List <IDCO>();

            for (int j = 0; j < document.NumOfChildren(); j++)
            {
                IDCO page = document.GetChild(j);
                if (page.ObjectType() == Constants.Page)
                {
                    for (int i = 0; i < page.NumOfChildren(); i++)
                    {
                        IDCO field = page.GetChild(i);
                        if (isObjectTable(field) && (field.ID == tableName))
                        {
                            tables.Add(field);
                            break;
                        }
                    }
                }
            }
            ExportCore.WriteDebugLog(" getTablesForDocument(" + document + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(tables);
        }
        ///       <summary>
        ///      Checks if a document contains a table.
        ///       <param name="document">DCO objects the corresponds to the current document that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>True if a page contains a table.</returns>
        public bool doesDocumentContainTable(IDCO document, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            bool docHasTable = false;

            for (int j = 0; j < document.NumOfChildren(); j++)
            {
                IDCO page = document.GetChild(j);
                if (page.ObjectType() == Constants.Page)
                {
                    for (int i = 0; i < page.NumOfChildren(); i++)
                    {
                        IDCO field = page.GetChild(i);
                        docHasTable = isObjectTable(field) && (field.ID == tableName);
                        if (docHasTable)
                        {
                            break;
                        }
                    }
                }
            }
            ExportCore.WriteDebugLog(" doesDocumentContainsTable(" + document + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(docHasTable);
        }
예제 #3
0
        public BaseTestClass(DirectoryInfo runtimeDir = null, string setupDCO = "", string runtimeDCO = "")
        {
            if (null == runtimeDir)
            {
                runtimeDir = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
            }
            if (string.IsNullOrEmpty(setupDCO))
            {
                setupDCO = Path.Combine(runtimeDir.Parent.Parent.FullName, "Dependency", "TestDCO", "Setup", "APT.xml");
            }
            if (string.IsNullOrEmpty(runtimeDCO))
            {
                runtimeDCO = Path.Combine(runtimeDir.Parent.Parent.FullName, "Dependency", "TestDCO", "Runtime", "Batch Profiler.xml");
            }

            _dco     = new DCO();
            _dclogxl = new MyDCLogXLib();
            _rrState = new MyRRState();
            _pilot   = new MyBPilotCtrl();

            //File.Copy(runtimeDCO, runtimeDCO+DateTime.Now.ToString("HH:mm:ss tt zz")+".bak");
            _dco.Read(runtimeDCO);
            _dco.ReadSetup(setupDCO);
            _pilot.BatchDir = Path.GetDirectoryName(runtimeDCO);
            oActions        = new Actions
            {
                //DatacapRRDCO = _dco,
                CurrentDCO          = _dco,
                RRLog               = _dclogxl,
                DatacapRRState      = _rrState,
                DatacapRRBatchPilot = _pilot,
                DateTimeFormats     = "YYYY-MM-dd"
            };
        }
예제 #4
0
        private void processTableRows(IDCO table, XmlNode tableNode)
        {
            // iterate over rows
            // print rows
            int i = rowStart;

            do
            {
                TDCOLib.DCO row = table.GetChild(i);
                if (row.ObjectType() == Constants.Field)
                {
                    i++;
                    Globals.Instance.SetData(Constants.forLoopString.CURRENTITERATIONDCO, row);
                    XmlNode dataNode = tableNode.ChildNodes.Item(0);
                    {
                        if (dataNode.Name == Constants.NodeTypeString.SE_DATA)
                        {
                            dataElement.setIsTableColumn(true);
                            dataElement.EvaluateData(dataNode);
                        }
                    }
                }
                Globals.Instance.SetData(Constants.forLoopString.CURRENTITERATIONDCO, Constants.EMPTYSTRING);
            } while (i < rowEnd);
        }
예제 #5
0
        private void setTableLimits(XmlNode tableNode, IDCO DCO)
        {
            rowStart = 0;
            rowEnd   = DCO.NumOfChildren();

            if (tableNode.Attributes != null && tableNode.Attributes.Count > 0)
            {
                if (!string.IsNullOrEmpty(tableNode.Attributes["fromrow"].Value) &&
                    Int32.Parse(tableNode.Attributes["fromrow"].Value) - 1 > rowStart)
                {
                    rowStart = Int32.Parse(tableNode.Attributes["fromrow"].Value) - 1;
                }
                if (!string.IsNullOrEmpty(tableNode.Attributes["torow"].Value) &&
                    Int32.Parse(tableNode.Attributes["torow"].Value) < rowEnd)
                {
                    rowEnd = Int32.Parse(tableNode.Attributes["torow"].Value);
                }
            }
        }
        ///       <summary>
        ///       Returns the sepcified table DCO object if it is present in the page.
        ///       <param name="page">DCO objects the corresponds to the current page that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>The sepcified table DCO object if it is present in the page</returns>
        public IDCO getTableForPage(IDCO page, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            IDCO table = null;

            for (int i = 0; i < page.NumOfChildren(); i++)
            {
                IDCO field = page.GetChild(i);
                if (isObjectTable(field) && (field.ID == tableName))
                {
                    table = field;
                    break;
                }
            }
            ExportCore.WriteDebugLog(" getTableForPage(" + page + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(table);
        }
        ///       <summary>
        ///      Checks if a page contains a table.
        ///       <param name="page">DCO objects the corresponds to the current page that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>True if a page contains a table.</returns>
        public bool doesPageContainTable(IDCO page, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            bool pageHasTable = false;

            for (int i = 0; i < page.NumOfChildren(); i++)
            {
                IDCO field = page.GetChild(i);
                pageHasTable = isObjectTable(field) && (field.ID == tableName);
                if (pageHasTable)
                {
                    break;
                }
            }
            ExportCore.WriteDebugLog(" doesPageContainsTable(" + page + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(pageHasTable);
        }
예제 #8
0
        public static IResult GetDCO(string drive_code, string param)
        {
            string  path = System.IO.Directory.GetCurrentDirectory() + "\\DCDriveList\\" + drive_code + ".dll";
            IResult rec  = new LEResult();

            try
            {
                Assembly ass    = Assembly.LoadFrom(path);
                Type     type   = ass.GetType(drive_code + ".DCO");
                Object   obj    = Activator.CreateInstance(type, new object[] { param });
                IDCO     SpoObj = (IDCO)obj;
                SpoObj.Driver_code = drive_code;
                rec.Result         = true;
                rec.obj            = SpoObj;
                return(rec);
            }
            catch (Exception exp)
            {
                rec.Result     = false;
                rec.ExtMessage = "加载工步驱动" + "[" + drive_code + "]失败:" + exp.Message;
                return(rec);
            }
        }