Exemplo n.º 1
0
        private void FillTreeUsers()
        {
            UserGroups.Refresh();
            Userods.Refresh();
            treeUsers.Nodes.Clear();
            List <Userod> usersForGroup;
            TreeNode      groupNode;
            TreeNode      userNode;

            for (int i = 0; i < UserGroups.List.Length; i++)
            {
                groupNode     = new TreeNode(UserGroups.List[i].Description);
                groupNode.Tag = UserGroups.List[i].UserGroupNum;
                usersForGroup = Userods.GetForGroup(UserGroups.List[i].UserGroupNum);
                for (int j = 0; j < usersForGroup.Count; j++)
                {
                    userNode     = new TreeNode(usersForGroup[j].UserName);
                    userNode.Tag = usersForGroup[j].UserNum;
                    groupNode.Nodes.Add(userNode);
                }
                treeUsers.Nodes.Add(groupNode);
            }
            treeUsers.ExpandAll();
            treeUsers.SelectedNode = treeUsers.Nodes[0];
            SelectedGroupNum       = UserGroups.List[0].UserGroupNum;
        }
Exemplo n.º 2
0
        private void FillUsers()
        {
            UserGroups.Refresh();
            Userods.Refresh();
            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"), 90);
            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";
            }
            int classNum = 0;

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

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row      = new ODGridRow();
                userdesc = table.Rows[i]["UserName"].ToString();
                if (table.Rows[i]["IsHidden"].ToString() == "1")
                {
                    userdesc += Lan.g(this, "(hidden)");
                }
                row.Cells.Add(userdesc);
                row.Cells.Add(UserGroups.GetGroup(PIn.PInt(table.Rows[i]["UserGroupNum"].ToString())).Description);
                row.Cells.Add(Employees.GetNameFL(PIn.PInt(table.Rows[i]["EmployeeNum"].ToString())));
                row.Cells.Add(Providers.GetNameLF(PIn.PInt(table.Rows[i]["ProvNum"].ToString())));
                row.Cells.Add(Clinics.GetDesc(PIn.PInt(table.Rows[i]["ClinicNum"].ToString())));
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }