private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (Title like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", "")); return; } } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.common_adR bll = new BLL.common_adR(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void BindData() { DataTable dt = new BLL.common_adR().GetList("ad_group_id = " + (int)EnumCollection.adR_group.梧桐花轮播图 + " order by ad_group_id,ad_sort_id"); this.rptBanner.DataSource = dt; this.rptBanner.DataBind(); BLL.common_article bll = new BLL.common_article(); dt = bll.GetListByPage(" group_id = " + (int)EnumCollection.article_group.我们的服务, "add_time desc", 1, 4); this.rptService.DataSource = dt; this.rptService.DataBind(); dt = bll.GetListByPage(" group_id = " + (int)EnumCollection.article_group.客户案例, "add_time desc", 1, 8); this.rptCase.DataSource = dt; this.rptCase.DataBind(); if (bll.GetRecordCount(" group_id = " + (int)EnumCollection.article_group.客户案例) <= 8) { this.more_i.Visible = false; } dt = bll.GetListByPage(" group_id = " + (int)EnumCollection.article_group.新闻动态, " add_time desc ", 1, 4); this.rptNews.DataSource = dt; this.rptNews.DataBind(); if (bll.GetRecordCount(" group_id = " + (int)EnumCollection.article_group.新闻动态) <= 4) { this.news_more.Visible = false; } }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_common_adR", EnumCollection.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.common_adR bll = new BLL.common_adR(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除广告位与数据对应" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", this.keywords)); }
private void SetRecommend(HttpContext context) { int id = RequestHelper.GetFormInt("id"); BLL.common_adR bll = new BLL.common_adR(); Model.common_adR model = bll.GetModel("ad_data_id=" + id + " and ad_group_id=" + (int)EnumCollection.adR_group.精品微课推荐课程); if (model != null) { new BLL.common_adR().Delete(model.id); } else { model = new Model.common_adR(); model.ad_group_id = (int)EnumCollection.adR_group.精品微课推荐课程; model.ad_group_name = EnumCollection.adR_group.精品微课推荐课程.ToString(); model.ad_type_id = 0; model.ad_type_name = ""; model.ad_data_title = ""; model.ad_data_subtitle = ""; model.ad_data_img = ""; model.ad_data_url = ""; model.ad_data_id = id; model.ad_sort_id = 0; model.add_time = System.DateTime.Now; bll.Add(model); } context.Response.Write("1"); context.Response.End(); }
private bool DoAdd() { BLL.common_adR bll = new BLL.common_adR(); Model.common_adR model = new Model.common_adR(); model.ad_group_id = (int)EnumCollection.adR_group.梧桐花轮播图; model.ad_group_name = Enum.GetName(typeof(EnumCollection.adR_group), model.ad_group_id); model.ad_type_id = 0; model.ad_type_name = ""; model.ad_data_id = Convert.ToInt32(this.txtad_data_id.Text); model.ad_data_title = this.txtad_data_title.Text; model.ad_data_subtitle = ""; model.ad_data_url = ""; model.ad_data_img = this.txtad_data_img.Text; model.ad_sort_id = Convert.ToInt32(this.txtad_sort_id.Text); model.add_time = System.DateTime.Now; int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加轮播图信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_common_adR", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.common_adR bll = new BLL.common_adR(); Model.common_adR model = bll.GetModel(this.id); model.ad_group_id = Convert.ToInt32(txtad_group_id.Text); model.ad_group_name = Convert.ToString(txtad_group_name.Text); model.ad_type_id = Convert.ToInt32(txtad_type_id.Text); model.ad_type_name = Convert.ToString(txtad_type_name.Text); model.ad_data_id = Convert.ToInt32(txtad_data_id.Text); model.ad_data_title = Convert.ToString(txtad_data_title.Text); model.ad_data_subtitle = Convert.ToString(txtad_data_subtitle.Text); model.ad_data_img = Convert.ToString(txtad_data_img.Text); model.ad_data_url = Convert.ToString(txtad_data_url.Text); model.ad_sort_id = Convert.ToInt32(txtad_sort_id.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改广告位与数据对应信息,主键:" + id); //记录日志 JscriptMsg("修改广告位与数据对应信息成功!", "Manage.aspx"); } else { JscriptMsg("保存过程中发生错误!", ""); } }
private void BindData() { this.page = RequestHelper.GetQueryInt("page", 1); BLL.common_adR bll = new BLL.common_adR(); this.rptList.DataSource = bll.GetListByPage("ad_group_id = " + (int)EnumCollection.adR_group.商城轮播图, "ad_group_id,ad_sort_id", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount("ad_group_id = " + (int)EnumCollection.adR_group.商城轮播图); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("adR_list.aspx", "page={0}", "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void ShowInfo(int _id) { BLL.common_adR bll = new BLL.common_adR(); Model.common_adR model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } this.txtad_data_title.Text = model.ad_data_title; this.txtad_data_id.Text = model.ad_data_id + ""; this.txtad_data_img.Text = model.ad_data_img; this.txtad_sort_id.Text = model.ad_sort_id + ""; }
protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("_recommend_course", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.common_adR bll = new BLL.common_adR(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtad_sort_id")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "ad_sort_id=" + sortId.ToString()); } AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "保存推荐微课排序"); //记录日志 JscriptMsg("保存排序成功!", "recommend_course.aspx"); }
private bool DoEdit(int id) { BLL.common_adR bll = new BLL.common_adR(); Model.common_adR model = bll.GetModel(id); model.ad_data_id = Convert.ToInt32(this.txtad_data_id.Text); model.ad_data_title = this.txtad_data_title.Text; model.ad_data_subtitle = ""; model.ad_data_img = this.txtad_data_img.Text; model.ad_sort_id = Convert.ToInt32(this.txtad_sort_id.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改轮播图信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
private void BindInfo() { BLL.common_adR bll = new BLL.common_adR(); Model.common_adR model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtad_group_id.Text = model.ad_group_id + ""; txtad_group_name.Text = model.ad_group_name + ""; txtad_type_id.Text = model.ad_type_id + ""; txtad_type_name.Text = model.ad_type_name + ""; txtad_data_id.Text = model.ad_data_id + ""; txtad_data_title.Text = model.ad_data_title + ""; txtad_data_subtitle.Text = model.ad_data_subtitle + ""; txtad_data_img.Text = model.ad_data_img + ""; txtad_data_url.Text = model.ad_data_url + ""; txtad_sort_id.Text = model.ad_sort_id + ""; txtadd_time.Text = model.add_time + ""; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_common_adR", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtad_group_id.Text.Trim() == "" || txtad_group_id.Text.Trim().Length > 4) { strError += "广告分组id为空或超出长度![br]"; } if (txtad_group_name.Text.Trim() == "" || txtad_group_name.Text.Trim().Length > 50) { strError += "广告分组名称为空或超出长度![br]"; } if (txtad_type_id.Text.Trim() == "" || txtad_type_id.Text.Trim().Length > 4) { strError += "广告类型id为空或超出长度![br]"; } if (txtad_type_name.Text.Trim() == "" || txtad_type_name.Text.Trim().Length > 50) { strError += "广告类型name为空或超出长度![br]"; } if (txtad_data_id.Text.Trim() == "" || txtad_data_id.Text.Trim().Length > 4) { strError += "广告数据id为空或超出长度![br]"; } if (txtad_data_title.Text.Trim() == "" || txtad_data_title.Text.Trim().Length > 50) { strError += "广告数据标题为空或超出长度![br]"; } if (txtad_data_subtitle.Text.Trim() == "" || txtad_data_subtitle.Text.Trim().Length > 500) { strError += "广告数据副标题为空或超出长度![br]"; } if (txtad_data_img.Text.Trim() == "" || txtad_data_img.Text.Trim().Length > 500) { strError += "广告数据图片为空或超出长度![br]"; } if (txtad_data_url.Text.Trim() == "" || txtad_data_url.Text.Trim().Length > 500) { strError += "广告位链接为空或超出长度![br]"; } if (txtad_sort_id.Text.Trim() == "" || txtad_sort_id.Text.Trim().Length > 4) { strError += "排序为空或超出长度![br]"; } if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8) { strError += "添加时间为空或超出长度![br]"; } if (strError != string.Empty) { JscriptMsg(strError, "", "Error"); return; } #endregion Model.common_adR model = new Model.common_adR(); BLL.common_adR bll = new BLL.common_adR(); model.ad_group_id = Convert.ToInt32(txtad_group_id.Text); model.ad_group_name = Convert.ToString(txtad_group_name.Text); model.ad_type_id = Convert.ToInt32(txtad_type_id.Text); model.ad_type_name = Convert.ToString(txtad_type_name.Text); model.ad_data_id = Convert.ToInt32(txtad_data_id.Text); model.ad_data_title = Convert.ToString(txtad_data_title.Text); model.ad_data_subtitle = Convert.ToString(txtad_data_subtitle.Text); model.ad_data_img = Convert.ToString(txtad_data_img.Text); model.ad_data_url = Convert.ToString(txtad_data_url.Text); model.ad_sort_id = Convert.ToInt32(txtad_sort_id.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加广告位与数据对应信息,主键:" + id); //记录日志 JscriptMsg("添加广告位与数据对应信息成功!", "Manage.aspx", ""); } else { JscriptMsg("保存过程中发生错误!", ""); } }
private void SetGoodsIndex() { int id = RequestHelper.GetFormInt("id"); Model.goods_goods goods = new BLL.goods_goods().GetModel(id); if (goods != null) { BLL.common_adR bll = new BLL.common_adR(); if (goods.group_id == (int)EnumCollection.goods_group.教育商城) { Model.common_adR model = bll.GetModel("ad_data_id=" + id + " and ad_group_id=" + (int)EnumCollection.adR_group.教育商城推荐商品); if (model != null) { new BLL.common_adR().Delete(model.id); } else { model = new Model.common_adR(); model.ad_group_id = (int)EnumCollection.adR_group.教育商城推荐商品; model.ad_group_name = EnumCollection.adR_group.教育商城推荐商品.ToString(); model.ad_type_id = 0; model.ad_type_name = ""; model.ad_data_title = ""; model.ad_data_subtitle = ""; model.ad_data_img = ""; model.ad_data_url = ""; model.ad_data_id = id; model.ad_sort_id = 0; model.add_time = System.DateTime.Now; bll.Add(model); } HttpContext.Current.Response.Write("1"); HttpContext.Current.Response.End(); return; } if (goods.group_id == (int)EnumCollection.goods_group.积分专区) { Model.common_adR model = bll.GetModel("ad_data_id=" + id + " and ad_group_id=" + (int)EnumCollection.adR_group.积分商城推荐商品); if (model != null) { new BLL.common_adR().Delete(model.id); } else { model = new Model.common_adR(); model.ad_group_id = (int)EnumCollection.adR_group.积分商城推荐商品; model.ad_group_name = EnumCollection.adR_group.积分商城推荐商品.ToString(); model.ad_type_id = 0; model.ad_type_name = ""; model.ad_data_title = ""; model.ad_data_subtitle = ""; model.ad_data_img = ""; model.ad_data_url = ""; model.ad_data_id = id; model.ad_sort_id = 0; model.add_time = System.DateTime.Now; bll.Add(model); } HttpContext.Current.Response.Write("1"); HttpContext.Current.Response.End(); return; } HttpContext.Current.Response.Write("0"); HttpContext.Current.Response.End(); return; } else { HttpContext.Current.Response.Write("0"); HttpContext.Current.Response.End(); return; } }