Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int ID = int.Parse(this.hdfid.Value);
            string CMS_Title = this.txtCMS_Title.Text;
            int CMS_Type = int.Parse(this.ddlNewType.SelectedValue);
            string CMS_Author = this.txtCMS_Author.Text;
            string CMS_Content = this.txtContent.Value;
            string CMS_Form = this.txtCMS_Form.Text;
            string CMS_Keyword = this.txtCMS_Keyword.Text;
            string CMS_Puter = this.txtCMS_Puter.Text;
            DateTime CMS_Time = DateTime.Parse(this.txtCMS_Time.Text);
            int CMS_Click = int.Parse(this.txtCMS_Click.Text);

            CMS.Model.CMS_News model = new CMS.Model.CMS_News();
            model.ID = ID;
            model.CMS_Title = CMS_Title;
            model.CMS_Type = CMS_Type;
            model.CMS_Author = CMS_Author;
            model.CMS_Content = CMS_Content;
            model.CMS_Form = CMS_Form;
            model.CMS_Keyword = CMS_Keyword;
            model.CMS_Puter = CMS_Puter;
            model.CMS_Time = CMS_Time;
            model.CMS_Click = CMS_Click;

            CMS.DAL.CMS_News bll = new CMS.DAL.CMS_News();
            bll.Update(model);

            JscriptPrint("资讯信息修改成功!", "NewsList.aspx", "Success");
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int CMS_Click = int.Parse(this.txtCMS_Click.Text);
            string CMS_Title = this.txtCMS_Title.Text;
            int CMS_Type = int.Parse(this.ddlNewType.SelectedValue);
            string CMS_Author = this.txtCMS_Author.Text;
            string CMS_Content = this.txtContent.Value;
            string CMS_Form = this.txtCMS_Form.Text;
            string CMS_Keyword = this.txtCMS_Keyword.Text;
            string CMS_Puter = this.txtCMS_Puter.Text;
            DateTime CMS_Time = DateTime.Parse(this.txtCMS_Time.Text);

            CMS.Model.CMS_News model = new CMS.Model.CMS_News();
            model.CMS_Click = CMS_Click;
            model.CMS_Title = CMS_Title;
            model.CMS_Type = CMS_Type;
            model.CMS_Author = CMS_Author;
            model.CMS_Content = CMS_Content;
            model.CMS_Form = CMS_Form;
            model.CMS_Keyword = CMS_Keyword;
            model.CMS_Puter = CMS_Puter;
            model.CMS_Time = CMS_Time;

            CMS.DAL.CMS_News dal = new CMS.DAL.CMS_News();
            dal.Add(model);

            string js = "window.location.href('NewsList.aspx');";
            this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script>alert('修改成功!');" + js + "</script>");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="PageIndex">页码</param>
        private void ListDataBind(int PageIndex)
        {
            int num = 15, i = 0, j = 0;

            CMS.DAL.CMS_News dal = new CMS.DAL.CMS_News();

            DataTable dt = dal.GetAll(null, null, PageIndex, num, out i, out j);
            this.PageNavigator1.PageCount = j;
            this.PageNavigator1.PageIndex = PageIndex;
            this.PageNavigator1.RecordCount = i;
            gvdataList.DataSource = dt;
            gvdataList.DataBind();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                int id = Int32.Parse(Request.QueryString["id"]);

                CMS.Model.CMS_News model = new CMS.Model.CMS_News();
                CMS.DAL.CMS_News dal = new CMS.DAL.CMS_News();

                model = dal.GetModel(id);

                this.lblTitle.Text = model.CMS_Title.ToString();
                this.lblTime.Text = model.CMS_Time.ToShortDateString();
                this.lblForm.Text = model.CMS_Form.ToString();
                this.lblAuthor.Text = model.CMS_Author.ToString();
                this.lblClick.Text = model.CMS_Click.ToString();
                this.lblContent.Text = model.CMS_Content.ToString();
            }
        }
Ejemplo n.º 5
0
        protected void lbtnDel_Click(object sender, EventArgs e)
        {
            CMS.DAL.CMS_News dal = new CMS.DAL.CMS_News();

            for (int i = 0; i < gvdataList.Rows.Count; i++)
            {
                Label label = (Label)gvdataList.Rows[i].FindControl("lb_id");
                int id = Convert.ToInt32(label.Text);
                CheckBox cb = (CheckBox)gvdataList.Rows[i].FindControl("cb_id");
                if (cb.Checked)
                {
                    //保存日志
                    // SaveLogs("[资讯模块]删除文章:" + model.Title);
                    //删除记录
                    //bll.Delete(kindId, id);
                    dal.Delete(id);
                }
            }

            JscriptPrint("批量删除成功啦!", "NewsList.aspx", "Success");
        }
Ejemplo n.º 6
0
 private void ShowInfo(int ID)
 {
     CMS.DAL.CMS_News bll = new CMS.DAL.CMS_News();
     CMS.Model.CMS_News model = bll.GetModel(ID);
     this.hdfid.Value = model.ID.ToString();
     this.txtCMS_Title.Text = model.CMS_Title;
     this.ddlNewType.SelectedValue = model.CMS_Type.ToString();
     this.txtCMS_Author.Text = model.CMS_Author;
     this.txtContent.Value = model.CMS_Content;
     this.txtCMS_Form.Text = model.CMS_Form;
     this.txtCMS_Keyword.Text = model.CMS_Keyword;
     this.txtCMS_Puter.Text = model.CMS_Puter;
     this.txtCMS_Time.Text = model.CMS_Time.ToString();
     this.txtCMS_Click.Text = model.CMS_Click.ToString();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 载入首页新闻
        /// </summary>
        private void InitNewsList()
        {
            CMS.DAL.CMS_News dal = new CMS.DAL.CMS_News();
            DataTable dt = dal.GetTopList(6," "," order by id desc").Tables[0];

            this.RepeaterNews.DataSource = dt.DefaultView;
            this.RepeaterNews.DataBind();
        }