예제 #1
0
    void ImportConnections()
    {
        connectionsToolStripMenuItem.DropDownItems.Clear();
        mListView.Items.Clear();

        PClient.Connections cons = (GeoMediaApp.Document as GeoMedia.Document).Connections as PClient.Connections;

        foreach (PClient.Connection con in cons)
        {
            if (con.Status == PClient.ConnectionConstants.gmcStatusClosed)
            {
                continue;
            }

            PClient.GDatabase db = con.Database as PClient.GDatabase;

            string name  = db.Name.Replace("=opgk", "=*");
            string info  = con.ConnectInfo.Replace("=opgk", "=*");
            string tekst = string.Format("{0} ({1})", con.ConnectionName, name);

            ToolStripMenuItem item = new ToolStripMenuItem(tekst);
            item.Click      += new EventHandler(connectionsItem_Click);
            item.Tag         = con.ConnectionName;
            item.Checked     = false;
            item.ToolTipText = "Name: " + con.ConnectionName + "\n" +
                               "Info: " + info + "\n" +
                               "Description :" + con.Description + "\n" +
                               "Database: " + name;

            //WriteEvent(string.Format("dodano po³¹czenie do {0}, (enabled)", name));

            connectionsToolStripMenuItem.DropDownItems.Add(item);
        }
    }
예제 #2
0
    void ImportFeatures()
    {
        PClient.GDatabase  objDB      = _connection.Database as PClient.GDatabase;
        PClient.GTableDefs tblDefs    = objDB.GTableDefs as PClient.GTableDefs;
        PClient.GTableDef  aliasTable = tblDefs["GAliasTable"];
        PClient.GField     field      = null;

        PClient.GRecordset dbRS = objDB.OpenRecordset("Select TableType, TableName From GAliasTable Where TableType='INGRFeatures'",
                                                      PClient.GConstants.gdbOpenDynaset, null, null, null, null);

        string aliasTableName = null;

        while (!dbRS.EOF)
        {
            field = dbRS.GFields["TableName"];

            aliasTableName = (string)field.Value;

            dbRS.MoveNext();
        }

        dbRS.Close();

        if (string.IsNullOrEmpty(aliasTableName))
        {
            return;
        }

        //WriteEvent("INGRFeatures table: " + aliasTableName);

        dbRS = objDB.OpenRecordset("Select FeatureName From " + aliasTableName,
                                   PClient.GConstants.gdbOpenDynaset, null, null, null, null);

        while (!dbRS.EOF)
        {
            field = dbRS.GFields["FeatureName"];

            string featureName = (string)field.Value;

            //WriteEvent(" Feature: " + featureName);
            ListViewItem item = new ListViewItem(featureName);
            item.SubItems.Add("");
            item.Checked = true;
            mListView.Items.Add(item);

            dbRS.MoveNext();
        }

        dbRS.Close();
    }