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.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; } }