Esempio n. 1
0
        private void btnAddNewDevice_Click(object sender, EventArgs e)
        {
            var nDevice = new frmInsertDevice();

            nDevice.Device     = new Device();
            nDevice.Devices    = _devices;
            nDevice.FormAction = frmInsertDevice.action.Insert;
            nDevice.ShowDialog();
            grdDevices.Refetch();
        }
Esempio n. 2
0
        private void btnEditDevice_Click(object sender, EventArgs e)
        {
            if (grdDevices.RowCount <= 0)
            {
                MessageBox.Show("Không có dữ liệu về sửa", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                var    nDevice = new frmInsertDevice();
                Device obj     = (from d in _devices.AsEnumerable()
                                  where d.DeviceGuid.Equals(grdDevices.GetValue("DeviceGuid"))
                                  select d).FirstOrDefault();
                nDevice.Devices    = _devices;
                nDevice.Device     = obj;
                nDevice.FormAction = frmInsertDevice.action.Update;
                nDevice.ShowDialog();

                grdDevices.Refresh();
            }
        }