Пример #1
0
        public void ShowUserControl()
        {
            NTSDataContext dbCtx = new NTSDataContext();

            var alarmList =
                from alarm in dbCtx.AlarmTable
                where alarm.AlarmCode == 10
                select alarm;

            dataGridView1.DataSource          = alarmList;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Пример #2
0
        public MainPage()
        {
            InitializeComponent();

            NTSDataContext dbCtx = new NTSDataContext();

            var alarmList =
                from alarm in dbCtx.AlarmTable
                where alarm.AlarmCode == 10
                select alarm;

            DateTime date       = new DateTime(2020, 06, 16);
            var      alarmList2 =
                from sensor1 in dbCtx.TM1_SENSOR1
                where sensor1.ReceivedTime.Month == date.Month
                select sensor1;

            dataGridView1.DataSource          = alarmList;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            dataGridView2.DataSource          = alarmList2;
            dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }