示例#1
0
        /// <summary>
        /// 加载数据
        /// </summary>
        private void LoadData()
        {
            DataSet ds = GongGaoInfoService.GetList("");

            if (ds.Tables[0].Rows.Count > 0)
            {
                this.repInfo.DataSource = ds;
                repInfo.DataBind();
            }
        }
示例#2
0
        /// <summary>
        /// Delete公告
        /// </summary>
        private void DelGongGao()
        {
            int id  = CRequest.GetInt("id", 0);
            int num = GongGaoInfoService.Delete(id);

            if (num > 0)
            {
                Response.Redirect("/admin/gonggao.aspx");
            }
        }
示例#3
0
        /// <summary>
        /// 添加公告
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string title   = this.txtTitle.Text.Trim();
            string content = this.txtContent.Text.Trim();
            string url     = txtURL.Text.Trim();

            if (title.Length == 0 || content.Length == 0 || url.Length == 0)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('各项不能为空!');", true);
                return;
            }
            GongGaoInfo item = new GongGaoInfo();

            item.title          = title;
            item.gongGaoContent = content;
            item.status         = 0;
            item.addTime        = DateTime.Now;

            if (Session["loginUser"] == null)
            {
                Response.Redirect("/admin/login.aspx");
                return;
            }
            AdminUser admin = Session["loginUser"] as AdminUser;

            item.addUser  = admin.id;
            item.infoType = 0;
            item.linkurl  = url;
            int num = GongGaoInfoService.Add(item);

            if (num > 0)
            {
                //ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加成功!');location.href='link.aspx';", true);
            }
            else
            {
                // ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加失败!');location.href='link.aspx';", true);
            }
            LoadData();
        }