private void FormClaimNotSent_Load(object sender, System.EventArgs e) { SetFilterControlsAndAction(() => { FillGrid(); } , odDateRangePicker, comboClinicMulti, comboBoxInsFilter ); odDateRangePicker.SetDateTimeTo(DateTime.Now.Date); odDateRangePicker.SetDateTimeFrom(odDateRangePicker.GetDateTimeTo().AddDays(-7)); //default to the previous week _listClaimSentEditUsers = Userods.GetUsersByPermission(Permissions.ClaimSentEdit, false); _listOldClaimTrackings = ClaimTrackings.RefreshForUsers(ClaimTrackingType.ClaimUser, _listClaimSentEditUsers.Select(x => x.UserNum).ToList()); _listNewClaimTrackings = _listOldClaimTrackings.Select(x => x.Copy()).ToList(); //Fill the Ins Filter box //comboBoxInsFilter.Items.Add(Lan.g(this,"All"));//always adding an 'All' option first foreach (ClaimNotSentStatuses claimStat in Enum.GetValues(typeof(ClaimNotSentStatuses))) { comboBoxInsFilter.Items.Add(claimStat); } comboBoxInsFilter.SelectedIndex = 0; //Pre-select 'All' for the user //Fill the right-click menu for the grid List <MenuItem> listMenuItems = new List <MenuItem>(); //The first item in the list will always exists, but we toggle it's visibility to only show when 1 row is selected. listMenuItems.Add(new MenuItem(Lan.g(this, "Go to Account"), new EventHandler(gridMain_RightClickHelper))); listMenuItems[0].Tag = 0; //Tags are used to identify what to do in gridMain_RightClickHelper. Menu.MenuItemCollection menuItemCollection = new Menu.MenuItemCollection(rightClickMenu); menuItemCollection.AddRange(listMenuItems.ToArray()); rightClickMenu.Popup += new EventHandler((o, ea) => { rightClickMenu.MenuItems[0].Visible = (gridMain.SelectedIndices.Count() == 1); //Only show 'Go to Account' when there is exactly 1 row selected. }); }
private void FormClaimNotSent_Load(object sender, System.EventArgs e) { odDateRangePicker.SetDateTimeTo(DateTime.Now.Date); odDateRangePicker.SetDateTimeFrom(odDateRangePicker.GetDateTimeTo().AddDays(-7)); //default to the previous week _listClaimSentEditUsers = Userods.GetUsersByPermission(Permissions.ClaimSentEdit, false); _listOldClaimTrackings = ClaimTrackings.RefreshForUsers(ClaimTrackingType.ClaimUser, _listClaimSentEditUsers.Select(x => x.UserNum).ToList()); _listNewClaimTrackings = _listOldClaimTrackings.Select(x => x.Copy()).ToList(); //Fill the clinics combobox if (PrefC.HasClinicsEnabled) { _listClinics = Clinics.GetForUserod(Security.CurUser); comboBoxClinics.Items.Add(Lan.g(this, "All")); int curIndex = 0; //start at 0 since we are adding an item if (!Security.CurUser.ClinicIsRestricted) { comboBoxClinics.Items.Add(Lan.g(this, "Unassigned")); curIndex++; //increment index after adding this option } for (int i = 0; i < _listClinics.Count; i++) { curIndex++; comboBoxClinics.Items.Add(_listClinics[i].Abbr); if (Clinics.ClinicNum == 0) { comboBoxClinics.SelectedIndices.Clear(); comboBoxClinics.SetSelected(0, true); } if (_listClinics[i].ClinicNum == Clinics.ClinicNum) { comboBoxClinics.SelectedIndices.Clear(); comboBoxClinics.SetSelected(curIndex, true); } } } else { labelClinics.Visible = false; comboBoxClinics.Visible = false; } //Fill the Ins Filter box //comboBoxInsFilter.Items.Add(Lan.g(this,"All"));//always adding an 'All' option first foreach (ClaimNotSentStatuses claimStat in Enum.GetValues(typeof(ClaimNotSentStatuses))) { comboBoxInsFilter.Items.Add(claimStat); } comboBoxInsFilter.SelectedIndex = 0; //Pre-select 'All' for the user //Fill the right-click menu for the grid List <MenuItem> listMenuItems = new List <MenuItem>(); //The first item in the list will always exists, but we toggle it's visibility to only show when 1 row is selected. listMenuItems.Add(new MenuItem(Lan.g(this, "Go to Account"), new EventHandler(gridMain_RightClickHelper))); listMenuItems[0].Tag = 0; //Tags are used to identify what to do in gridMain_RightClickHelper. Menu.MenuItemCollection menuItemCollection = new Menu.MenuItemCollection(rightClickMenu); menuItemCollection.AddRange(listMenuItems.ToArray()); rightClickMenu.Popup += new EventHandler((o, ea) => { rightClickMenu.MenuItems[0].Visible = (gridMain.SelectedIndices.Count() == 1); //Only show 'Go to Account' when there is exactly 1 row selected. }); }