Ejemplo n.º 1
0
        private void GetTables(CUCMAXLProfile myAXLProfile)
        {
            // Clear table list
            tvTables.Nodes.Clear();

            // Run AXL Query
            CUCMAXLClient myClient = new CUCMAXLClient(myAXLProfile.AXLHost, myAXLProfile.AXLUser, myAXLProfile.AXLPass);

            if (myClient.RunQuery(@"select tabname, nrows  from systables where flags = 8 order by tabname asc"))
            {
                // We received an error; put the error in the status bar
                toolStripStatusLabel1.Text = "SQL Error: " + myClient.ErrorMsg;
                return;
            }

            // Set the record count in the status bar
            toolStripStatusLabel1.Text = "Table count: " + myClient.ReturnDataSet.Count.ToString();

            // Loop over all records
            foreach (Dictionary <string, string> sqlRecord in myClient.ReturnDataSet)
            {
                // Add to TreeView
                TreeNode rootNode = new TreeNode();
                Decimal  rowCount = Decimal.Parse(sqlRecord["nrows"]);
                rootNode.Text = sqlRecord["tabname"] + " (" + rowCount.ToString("0.#") + ")";
                rootNode.Tag  = sqlRecord["tabname"];
                tvTables.Nodes.Add(rootNode);
            }
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     testProfile = new CUCMAXLProfile(tb_AXLHost.Text, tb_AXLUser.Text, tb_AXLPass.Text);
     if (testProfile.Validated)
     {
         MessageBox.Show("Connection successful!");
     }
     else
     {
         MessageBox.Show("Connection failed with error: " + testProfile.AXLError);
     }
 }
Ejemplo n.º 3
0
        private void RunTestRISPort(CUCMAXLProfile myAXLProfile)
        {
            RISService          myRISClient = new RISService(myAXLProfile.AXLHost, myAXLProfile.AXLUser, myAXLProfile.AXLPass);
            CmSelectionCriteria filtre      = new CmSelectionCriteria
            {
                SelectBy           = "Name",
                MaxReturnedDevices = 20,
                Class = DeviceClass.Phone.ToString(),
                Model = 255 //"Any" Model.
            };

            //String stateInfo = null; // Execution summary

            //SelectCmDeviceResult result = myRISClient.SelectCmDevice(ref stateInfo, filtre);

            //CmNode[] nodes = result.CmNodes;
        }
Ejemplo n.º 4
0
        private void RunQueryToPane(CUCMAXLProfile myAXLProfile, string sqlQuery)
        {
            // Clear existing results
            dataGridView1.DataSource = null;
            dataGridView1.Rows.Clear();
            if (myAXLSQLApp.currentAXLProfile != null)
            {
                // Run AXL Query
                CUCMAXLClient myClient = new CUCMAXLClient(
                    myAXLProfile.AXLHost,
                    myAXLProfile.AXLUser,
                    myAXLProfile.AXLPass
                    );
                if (myClient.RunQuery(sqlQuery))
                {
                    // We received an error; put the error in the status bar
                    toolStripStatusLabel1.Text = "SQL Error: " + myClient.ErrorMsg;
                    return;
                }

                // Set the record count in the status bar
                toolStripStatusLabel1.Text = "Record count: " + myClient.ReturnDataSet.Count.ToString();

                // If we received no results, don't bother populating the data table
                if (myClient.ReturnDataSet.Count == 0)
                {
                    return;
                }

                // Create a new data table
                DataTable sqlResultsTable = new DataTable("sqlResults");

                List <string> ColumnList = new List <string>();

                // Loop over the first record fields to get key names
                foreach (KeyValuePair <string, string> fieldPair in myClient.ReturnDataSet.First())
                {
                    ColumnList.Add(fieldPair.Key);
                    sqlResultsTable.Columns.Add(new DataColumn(fieldPair.Key));
                }

                // Loop over all records
                foreach (Dictionary <string, string> sqlRecord in myClient.ReturnDataSet)
                {
                    // Create row
                    DataRow newRow;
                    newRow = sqlResultsTable.NewRow();

                    // Loop over columns
                    foreach (string colName in ColumnList)
                    {
                        if (sqlRecord[colName] == null)
                        {
                            newRow[colName] = "<null>";
                        }
                        else
                        {
                            newRow[colName] = sqlRecord[colName];
                        }
                    }

                    // Add row
                    sqlResultsTable.Rows.Add(newRow);
                }

                dataGridView1.DataSource = sqlResultsTable;
            }
        }