예제 #1
0
 /// <summary>
 /// 设备分组修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mnu_DevTypeModify_Click(object sender, EventArgs e)
 {
     if (lv_Category.SelectedItems.Count > 0 && lv_Category.SelectedItems[0].Tag.ToString() != "999999")
     {
         frmDevType fdt = new frmDevType();
         fdt.txtName.Text = lv_Category.SelectedItems[0].Text;
         fdt.txt_ImgGroup.Text = ((DevTypeViewItem)(lv_Category.SelectedItems[0])).imgGroup.ToString();
         if (fdt.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 string ID = this.lv_Category.SelectedItems[0].Tag.ToString();
                 string Name = fdt.txtName.Text;
                 string imggroup = fdt.txt_ImgGroup.Text;
                 DBDevType.DBDevTypeUPdate(Name, ID,imggroup);
                 lv_Category.SelectedItems[0].Text = Name;
             }
             catch (Exception err)
             {
                 fdebug.AddInfo("mnu_DevTypeModify_Click() " + err.Message);
                 //MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("请选中你要修改的项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #2
0
 /// <summary>
 /// 设备分组增加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mnu_DevTypeAdd_Click(object sender, EventArgs e)
 {
     frmDevType fdt = new frmDevType();
     if (fdt.ShowDialog() == DialogResult.OK)
     {
         try
         {
             string Name = fdt.txtName.Text;
             string imggroup = fdt.txt_ImgGroup.Text;
             DBDevType.DBDevTypInsert(Name,imggroup);
             LoadDevTypes();
         }
         catch (Exception err)
         {
             fdebug.AddInfo("mnu_DevTypeAdd_Click() " + err.Message );
             //MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }