void UpdatePass() { TreeNode node = treeView1.SelectedNode; if (node != null) { if (node.FullPath.IndexOf("用户\\") == 0) { Core.InputBox inputbox = new Core.InputBox("设置密码", "请输入用户[" + (node.Tag as UserAndRight.User).Name + "]的新密码,不能超过20个或少于6字符.", 20, ""); inputbox.ShowDialog(this); string s = inputbox.Result as string; inputbox = null; if (s != null) { if (s.Length >= 6) { if (!_e.UpdateUser(node.Tag as UserAndRight.User, "pwd", s)) { MessageBox.Show("修改密码失败, 请继续使用原密码.", "检查并修改密码", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } } else { MessageBox.Show("密码长度不够, 修改密码失败. 请继续使用原密码.", "检查并修改密码", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } } } } }
void CreateUser() { string name = ""; Core.InputBox inputbox = new Core.InputBox("新建用户", "请录入新用户的名称, 不能为空或重复.", 40, name); inputbox.ShowDialog(this); if (inputbox.Result != null) { name = inputbox.Result as string; if (name.Length > 0) { UserAndRight.User u = _e.CreateUser(name); if (u != null) { _right.ToRightRuler(u.Ruler); TreeNode node = treeView1.Nodes[KEY_TOP_USER]; TreeNode newNode = node.Nodes.Add(u.Name); newNode.Tag = u; newNode.ImageKey = "itemOfBank"; newNode.SelectedImageKey = newNode.ImageKey; } } } inputbox = null; }