public void InitializeOnStartup(bool refreshData, long userGroupNum, bool isPermissionMode, bool isCEMT = false) { _userGroupNum = userGroupNum; _isPermissionMode = isPermissionMode; _isCEMT = isCEMT; if (_isPermissionMode) { butUp.Visible = false; butDown.Visible = false; butSetAll.Visible = true; comboUserGroup.Visible = true; labelUserGroup.Visible = true; label1.Text = Lan.g(this, "The current selection's internal name is:"); } else { butUp.Visible = true; butDown.Visible = true; butSetAll.Visible = false; comboUserGroup.Visible = false; labelUserGroup.Visible = false; label1.Text = Lan.g(this, "Move the selected item within its list.") + "\r\n" + Lan.g(this, "The current selection's internal name is:"); } if (refreshData) { ListDisplayReportAll = DisplayReports.GetAll(true); ListGroupPermissionsForReports = GroupPermissions.GetPermsForReports(); ListGroupPermissionsOld = new List <GroupPermission>(); foreach (GroupPermission perm in ListGroupPermissionsForReports) { ListGroupPermissionsOld.Add(perm.Copy()); } if (!isCEMT) { _listUserGroups = UserGroups.GetList(); } else { _listUserGroups = UserGroups.GetList(true); } for (int i = 0; i < _listUserGroups.Count; i++) { comboUserGroup.Items.Add(_listUserGroups[i].Description); if (_listUserGroups[i].UserGroupNum == _userGroupNum) { comboUserGroup.SelectedIndex = i; } } if (comboUserGroup.SelectedIndex == -1) { comboUserGroup.SelectedIndex = 0; } } FillGrids(); }
///<summary>Gives the current usergroup all permissions. There should only be one usergroup selected when this is called. Throws exceptions.</summary> public void SetAll() { if (_listUserGroupNums.Count != 1) { throw new Exception("SetAll may not be called when multiple usergroups are selected."); } GroupPermission perm; for (int i = 0; i < Enum.GetNames(typeof(Permissions)).Length; i++) { if (i == (int)Permissions.SecurityAdmin || i == (int)Permissions.StartupMultiUserOld || i == (int)Permissions.StartupSingleUserOld || i == (int)Permissions.EhrKeyAdd) { continue; } perm = GroupPermissions.GetPerm(_listUserGroupNums.First(), (Permissions)i); if (perm == null) { perm = new GroupPermission(); perm.PermType = (Permissions)i; perm.UserGroupNum = _listUserGroupNums.First(); try { GroupPermissions.Insert(perm); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } //add all the report permissions as well List <DisplayReport> _listDisplayReportAll = DisplayReports.GetAll(false); foreach (DisplayReport report in _listDisplayReportAll) { if (GroupPermissions.HasPermission(_listUserGroupNums.First(), Permissions.Reports, report.DisplayReportNum)) { continue; //don't bother creating or adding the permission if the usergroup already has it. } perm = new GroupPermission(); perm.NewerDate = DateTime.MinValue; perm.NewerDays = 0; perm.PermType = Permissions.Reports; perm.UserGroupNum = _listUserGroupNums.First(); perm.FKey = report.DisplayReportNum; try { GroupPermissions.Insert(perm); } catch (Exception ex) { MessageBox.Show(ex.Message); } } FillTreePerm(); }
private void butOK_Click(object sender, EventArgs e) { if (Prefs.UpdateInt(PrefName.ReportsPPOwriteoffDefaultToProcDate, comboReportWriteoff.SelectedIndex) | Prefs.UpdateBool(PrefName.ReportsShowPatNum, checkReportsShowPatNum.Checked) | Prefs.UpdateBool(PrefName.ReportPandIschedProdSubtractsWO, checkReportProdWO.Checked) | Prefs.UpdateBool(PrefName.ReportPandIhasClinicInfo, checkReportPIClinicInfo.Checked) | Prefs.UpdateBool(PrefName.ReportPandIhasClinicBreakdown, checkReportPIClinic.Checked) | Prefs.UpdateBool(PrefName.ProviderPayrollAllowToday, checkProviderPayrollAllowToday.Checked) | Prefs.UpdateBool(PrefName.NetProdDetailUseSnapshotToday, checkNetProdDetailUseSnapshotToday.Checked) | Prefs.UpdateBool(PrefName.ReportsWrapColumns, checkReportPrintWrapColumns.Checked) | Prefs.UpdateBool(PrefName.ReportsIncompleteProcsNoNotes, checkReportsIncompleteProcsNoNotes.Checked) | Prefs.UpdateBool(PrefName.ReportsIncompleteProcsUnsigned, checkReportsIncompleteProcsUnsigned.Checked) | Prefs.UpdateBool(PrefName.TreatFinderProcsAllGeneral, checkBenefitAssumeGeneral.Checked) | Prefs.UpdateBool(PrefName.ReportsShowHistory, checkReportsShowHistory.Checked) | Prefs.UpdateBool(PrefName.OutstandingInsReportDateFilterTab, checkOutstandingRpDateTab.Checked) | Prefs.UpdateBool(PrefName.ReportsDoShowHiddenTPPrepayments, checkReportDisplayUnearnedTP.Checked) ) { changed = true; } if (UpdateReportingServer()) { ConnectionStore.ClearConnectionDictionary(); changed = true; } if (changed) { DataValid.SetInvalid(InvalidType.Prefs); } if (Security.IsAuthorized(Permissions.SecurityAdmin)) { GroupPermissions.Sync(userControlReportSetup.ListGroupPermissionsForReports, userControlReportSetup.ListGroupPermissionsOld); if (userControlReportSetup.ListGroupPermissionsForReports.Exists(x => x.UserGroupNum == _userGroupNum)) { HasReportPerms = true; } DataValid.SetInvalid(InvalidType.Security); } if (DisplayReports.Sync(userControlReportSetup.ListDisplayReportAll)) { DataValid.SetInvalid(InvalidType.DisplayReports); } DialogResult = DialogResult.OK; }
public void init() { displayReports = new DisplayReports(); AddActionClassesToList(displayReports); }
///<summary>A recursive function that sets the checkbox for a node. Also sets the text for the node.</summary> private void FillNodes(TreeNode node, List <long> listUserGroupNums) { //first, any child nodes for (int i = 0; i < node.Nodes.Count; i++) { FillNodes(node.Nodes[i], listUserGroupNums); } //then this node if (node.ImageIndex == 0) { return; } node.ImageIndex = 1; node.Text = GroupPermissions.GetDesc((Permissions)node.Tag); //get all grouppermissions for the passed-in usergroups List <GroupPermission> listGroupPerms = GroupPermissions.GetForUserGroups(listUserGroupNums); List <GroupPermission> listBaseReportingPerms = listGroupPerms.Where(x => x.PermType == Permissions.Reports && x.FKey == 0).ToList(); List <GroupPermission> listDisplayReportingPerms = listGroupPerms.Where(x => x.PermType == Permissions.Reports && x.FKey != 0).ToList(); //group by permtype, preferring newerdays/newerdate that are further back in the past. listGroupPerms = listGroupPerms.GroupBy(x => x.PermType) .Select(x => x .OrderBy((GroupPermission y) => { if (y.NewerDays == 0 && y.NewerDate == DateTime.MinValue) { return(DateTime.MinValue); } if (y.NewerDays == 0) { return(y.NewerDate); } return(DateTimeOD.Today.AddDays(-y.NewerDays)); }).FirstOrDefault()) .ToList(); //display the correct newerdays/newerdate that was found for each permission. for (int i = 0; i < listGroupPerms.Count; i++) { if (listUserGroupNums.Contains(listGroupPerms[i].UserGroupNum) && listGroupPerms[i].PermType == (Permissions)node.Tag) { node.ImageIndex = 2; if (listGroupPerms[i].NewerDate.Year > 1880) { node.Text += " (" + Lan.g(this, "if date newer than") + " " + listGroupPerms[i].NewerDate.ToShortDateString() + ")"; } else if (listGroupPerms[i].NewerDays > 0) { node.Text += " (" + Lan.g(this, "if days newer than") + " " + listGroupPerms[i].NewerDays.ToString() + ")"; } } } //Special case for Reports permission. //Get a list of all report permissions from usergroups that this user is associated to IF the usergroup has the "base" (FKey = 0) report permission. if ((Permissions)node.Tag == Permissions.Reports) { List <GroupPermission> listReportPermsForUser = listDisplayReportingPerms.FindAll(x => listUserGroupNums.Contains(x.UserGroupNum)).ToList(); listReportPermsForUser.RemoveAll(x => !listBaseReportingPerms.Select(y => y.UserGroupNum).Contains(x.UserGroupNum)); int state = DisplayReports.GetReportState(listReportPermsForUser); if (state == 1) { node.ImageIndex = 2; //Checked } else if (state == 0) { node.ImageIndex = 3; //Partially Checked } else { node.ImageIndex = 1; //Unchecked } } }
///<summary>Takes all non-hidden display reports and displays them in their various listboxes. ///Hides listboxes that have no display reports.</summary> private void FillLists() { _listProdInc=DisplayReports.GetForCategory(DisplayReportCategory.ProdInc,false); _listMonthly=DisplayReports.GetForCategory(DisplayReportCategory.Monthly,false); _listDaily=DisplayReports.GetForCategory(DisplayReportCategory.Daily,false); _listList=DisplayReports.GetForCategory(DisplayReportCategory.Lists,false); _listPublicHealth=DisplayReports.GetForCategory(DisplayReportCategory.PublicHealth,false); _listArizonaPrimary=DisplayReports.GetForCategory(DisplayReportCategory.ArizonaPrimaryCare,false); _listReportPermissions=GroupPermissions.GetPermsForReports().Where(x => Security.CurUser.IsInUserGroup(x.UserGroupNum)).ToList(); //add the items to the list boxes and set the list box heights. (positions too?) listProdInc.Items.Clear(); listDaily.Items.Clear(); listMonthly.Items.Clear(); listLists.Items.Clear(); listPublicHealth.Items.Clear(); listArizonaPrimaryCare.Items.Clear(); //listUDSReports.Items.Clear(); foreach(DisplayReport report in _listProdInc) { if(!_listReportPermissions.Exists(x => x.FKey==report.DisplayReportNum)) { listProdInc.Items.Add(report.Description+" [Locked]"); } else { listProdInc.Items.Add(report.Description); } } if(_listProdInc.Count==0) { listProdInc.Visible=false; labelProdInc.Visible=false; } else { listProdInc.Visible=true; labelProdInc.Visible=true; listProdInc.Height=Math.Min((_listProdInc.Count+1) * listProdInc.ItemHeight,listProdInc.Height); } foreach(DisplayReport report in _listDaily) { if(!_listReportPermissions.Exists(x => x.FKey==report.DisplayReportNum)) { listDaily.Items.Add(report.Description+" [Locked]"); } else { listDaily.Items.Add(report.Description); } } if(_listDaily.Count==0) { listDaily.Visible=false; labelDaily.Visible=false; } else { listDaily.Visible=true; labelDaily.Visible=true; listDaily.Height=Math.Min((_listDaily.Count+1) * listDaily.ItemHeight,listDaily.Height); } foreach(DisplayReport report in _listMonthly) { if(!_listReportPermissions.Exists(x => x.FKey==report.DisplayReportNum)) { listMonthly.Items.Add(report.Description+" [Locked]"); } else { listMonthly.Items.Add(report.Description); } } if(_listMonthly.Count==0) { listMonthly.Visible=false; labelMonthly.Visible=false; } else { listMonthly.Visible=true; labelMonthly.Visible=true; listMonthly.Height=Math.Min((_listMonthly.Count+1) * listMonthly.ItemHeight,listMonthly.Height); } foreach(DisplayReport report in _listList) { if(!_listReportPermissions.Exists(x => x.FKey==report.DisplayReportNum)) { listLists.Items.Add(report.Description+" [Locked]"); } else { listLists.Items.Add(report.Description); } } if(_listList.Count==0) { listLists.Visible=false; labelLists.Visible=false; } else { listLists.Visible=true; labelLists.Visible=true; listLists.Height=Math.Min((_listList.Count+1) * listLists.ItemHeight,listLists.Height); } foreach(DisplayReport report in _listPublicHealth) { if(!_listReportPermissions.Exists(x => x.FKey==report.DisplayReportNum)) { listPublicHealth.Items.Add(report.Description+" [Locked]"); } else { listPublicHealth.Items.Add(report.Description); } } if(_listPublicHealth.Count==0) { listPublicHealth.Visible=false; labelPublicHealth.Visible=false; } else { listPublicHealth.Visible=true; labelPublicHealth.Visible=true; listPublicHealth.Height=Math.Min((_listPublicHealth.Count+1) * listPublicHealth.ItemHeight,listPublicHealth.Height); } //Arizona primary care list and label must only be visible when the Arizona primary //care option is checked in the miscellaneous options. foreach(DisplayReport report in _listArizonaPrimary) { if(!_listReportPermissions.Exists(x => x.FKey==report.DisplayReportNum)) { listArizonaPrimaryCare.Items.Add(report.Description+" [Locked]"); } else { listArizonaPrimaryCare.Items.Add(report.Description); } } if(_listArizonaPrimary.Count==0 || !UsingArizonaPrimaryCare()) { listArizonaPrimaryCare.Visible=false; labelArizonaPrimaryCare.Visible=false; } else { listArizonaPrimaryCare.Visible=true; labelArizonaPrimaryCare.Visible=true; listArizonaPrimaryCare.Height=Math.Min((_listArizonaPrimary.Count+1) * listArizonaPrimaryCare.ItemHeight,49); } }