private void BT_Query_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(TB_CodeQuery.Text))
     {
         warningDt = null;
         warningDt = AsmAlarmCode_BLL.GetAlarmCodesByCondition("ALARM_CODE='" + TB_CodeQuery.Text + "'");
         if (warningDt.Rows.Count > 0)
         {
             DGV_CodeInfor.DataSource = warningDt;
             //TB_Code.Text = warningDt.Rows[0]["ALARM_CODE"].ToString();
             TB_Code.Enabled = true;
             //TB_ChineseInfor.Text= warningDt.Rows[0]["ALARM_TEXT"].ToString();
             //TB_EnglishInfor.Text= warningDt.Rows[0]["ALARM_ENGLISH"].ToString();
         }
         else
         {
             MessageBox.Show("该报警代码不存在,请重新审查!");
             ReflshDataGridView();
         }
     }
     else
     {
         MessageBox.Show("请填写完报警代码后进行查询!");
     }
 }
 /// <summary>
 /// 删除按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BT_Delete_Click(object sender, EventArgs e)
 {
     if (AsmAlarmCode_BLL.DeleteAlarmCodeByCondition("ALARM_CODE='" + TB_Code.Text + "'") > 0)
     {
         MessageBox.Show("删除成功!");
         ClearPL_Edit();
         ReflshDataGridView();
     }
     else
     {
         MessageBox.Show("删除失败!");
         ReflshDataGridView();
     }
 }
 private void BT_Save_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(TB_Code.Text) && !String.IsNullOrEmpty(TB_ChineseInfor.Text) && !String.IsNullOrEmpty(TB_EnglishInfor.Text))
     {
         //新增
         if (flag)
         {
             if (AsmAlarmCode_BLL.IsExistCode("ALARM_CODE='" + TB_Code.Text + "'"))
             {
                 MessageBox.Show("该报警代码已存在!");
             }
             else
             {
                 AsmAlarmCodeObject aaco = new AsmAlarmCodeObject();
                 aaco.DT            = DateTime.Now;
                 aaco.ALARM_CODE    = int.Parse(TB_Code.Text);
                 aaco.ALARM_TEXT    = TB_ChineseInfor.Text;
                 aaco.ALARM_ENGLISH = TB_EnglishInfor.Text;
                 if (AsmAlarmCode_BLL.AddAlarmCode(aaco) > 0)
                 {
                     MessageBox.Show("保存成功!");
                     ClearPL_Edit();
                     ReflshDataGridView();
                 }
                 else
                 {
                     MessageBox.Show("保存失败!");
                     ReflshDataGridView();
                 }
             }
         }
         //修改
         else
         {
             if (AsmAlarmCode_BLL.IsExistCode("ALARM_CODE='" + TB_Code.Text + "'"))
             {
                 AsmAlarmCodeObject aaco = AsmAlarmCode_BLL.GetAlarmCodeObjectByCondition("where ALARM_CODE='" + TB_Code.Text + "'");
                 aaco.DT            = DateTime.Now;
                 aaco.ALARM_CODE    = int.Parse(TB_Code.Text);
                 aaco.ALARM_TEXT    = TB_ChineseInfor.Text;
                 aaco.ALARM_ENGLISH = TB_EnglishInfor.Text;
                 if (AsmAlarmCode_BLL.UpdateAlarmCode(aaco) > 0)
                 {
                     MessageBox.Show("修改成功!");
                     ClearPL_Edit();
                     ReflshDataGridView();
                 }
                 else
                 {
                     MessageBox.Show("修改失败!");
                     ReflshDataGridView();
                 }
             }
             else
             {
                 MessageBox.Show("该报警信息不存在!");
             }
         }
     }
     else
     {
         MessageBox.Show("请完整输入信息");
     }
 }
 private void ReflshDataGridView()
 {
     warningDt = null;
     warningDt = AsmAlarmCode_BLL.GetAlarmCodes();
     DGV_CodeInfor.DataSource = warningDt;
 }