Exemplo n.º 1
0
        private Int32 GetSelectedThresholdId()
        {
            DataRowView dataRow = (DataRowView)cmbBoxThresholdTypes.SelectedItem;

            LinqExample.SLA_RT_monitoringDataSetThreshold.ThresholdsRow selectedRow =
                (LinqExample.SLA_RT_monitoringDataSetThreshold.ThresholdsRow)dataRow.Row;

            return(selectedRow.id);
        }
Exemplo n.º 2
0
        //Run when select devices from the list
        private void cmbBoxThresholdTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            SqlDataReader measurementsReader = null;
            DataRowView   dataRow            = (DataRowView)cmbBoxThresholdTypes.SelectedItem;

            LinqExample.SLA_RT_monitoringDataSetThreshold.ThresholdsRow selectedRow =
                (LinqExample.SLA_RT_monitoringDataSetThreshold.ThresholdsRow)dataRow.Row;

            measurmentsSqlCommand.Parameters[0].Value = selectedRow.id;

            global::System.Data.ConnectionState previousConnectionState = measurmentsSqlCommand.Connection.State;
            if (((measurmentsSqlCommand.Connection.State & global::System.Data.ConnectionState.Open)
                 != global::System.Data.ConnectionState.Open))
            {
                measurmentsSqlCommand.Connection.Open();
            }
            try
            {
                measurementsReader = measurmentsSqlCommand.ExecuteReader();
            }
            catch (Exception e123)
            {
                MessageBox.Show(e123.ToString());
            }


            listDevices.Items.Clear();

            while (measurementsReader.Read())
            {
                listDevices.Items.Add(measurementsReader.GetString(0));
            }

            if (listDevices.Items.Count > 0)
            {
                listDevices.SelectedItems.Add(listDevices.Items[0]);
            }

            measurementsReader.Close();//Close the reader since we are opening it every time when selected item
            CreateGraph(zg1);
        }