private void btnRemove_Click(object sender, EventArgs e) { int id; if (dgvCorUser.SelectedRows.Count <= 0) { MessageBox.Show("请选择一行进行操作!"); return; } id = Convert.ToInt16(dgvCorUser.SelectedRows[0].Cells[0].Value); if (id == ProgramDate.NowLoginId) { MessageBox.Show("不能删除社长"); } else if (CorManage.RemoveUserCor(id)) { MessageBox.Show("删除成功!"); //社团用户成员表刷新 dgvCorUser.DataSource = CorManage.GetCorUser(); } else { MessageBox.Show("删除失败!"); } }
//加入社团成员 private void btnCorAdd_Click(object sender, EventArgs e) { if (!AdminManage.UserXh(tboxUserXh.Text.Trim())) { MessageBox.Show("学号不存在!"); } //#功能添加#还可以加入判断该同学已加入本社团或其他社团。留个坑,有空再来 else if (CorManage.GetCorAdd(tboxUserXh.Text)) { MessageBox.Show("添加成功"); //社团用户成员表刷新 dgvCorUser.DataSource = CorManage.GetCorUser(); tboxUserXh.Text = ""; } else { MessageBox.Show("添加失败"); } }
private void CorAdmin_Load(object sender, EventArgs e) { dgvCorUser.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvNotice.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; id = ProgramDate.CorId; List <Cor> CorList = UserManage.GetCor(ProgramDate.CorId); Cor c = CorList[0]; tboxCorName.Text = c.CorName.ToString(); tboxCorPeo.Text = c.PropriName.ToString(); tboxCorCretime.Text = c.CreTime.ToString(); tboxIntroduce.Text = c.Introduce.ToString(); tboxCorPeo.Enabled = false; tboxCorType.Enabled = false; tboxCorCretime.Enabled = false; //加载社团类别数据 tboxCorType.Text = CorManage.GetCorTypeId(c.TypeId); //社团用户列表加载 dgvCorUser.DataSource = CorManage.GetCorUser(); //加载社团公告 DataTable dt = AdminManage.GetNoticeList(ProgramDate.CorId); dgvNotice.DataSource = dt; //失效设置红色 for (int i = 0; i < dt.Rows.Count; i++) { if (DateTime.Compare(Convert.ToDateTime(dt.Rows[i][3]), DateTime.Now) < 0) { dgvNotice.Rows[i].DefaultCellStyle.BackColor = Color.Red; } } //禁用社团id显示 tboxNoticeCorId.Enabled = false; //加载社团图片 byte[] img = AdminManage.GetCorImg(id); pboxLOGO.Image = Image.FromStream(new MemoryStream(img)); pboxLOGO.SizeMode = PictureBoxSizeMode.Zoom; }