Exemplo n.º 1
0
        private void butSetAll_Click(object sender, EventArgs e)
        {
            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)
                {
                    continue;
                }
                perm = GroupPermissions.GetPerm(SelectedGroupNum, (Permissions)i);
                if (perm == null)
                {
                    perm              = new GroupPermission();
                    perm.PermType     = (Permissions)i;
                    perm.UserGroupNum = SelectedGroupNum;
                    try{
                        GroupPermissions.InsertOrUpdate(perm, true);
                    }
                    catch (Exception ex) {
                        MessageBox.Show(ex.Message);
                    }
                    changed = true;
                }
            }
            FillTreePerm();
        }
Exemplo n.º 2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            Userod selectedUser = (Userod)listUser.SelectedItem;

            if (selectedUser.Password != "")
            {
                if (!Userods.CheckPassword(textPassword.Text, selectedUser.Password))
                {
                    MsgBox.Show(this, "Incorrect password");
                    return;
                }
                //if (selectedUser.UserGroupNum == 1) this works to elevate privs to admin
                if (GroupPermissions.HasPermission(selectedUser.UserGroupNum, Permissions.AnesthesiaControlMeds))
                {
                    DialogResult     = DialogResult.OK;
                    Security.CurUser = (Userod)listUser.SelectedItem;
                    return;
                }
                else
                {
                    MessageBox.Show(this, "You must be an administrator to unlock this action");
                }
                return;
            }
        }
Exemplo n.º 3
0
        private void butSetAll_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "Please select user first.");
                return;
            }
            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(SelectedGroupNum, (Permissions)i);
                if (perm == null)
                {
                    perm              = new GroupPermission();
                    perm.PermType     = (Permissions)i;
                    perm.UserGroupNum = SelectedGroupNum;
                    try{
                        GroupPermissions.Insert(perm);
                    }
                    catch (Exception ex) {
                        MessageBox.Show(ex.Message);
                    }
                    changed = true;
                }
            }
            FillTreePerm();
        }
Exemplo n.º 4
0
 ///<summary>Checks to see if current user is authorized.  It also checks any date restrictions.  If not authorized, it gives a Message box saying so and returns false.</summary>
 public static bool IsAuthorized(Permissions perm, DateTime date, bool suppressMessage)
 {
     if (Security.CurUser != null && GroupPermissions.HasPermission(Security.CurUser.UserGroupNum, perm))
     {
         if (GroupPermissions.PermTakesDates(perm))
         {
             DateTime dateLimit = GetDateLimit(perm, Security.CurUser.UserGroupNum);
             if (date <= dateLimit)                  //not authorized
             {
                 if (!suppressMessage)
                 {
                     MessageBox.Show(Lan.g("Security", "Not authorized for") + "\r\n"
                                     + GroupPermissions.GetDesc(perm) + "\r\n"
                                     + Lan.g("Security", "Date limitation"));
                 }
                 return(false);
             }
             return(true);
         }
         //doesn't take a date
         return(true);
     }
     if (!suppressMessage)
     {
         MessageBox.Show(Lan.g("Security", "Not authorized for") + "\r\n"
                         + GroupPermissions.GetDesc(perm));
     }
     return(false);
 }
Exemplo n.º 5
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != "" || textDays.errorProvider1.GetError(textDays) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            int newerDays = PIn.Int(textDays.Text);

            if (newerDays > GroupPermissions.NewerDaysMax)
            {
                MsgBox.Show(this, $"Days must be less than {GroupPermissions.NewerDaysMax.ToString()}.");
                return;
            }
            Cur.NewerDays = newerDays;
            Cur.NewerDate = PIn.Date(textDate.Text);
            try{
                if (Cur.IsNew)
                {
                    GroupPermissions.Insert(Cur);
                }
                else
                {
                    GroupPermissions.Update(Cur);
                }
                SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, $"Permission '{Cur.PermType}' granted to " +
                                          $"'{UserGroups.GetGroup(Cur.UserGroupNum).Description}'");
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 6
0
        private void treePermissions_DoubleClick(object sender, System.EventArgs e)
        {
            if (clickedPermNode == null)
            {
                return;
            }
            Permissions permType = (Permissions)clickedPermNode.Tag;

            if (!GroupPermissions.PermTakesDates(permType))
            {
                return;
            }
            GroupPermission perm = GroupPermissions.GetPerm(SelectedGroupNum, (Permissions)clickedPermNode.Tag);

            if (perm == null)
            {
                return;
            }
            FormGroupPermEdit FormG = new FormGroupPermEdit(perm);

            FormG.ShowDialog();
            if (FormG.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            FillTreePerm();
            changed = true;
        }
Exemplo n.º 7
0
 private void FillListBox()
 {
     Userods.RefreshCache();
     UserGroups.RefreshCache();
     GroupPermissions.RefreshCache();
     listUser.BeginUpdate();
     listUser.Items.Clear();
     if (PrefC.GetBool(PrefName.UserNameManualEntry))
     {
         //Because _listUsers is used to verify the user name typed in, we need to include both non-hidden and CEMT users for offices that type in their credentials instead of picking.
         _listUsers = Userods.GetUsers(true);
     }
     else if (checkShowCEMTUsers.Checked)             //Only show list of CEMT users.
     {
         _listUsers = Userods.GetUsersForCEMT().Where(x => !x.IsHidden).ToList();
     }
     else              //This will be the most common way to fill the user list.  Only includes non-hidden, non-CEMT users.
     {
         _listUsers = Userods.GetUsers();
     }
     _listUsers.ForEach(x => listUser.Items.Add(x));
     if (UserNumPrompt > 0)
     {
         listUser.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == UserNumPrompt);            //can be -1 if not found
     }
     else if (Security.CurUser != null)
     {
         listUser.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == Security.CurUser.UserNum); //can be -1 if not found
     }
     if (listUser.SelectedIndex == -1 && listUser.Items.Count > 0)                                  //It is possible there are no users in the list if all users are CEMT users.
     {
         listUser.SelectedIndex = 0;
     }
     listUser.EndUpdate();
 }
Exemplo n.º 8
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != ""
                )
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            int newerDays = PIn.Int(textDays.Text);

            if (newerDays > 3000)
            {
                MsgBox.Show(this, "Days must be less than 3000.");
                return;
            }
            Cur.NewerDays = newerDays;
            Cur.NewerDate = PIn.Date(textDate.Text);
            try{
                if (Cur.IsNew)
                {
                    GroupPermissions.Insert(Cur);
                }
                else
                {
                    GroupPermissions.Update(Cur);
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DialogResult = DialogResult.OK;
        }
        private void listUserTabUserGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_isFillingList || SelectedUser == null)
            {
                return;
            }
            if (listUserTabUserGroups.SelectedItems.OfType <ODBoxItem <UserGroup> >().Select(x => x.Tag.UserGroupNum).Count() == 0)
            {
                MsgBox.Show(this, "A user must have at least one User Group attached.");
                RefreshUserTabGroups();                 //set the groups back to what they were before.
                return;
            }
            List <long> listSelectedUserUserGroupsOld = SelectedUser.GetGroups(IsForCEMT).Select(x => x.UserGroupNum).ToList();
            List <long> listSelectedUserUserGroups    = listUserTabUserGroups.SelectedTags <UserGroup>().Select(x => x.UserGroupNum).ToList();

            if (           //Current selected groups do not contain SecurityAdmin permission
                GroupPermissions.GetForUserGroups(listSelectedUserUserGroups, Permissions.SecurityAdmin).Count == 0
                //Selected user had SecurityAdmin permission before new selections
                && GroupPermissions.GetForUserGroups(listSelectedUserUserGroupsOld, Permissions.SecurityAdmin).Count > 0)
            {
                //The SelectedUser is no longer part of SecurityAdmin group. Check that at least one other user is part of a SecurityAdmin Group.
                if (!Userods.IsSomeoneElseSecurityAdmin(SelectedUser))
                {
                    MsgBox.Show(this, Lan.g(this, "At least one user must have Security Admin permission."));
                    RefreshUserTabGroups();                     //set the groups back to what they were before.
                    return;
                }
            }
            if (UserGroupAttaches.SyncForUser(SelectedUser, listSelectedUserUserGroups) != 0)
            {
                UserGroupAttaches.RefreshCache();                //only refreshes local cache.
            }
            RefreshUserTree();
        }
Exemplo n.º 10
0
        ///<summary>Allows users to edit the date locks on specific permissions.
        ///Does nothing if in ReadOnly mode or if more than one UserGroup is selected.</summary>
        private void treePermissions_DoubleClick(object sender, System.EventArgs e)
        {
            if (ReadOnly || _listUserGroupNums.Count != 1)
            {
                return;
            }
            if (_clickedPermNode == null)
            {
                return;
            }
            Permissions permType = (Permissions)_clickedPermNode.Tag;

            if (!GroupPermissions.PermTakesDates(permType))
            {
                return;
            }
            GroupPermission perm = GroupPermissions.GetPerm(_listUserGroupNums.First(), (Permissions)_clickedPermNode.Tag);

            if (perm == null)
            {
                return;
            }
            //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)
            {
                return;
            }
            FillTreePerm();
        }
Exemplo n.º 11
0
 ///<summary>A recursive function that sets the checkbox for a node.  Also sets the text for the node.</summary>
 private void FillNodes(TreeNode node, int userGroupNum)
 {
     //first, any child nodes
     for (int i = 0; i < node.Nodes.Count; i++)
     {
         FillNodes(node.Nodes[i], userGroupNum);
     }
     //then this node
     if (node.ImageIndex == 0)
     {
         return;
     }
     node.ImageIndex = 1;
     node.Text       = GroupPermissions.GetDesc((Permissions)node.Tag);
     for (int i = 0; i < GroupPermissions.List.Length; i++)
     {
         if (GroupPermissions.List[i].UserGroupNum == userGroupNum &&
             GroupPermissions.List[i].PermType == (Permissions)node.Tag)
         {
             node.ImageIndex = 2;
             if (GroupPermissions.List[i].NewerDate.Year > 1880)
             {
                 node.Text += " (" + Lan.g(this, "if date newer than") + " " + GroupPermissions.List[i].NewerDate.ToShortDateString() + ")";
             }
             else if (GroupPermissions.List[i].NewerDays > 0)
             {
                 node.Text += " (" + Lan.g(this, "if days newer than") + " " + GroupPermissions.List[i].NewerDays.ToString() + ")";
             }
         }
     }
 }
 private void butOK_Click(object sender, EventArgs e)
 {
     if (GroupPermissions.Sync(_listGroupPermissions, _listGroupPermissionsOld))
     {
         DataValid.SetInvalid(InvalidType.Security);
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 13
0
 private void FillTreePerm()
 {
     GroupPermissions.Refresh();
     labelPerm.Text = Lan.g(this, "Permissions for group:") + "  " + UserGroups.GetGroup(SelectedGroupNum).Description;
     for (int i = 0; i < treePermissions.Nodes.Count; i++)
     {
         FillNodes(treePermissions.Nodes[i], SelectedGroupNum);
     }
 }
Exemplo n.º 14
0
 private void FillList()
 {
     UserGroups.RefreshCache();
     listGroups.Items.Clear();
     _listUserGroups = UserGroups.GetWhere(x => IsAdminMode || !GroupPermissions.HasPermission(x.UserGroupNum, Permissions.SecurityAdmin, 0));
     for (int i = 0; i < _listUserGroups.Count; i++)
     {
         listGroups.Items.Add(_listUserGroups[i].Description);
     }
 }
Exemplo n.º 15
0
        ///<summary>This just keeps FillTreePermissionsInitial looking cleaner.</summary>
        private TreeNode SetNode(Permissions perm)
        {
            TreeNode retVal = new TreeNode();

            retVal.Text               = GroupPermissions.GetDesc(perm);
            retVal.Tag                = perm;
            retVal.ImageIndex         = 1;
            retVal.SelectedImageIndex = 1;
            return(retVal);
        }
Exemplo n.º 16
0
        ///<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 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.º 18
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.º 19
0
 ///<summary>Fills the tree's checkboxes depending on whether or not the usergroups in _listUserGroupNums have the specific permission.</summaryZ>
 public void FillTreePerm()
 {
     GroupPermissions.RefreshCache();
     if (_listUserGroupNums.Count == 0)
     {
         treePermissions.Enabled = false;
     }
     else
     {
         treePermissions.Enabled = true;
     }
     treePermissions.BeginUpdate();
     for (int i = 0; i < treePermissions.Nodes.Count; i++)
     {
         FillNodes(treePermissions.Nodes[i], _listUserGroupNums);
     }
     treePermissions.EndUpdate();
 }
        private void butAdjustQtys_Click(object sender, EventArgs e)
        {
            Userod curUser = Security.CurUser;

            if (GroupPermissions.HasPermission(curUser.UserGroupNum, Permissions.AnesthesiaControlMeds))
            {
                FormAnesthMedsEdit  FormA = new FormAnesthMedsEdit();
                AnesthMedsInventory med   = new AnesthMedsInventory();
                med.IsNew = true;
                FormA.ShowDialog();
                return;
            }
            else
            {
                MessageBox.Show(Lan.g(this, "You must be an administrator to unlock this action"));
                return;
            }
        }
Exemplo n.º 21
0
 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;
 }
Exemplo n.º 22
0
 ///<summary></summary>
 public FormAudit()
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     Lan.F(this);
     Permissions[] permArray = (Permissions[])Enum.GetValues(typeof(Permissions));
     permissionsAlphabetic = new List <string>();
     for (int i = 1; i < permArray.Length; i++)
     {
         if (GroupPermissions.HasAuditTrail(permArray[i]))
         {
             permissionsAlphabetic.Add(permArray[i].ToString());
         }
     }
     permissionsAlphabetic.Sort();
     permissionsAlphabetic.Insert(0, Permissions.None.ToString());
 }
Exemplo n.º 23
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;
                }
            }
        }
Exemplo n.º 24
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     Cur.NewerDays = PIn.PInt(textDays.Text);
     Cur.NewerDate = PIn.PDate(textDate.Text);
     try{
         GroupPermissions.InsertOrUpdate(Cur, IsNew);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 25
0
		private DialogResult userControlSecurityTabs_ReportPermissionChecked(object sender,SecurityEventArgs e) {
			GroupPermission perm = e.Perm;
			FormReportSetup FormRS = new FormReportSetup(perm.UserGroupNum,true);
			FormRS.ShowDialog();
			if(FormRS.DialogResult==DialogResult.Cancel) {
				return FormRS.DialogResult;
			}
			if(!FormRS.HasReportPerms) {//Only insert base Reports permission if the user actually has any reports allowed
				return FormRS.DialogResult;
			}
			try {
				GroupPermissions.Insert(perm);
			}
			catch(Exception ex) {
				MessageBox.Show(ex.Message);
				return DialogResult.Cancel;
			}
			return FormRS.DialogResult;
		}
Exemplo n.º 26
0
 private void FormGroupPermEdit_Load(object sender, System.EventArgs e)
 {
     textName.Text = GroupPermissions.GetDesc(Cur.PermType);
     if (Cur.NewerDate.Year < 1880)
     {
         textDate.Text = "";
     }
     else
     {
         textDate.Text = Cur.NewerDate.ToShortDateString();
     }
     if (Cur.NewerDays == 0)
     {
         textDays.Text = "";
     }
     else
     {
         textDays.Text = Cur.NewerDays.ToString();
     }
 }
Exemplo n.º 27
0
 private void FormMultiAdj_Load(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.AdjustmentCreate, true) && !Security.IsAuthorized(Permissions.AdjustmentEditZero, true))
     {
         MessageBox.Show(Lans.g("Security", "Not authorized for") + "\r\n" + GroupPermissions.GetDesc(Permissions.AdjustmentCreate));
         DialogResult = DialogResult.Cancel;
         return;
     }
     dateAdjustment.Text  = DateTime.Today.ToShortDateString();
     _rigorousAdjustments = PrefC.GetInt(PrefName.RigorousAdjustments);
     FillListBoxAdjTypes();
     FillComboProv();
     FillComboClinics();
     //Must happen after comboboxes are filled
     if (_rigorousAdjustments == 0)
     {
         comboProv.Enabled     = false;
         comboClinic.Enabled   = false;
         butPickProv.Enabled   = false;
         butPickClinic.Enabled = false;
     }
     if (_rigorousAdjustments == (int)RigorousAdjustments.DontEnforce)
     {
         radioIncludeAll.Checked = true;
         creditFilterRefresh();
     }
     else
     {
         radioAllocatedOnly.Checked = true;
         creditFilterRefresh();
     }
     FillGrid();
     if (_isSelectionMode)
     {
         foreach (Procedure selectedProc in _listSelectedProcs)
         {
             gridMain.SetSelected(_listGridEntries.FindIndex(x => x.Proc.ProcNum == selectedProc.ProcNum), true);
         }
     }
     textAmt.Select();            //start cursor here
 }
        private void gridAnesthMedsInventory_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Userod curUser = Security.CurUser;

            if (GroupPermissions.HasPermission(curUser.UserGroupNum, Permissions.AnesthesiaControlMeds))
            {
                FormAnesthMedsEdit FormME = new FormAnesthMedsEdit();
                FormME.Med = listAnestheticMeds[e.Row];
                FormME.ShowDialog();
                if (FormME.DialogResult == DialogResult.OK)
                {
                    FillGrid();
                }
                return;
            }
            else
            {
                MessageBox.Show(Lan.g(this, "You must be an administrator with rights to control anesthetic medication inventory levels to unlock this action"));
                return;
            }
        }
Exemplo n.º 29
0
 ///<summary></summary>
 public static void InsertOrUpdate(GroupPermission gp, bool isNew)
 {
     if (gp.NewerDate.Year > 1880 && gp.NewerDays > 0)
     {
         throw new Exception(Lan.g("GroupPermissions", "Date or days can be set, but not both."));
     }
     if (!GroupPermissions.PermTakesDates(gp.PermType))
     {
         if (gp.NewerDate.Year > 1880 || gp.NewerDays > 0)
         {
             throw new Exception(Lan.g("GroupPermissions", "This type of permission may not have a date or days set."));
         }
     }
     if (isNew)
     {
         Insert(gp);
     }
     else
     {
         Update(gp);
     }
 }
Exemplo n.º 30
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();
 }