示例#1
0
        /// <summary>
        /// Query Button Click Event.
        /// </summary>
        private void QueryBtn_Click(object sender, EventArgs e)
        {
            try {
                CurAlarms.Clear();
                AlarmGridView.Rows.Clear();

                var area2 = ComUtility.DefaultString;
                if (Area2NameCB.SelectedIndex != 0)
                {
                    area2 = Area2NameCB.Text.Trim();
                }

                var area3 = ComUtility.DefaultString;
                if (Area3NameCB.SelectedIndex != 0)
                {
                    area3 = Area3NameCB.Text.Trim();
                }

                var sta = ComUtility.DefaultString;
                if (StaNameCB.SelectedIndex != 0)
                {
                    sta = StaNameCB.Text.Trim();
                }

                var dev = ComUtility.DefaultString;
                if (DevNameCB.SelectedIndex != 0)
                {
                    dev = DevNameCB.Text.Trim();
                }

                var node = ComUtility.DefaultString;
                if (NodeNameCB.SelectedIndex != 0)
                {
                    node = NodeNameCB.Text.Trim();
                }

                var level = EnmAlarmLevel.NoAlarm;
                if (AlarmLevelCB.SelectedIndex > 0)
                {
                    var alarmLevel = (Int32)AlarmLevelCB.SelectedValue;
                    level = Enum.IsDefined(typeof(EnmAlarmLevel), alarmLevel) ? (EnmAlarmLevel)alarmLevel : EnmAlarmLevel.NoAlarm;
                }

                var bfTime    = BeginFromTime.Value;
                var btTime    = BeginToTime.Value;
                var efTime    = EndFromTime.Value;
                var etTime    = EndToTime.Value;
                var fInterval = Common.GetSecondFromDateTime(TimeFromIntervalTB.Text);
                var eInterval = Common.GetSecondFromDateTime(TimeToIntervalTB.Text);

                var result = Common.ShowWait(() => {
                    CurAlarms = new Alarm().GetHisAlarms(area2, area3, sta, dev, node, level, bfTime, btTime, efTime, etTime, fInterval, eInterval);
                }, default(string), "正在查询,请稍后...", default(int), default(int));

                if (result == DialogResult.OK)
                {
                    AlarmGridView.RowCount = CurAlarms.Count;
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.HisAlarmForm.QueryBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }