예제 #1
0
        /// <summary>
        /// Returns XML string with all occurences of Active element "Data matrix".
        /// </summary>
        /// <param name="index">index of data source in FEplugin data sources table</param>
        /// <returns>XML string</returns>
        public static string getList(int index)
        {
            string resultString = ""; // result XML string
            string ErrStr       = ""; // error reports

            // loading DTD to resultString
            try { resultString = XMLHelper.loadDTD(); }
            catch (Exception e)
            {
#if (LADENI)
                MessageBox.Show("error while loading DTD: " + e.Message);
#endif
                return(resultString);
            }

            // root element
            resultString += "<active_list>";


            // processing of each box "Data matrix"

            #region   searching a processing of each boxes Column (DataMiningCommon.DataMatrix)

            IBoxModule[] MatrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.DataMatrix");


            // processing of each box Column
            foreach (IBoxModule MBox in MatrBoxes)
            {
                try
                {
                    Rec_data_matrix rMatrix = new Rec_data_matrix(); // zaznam o datove matici

                    // searching ID
                    rMatrix.id = "matrix" + MBox.ProjectIdentifier.ToString();

                    // searching data source name (database)
                    IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(MBox, "DataMiningCommon.Database");
                    if (db_names.GetLength(0) != 1)  // searched more than one data source or neither one
                    {
                        throw new System.Exception("found " + db_names.GetLength(0).ToString() + " databases");
                    }
                    rMatrix.db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue;

                    // searching data matrix name
                    rMatrix.matrix_name = MBox.GetPropertyString("Name");

                    // searching records count
                    rMatrix.record_count = MBox.GetPropertyLong("RecordCount").ToString();

                    // adding item to XML
                    resultString += rMatrix.ToXML();
                }
                catch (System.Exception e)
                {
                    ErrStr += "Box ProjectIdentifier=" + MBox.ProjectIdentifier.ToString() + ": " + e.Message + "\n";
                }
            }

            #endregion


            resultString += "</active_list>";

#if (LADENI)
            // Kody - storing output to file "XMLData_matrixExample.xml" in directory
            XMLHelper.saveXMLexample(resultString, "../XML/XMLData_matrixExample.xml");

            if (ErrStr != "")
            {
                MessageBox.Show("Chyby pri generating seznamu Boolskych cedent:\n" + ErrStr);
            }
#endif

            return(resultString);
        }
        /// <summary>
        /// Returns XML string with all occurences of Active element "Data matrix".
        /// </summary>
        /// <param name="index">index of data source in FEplugin data sources table</param>
        /// <returns>XML string</returns>
        public static string getList(int index)
        {
            string resultString = ""; // result XML string
            string ErrStr = "";  // error reports

            // loading DTD to resultString
            try { resultString = XMLHelper.loadDTD(); }
            catch (Exception e)
            {
            #if (LADENI)
                MessageBox.Show("error while loading DTD: " + e.Message);
            #endif
                return resultString;
            }

            // root element
            resultString += "<active_list>";

            // processing of each box "Data matrix"

            #region   searching a processing of each boxes Column (DataMiningCommon.DataMatrix)

            IBoxModule[] MatrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.DataMatrix");

            // processing of each box Column
            foreach (IBoxModule MBox in MatrBoxes)
            {
                try
                {
                    Rec_data_matrix rMatrix = new Rec_data_matrix(); // zaznam o datove matici

                    // searching ID
                    rMatrix.id = "matrix" + MBox.ProjectIdentifier.ToString();

                    // searching data source name (database)
                    IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(MBox, "DataMiningCommon.Database");
                    if (db_names.GetLength(0) != 1)  // searched more than one data source or neither one
                        throw new System.Exception("found " + db_names.GetLength(0).ToString() + " databases");
                    rMatrix.db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue;

                    // searching data matrix name
                    rMatrix.matrix_name = MBox.GetPropertyString("Name");

                    // searching records count
                    rMatrix.record_count = MBox.GetPropertyLong("RecordCount").ToString();

                    // adding item to XML
                    resultString += rMatrix.ToXML();

                }
                catch (System.Exception e)
                {
                    ErrStr += "Box ProjectIdentifier=" + MBox.ProjectIdentifier.ToString() + ": " + e.Message + "\n";
                }
            }

            #endregion

            resultString += "</active_list>";

            #if (LADENI)
            // Kody - storing output to file "XMLData_matrixExample.xml" in directory
            XMLHelper.saveXMLexample(resultString, "../XML/XMLData_matrixExample.xml");

            if (ErrStr != "")
                MessageBox.Show("Chyby pri generating seznamu Boolskych cedent:\n" + ErrStr);
            #endif

            return resultString;
        }