示例#1
0
 private void btnEditDevice_Click(object sender, EventArgs e)
 {
     if (tbSections1.CurrentRow != null && dgvDevices.CurrentRow != null)
     {
         frmAddEditDeviceToEquipment frmEdit = new frmAddEditDeviceToEquipment(new Section {
             Id = Convert.ToInt32(tbSections1.CurrentRow.Cells["sid"].Value), Name = tbSections1.CurrentRow.Cells["sSec"].Value.ToString()
         },
                                                                               new Device {
             Id = Convert.ToInt32(dgvDevices.CurrentRow.Cells["id_device"].Value), Quantity = Convert.ToInt32(dgvDevices.CurrentRow.Cells["device_quantity"].Value), Name = dgvDevices.CurrentRow.Cells["device_name"].Value.ToString()
         });
         if (frmEdit.ShowDialog() == DialogResult.OK)
         {
             FillDevices();
         }
     }
 }
示例#2
0
 private void btnAddDeviceToSection_Click(object sender, EventArgs e)
 {
     if (tbSections1.CurrentRow != null)
     {
         frmAddEditDeviceToEquipment frmAdd = new frmAddEditDeviceToEquipment(new Section {
             Id = Convert.ToInt32(tbSections1.CurrentRow.Cells["sid"].Value), Name = tbSections1.CurrentRow.Cells["sSec"].Value.ToString()
         },
                                                                              new Device {
             Id = 0, Quantity = 0, Name = ""
         });
         if (frmAdd.ShowDialog() == DialogResult.OK)
         {
             FillDevices();
         }
     }
 }