///<summary>Commit changes that the user might have made to the display name.</summary> private void CommitChange() { DisplayReportCategory selectedCat = (DisplayReportCategory)_selectedGrid.Tag; DisplayReport clicked = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y); clicked.Description = _selectedGrid.Rows[_selectedCell.Y].Cells[0].Text.Replace(" (hidden)", ""); //Remove (hidden) text }
private void butDown_Click(object sender, EventArgs e) { if (_selectedCell.Y == -1 || _selectedGrid == null) { MsgBox.Show(this, "Please select a report first."); return; } DisplayReportCategory selectedCat = (DisplayReportCategory)_selectedGrid.Tag; DisplayReport selectedReport = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y); if (selectedReport.ItemOrder == _selectedGrid.Rows.Count - 1) { return; //the item is already the last in the list and cannot go down anymore. } DisplayReport switchReport = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y + 1); selectedReport.ItemOrder++; _selectedCell.Y++; switchReport.ItemOrder--; FillGrids(); }
///<summary>Get all display reports for the passed-in category. Pass in true to retrieve hidden display reports.</summary> public static List <DisplayReport> GetForCategory(DisplayReportCategory category, bool showHidden) { //No need to check RemotingRole; no call to db. return(GetWhere(x => x.Category == category, !showHidden)); }
///<summary>This method is used by all grids in this form. If any new grids are added, they will need to be added to this method.</summary> private void grid_CellClick(object sender, ODGridClickEventArgs e) { if (_selectedCell.Y != -1 && _selectedGrid != null) { //commit change before the new cell is selected to save the old cell's changes. CommitChange(); } _selectedCell.X = e.Col; _selectedCell.Y = e.Row; _selectedGrid = (ODGrid)sender; //this label makes sure the user always has some idea of what the selected report is, even if the DisplayName might be incomprehensible. labelODInternal.Text = GetInternalName((DisplayReport)_selectedGrid.Rows[_selectedCell.Y].Tag); DisplayReportCategory selectedCat = (DisplayReportCategory)_selectedGrid.Tag; //de-select all but the currently selected grid if (selectedCat != DisplayReportCategory.ProdInc) { gridProdInc.SetSelected(-1, true); } if (selectedCat != DisplayReportCategory.Daily) { gridDaily.SetSelected(-1, true); } if (selectedCat != DisplayReportCategory.Monthly) { gridMonthly.SetSelected(-1, true); } if (selectedCat != DisplayReportCategory.Lists) { gridLists.SetSelected(-1, true); } if (selectedCat != DisplayReportCategory.PublicHealth) { gridPublicHealth.SetSelected(-1, true); } DisplayReport clicked = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y); if (_isPermissionMode) { if (_selectedCell.X == 1) { GroupPermission groupPerm = ListGroupPermissionsForReports.Find(x => x.FKey == clicked.DisplayReportNum && x.UserGroupNum == _listUserGroups[comboUserGroup.SelectedIndex].UserGroupNum); if (groupPerm == null) //They don't have perm { groupPerm = new GroupPermission(); groupPerm.NewerDate = DateTime.MinValue; groupPerm.NewerDays = 0; groupPerm.PermType = Permissions.Reports; groupPerm.UserGroupNum = _listUserGroups[comboUserGroup.SelectedIndex].UserGroupNum; groupPerm.FKey = clicked.DisplayReportNum; ListGroupPermissionsForReports.Add(groupPerm); } else { ListGroupPermissionsForReports.Remove(groupPerm); } } } else { if (_selectedCell.X == 1) { clicked.IsVisibleInSubMenu = !clicked.IsVisibleInSubMenu; if (clicked.IsVisibleInSubMenu) { clicked.IsHidden = false; } } else if (_selectedCell.X == 2) { clicked.IsHidden = !clicked.IsHidden; if (clicked.IsHidden) { clicked.IsVisibleInSubMenu = false; } } } FillGrids(); }