コード例 #1
0
        private void btnnoticeRemove_Click(object sender, EventArgs e)
        {
            if (dgvNotice.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择一行进行操作!");
                return;
            }
            NoticeId = Convert.ToInt16(dgvNotice.SelectedRows[0].Cells[0].Value);
            if (tboxNoticeContent.Text.Trim() == "")
            {
                MessageBox.Show("信息不能为空");
                return;
            }

            if (AdminManage.DelNotice(NoticeId))
            {
                MessageBox.Show("删除成功!");
                tboxNoticeContent.Text = "";
                //加载社团公告
                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;
                    }
                }
            }
            else
            {
                MessageBox.Show("公告删除失败!");
            }
        }
コード例 #2
0
        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;
                }
            }
        }
コード例 #3
0
 private void btnDelUnuseTime_Click(object sender, EventArgs e)
 {
     if (AdminManage.DelUnuseNotice())
     {
         MessageBox.Show("删除成功!");
         tboxNoticeContent.Text = "";
         dgvNotice.DataSource   = AdminManage.GetNoticeList(id);
     }
     else
     {
         MessageBox.Show("公告删除失败!");
     }
 }
コード例 #4
0
 //刷新
 private void btnNew_Click(object sender, EventArgs e)
 {
     //填充数据
     dgvCorData.DataSource = AdminManage.GetCorList();
     //加载社团公告
     dgvNotice.DataSource = AdminManage.GetNoticeList(id);
     //输入框清空
     tboxFind.Text    = "";
     tboxTypeId.Text  = "";
     tboxCorName.Text = "";
     tboxCreTime.Text = "";
     tboxPeo.Text     = "";
     tboxIntro.Text   = "";
 }
コード例 #5
0
        private void btnNoticeAdd_Click(object sender, EventArgs e)
        {
            if (tboxNoticeContent.Text.Trim() == "")
            {
                MessageBox.Show("信息不能为空");
                return;
            }
            //获取日期
            string noticeBeginDate = dtpBeginTime.Value.ToString();
            string noticeEndDate   = dtpTimeEnd.Value.ToString();

            //判断失效日期不能小于当前时间
            if (DateTime.Compare(dtpTimeEnd.Value, DateTime.Now) < 0)
            {
                MessageBox.Show("失效时间不能小于当前日期");
                return;
            }
            //获取内容
            string NoticeContent = tboxNoticeContent.Text;

            Notice n = new Notice(id, NoticeContent, noticeBeginDate, noticeEndDate);

            //添加公告到公告表
            if (AdminManage.AddNotice(n))
            {
                MessageBox.Show("添加成功!");
                tboxNoticeContent.Text = "";
                //加载社团公告
                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;
                    }
                }
            }
            else
            {
                MessageBox.Show("公告添加失败!");
            }
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
                    }
                }
            }
        }