private void DeleteSelectedHistoricalEntry() { SecurityTools.CheckForAccess(SecurityGroups.ModifyDevice); try { string entryGuid = DataGridHistory.CurrentRowStringValue(HistoricalDevicesCols.HistoryEntryGuid); using (DataTable results = DBFactory.GetDatabase().DataTableFromQueryString(Queries.SelectHistoricalDeviceEntry(entryGuid))) { string dateStamp = results.Rows[0][HistoricalDevicesCols.ActionDateTime].ToString(); string actionType = Attributes.DeviceAttributes.ChangeType[results.Rows[0][HistoricalDevicesCols.ChangeType].ToString()].DisplayValue; var blah = OtherFunctions.Message("Are you sure you want to delete this entry? This cannot be undone!" + "\r\n" + "\r\n" + "Entry info: " + dateStamp + " - " + actionType + " - " + entryGuid, MessageBoxButtons.YesNo, MessageBoxIcon.Question, "Are you sure?", this); if (blah == DialogResult.Yes) { int affectedRows = DBFactory.GetDatabase().ExecuteNonQuery(Queries.DeleteHistoricalEntryByGuid(entryGuid)); if (affectedRows > 0) { StatusPrompt("Entry deleted!", Color.Green); RefreshData(); } } } } catch (Exception ex) { ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod()); } }
private void NewEntryView() { string entryGuid = DataGridHistory.CurrentRowStringValue(HistoricalDevicesCols.HistoryEntryGuid); if (!Helpers.ChildFormControl.FormIsOpenByGuid(typeof(ViewHistoryForm), entryGuid)) { Waiting(); new ViewHistoryForm(this, entryGuid, currentViewDevice.Guid); DoneWaiting(); } }