Пример #1
0
 // 刷新
 private void button5_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode != null && treeView1.SelectedNode.Tag?.ToString() != "1")
     {
         dataGridView1.DataSource = UserCommons.GetUsers(treeView1.SelectedNode.Text);
     }
 }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (UserCommons.ChangePassword(txtUser.Text, txtDescription.Text, txtPassWord.Text, _ip))
     {
         MessageBox.Show("更改成功");
         this.Close();
     }
 }
Пример #3
0
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     dataGridView1.DataSource = null;
     if (treeView1.SelectedNode != null && treeView1.SelectedNode.Tag?.ToString() != "1")
     {
         this.Text = "用户管理:" + treeView1.SelectedNode.Text;
         dataGridView1.DataSource = UserCommons.GetUsers(treeView1.SelectedNode.Text);
     }
 }
Пример #4
0
 //删除
 private void button2_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode != null && treeView1.SelectedNode.Tag?.ToString() != "1")
     {
         if (dataGridView1.CurrentRow != null)
         {
             if (UserCommons.DeleteUser(dataGridView1.CurrentRow.Cells["Column1"]?.Value.ToString(), treeView1.SelectedNode.Text))
             {
                 MessageBox.Show("删除成功");
                 dataGridView1.DataSource = UserCommons.GetUsers(treeView1.SelectedNode.Text);
             }
         }
     }
 }
Пример #5
0
 //更改
 private void button3_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode != null && treeView1.SelectedNode.Tag?.ToString() != "1")
     {
         if (dataGridView1.CurrentRow != null)
         {
             new UserChangeForm(new UserModel()
             {
                 Name        = dataGridView1.CurrentRow.Cells["Column1"]?.Value.ToString(),
                 DisplayName = dataGridView1.CurrentRow.Cells["Column2"]?.Value.ToString(),
             }, treeView1.SelectedNode.Text).ShowDialog();
             dataGridView1.DataSource = UserCommons.GetUsers(treeView1.SelectedNode.Text);
         }
     }
 }
Пример #6
0
 //添加
 private void button1_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode != null && treeView1.SelectedNode.Tag?.ToString() != "1")
     {
         new UserForm(m =>
         {
             var re = UserCommons.UpdateGroupUsers(m, "Users", treeView1.SelectedNode.Text);
             MessageBox.Show(re.Message);
             if (re.Status)
             {
                 dataGridView1.DataSource = UserCommons.GetUsers(treeView1.SelectedNode.Text);
             }
         }).ShowDialog();
     }
 }
Пример #7
0
        //添加账户
        private void button3_Click(object sender, EventArgs e)
        {
            new Action(() =>
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    var model = new UserModel()
                    {
                        Name        = row.Cells["Column1"].Value?.ToString(),
                        DisplayName = row.Cells["Column1"].Value?.ToString(),
                    };
                    var re = UserCommons.UpdateGroupUsers(model, "Users", _ip);

                    SetRow(row, re.Message, re.Status);
                }
            }).BeginInvoke(null, null);
        }