Example #1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            TreeNode node = tvList.SelectedNode;

            if (node != null)
            {
                IUserInfo    ui   = (IUserInfo)DataHost;
                Пользователь user = ui.FindByFullName(node.Text);
                if (user != null)
                {
                    using (frmUserInfo form = new frmUserInfo(UserLevel.Диспетчер, user))
                    {
                        if (form.ShowDialog(this) == DialogResult.OK)
                        {
                            ui.ChangeUser(user, form.UserInfo);
                            fillTree();
                            findTree(form.UserInfo.ПолноеИмя());
                        }
                    }
                }
            }
        }
Example #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            UserLevel style = UserLevel.Диспетчер;
            TreeNode  node  = tvList.SelectedNode;

            if (node != null)
            {
                while (node.Level > 0)
                {
                    node = node.Parent;
                }
                style = (UserLevel)node.Tag;
            }
            using (frmUserInfo form = new frmUserInfo(style, null))
            {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    IUserInfo ui = (IUserInfo)DataHost;
                    ui.AddNewUser(form.UserInfo);
                    fillTree();
                    findTree(form.UserInfo.ПолноеИмя());
                }
            }
        }