///<summary>Fills listUserTabUserGroups.</summary>
 private void FillUserTabGroups()
 {
     _isFillingList = true;
     listUserTabUserGroups.Items.Clear();
     foreach (UserGroup groupCur in UserGroups.GetList(IsForCEMT))
     {
         listUserTabUserGroups.Items.Add(new ODBoxItem <UserGroup>(groupCur.Description, groupCur));
     }
     _isFillingList = false;
     RefreshUserTabGroups();
 }
 private void InitializeOnStartup()
 {
     _listUserGroups = UserGroups.GetList();
     comboUserGroup.Items.AddList(_listUserGroups, x => x.Description);
     comboUserGroup.SetSelectedKey <UserGroup>(_userGroupNum, x => x.UserGroupNum);
     if (comboUserGroup.SelectedIndex == -1)
     {
         comboUserGroup.SelectedIndex = 0;
     }
     _listGroupPermissions    = GroupPermissions.GetForUserGroups(_listUserGroups.Select(x => x.UserGroupNum).ToList(), Permissions.DashboardWidget);
     _listGroupPermissionsOld = _listGroupPermissions.Select(x => x.Copy()).ToList();
 }
Exemplo n.º 3
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     try{
         UserGroups.Delete(CurGroup);
         DialogResult = DialogResult.OK;
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Please enter a description.");
         return;
     }
     CurGroup.Description = textDescription.Text;
     try{
         UserGroups.InsertOrUpdate(CurGroup, IsNew);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 5
0
        private void FormDentalSchoolSetup_Load(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.Setup))
            {
                return;
            }
            UserGroup studentGroup    = UserGroups.GetGroup(PrefC.GetLong(PrefName.SecurityGroupForStudents));
            UserGroup instructorGroup = UserGroups.GetGroup(PrefC.GetLong(PrefName.SecurityGroupForInstructors));

            if (studentGroup != null)
            {
                textStudents.Text = studentGroup.Description;
            }
            if (instructorGroup != null)
            {
                textInstructors.Text = instructorGroup.Description;
            }
        }
Exemplo n.º 6
0
        ///<summary>Refreshes the UserGroups list box on the "User" tab. Also refreshes the security tree.
        ///Public so that it can be called from the Form that implements this control.</summary>
        public void RefreshUserTabGroups()
        {
            List <UserGroup> listUserGroups = (SelectedUser == null) ? UserGroups.GetList(IsForCEMT) : SelectedUser.GetGroups(IsForCEMT);

            _isFillingList = true;
            listUserTabUserGroups.Items.Clear();
            for (int i = 0; i < listUserGroups.Count; i++)
            {
                listUserTabUserGroups.Items.Add(new ODBoxItem <UserGroup>(listUserGroups[i].Description, listUserGroups[i]));
                if (SelectedUser != null)
                {
                    listUserTabUserGroups.SetSelected(i, true);
                }
            }
            _isFillingList = false;
            //RefreshTree takes a while (it has to draw many images) so this is to show the usergroup selections before loading the tree.
            Application.DoEvents();
            RefreshUserTree();
        }
Exemplo n.º 7
0
        private void FormGlobalSecurity_Load(object sender, EventArgs e)
        {
            textLogOffAfterMinutes.Text                = PrefC.GetInt(PrefName.SecurityLogOffAfterMinutes).ToString();
            checkAllowLogoffOverride.Checked           = PrefC.GetBool(PrefName.SecurityLogOffAllowUserOverride);
            checkPasswordsMustBeStrong.Checked         = PrefC.GetBool(PrefName.PasswordsMustBeStrong);
            checkPasswordsStrongIncludeSpecial.Checked = PrefC.GetBool(PrefName.PasswordsStrongIncludeSpecial);
            checkPasswordForceWeakToStrong.Checked     = PrefC.GetBool(PrefName.PasswordsWeakChangeToStrong);
            checkTimecardSecurityEnabled.Checked       = PrefC.GetBool(PrefName.TimecardSecurityEnabled);
            checkCannotEditOwn.Checked       = PrefC.GetBool(PrefName.TimecardUsersDontEditOwnCard);
            checkCannotEditOwn.Enabled       = checkTimecardSecurityEnabled.Checked;
            checkDomainLoginEnabled.Checked  = PrefC.GetBool(PrefName.DomainLoginEnabled);
            textDomainLoginPath.ReadOnly     = !checkDomainLoginEnabled.Checked;
            textDomainLoginPath.Text         = PrefC.GetString(PrefName.DomainLoginPath);
            checkLogOffWindows.Checked       = PrefC.GetBool(PrefName.SecurityLogOffWithWindows);
            checkUserNameManualEntry.Checked = PrefC.GetBool(PrefName.UserNameManualEntry);
            if (PrefC.GetDate(PrefName.BackupReminderLastDateRun).ToShortDateString() == DateTime.MaxValue.AddMonths(-1).ToShortDateString())
            {
                checkDisableBackupReminder.Checked = true;
            }
            if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
            {
                textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
            }
            if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
            {
                textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
            }
            if (PrefC.GetBool(PrefName.CentralManagerSecurityLock))
            {
                butChange.Enabled = false;
                labelGlobalDateLockDisabled.Visible = true;
            }
            List <UserGroup> listGroupsNotAdmin = UserGroups.GetList().FindAll(x => !GroupPermissions.HasPermission(x.UserGroupNum, Permissions.SecurityAdmin, 0));

            for (int i = 0; i < listGroupsNotAdmin.Count; i++)
            {
                comboGroups.Items.Add(listGroupsNotAdmin[i].Description, listGroupsNotAdmin[i]);
                if (PrefC.GetLong(PrefName.DefaultUserGroup) == listGroupsNotAdmin[i].UserGroupNum)
                {
                    comboGroups.SelectedIndex = i;
                }
            }
        }
        ///<summary>Fills listUserGroupTabUserGroups. Public so that it can be called from the Form that implements this control.</summary>
        public void FillListUserGroupTabUserGroups()
        {
            _isFillingList = true;
            UserGroup selectedGroup = SelectedUserGroup;             //Preserve Usergroup selection.

            listUserGroupTabUserGroups.Items.Clear();
            foreach (UserGroup groupCur in UserGroups.GetList(IsForCEMT))
            {
                ODBoxItem <UserGroup> boxItemCur = new ODBoxItem <UserGroup>(groupCur.Description, groupCur);
                listUserGroupTabUserGroups.Items.Add(boxItemCur);
                if (selectedGroup != null && groupCur.UserGroupNum == selectedGroup.UserGroupNum)
                {
                    listUserGroupTabUserGroups.SelectedItem = boxItemCur;
                }
            }
            _isFillingList = false;
            if (listUserGroupTabUserGroups.SelectedItem == null)
            {
                listUserGroupTabUserGroups.SetSelected(0, true);
            }
        }
Exemplo n.º 9
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (PrefC.GetLong(PrefName.DefaultUserGroup) == CurGroup.UserGroupNum)
     {
         MsgBox.Show(this, "Cannot delete user group that is set as the default user group.");
         return;
     }
     try{
         UserGroups.Delete(CurGroup);
         DataValid.SetInvalid(InvalidType.Security);
         DialogResult = DialogResult.OK;
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 10
0
 private void FillListBox()
 {
     Userods.RefreshCache();
     UserGroups.RefreshCache();
     GroupPermissions.RefreshCache();
     listUser.BeginUpdate();
     listUser.Items.Clear();
     shortList = UserodC.ShortList;
     for (int i = 0; i < shortList.Count; i++)
     {
         listUser.Items.Add(shortList[i]);
         if (Security.CurUser != null && shortList[i].UserNum == Security.CurUser.UserNum)
         {
             listUser.SelectedIndex = i;
         }
     }
     if (listUser.SelectedIndex == -1)
     {
         listUser.SelectedIndex = 0;
     }
     listUser.EndUpdate();
 }
 ///<summary>Fills the filter comboboxes on the "Users" tab.</summary>
 private void FillFilters()
 {
     foreach (UserFilters filterCur in Enum.GetValues(typeof(UserFilters)))
     {
         if (PrefC.GetBool(PrefName.EasyHideDentalSchools) && (filterCur == UserFilters.Students || filterCur == UserFilters.Instructors))
         {
             continue;
         }
         comboShowOnly.Items.Add(new ODBoxItem <UserFilters>(Lan.g(this, filterCur.GetDescription()), filterCur));
     }
     comboShowOnly.SelectedIndex = 0;
     comboSchoolClass.Items.Add(new ODBoxItem <SchoolClass>(Lan.g(this, "All")));
     comboSchoolClass.SelectedIndex = 0;
     foreach (SchoolClass schoolClassCur in SchoolClasses.GetDeepCopy())
     {
         comboSchoolClass.Items.Add(new ODBoxItem <SchoolClass>(SchoolClasses.GetDescript(schoolClassCur), schoolClassCur));
     }
     if (PrefC.HasClinicsEnabled)
     {
         comboClinic.Visible = true;
         labelClinic.Visible = true;
         comboClinic.Items.Clear();
         comboClinic.Items.Add(new ODBoxItem <Clinic>(Lan.g(this, "All Clinics")));
         comboClinic.SelectedIndex = 0;
         foreach (Clinic clinicCur in Clinics.GetDeepCopy(true))
         {
             comboClinic.Items.Add(new ODBoxItem <Clinic>(clinicCur.Abbr, clinicCur));
         }
     }
     comboGroups.Items.Clear();
     comboGroups.Items.Add(new ODBoxItem <UserGroup>(Lan.g(this, "All Groups")));
     comboGroups.SelectedIndex = 0;
     foreach (UserGroup groupCur in UserGroups.GetList(IsForCEMT))
     {
         comboGroups.Items.Add(new ODBoxItem <UserGroup>(groupCur.Description, groupCur));
     }
 }
 public FormDashboardWidgetSetup()
 {
     InitializeComponent();
     Lan.F(this);
     _userGroupNum = UserGroups.GetForUser(Security.CurUser.UserNum, false).FirstOrDefault().UserGroupNum;
 }
Exemplo n.º 13
0
        private void FormUserEdit_Load(object sender, System.EventArgs e)
        {
            checkIsHidden.Checked = UserCur.IsHidden;
            if (UserCur.UserNum != 0)
            {
                textUserNum.Text = UserCur.UserNum.ToString();
            }
            textUserName.Text   = UserCur.UserName;
            textDomainUser.Text = UserCur.DomainUser;
            if (!PrefC.GetBool(PrefName.DomainLoginEnabled))
            {
                labelDomainUser.Visible   = false;
                textDomainUser.Visible    = false;
                butPickDomainUser.Visible = false;
            }
            checkRequireReset.Checked = UserCur.IsPasswordResetRequired;
            _listUserGroups           = UserGroups.GetList();
            _isFillingList            = true;
            for (int i = 0; i < _listUserGroups.Count; i++)
            {
                listUserGroup.Items.Add(new ODBoxItem <UserGroup>(_listUserGroups[i].Description, _listUserGroups[i]));
                if (!_isFromAddUser && UserCur.IsInUserGroup(_listUserGroups[i].UserGroupNum))
                {
                    listUserGroup.SetSelected(i, true);
                }
                if (_isFromAddUser && _listUserGroups[i].UserGroupNum == PrefC.GetLong(PrefName.DefaultUserGroup))
                {
                    listUserGroup.SetSelected(i, true);
                }
            }
            if (listUserGroup.SelectedIndex == -1)          //never allowed to delete last group, so this won't fail
            {
                listUserGroup.SelectedIndex = 0;
            }
            _isFillingList = false;
            securityTreeUser.FillTreePermissionsInitial();
            RefreshUserTree();
            listEmployee.Items.Clear();
            listEmployee.Items.Add(Lan.g(this, "none"));
            listEmployee.SelectedIndex = 0;
            _listEmployees             = Employees.GetDeepCopy(true);
            for (int i = 0; i < _listEmployees.Count; i++)
            {
                listEmployee.Items.Add(Employees.GetNameFL(_listEmployees[i]));
                if (UserCur.EmployeeNum == _listEmployees[i].EmployeeNum)
                {
                    listEmployee.SelectedIndex = i + 1;
                }
            }
            listProv.Items.Clear();
            listProv.Items.Add(Lan.g(this, "none"));
            listProv.SelectedIndex = 0;
            _listProviders         = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                listProv.Items.Add(_listProviders[i].GetLongDesc());
                if (UserCur.ProvNum == _listProviders[i].ProvNum)
                {
                    listProv.SelectedIndex = i + 1;
                }
            }
            _listClinics           = Clinics.GetDeepCopy(true);
            _listUserAlertTypesOld = AlertSubs.GetAllForUser(UserCur.UserNum);
            List <long> listSubscribedClinics;
            bool        isAllClinicsSubscribed = false;

            if (_listUserAlertTypesOld.Select(x => x.ClinicNum).Contains(-1))             //User subscribed to all clinics
            {
                isAllClinicsSubscribed = true;
                listSubscribedClinics  = _listClinics.Select(x => x.ClinicNum).Distinct().ToList();
            }
            else
            {
                listSubscribedClinics = _listUserAlertTypesOld.Select(x => x.ClinicNum).Distinct().ToList();
            }
            List <long> listAlertCatNums = _listUserAlertTypesOld.Select(x => x.AlertCategoryNum).Distinct().ToList();

            listAlertSubMulti.Items.Clear();
            _listAlertCategories = AlertCategories.GetDeepCopy();
            List <long> listUserAlertCatNums = _listUserAlertTypesOld.Select(x => x.AlertCategoryNum).ToList();

            foreach (AlertCategory cat in _listAlertCategories)
            {
                int index = listAlertSubMulti.Items.Add(Lan.g(this, cat.Description));
                listAlertSubMulti.SetSelected(index, listUserAlertCatNums.Contains(cat.AlertCategoryNum));
            }
            if (!PrefC.HasClinicsEnabled)
            {
                tabClinics.Enabled = false;              //Disables all controls in the clinics tab.  Tab is still selectable.
                listAlertSubsClinicsMulti.Visible = false;
                labelAlertClinic.Visible          = false;
            }
            else
            {
                listClinic.Items.Clear();
                listClinic.Items.Add(Lan.g(this, "All"));
                listAlertSubsClinicsMulti.Items.Add(Lan.g(this, "All"));
                listAlertSubsClinicsMulti.Items.Add(Lan.g(this, "Headquarters"));
                if (UserCur.ClinicNum == 0)               //Unrestricted
                {
                    listClinic.SetSelected(0, true);
                    checkClinicIsRestricted.Enabled = false; //We don't really need this checkbox any more but it's probably better for users to keep it....
                }
                if (isAllClinicsSubscribed)                  //They are subscribed to all clinics
                {
                    listAlertSubsClinicsMulti.SetSelected(0, true);
                }
                else if (listSubscribedClinics.Contains(0))                 //They are subscribed to Headquarters
                {
                    listAlertSubsClinicsMulti.SetSelected(1, true);
                }
                List <UserClinic> listUserClinics = UserClinics.GetForUser(UserCur.UserNum);
                for (int i = 0; i < _listClinics.Count; i++)
                {
                    listClinic.Items.Add(_listClinics[i].Abbr);
                    listClinicMulti.Items.Add(_listClinics[i].Abbr);
                    listAlertSubsClinicsMulti.Items.Add(_listClinics[i].Abbr);
                    if (UserCur.ClinicNum == _listClinics[i].ClinicNum)
                    {
                        listClinic.SetSelected(i + 1, true);
                    }
                    if (UserCur.ClinicNum != 0 && listUserClinics.Exists(x => x.ClinicNum == _listClinics[i].ClinicNum))
                    {
                        listClinicMulti.SetSelected(i, true);                       //No "All" option, don't select i+1
                    }
                    if (!isAllClinicsSubscribed && _listUserAlertTypesOld.Exists(x => x.ClinicNum == _listClinics[i].ClinicNum))
                    {
                        listAlertSubsClinicsMulti.SetSelected(i + 2, true);                     //All+HQ
                    }
                }
                checkClinicIsRestricted.Checked = UserCur.ClinicIsRestricted;
            }
            if (string.IsNullOrEmpty(UserCur.PasswordHash))
            {
                butPassword.Text = Lan.g(this, "Create Password");
            }
            if (!PrefC.IsODHQ)
            {
                butJobRoles.Visible = false;
            }
            if (IsNew)
            {
                butUnlock.Visible = false;
            }
            _listDoseSpotUserPrefOld = UserOdPrefs.GetByUserAndFkeyAndFkeyType(UserCur.UserNum,
                                                                               Programs.GetCur(ProgramName.eRx).ProgramNum, UserOdFkeyType.Program,
                                                                               Clinics.GetForUserod(Security.CurUser, true).Select(x => x.ClinicNum)
                                                                               .Union(new List <long>()
            {
                0
            })                                                //Always include 0 clinic, this is the default, NOT a headquarters only value.
                                                                               .Distinct()
                                                                               .ToList());
            _listDoseSpotUserPrefNew = _listDoseSpotUserPrefOld.Select(x => x.Clone()).ToList();
            _doseSpotUserPrefDefault = _listDoseSpotUserPrefNew.Find(x => x.ClinicNum == 0);
            if (_doseSpotUserPrefDefault == null)
            {
                _doseSpotUserPrefDefault = DoseSpot.GetDoseSpotUserIdFromPref(UserCur.UserNum, 0);
                _listDoseSpotUserPrefNew.Add(_doseSpotUserPrefDefault);
            }
            textDoseSpotUserID.Text = _doseSpotUserPrefDefault.ValueString;
            if (_isFromAddUser && !Security.IsAuthorized(Permissions.SecurityAdmin, true))
            {
                butPassword.Visible       = false;
                checkRequireReset.Checked = true;
                checkRequireReset.Enabled = false;
                butUnlock.Visible         = false;
                butJobRoles.Visible       = false;
            }
            if (!PrefC.HasClinicsEnabled)
            {
                butDoseSpotAdditional.Visible = false;
            }
        }
Exemplo n.º 14
0
        private void FillUsers()
        {
            UserGroups.RefreshCache();
            Cache.Refresh(InvalidType.Security);
            SelectedGroupNum = 0;
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableSecurity", "Username"), 90);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Group"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Employee"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Provider"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Clinic"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "ClinicRestricted"), 100, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Strong"), 80, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            string    usertype = "all";

            if (comboUsers.SelectedIndex == 1)
            {
                usertype = "prov";
            }
            if (comboUsers.SelectedIndex == 2)
            {
                usertype = "emp";
            }
            if (comboUsers.SelectedIndex == 3)
            {
                usertype = "other";
            }
            long classNum = 0;

            if (comboSchoolClass.Visible && comboSchoolClass.SelectedIndex > 0)
            {
                classNum = SchoolClasses.List[comboSchoolClass.SelectedIndex - 1].SchoolClassNum;
            }
            ListUser = Userods.RefreshSecurity(usertype, classNum);
            string userdesc;

            for (int i = 0; i < ListUser.Count; i++)
            {
                row      = new ODGridRow();
                userdesc = ListUser[i].UserName;
                if (ListUser[i].IsHidden)
                {
                    userdesc += Lan.g(this, "(hidden)");
                }
                row.Cells.Add(userdesc);
                row.Cells.Add(UserGroups.GetGroup(ListUser[i].UserGroupNum).Description);
                row.Cells.Add(Employees.GetNameFL(ListUser[i].EmployeeNum));
                row.Cells.Add(Providers.GetLongDesc(ListUser[i].ProvNum));
                row.Cells.Add(Clinics.GetDesc(ListUser[i].ClinicNum));
                row.Cells.Add(ListUser[i].ClinicIsRestricted?"X":"");
                row.Cells.Add(ListUser[i].PasswordIsStrong?"X":"");
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 15
0
 private void FillForm()
 {
     ProgramProperties.RefreshCache();
     PropertyList         = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
     textProgName.Text    = ProgramCur.ProgName;
     textProgDesc.Text    = ProgramCur.ProgDesc;
     checkEnabled.Checked = ProgramCur.Enabled;
     if (GetProp("HideChartRxButtons") == "1")
     {
         checkHideButChartRx.Checked = true;
     }
     else
     {
         checkHideButChartRx.Checked = false;
     }
     if (GetProp("ProcRequireSignature") == "1")
     {
         checkProcRequireSignature.Checked = true;
     }
     else
     {
         checkProcRequireSignature.Checked = false;
     }
     if (GetProp("ProcNotesNoIncomplete") == "1")
     {
         checkProcNotesNoIncomplete.Checked = true;
     }
     else
     {
         checkProcNotesNoIncomplete.Checked = false;
     }
     SetModeRadioButtons(GetProp("eClinicalWorksMode"));
     SetModeVisibilities();
     textECWServer.Text = GetProp("eCWServer");          //this property will not exist if using Oracle, eCW will never use Oracle
     if (HL7Defs.IsExistingHL7Enabled())
     {
         HL7Def def = HL7Defs.GetOneDeepEnabled();
         textHL7Server.Text          = def.HL7Server;
         textHL7ServiceName.Text     = def.HL7ServiceName;
         textHL7FolderIn.Text        = def.OutgoingFolder;       //because these are the opposite of the way they are in the HL7Def
         textHL7FolderOut.Text       = def.IncomingFolder;
         checkQuadAsToothNum.Checked = def.IsQuadAsToothNum;
     }
     else
     {
         textHL7Server.Text      = GetProp("HL7Server");         //this property will not exist if using Oracle, eCW will never use Oracle
         textHL7ServiceName.Text = GetProp("HL7ServiceName");    //this property will not exist if using Oracle, eCW will never use Oracle
         textHL7FolderIn.Text    = PrefC.GetString(PrefName.HL7FolderIn);
         textHL7FolderOut.Text   = PrefC.GetString(PrefName.HL7FolderOut);
         //if a def is enabled, the value associated with the def will override this setting
         checkQuadAsToothNum.Checked = GetProp("IsQuadAsToothNum") == "1";            //this property will not exist if using Oracle, eCW will never use Oracle
     }
     textODServer.Text = MiscData.GetODServer();
     comboDefaultUserGroup.Items.Clear();
     _listUserGroups = UserGroups.GetList();
     for (int i = 0; i < _listUserGroups.Count; i++)
     {
         comboDefaultUserGroup.Items.Add(_listUserGroups[i].Description);
         if (GetProp("DefaultUserGroup") == _listUserGroups[i].UserGroupNum.ToString())
         {
             comboDefaultUserGroup.SelectedIndex = i;
         }
     }
     checkShowImages.Checked   = GetProp("ShowImagesModule") == "1";
     checkFeeSchedules.Checked = GetProp("FeeSchedulesSetManually") == "1";
     textMedPanelURL.Text      = GetProp("MedicalPanelUrl");     //this property will not exist if using Oracle, eCW will never use Oracle
     checkLBSessionId.Checked  = GetProp("IsLBSessionIdExcluded") == "1";
 }
Exemplo n.º 16
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn("User Name", 120);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Group Name", 120);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Show CDS", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Show i", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Edit CDS", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Source", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Problem", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Medication", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Allergy", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Demographic", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Labs", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Vitals", 80, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow       row;
            List <Userod> ListUsers = Userods.GetDeepCopy(true);

            UserGroup[] ArrayGroups = UserGroups.GetDeepCopy().ToArray();
            //if(radioUser.Checked) {//by user
            for (int i = 0; i < ListUsers.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(ListUsers[i].UserName);
                for (int g = 0; g < ArrayGroups.Length; g++)           //group name.
                {
                    if (!ListUsers[i].IsInUserGroup(ArrayGroups[g].UserGroupNum))
                    {
                        continue;
                    }
                    row.Cells.Add(ArrayGroups[g].Description);
                    break;
                }
                for (int p = 0; p < _listCdsPermissions.Count; p++)
                {
                    if (ListUsers[i].UserNum != _listCdsPermissions[p].UserNum)
                    {
                        continue;
                    }
                    row.Cells.Add((_listCdsPermissions[p].ShowCDS                                           ?"X":"")); //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].SetupCDS                                  ?"X":""));         //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].ShowInfobutton            ?"X":""));                         //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].EditBibliography  ?"X":""));                                 //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].ProblemCDS                                ?"X":""));         //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].MedicationCDS                     ?"X":""));                 //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].AllergyCDS                                ?"X":""));         //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].DemographicCDS            ?"X":""));                         //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].LabTestCDS                                ?"X":""));         //"X" if user has permission
                    row.Cells.Add((_listCdsPermissions[p].VitalCDS                                  ?"X":""));         //"X" if user has permission
                    row.Tag = _listCdsPermissions[p].CDSPermissionNum;                                                 //used to edit correct permission.
                    break;
                }
                gridMain.ListGridRows.Add(row);
            }
            //}
            //else {//by user group
            //	for(int g=0;g<ArrayGroups.Length;g++) {
            //		row=new ODGridRow();
            //		row.Cells.Add("");//No User Name
            //		row.Cells.Add(ArrayGroups[g].Description);
            //TODO: Later. No time now for group level permission editing.
            //		gridMain.Rows.Add(row);
            //	}
            //}
            gridMain.EndUpdate();
        }
Exemplo n.º 17
0
 private void FillTreePerm()
 {
     GroupPermissions.Refresh();
     if (SelectedGroupNum == 0)
     {
         labelPerm.Text          = "";
         treePermissions.Enabled = false;
     }
     else
     {
         labelPerm.Text          = Lan.g(this, "Permissions for group:") + "  " + UserGroups.GetGroup(SelectedGroupNum).Description;
         treePermissions.Enabled = true;
     }
     for (int i = 0; i < treePermissions.Nodes.Count; i++)
     {
         FillNodes(treePermissions.Nodes[i], SelectedGroupNum);
     }
 }
Exemplo n.º 18
0
 ///<summary>Toggles permissions based on the node the user has clicked.
 ///Will do nothing if in Read-Only mode or more than one usergroup is selected.</summary>
 private void treePermissions_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (ReadOnly || _listUserGroupNums.Count != 1)
     {
         return;
     }
     _clickedPermNode = treePermissions.GetNodeAt(e.X, e.Y);
     if (_clickedPermNode == null)
     {
         return;
     }
     //Do nothing if the user didn't click on a check box.
     if (_clickedPermNode.Parent == null)           //level 1
     {
         if (e.X < 5 || e.X > 17)
         {
             return;
         }
     }
     else if (_clickedPermNode.Parent.Parent == null)           //level 2
     {
         if (e.X < 24 || e.X > 36)
         {
             return;
         }
     }
     else if (_clickedPermNode.Parent.Parent.Parent == null)           //level 3
     {
         if (e.X < 43 || e.X > 55)
         {
             return;
         }
     }
     //User clicked on a check box.  Do stuff.
     if (_clickedPermNode.ImageIndex == 1)           //unchecked, so need to add a permission
     {
         GroupPermission perm = new GroupPermission();
         perm.PermType     = (Permissions)_clickedPermNode.Tag;
         perm.UserGroupNum = _listUserGroupNums.First();
         if (GroupPermissions.PermTakesDates(perm.PermType))
         {
             perm.IsNew = true;
             //Call an event that bubbles back up to the calling Form. The event returns a dialog result so we know how to continue here.
             DialogResult result = GroupPermissionChecked?.Invoke(sender, new SecurityEventArgs(perm)) ?? DialogResult.Cancel;
             if (result == DialogResult.Cancel)
             {
                 treePermissions.EndUpdate();
                 return;
             }
         }
         else if (perm.PermType == Permissions.Reports)               //Reports permission is being checked.
         //Call an event that bubbles back up to the calling Form. The event returns a dialog result so we know how to continue here.
         {
             DialogResult result = ReportPermissionChecked?.Invoke(sender, new SecurityEventArgs(perm)) ?? DialogResult.Cancel;
             if (result == DialogResult.Cancel)
             {
                 treePermissions.EndUpdate();
                 return;
             }
         }
         else
         {
             try {
                 GroupPermissions.Insert(perm);
                 SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Permission '" + perm.PermType + "' granted to '"
                                           + UserGroups.GetGroup(perm.UserGroupNum).Description + "'");
             }
             catch (Exception ex) {
                 MessageBox.Show(ex.Message);
                 return;
             }
         }
         if (perm.PermType.In(Permissions.ProcComplEdit, Permissions.ProcExistingEdit))
         {
             //Adding ProcComplEdit full, so add ProcComplEditlimited too.
             //Do the same for EO and EC procs
             GroupPermission permLimited = GroupPermissions.GetPerm(_listUserGroupNums.First(), Permissions.ProcComplEditLimited);
             if (permLimited == null)
             {
                 GroupPermissions.RefreshCache();                        //refresh NewerDays/Date to add the same for ProcComplEditLimited
                 perm                     = GroupPermissions.GetPerm(_listUserGroupNums.First(), perm.PermType);
                 permLimited              = new GroupPermission();
                 permLimited.NewerDate    = perm.NewerDate;
                 permLimited.NewerDays    = perm.NewerDays;
                 permLimited.UserGroupNum = perm.UserGroupNum;
                 permLimited.PermType     = Permissions.ProcComplEditLimited;
                 try {
                     GroupPermissions.Insert(permLimited);
                     SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Permission '" + perm.PermType + "' granted to '"
                                               + UserGroups.GetGroup(perm.UserGroupNum).Description + "'");
                 }
                 catch (Exception ex) {
                     MessageBox.Show(ex.Message);
                     return;
                 }
             }
         }
     }
     else if (_clickedPermNode.ImageIndex == 2)           //checked, so need to delete the perm
     {
         try {
             GroupPermissions.RemovePermission(_listUserGroupNums.First(), (Permissions)_clickedPermNode.Tag);
             SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Permission '" + _clickedPermNode.Tag + "' revoked from '"
                                       + UserGroups.GetGroup(_listUserGroupNums.First()).Description + "'");
         }
         catch (Exception ex) {
             MessageBox.Show(ex.Message);
             return;
         }
         if ((Permissions)_clickedPermNode.Tag == Permissions.ProcComplEditLimited)
         {
             //Deselecting ProcComplEditLimted, deselect ProcComplEdit and ProcExistingEdit permissions if present.
             List <Permissions> listPermissions = new List <Permissions>();
             if (GroupPermissions.HasPermission(_listUserGroupNums.First(), Permissions.ProcComplEdit, 0))
             {
                 listPermissions.Add(Permissions.ProcComplEdit);
             }
             if (GroupPermissions.HasPermission(_listUserGroupNums.First(), Permissions.ProcExistingEdit, 0))
             {
                 listPermissions.Add(Permissions.ProcExistingEdit);
             }
             listPermissions.ForEach(x => {
                 try {
                     GroupPermissions.RemovePermission(_listUserGroupNums.First(), x);
                     SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Permission '" + _clickedPermNode.Tag + "' revoked from '"
                                               + UserGroups.GetGroup(_listUserGroupNums.First()).Description + "'");
                 }
                 catch (Exception ex) {
                     MessageBox.Show(ex.Message);
                     return;
                 }
             });
         }
     }
     else if (_clickedPermNode.ImageIndex == 3)           //Partially checked (currently only applies to Reports permission)
     {
         try {
             GroupPermissions.RemovePermission(_listUserGroupNums.First(), (Permissions)_clickedPermNode.Tag);
             SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Permission '" + _clickedPermNode.Tag + "' revoked from '"
                                       + UserGroups.GetGroup(_listUserGroupNums.First()).Description + "'");
         }
         catch (Exception ex) {
             MessageBox.Show(ex.Message);
             return;
         }
     }
     if ((Permissions)_clickedPermNode.Tag == Permissions.AccountProcsQuickAdd)
     {
         string programName = PrefC.GetString(PrefName.SoftwareName);
         MsgBox.Show(this, programName + " needs to be restarted on workstations before the changes will take place.");
     }
     FillTreePerm();
 }