Example #1
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>");
        }
Example #2
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");
        }
Example #3
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();
            }
        }
Example #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CMS.Model.CMS_News GetModel(int ID)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" ID,CMS_Click,CMS_Title,CMS_Type,CMS_Author,CMS_Content,CMS_Form,CMS_Keyword,CMS_Puter,CMS_Time ");
     strSql.Append(" from CMS_News ");
     strSql.Append(" where ID=" + ID + " ");
     CMS.Model.CMS_News model = new CMS.Model.CMS_News();
     DataSet ds = DbHelperSQL.Query(strSql.ToString());
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
         {
             model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
         }
         if (ds.Tables[0].Rows[0]["CMS_Click"].ToString() != "")
         {
             model.CMS_Click = int.Parse(ds.Tables[0].Rows[0]["CMS_Click"].ToString());
         }
         model.CMS_Title = ds.Tables[0].Rows[0]["CMS_Title"].ToString();
         if (ds.Tables[0].Rows[0]["CMS_Type"].ToString() != "")
         {
             model.CMS_Type = int.Parse(ds.Tables[0].Rows[0]["CMS_Type"].ToString());
         }
         model.CMS_Author = ds.Tables[0].Rows[0]["CMS_Author"].ToString();
         model.CMS_Content = ds.Tables[0].Rows[0]["CMS_Content"].ToString();
         model.CMS_Form = ds.Tables[0].Rows[0]["CMS_Form"].ToString();
         model.CMS_Keyword = ds.Tables[0].Rows[0]["CMS_Keyword"].ToString();
         model.CMS_Puter = ds.Tables[0].Rows[0]["CMS_Puter"].ToString();
         if (ds.Tables[0].Rows[0]["CMS_Time"].ToString() != "")
         {
             model.CMS_Time = DateTime.Parse(ds.Tables[0].Rows[0]["CMS_Time"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }