コード例 #1
0
ファイル: UserInfo.cs プロジェクト: wyntung/HLZDGL
        //用户属性
        private void ToolStripMenuItem6_Click(object sender, EventArgs e)
        {
            treeView1.PathSeparator = "/";
            string path = treeView1.SelectedNode.FullPath.ToString();
            int count = 0;
            for (int i = 0; i < path.Length; i++)
            {
                if (path[i].CompareTo('/') == 0)
                    count++;
            }

            if (listView1.SelectedItems.Count != 0)
            {
                AddUserGroup addUserGroup = new AddUserGroup(sqlConnection);
                AddUser addUser = new AddUser(sqlConnection);
                string userGrpName = "";
                switch (count)
                {
                    case 1:	//第二级节点:用户属性
                        userGrpName = treeView1.SelectedNode.Text;
                        addUser.UserGrpName = treeView1.SelectedNode.Text;
                        addUser.BarCode = listView1.SelectedItems[0].SubItems[1].Text;
                        addUser.Text = "用户属性";
                        addUser.m_OperateFlag = 2;
                        if (addUser.ShowDialog(this) == DialogResult.OK)
                        {
                            dataSet.Tables["UserGrpDetailsView"].Clear();
                            dataSet.Tables["UserInfoDetailsView"].Clear();
                            treeView1.Nodes.Clear();

                            technologyLib.GetUserGrpDetailsViewData(dataSet);
                            technologyLib.GetUserInfoDetailsViewData(dataSet);

                            InitialTreeView(treeView1);
                            listView1.Clear();
                            InsertAllColumns(1);
                            AddItem_UserInfo(userGrpName);
                        }
                        break;
                    case 2: //第三级节点:单个用户属性
                        userGrpName = treeView1.SelectedNode.Parent.Text;
                        addUser.UserGrpName = treeView1.SelectedNode.Parent.Text;
                        addUser.BarCode = listView1.SelectedItems[0].SubItems[1].Text;
                        addUser.Text = "用户属性";
                        addUser.m_OperateFlag = 2;
                        if (addUser.ShowDialog(this) == DialogResult.OK)
                        {
                            dataSet.Tables["UserGrpDetailsView"].Clear();
                            dataSet.Tables["UserInfoDetailsView"].Clear();
                            treeView1.Nodes.Clear();

                            technologyLib.GetUserGrpDetailsViewData(dataSet);
                            technologyLib.GetUserInfoDetailsViewData(dataSet);

                            InitialTreeView(treeView1);
                            listView1.Clear();
                            InsertAllColumns(2);
                            AddItem_UserInfo(userGrpName);
                        }
                        break;
                }
            }
            else
            {
                MessageBox.Show("请选择相应的用户!");
            }
        }
コード例 #2
0
ファイル: UserInfo.cs プロジェクト: wyntung/HLZDGL
        //添加用户
        private void ToolStripMenuItem4_Click(object sender, EventArgs e)
        {
            treeView1.PathSeparator = "/";
            string path = treeView1.SelectedNode.FullPath.ToString();
            int count = 0;
            for (int i = 0; i < path.Length; i++)
            {
                if (path[i].CompareTo('/') == 0)
                    count++;
            }

            AddUserGroup addUserGroup = new AddUserGroup(sqlConnection);
            AddUser addUser = new AddUser(sqlConnection);
            string userGrpName = "";
            switch (count)
            {
                case 1:	//第二级节点:添加用户
                    addUser.UserGrpName = treeView1.SelectedNode.Text;
                    userGrpName = treeView1.SelectedNode.Text;
                    addUser.Text = "添加用户";
                    addUser.m_OperateFlag = 1;
                    if (addUser.ShowDialog(this) == DialogResult.OK)
                    {
                        dataSet.Tables["UserGrpDetailsView"].Clear();
                        dataSet.Tables["UserInfoDetailsView"].Clear();
                        treeView1.Nodes.Clear();

                        technologyLib.GetUserGrpDetailsViewData(dataSet);
                        technologyLib.GetUserInfoDetailsViewData(dataSet);

                        InitialTreeView(treeView1);
                        listView1.Clear();
                        InsertAllColumns(1);
                        AddItem_UserInfo(userGrpName);
                    }
                    break;
            }
        }