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 DataGridHistory_VisibleChanged(object sender, EventArgs e) { if (DataGridHistory.Visible) { DataGridHistory.ClearSelection(); } }
private void NewEntryView() { string entryGuid = DataGridHistory.CurrentRowStringValue(HistoricalDevicesCols.HistoryEntryGuid); if (!Helpers.ChildFormControl.FormIsOpenByGuid(typeof(ViewHistoryForm), entryGuid)) { Waiting(); new ViewHistoryForm(this, entryGuid, currentViewDevice.Guid); DoneWaiting(); } }
private void RefreshDataGridHistory() { try { DataGridHistory.Items.Refresh(); DataGridHistory.ScrollIntoView(CollectionView.NewItemPlaceholder); } catch (Exception ex) { clsLogger.WriteToLogFile("Error during refreshing website history data :" + ex.Message); } }
public ViewDeviceForm(ExtendedForm parentForm, MappedObject device, bool startHidden = false) : base(parentForm, device, startHidden) { currentViewDevice = (Device)device; InitializeComponent(); InitDBControls(); controlParser = new DBControlParser(this); controlParser.EnableFieldValidation(); defaultFormTitle = this.Text; liveBox = new LiveBox(this); liveBox.AttachToControl(CurrentUserTextBox, DevicesCols.CurrentUser, LiveBoxSelectAction.UserSelect, DevicesCols.MunisEmpNum); liveBox.AttachToControl(DescriptionTextBox, DevicesCols.Description, LiveBoxSelectAction.SelectValue); munisToolBar = new MunisToolBar(this); munisToolBar.InsertMunisDropDown(ToolStrip1, 6); windowList = new WindowList(this); windowList.InsertWindowList(ToolStrip1); statusSlider = new SliderLabel(); statusSlider.FlashStripOnNewMessage = true; StatusStrip.Items.Add(statusSlider.ToToolStripControl(StatusStrip)); RefreshCombos(); DataGridHistory.DoubleBuffered(true); TrackingGrid.DoubleBuffered(true); SetEditMode(false); LoadCurrentDevice(); WatchdogInstance.Watchdog.StatusChanged += Watchdog_StatusChanged; if (!startHidden) { this.Show(); } else { // Let the base class know that the hidden form is ready. // Since no load event occurs, we need someway to notify // when all the components are instantiated and populated. base.HiddenFormReady(); } }
private void LoadHistoryAndFields() { using (var historicalResults = GetHistoricalTable(currentViewDevice.Guid)) { currentHash = GetHash(currentViewDevice.PopulatingTable, historicalResults); controlParser.FillDBFields(currentViewDevice.PopulatingTable); MunisUser = new MunisEmployee(currentViewDevice.CurrentUser, currentViewDevice.CurrentUserEmpNum); SetMunisEmpStatus(); DataGridHistory.SuspendLayout(); DataGridHistory.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; DataGridHistory.ColumnHeadersHeight = 38; DataGridHistory.Populate(historicalResults, HistoricalGridColumns()); DataGridHistory.FastAutoSizeColumns(); DataGridHistory.ResumeLayout(); UpdateAttachCountHandler(this, new EventArgs()); SetADInfo(); RemoteToolsControl.Device = currentViewDevice; } }
public void LoadCurrentDevice() { try { gridFilling = true; LoadHistoryAndFields(); if (currentViewDevice.IsTrackable) { LoadTracking(currentViewDevice.Guid); } SetPingHistoryLink(); SetTracking(currentViewDevice.IsTrackable, currentViewDevice.Tracking.IsCheckedOut); this.Text = this.defaultFormTitle + FormTitle(currentViewDevice); DataGridHistory.ClearSelection(); } catch (Exception ex) { ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod()); } }