private void dgvCorData_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvCorData.SelectedRows.Count <= 0) { MessageBox.Show("请选择一行进行操作!"); return; } id = Convert.ToInt16(dgvCorData.SelectedRows[0].Cells[0].Value); //读取数据 tboxTypeId.Text = dgvCorData.SelectedRows[0].Cells[1].Value.ToString().Trim(); tboxCorName.Text = dgvCorData.SelectedRows[0].Cells[2].Value.ToString().Trim(); tboxCreTime.Text = dgvCorData.SelectedRows[0].Cells[3].Value.ToString().Trim(); tboxPeo.Text = dgvCorData.SelectedRows[0].Cells[4].Value.ToString().Trim(); tboxIntro.Text = dgvCorData.SelectedRows[0].Cells[5].Value.ToString().Trim(); //加载社团图片 byte[] img = AdminManage.GetCorImg(id); pictureBox1.Image = Image.FromStream(new MemoryStream(img)); pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; //加载社团公告 DataTable dt = AdminManage.GetNoticeList(id); 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; } } }
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; }
private void UserInterface_Load(object sender, EventArgs e) { dgvNoticeList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //当前登录用户的id int id = ProgramDate.NowLoginId; //MessageBox.Show(id.ToString()); //用户信息获取 List <User> UserList = UserManage.GetUser(id); User u = UserList[0]; UserlblNameCon.Text = u.Name.ToString(); UserlblXhcon.Text = u.StuId.ToString(); UserlblTelCon.Text = u.Tel.ToString(); UserlblGenderCon.Text = u.Gender.ToString(); pboxHeadImg.Image = Image.FromStream(new MemoryStream(u.HeadImg)); pboxHeadImg.SizeMode = PictureBoxSizeMode.Zoom; //设置学号,性别不可用 UserlblXhcon.Enabled = false; UserlblGenderCon.Enabled = false; //用户社团信息获取 if (ProgramDate.CorId == -1) //当前用户没有加入社团 { pboxLOGO.Hide(); //lblCorName.Hide(); lblCorNameCon.Hide(); lblCorPeo.Hide(); lblCorPeoCon.Hide(); lblType.Hide(); lblTypeCon.Hide(); lblCretime.Hide(); lblCretimeCon.Hide(); lblIntroduce.Hide(); lblIntroduceCon.Hide(); lblNotice.Hide(); dgvNoticeList.Hide(); lblNoticeContent.Hide(); tboxNotice.Hide(); lblCorName.Text = "你没有加入社团哦!"; } else { //加载社团图片 byte[] img = AdminManage.GetCorImg(ProgramDate.CorId); pboxLOGO.Image = Image.FromStream(new MemoryStream(img)); pboxLOGO.SizeMode = PictureBoxSizeMode.Zoom; //文字信息加载 List <Cor> CorList = UserManage.GetCor(ProgramDate.CorId); Cor c = CorList[0]; lblCorNameCon.Text = c.CorName.ToString(); lblCorPeoCon.Text = c.PropriName.ToString(); lblCretimeCon.Text = c.CreTime.ToString(); lblIntroduceCon.Text = c.Introduce.ToString(); //加载社团类别数据 lblTypeCon.Text = CorManage.GetCorTypeId(c.TypeId); //加载社团公告 DataTable dt = AdminManage.GetNoticeList(ProgramDate.CorId); dgvNoticeList.DataSource = dt; //失效设置红色 for (int i = 0; i < dt.Rows.Count; i++) { if (DateTime.Compare(Convert.ToDateTime(dt.Rows[i][3]), DateTime.Now) < 0) { dgvNoticeList.Rows[i].DefaultCellStyle.BackColor = Color.Red; } } } }