protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("theme_advert_list", "广告位页面列表")) { PageReturnMsg = PageNoPowerMsg(); } id = RequestTool.RequestInt("id", 0); key = RequestTool.RequestString("key"); tid = RequestTool.RequestInt("tid", 0); adv = B_Lebi_Theme_Advert.GetModel(id); if (adv == null) { adv = new Lebi_Theme_Advert(); } theme = B_Lebi_Theme.GetModel(tid); if (theme == null) { theme = new Lebi_Theme(); } string where = "Theme_Advert_id=" + id; if (key != "") { where += " and (Title like lbsql{'%" + key + "%'} or [URL] like lbsql{'%" + key + "%'})"; } imgs = B_Lebi_Advert.GetList(where, "Sort desc", PageSize, page); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Theme_Advert model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Theme_Advert] set "); strSql.Append("[Theme_id]=@Theme_id,"); strSql.Append("[Code]=@Code,"); strSql.Append("[Width]=@Width,"); strSql.Append("[Height]=@Height,"); strSql.Append("[Sort]=@Sort,"); strSql.Append("[Description]=@Description,"); strSql.Append("[Content]=@Content"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@Theme_id", model.Theme_id), new OleDbParameter("@Code", model.Code), new OleDbParameter("@Width", model.Width), new OleDbParameter("@Height", model.Height), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Description", model.Description), new OleDbParameter("@Content", model.Content) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_Theme_Advert ReaderBind(IDataReader dataReader) { Lebi_Theme_Advert model = new Lebi_Theme_Advert(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } ojb = dataReader["Theme_id"]; if (ojb != null && ojb != DBNull.Value) { model.Theme_id = (int)ojb; } model.Code = dataReader["Code"].ToString(); ojb = dataReader["Width"]; if (ojb != null && ojb != DBNull.Value) { model.Width = (int)ojb; } ojb = dataReader["Height"]; if (ojb != null && ojb != DBNull.Value) { model.Height = (int)ojb; } ojb = dataReader["Sort"]; if (ojb != null && ojb != DBNull.Value) { model.Sort = (int)ojb; } model.Description = dataReader["Description"].ToString(); model.Content = dataReader["Content"].ToString(); return(model); }
/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_Theme_Advert SafeBindForm(Lebi_Theme_Advert model) { if (HttpContext.Current.Request["Theme_id"] != null) { model.Theme_id = Shop.Tools.RequestTool.RequestInt("Theme_id", 0); } if (HttpContext.Current.Request["Code"] != null) { model.Code = Shop.Tools.RequestTool.RequestSafeString("Code"); } if (HttpContext.Current.Request["Width"] != null) { model.Width = Shop.Tools.RequestTool.RequestInt("Width", 0); } if (HttpContext.Current.Request["Height"] != null) { model.Height = Shop.Tools.RequestTool.RequestInt("Height", 0); } if (HttpContext.Current.Request["Sort"] != null) { model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0); } if (HttpContext.Current.Request["Description"] != null) { model.Description = Shop.Tools.RequestTool.RequestSafeString("Description"); } if (HttpContext.Current.Request["Content"] != null) { model.Content = Shop.Tools.RequestTool.RequestSafeString("Content"); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Theme_Advert model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Theme_Advert] set "); strSql.Append("Theme_id= @Theme_id,"); strSql.Append("Code= @Code,"); strSql.Append("Width= @Width,"); strSql.Append("Height= @Height,"); strSql.Append("Sort= @Sort,"); strSql.Append("Description= @Description,"); strSql.Append("Content= @Content"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Theme_id", SqlDbType.Int, 4), new SqlParameter("@Code", SqlDbType.NVarChar, 50), new SqlParameter("@Width", SqlDbType.Int, 4), new SqlParameter("@Height", SqlDbType.Int, 4), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@Description", SqlDbType.NVarChar, 200), new SqlParameter("@Content", SqlDbType.NText) }; parameters[0].Value = model.id; parameters[1].Value = model.Theme_id; parameters[2].Value = model.Code; parameters[3].Value = model.Width; parameters[4].Value = model.Height; parameters[5].Value = model.Sort; parameters[6].Value = model.Description; parameters[7].Value = model.Content; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Theme_Advert model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Theme_Advert]("); strSql.Append("Theme_id,Code,Width,Height,Sort,Description,Content)"); strSql.Append(" values ("); strSql.Append("@Theme_id,@Code,@Width,@Height,@Sort,@Description,@Content)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Theme_id", model.Theme_id), new SqlParameter("@Code", model.Code), new SqlParameter("@Width", model.Width), new SqlParameter("@Height", model.Height), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Description", model.Description), new SqlParameter("@Content", model.Content) }; object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
public void Advertisement(string code) { Lebi_Theme_Advert model = B_Lebi_Theme_Advert.GetModel("Code='" + code + "' and Theme_id=" + CurrentTheme.id + ""); if (model == null) { return; } if (model.Content == "") { model.Content = "${<a href=\"{%URL%}\"><img src=\"{%Image%}\" title=\"{%Title%}\" width=\"{%Width%}\" height=\"{%Height%}\" /></a>}$"; } string vv = Shop.Bussiness.Theme.DoAdvertCodeConvert(model.Content, model, CurrentLanguage, CurrentTheme); Response.Write(vv); }
/// <summary> /// 得到一个对象实体 by id /// </summary> public Lebi_Theme_Advert GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Theme_Advert] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_Theme_Advert model = new Lebi_Theme_Advert(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters); 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]["Theme_id"].ToString() != "") { model.Theme_id = int.Parse(ds.Tables[0].Rows[0]["Theme_id"].ToString()); } model.Code = ds.Tables[0].Rows[0]["Code"].ToString(); if (ds.Tables[0].Rows[0]["Width"].ToString() != "") { model.Width = int.Parse(ds.Tables[0].Rows[0]["Width"].ToString()); } if (ds.Tables[0].Rows[0]["Height"].ToString() != "") { model.Height = int.Parse(ds.Tables[0].Rows[0]["Height"].ToString()); } if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.Description = ds.Tables[0].Rows[0]["Description"].ToString(); model.Content = ds.Tables[0].Rows[0]["Content"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 by where条件 /// </summary> public Lebi_Theme_Advert GetModel(string strWhere) { if (strWhere.IndexOf("lbsql{") > 0) { SQLPara para = new SQLPara(strWhere, "", ""); return(GetModel(para)); } StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Theme_Advert] "); strSql.Append(" where " + strWhere + ""); Lebi_Theme_Advert model = new Lebi_Theme_Advert(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(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]["Theme_id"].ToString() != "") { model.Theme_id = int.Parse(ds.Tables[0].Rows[0]["Theme_id"].ToString()); } model.Code = ds.Tables[0].Rows[0]["Code"].ToString(); if (ds.Tables[0].Rows[0]["Width"].ToString() != "") { model.Width = int.Parse(ds.Tables[0].Rows[0]["Width"].ToString()); } if (ds.Tables[0].Rows[0]["Height"].ToString() != "") { model.Height = int.Parse(ds.Tables[0].Rows[0]["Height"].ToString()); } if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.Description = ds.Tables[0].Rows[0]["Description"].ToString(); model.Content = ds.Tables[0].Rows[0]["Content"].ToString(); return(model); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("advert_edit", "设置广告位")) { WindowNoPower(); } id = RequestTool.RequestInt("id", 0); tid = RequestTool.RequestInt("tid", 0); theme = B_Lebi_Theme.GetModel(tid); if (theme == null) { PageError(); return; } model = B_Lebi_Theme_Advert.GetModel(id); if (model == null) { model = new Lebi_Theme_Advert(); model.Theme_id = theme.id; } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Theme_Advert model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Theme_Advert]("); strSql.Append("[Theme_id],[Code],[Width],[Height],[Sort],[Description],[Content])"); strSql.Append(" values ("); strSql.Append("@Theme_id,@Code,@Width,@Height,@Sort,@Description,@Content)"); OleDbParameter[] parameters = { new OleDbParameter("@Theme_id", model.Theme_id), new OleDbParameter("@Code", model.Code), new OleDbParameter("@Width", model.Width), new OleDbParameter("@Height", model.Height), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Description", model.Description), new OleDbParameter("@Content", model.Content) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
/// <summary> /// 编辑广告位 /// </summary> public void Advert_Edit() { if (!EX_Admin.Power("advert_edit", "设置广告位")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); int Theme_id = RequestTool.RequestInt("Theme_id", 0); string code = RequestTool.RequestString("Code"); int count = B_Lebi_Theme_Advert.Counts("Theme_id=" + Theme_id + " and Code=lbsql{'" + code + "'} and id!=" + id + ""); if (count > 0) { Response.Write("{\"msg\":\"代码已存在\"}"); return; } Lebi_Theme theme = B_Lebi_Theme.GetModel(Theme_id); Lebi_Theme_Advert model = B_Lebi_Theme_Advert.GetModel(id); if (model == null) { model = new Lebi_Theme_Advert(); model = B_Lebi_Theme_Advert.BindForm(model); B_Lebi_Theme_Advert.Add(model); } else { model = B_Lebi_Theme_Advert.BindForm(model); B_Lebi_Theme_Advert.Update(model); } string action = Tag("设置广告位"); Log.Add(action, "Theme_Advert", model.id.ToString(), CurrentAdmin); Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("advertimage_edit", "编辑广告")) { PageNoPower(); } int id = RequestTool.RequestInt("id", 0); int aid = RequestTool.RequestInt("aid"); advert = B_Lebi_Theme_Advert.GetModel(aid); if (advert == null) { PageError(); return; } theme = B_Lebi_Theme.GetModel(advert.Theme_id); model = B_Lebi_Advert.GetModel(id); if (model == null) { model = new Lebi_Advert(); model.Theme_Advert_Code = advert.Code; model.Theme_Advert_id = advert.id; } }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Theme_Advert model) { D_Lebi_Theme_Advert.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Theme_Advert model) { return(D_Lebi_Theme_Advert.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Theme_Advert SafeBindForm(Lebi_Theme_Advert model) { return(D_Lebi_Theme_Advert.Instance.SafeBindForm(model)); }