Пример #1
0
 protected void btn_add_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         string ids = Request.QueryString["id"].ToString();
         if (ids != "0")
         {
             zs.Model.Tbl_Page model = bll.GetModel(int.Parse(ids));
             model.name            = this.tb_name.Text.Trim();
             model.metatags        = this.tb_tags.Text.Trim();
             model.metadescription = ApplicationMethod.NoHtmlCode(this.tb_metadesc.Text.Trim(), 80);
             model.conts           = Request.Form["myValue"].ToString();
             bll.Update(model);
             BindData();
         }
         else
         {
             zs.Model.Tbl_Page model = new zs.Model.Tbl_Page();
             model.name            = this.tb_name.Text.Trim();
             model.metatags        = this.tb_tags.Text.Trim();
             model.metadescription = ApplicationMethod.NoHtmlCode(this.tb_metadesc.Text.Trim(), 80);
             model.conts           = Request.Form["myValue"].ToString();
             bll.Add(model);
         }
     }
 }
Пример #2
0
    private void GetContent()
    {
        zs.BLL.Tbl_Page bll = new zs.BLL.Tbl_Page();
        string          id  = ApplicationMethod.decript(Request.QueryString["id"]);

        zs.Model.Tbl_Page model = bll.GetModelByCache(int.Parse(id));
        this.lb_title.Text = model.name;
        this.lb_Cont.Text  = model.conts;
        tags       = model.metatags;
        desc       = model.metadescription;
        Page.Title = model.name + " - 浙江树人大学招生网";
    }
Пример #3
0
 private void BindData()
 {
     if (Request.QueryString["id"] != null)
     {
         string ids = Request.QueryString["id"].ToString();
         if (ids != "0")
         {
             zs.Model.Tbl_Page model = bll.GetModel(int.Parse(ids));
             this.tb_name.Text     = model.name;
             this.tb_tags.Text     = model.metatags;
             this.tb_metadesc.Text = model.metadescription;
             cont = model.conts;
             this.btn_add.Text = "修改";
         }
     }
 }
Пример #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <zs.Model.Tbl_Page> DataTableToList(DataTable dt)
        {
            List <zs.Model.Tbl_Page> modelList = new List <zs.Model.Tbl_Page>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                zs.Model.Tbl_Page model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zs.Model.Tbl_Page();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["name"] != null && dt.Rows[n]["name"].ToString() != "")
                    {
                        model.name = dt.Rows[n]["name"].ToString();
                    }
                    if (dt.Rows[n]["conts"] != null && dt.Rows[n]["conts"].ToString() != "")
                    {
                        model.conts = dt.Rows[n]["conts"].ToString();
                    }
                    if (dt.Rows[n]["metatags"] != null && dt.Rows[n]["metatags"].ToString() != "")
                    {
                        model.metatags = dt.Rows[n]["metatags"].ToString();
                    }
                    if (dt.Rows[n]["metadescription"] != null && dt.Rows[n]["metadescription"].ToString() != "")
                    {
                        model.metadescription = dt.Rows[n]["metadescription"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zs.Model.Tbl_Page model)
 {
     return(dal.Update(model));
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(zs.Model.Tbl_Page model)
 {
     return(dal.Add(model));
 }