Esempio n. 1
0
 private void BT_Query_Click(object sender, EventArgs e)
 {
     if (CB_Type1.SelectedIndex != -1)
     {
         deviceDT = null;
         deviceDT = AsmDevice_BLL.GetDevicesByCondition("DEVICE_TYPE='" + CB_Type1.Text + "' and DEVICE_STATION='" + CB_ST1.Text + "'");
         DGV_DeviceInfor.DataSource = deviceDT;
     }
     else
     {
         deviceDT = null;
         deviceDT = AsmDevice_BLL.GetDevicesByCondition("DEVICE_STATION='" + CB_ST1.Text + "'");
         DGV_DeviceInfor.DataSource = deviceDT;
     }
 }
Esempio n. 2
0
 private void BT_Delete_Click(object sender, EventArgs e)
 {
     if (TB_IP.Text != "")
     {
         if (AsmDevice_BLL.DeleteDeviceByCondition("DEVICE_IP='" + TB_IP.Text + "'") > 0)
         {
             MessageBox.Show("删除成功!");
             BT_Delete.Visible = false;
             ClearEdit();
             ReflshDataGridView();
         }
         else
         {
             MessageBox.Show("删除失败!");
             ReflshDataGridView();
         }
     }
 }
Esempio n. 3
0
 private void ReflshDataGridView()
 {
     deviceDT = null;
     deviceDT = AsmDevice_BLL.GetDevices();
     DGV_DeviceInfor.DataSource = deviceDT;
 }
Esempio n. 4
0
 private void BT_Save_Click(object sender, EventArgs e)
 {
     if (check() == true)
     {
         //新增
         if (flag)
         {
             //判断设备名是否存在
             if (AsmDevice_BLL.IsExistCode("DEVICE_IP='" + TB_IP.Text + "'"))
             {
                 MessageBox.Show("IP地址存在冲突,请检查!");
             }
             else
             {
                 AsmDeviceObject ado = new AsmDeviceObject();
                 ado.DEVICE_NAME       = TB_Name.Text;
                 ado.DEVICE_STATION    = CB_ST2.Text;
                 ado.DEVICE_TYPE       = CB_Type2.SelectedItem.ToString();
                 ado.DEVICE_IP         = TB_IP.Text;
                 ado.DEVICE_CID        = TB_CID.Text;
                 ado.DEVICE_PROTOCOL   = CB_Pro.SelectedItem.ToString();
                 ado.DEVICE_PRINTADD   = TB_Print.Text;
                 ado.DEVICE_CONTROLADD = TB_Control.Text;
                 if (AsmDevice_BLL.AddDeviceObject(ado) > 0)
                 {
                     MessageBox.Show("新增成功!");
                     ClearEdit();
                     ReflshDataGridView();
                 }
                 else
                 {
                     MessageBox.Show("新增失败!");
                     ReflshDataGridView();
                 }
             }
         }
         //修改
         else
         {
             if (AsmDevice_BLL.IsExistCode("DEVICE_IP='" + oldIP + "'"))
             {
                 AsmDeviceObject ado = AsmDevice_BLL.GetDeviceObjectByCondition("where DEVICE_IP='" + oldIP + "'");
                 ado.DEVICE_NAME       = TB_Name.Text;
                 ado.DEVICE_STATION    = CB_ST2.Text;
                 ado.DEVICE_TYPE       = CB_Type2.SelectedItem.ToString();
                 ado.DEVICE_IP         = TB_IP.Text;
                 ado.DEVICE_CID        = TB_CID.Text;
                 ado.DEVICE_PROTOCOL   = CB_Pro.SelectedItem.ToString();
                 ado.DEVICE_PRINTADD   = TB_Print.Text;
                 ado.DEVICE_CONTROLADD = TB_Control.Text;
                 if (AsmDevice_BLL.UpdateDeviceObject(ado) > 0)
                 {
                     MessageBox.Show("修改成功!");
                     ClearEdit();
                     ReflshDataGridView();
                 }
                 else
                 {
                     MessageBox.Show("修改失败!");
                     ReflshDataGridView();
                 }
             }
             else
             {
                 MessageBox.Show("该设备不存在!");
             }
         }
     }
 }