Beispiel #1
0
        private void dgvUGR_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            GroupBusinessLogic      groupBusinessLogic      = new GroupBusinessLogic();
            View_GroupBusinessLogic view_GroupBusinessLogic = new View_GroupBusinessLogic();

            //单击班组名称显示该班组成员
            if (e.ColumnIndex == 3 && e.RowIndex != -1)
            {
                string groupID = this.dgvUGR.Rows[e.RowIndex].Cells[2].Value.ToString();
                this.dgvUserInGroup.DataSource = view_GroupBusinessLogic.GetView_GroupByGroupID(groupID);
                SetdgvUserInGroupColumns();
                txbGroupID.Text = groupID;
            }
            //单击编辑执行的操作
            if (e.ColumnIndex == 0 && e.RowIndex != -1)
            {
                string        groupID       = this.dgvUGR.Rows[e.RowIndex].Cells[2].Value.ToString();
                EditGroupForm editGroupForm = new EditGroupForm(groupID);
                editGroupForm.ShowDialog();
                this.dgvUGR.DataSource = groupBusinessLogic.GetAllGroup();
            }
            //单击删除执行的操作
            if (e.ColumnIndex == 1 && e.RowIndex != -1)
            {
                DialogResult result = MessageBox.Show("确定删除该组?", "提示", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    string groupID = this.dgvUGR.Rows[e.RowIndex].Cells[2].Value.ToString();
                    groupBusinessLogic.DeleteGroupById(groupID);//删除已经做级联
                    MessageBox.Show("删除成功!");
                    LoadGroup();
                }
            }
        }
Beispiel #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string groupID;
            string userID;

            groupID = txbGroupID.Text.Trim();
            userID  = txbUserID.Text.Trim();
            if (groupID == "")
            {
                MessageBox.Show("请选择要添加的组别!");
                return;
            }
            if (userID == "")
            {
                MessageBox.Show("请选择要添加的用户!");
                return;
            }
            Authorize(groupID, userID);
            this.dgvUserInGroup.DataSource = view_GroupBusinessLogic.GetView_GroupByGroupID(groupID);
            SetdgvUserInGroupColumns();
        }