Exemple #1
0
 protected void btnAddQY_Click(object sender, EventArgs e)
 {
     Model.TcConfig mzd = new Model.TcConfig();
     BLL.TcConfig   bzd = new BLL.TcConfig();
     mzd.Name    = txtqymc.Text.Trim();
     mzd.Ename   = txtpx.Text.Trim();
     mzd.Types   = types;
     mzd.Content = txtcontent.Text.Trim().FilterSql();
     bzd.Add(mzd);
     txtqymc.Text    = "";
     txtpx.Text      = "";
     txtcontent.Text = "";
     BindGridView();
 }
Exemple #2
0
        //执行编辑
        protected void gvqy_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int     qyid       = gvqy.DataKeys[e.RowIndex][0].GetString().GetInt();
            TextBox txtqymc    = gvqy.Rows[e.RowIndex].FindControl("txtqymc") as TextBox;
            TextBox txtqypx    = gvqy.Rows[e.RowIndex].FindControl("txtqypx") as TextBox;
            TextBox txtcontent = gvqy.Rows[e.RowIndex].FindControl("txtcontent") as TextBox;

            BLL.TcConfig   bbk = new BLL.TcConfig();
            Model.TcConfig mbk = new Model.TcConfig();
            mbk         = bbk.GetModel(qyid);
            mbk.Name    = txtqymc.Text;
            mbk.Ename   = txtqypx.Text;
            mbk.Types   = types;
            mbk.Content = txtcontent.Text;
            bbk.Update(mbk);
            gvqy.EditIndex = -1;
            BindGridView();
        }
Exemple #3
0
        private void LoadData()
        {
            DataTable dt = new Model.TcConfig().Select("types='web'").ToDataTable();

            foreach (DataRow item in dt.Rows)
            {
                var name = item["Ename"].GetString();
                var c    = FindControl("txt_" + name) as TextBox;
                if (name == "weblogo")
                {
                    if (item["content"].GetString().Length > 0)
                    {
                        weblogo = LibFile.get_img(item["content"].GetString(), "", "");
                    }
                }
                if (c != null)
                {
                    c.Text = item["content"].GetString();
                }
            }
        }
Exemple #4
0
        public static string Get(string key, string types)
        {
            var s    = "";
            var list = new List <Model.TcConfig>();

            if (HttpContext.Current.Cache["wangzhanpeizhilist"] == null)
            {
                list = new Model.TcConfig().Select().ToList <Model.TcConfig>();
                HttpContext.Current.Cache.Insert("wangzhanpeizhilist", list, null, DateTime.Now.AddHours(1), TimeSpan.Zero);
            }
            else
            {
                list = (List <Model.TcConfig>)HttpContext.Current.Cache["wangzhanpeizhilist"];
            }
            var mlist = list.Where(p => p.Ename == key && p.Types == types);//应该就只有一个值的

            foreach (Model.TcConfig item in mlist)
            {
                s = item.Content;
            }
            return(s);
        }
Exemple #5
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            var list = new Model.TcConfig().Select("types='web'").ToList <Model.TcConfig>();

            foreach (var item in list)
            {
                var name = item.Ename.GetString();
                var c    = FindControl("txt_" + name) as TextBox;
                if (c != null)
                {
                    item.Content = c.Text.GetString();
                    item.Update("id=" + item.ID);
                }
                if (filefm.HasFile && name == "weblogo")
                {
                    item.Content = LibFile.ProcessTupian(filefm);
                    item.Update("id=" + item.ID);
                }
            }

            Cache.Remove("wangzhanpeizhilist");

            alert("保存成功!");
        }