private void FillGrid(ODGrid grid, bool isSelectionMaintained, params SheetDef[] arrDashboardSheetDefs) { List <SheetDef> listSelectedDashboards = grid.SelectedTags <SheetDef>(); grid.BeginUpdate(); grid.ListGridColumns.Clear(); grid.ListGridColumns.Add(new GridColumn("Name", 0, HorizontalAlignment.Left)); if (grid == gridCustom) { grid.ListGridColumns.Add(new GridColumn("Allowed", 50, HorizontalAlignment.Center)); _colAllowed = gridCustom.ListGridColumns.Count - 1; //Dynamically determines the 'Allowed' column index in case we add others later. } grid.ListGridRows.Clear(); foreach (SheetDef sheetDefWidget in arrDashboardSheetDefs) { GridRow row = new GridRow(); row.Cells.Add(sheetDefWidget.Description); if (grid == gridCustom) { bool isAllowed = IsUserGroupAllowed(sheetDefWidget, comboUserGroup.GetSelected <UserGroup>()); row.Cells.Add(isAllowed ? "X":""); } row.Tag = sheetDefWidget; grid.ListGridRows.Add(row); } grid.EndUpdate(); if (isSelectionMaintained) { foreach (SheetDef sheetDef in listSelectedDashboards) { SelectDashboardDef(sheetDef); } } }
private void SelectLabFees(ref ODGrid grid) { List <long> listSelectedProcNums = grid.SelectedTags <Procedure>().Select(x => x.ProcNum).ToList(); listSelectedProcNums.AddRange(grid.SelectedTags <Procedure>().Where(x => x.ProcNumLab > 0).Select(x => x.ProcNumLab).ToList()); //Go through the entire grid and select any procedures that have a ProcNum that matches selected ProcNums or ProcNumLabs. List <Procedure> listAllProcs = grid.GetTags <Procedure>(); for (int i = 0; i < listAllProcs.Count; i++) { if (listAllProcs[i].ProcNum.In(listSelectedProcNums) || listAllProcs[i].ProcNumLab.In(listSelectedProcNums)) { grid.SetSelected(i, true); //Either a selected procedure or one of the labs associated to a selected procedure. } } }
private void butDeleteRules_Click(object sender, EventArgs e) { if (gridRules.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select one or more Rules to delete."); return; } if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Are you sure you want to delete all selected Rules?")) { return; } List <long> listTimeCardRuleNums = gridRules.SelectedTags <TimeCardRule>().Select(x => x.TimeCardRuleNum).ToList(); TimeCardRules.DeleteMany(listTimeCardRuleNums); DataValid.SetInvalid(InvalidType.TimeCardRules); FillRules(); }
///<summary>Returns the tags of the selected items. The items in the combo box must be ODBoxItems.</summary> public List <T> SelectedTags <T>() { SynchronizeGrid(); return(gridMain.SelectedTags <T>()); }