Ejemplo n.º 1
0
        public frmRoleList(User u, Events e)
            : this()
        {
            this.user = u;
            this.event_ = e;
            this.checkBoxes = new Dictionary<string, List<CheckBox>>();
            accbUsers.AutoCompleteManager.DataProvider = new UserDataProvider();
            accbUsers.AutoCompleteManager.AutoAppend = true;

            RoleHelper client = new RoleHelper();
            try
            {

                List<Function> functions = client.ViewFunction().ToList();

                TreeViewItem root = new TreeViewItem() { Header = "All Rights", IsExpanded = true };
                tvFunctions.Items.Add(root);
                string currGroup = "";
                TreeViewItem parent = null;
                foreach (Function function in functions)
                {
                    if (function.Grouping != currGroup)
                    {
                        currGroup = function.Grouping;
                        parent = new TreeViewItem() { Header = function.Grouping, IsExpanded = true };
                        root.Items.Add(parent);
                    }
                    parent.Items.Add(new TreeViewItem() { Header = function.Description, Tag = function.FunctionEnum });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                client.Close();
            }
        }