///<summary>Delete the Kiosk or MobileDevice.</summary> public void Delete() { if (IsKiosk) { TerminalActives.DeleteForCmptrSessionAndId(_computerKiosk.ComputerName, _computerKiosk.SessionId, processId: _computerKiosk.ProcessId); } else { MobileAppDevices.Delete(_mobileDevice.MobileAppDeviceNum); } }
///<summary>Fills the big main grid.</summary> private void FillGridMobileAppDevices() { gridMobileAppDevices.BeginUpdate(); //Columns gridMobileAppDevices.ListGridColumns.Clear(); gridMobileAppDevices.AddColumn("Device Name", 0); gridMobileAppDevices.AddColumn("Last Attempt", 0); gridMobileAppDevices.AddColumn("Last Login", 0); if (PrefC.HasClinicsEnabled) { gridMobileAppDevices.AddColumn("Clinic", 0); } gridMobileAppDevices.ListGridColumns.Add(new GridColumn("Enabled", 50, HorizontalAlignment.Center)); if (_eClipboardAllowEdit) { gridMobileAppDevices.ListGridColumns.Add(new GridColumn("Delete", 45, HorizontalAlignment.Center)); } //Rows gridMobileAppDevices.ListGridRows.Clear(); List <MobileAppDevice> listDevicesToShow = MobileAppDevices.GetForUser(Security.CurUser); if (_clinicNumEClipboardTab > 0) { listDevicesToShow.RemoveAll(x => x.ClinicNum != _clinicNumEClipboardTab); } foreach (MobileAppDevice device in listDevicesToShow) { GridRow row = new GridRow(); row.Cells.Add(device.DeviceName + "\r\n(" + device.UniqueID + ")"); row.Cells.Add((device.LastAttempt.Year > 1880 ? device.LastAttempt.ToString() : "")); row.Cells.Add((device.LastLogin.Year > 1880 ? device.LastLogin.ToString() : "")); if (PrefC.HasClinicsEnabled) { row.Cells.Add((device.ClinicNum == 0 ? Clinics.GetPracticeAsClinicZero() : Clinics.GetClinic(device.ClinicNum)).Abbr); } row.Cells.Add((device.IsAllowed ? "X" : "")); if (_eClipboardAllowEdit) { #region Delete click handler void DeleteClick(object sender, EventArgs e) { if (device.PatNum > 0) { MsgBox.Show("A patient is currently using this device. Please clear the patient from the device using the Kiosk Manager" + " or wait until the patient is no longer using the device."); return; } if (!MsgBox.Show(MsgBoxButtons.YesNo, "This will immediately remove the device from the database and all other workstations." + " Continue?")) { return; } MobileAppDevices.Delete(device.MobileAppDeviceNum); FillGridMobileAppDevices(); } #endregion Delete click handler GridCell cell = new GridCell("Delete"); cell.ColorBackG = Color.LightGray; cell.ClickEvent = DeleteClick; row.Cells.Add(cell); } row.Tag = device; gridMobileAppDevices.ListGridRows.Add(row); } gridMobileAppDevices.EndUpdate(); }