Пример #1
0
 /// <summary>
 /// 新增遥控
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bt_ykadd_Click(object sender, EventArgs e)
 {
     Log.WriteLog("新增遥控");
     try
     {
         if ((m_obj.equtype.ToString()).StartsWith("P_"))
         {
             Yk_cfg ykcfg = new Yk_cfg();
             ykcfg.AreaID = (int)cb_ykarea.SelectedValue;
             ykcfg.Order  = Byklist.Count;
             ykcfg.EquID  = m_obj.equ.EquID;
             DBOPs ds = new DBOPs();
             int   i  = ds.InsertYKConfig(ykcfg);
             Log.WriteLog("新增遥控执行完毕");
             if (i > -1)
             {
                 ykcfg.ID = i;
                 Byklist.Add(ykcfg);
             }
             Log.WriteLog("新增遥控并添加到列表完毕");
         }
     }
     catch (Exception ee)
     {
         Log.WriteLog("新增遥控错误:" + ee.Message);
     }
 }
Пример #2
0
 /// <summary>
 /// 新增遥控
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bt_ykadd_Click(object sender, EventArgs e)
 {
     try
     {
         if ((m_obj.equtype.ToString()).StartsWith("P_"))
         {
             if (cb_ykarea.SelectedItem == null)
             {
                 MessageBox.Show("请选择分区");
                 return;
             }
             Yk_cfg ykcfg = new Yk_cfg();
             ykcfg.AreaID = (int)cb_ykarea.SelectedValue;
             ykcfg.Order  = Byklist.Count;
             ykcfg.EquID  = m_obj.equ.EquID;
             DBOPs ds = new DBOPs();
             int   i  = ds.InsertYKConfig(ykcfg);
             if (i > -1)
             {
                 ykcfg.ID = i;
                 Byklist.Add(ykcfg);
             }
         }
     }
     catch (Exception ee)
     {
         gMain.log.WriteLog("新增遥控错误:" + ee.Message);
     }
 }
Пример #3
0
 //修改遥控点位
 private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (cb_ykarea.SelectedItem == null)
         {
             MessageBox.Show("请选择分区");
             return;
         }
         Yk_cfg ykcfg = dataGridView2.CurrentRow.DataBoundItem as Yk_cfg;
         string sql   = string.Format("update yk_cfg set addrandbit='{0}',`order`='{1}',areaid={2} where(id={3})", ykcfg.AddrAndBit, ykcfg.Order, cb_ykarea.SelectedValue, ykcfg.ID);
         if (!checkBox1.Checked)
         {
             sql = string.Format("update yk_cfg set addrandbit='{0}',`order`='{1}',areaid={2} where(id={3})", Int2Hex(ykcfg.AddrAndBit), ykcfg.Order, cb_ykarea.SelectedValue, ykcfg.ID);
         }
         int i = DBHelper.ExcuteTransactionSql(sql);
     }
     catch (Exception ex)
     {
         Log.WriteLog(ex);
     }
 }