Пример #1
0
 private void DoQuery()
 {
     tst_Label.Text = "正在查询...";
     this.Enabled   = false;
     try
     {
         List <CEntityWarningInfo> results = m_proxyWarningInfo.QueryWarningInfo(dtp_StartTime.Value, dtp_EndTime.Value);
         if (null == results)
         {
             // 查询失败
             MessageBox.Show("数据库忙,请稍后再试");
             this.Enabled = true;
             return;
         }
         if (results.Count > 5000)
         {
             //如果大于2000条,表格不支持,提示
             MessageBox.Show("查询结果超过最大值,请缩小时间范围");
             this.Enabled = true;
             return;
         }
         m_dgvInfo.ClearAllRows();
         foreach (CEntityWarningInfo entity in results)
         {
             m_dgvInfo.AddRow(new string[] { entity.DataTime.ToString(CS_DateFormat), entity.InfoDetail, entity.WarningInfoID.ToString() }, CExDataGridView.EDataState.ENormal);
         }
         m_dgvInfo.UpdateDataToUI();
         tst_Label.Text = string.Format("查询已成功完成,共{0}条警告", results.Count);
         if (results.Count > 0)
         {
             btnDelete.Enabled = true; //可以删除
         }
         else
         {
             btnDelete.Enabled = false; //不删除
         }
         this.Enabled = true;
     }
     catch (Exception e)
     {
         Debug.WriteLine("查询失败!" + e);
         MessageBox.Show("查询失败!");
     }
 }
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     m_dgvUserInfo.ClearAllRows();
     m_dgvStatusInfo.ClearAllRows();
     InitData();
 }