//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_channel_manage", DTEnums.ActionEnum.Delete.ToString());//检查权限 int sucCount = 0; int errorCount = 0; BLL.site_channel bll = new BLL.site_channel(); 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) { Model.site_channel model = bll.GetModel(id); if (bll.Delete(id)) { sucCount += 1; //删除URL配置 new BLL.url_rewrite().Remove("channel", model.name); } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除频道成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 CacheHelper.Remove(DTKeys.CACHE_SITE_CHANNEL_LIST); //更新一下频道的缓存 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("channel_list.aspx", "site_id={0}&keywords={1}", this.site_id.ToString(), this.keywords), "parent.loadMenuTree"); }
//查找匹配的URL private string get_url_rewrite(int channel_id, string call_index, int id) { if (channel_id == 0) { return(string.Empty); } string querystring = id.ToString(); string channel_name = new BLL.site_channel().GetChannelName(channel_id); if (string.IsNullOrEmpty(channel_name)) { return(string.Empty); } if (!string.IsNullOrEmpty(call_index)) { querystring = call_index; } BLL.url_rewrite bll = new BLL.url_rewrite(); Model.url_rewrite model = bll.GetInfo(channel_name, "detail"); if (model != null) { return(linkurl(model.name, querystring)); } return(string.Empty); }
/// <summary> /// 获得前几行数据 /// </summary> public DataSet GetList(int channel_id, int Top, string strWhere, string filedOrder) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(new DataSet()); } return(dal.GetList(channelName, Top, strWhere, filedOrder)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.article ArticleModel(string channel_name, string call_index) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { return(null); } return(dal.GetModel(channel_name, call_index)); }
/// <summary> /// 是否存在该记录 /// </summary> public bool ArticleExists(string channel_name, string call_index) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { return(false); } return(int.Parse(dal.GetExists(sysdatabaseprefix, channel_name, "count(1)", string.Format("call_index='{0}'", call_index))) > 0); }
/// <summary> /// 是否存在该记录 /// </summary> public bool ArticleExists(string channel_name, string call_index) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { return(false); } return(dal.Exists(channel_name, call_index)); }
/// <summary> /// 返回商品库存数量 /// </summary> public int GetStockQuantity(int channel_id, int article_id, int goods_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(0); } return(dal.GetStockQuantity(channelName, channel_id, article_id, goods_id)); }
/// <summary> /// 是否存在该记录 /// </summary> public bool Exists(int channel_id, int article_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(false); } return(dal.Exists(channelName, article_id)); }
/// <summary> /// 返回信息封面图 /// </summary> public string GetImgUrl(int channel_id, int article_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(string.Empty); } return(dal.GetImgUrl(channelName, article_id)); }
/// <summary> /// 是否存在标题 /// </summary> public bool ExistsTitle(int channel_id, int category_id, string title) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(false); } return(int.Parse(dal.GetExists(sysdatabaseprefix, channelName, "count(1)", string.Format("category_id={0} and title='{1}'", category_id, title))) > 0); }
/// <summary> /// 根据频道名称获取总记录数 /// </summary> public int ArticleCount(string channel_name, int category_id, string strWhere) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { return(0); } return(dal.ArticleCount(channel_name, category_id, strWhere)); }
/// <summary> /// 根据频道名称显示前几条数据 /// </summary> public DataSet ArticleList(string channel_name, int category_id, int Top, string strWhere, string filedOrder) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { return(new DataSet()); } return(dal.ArticleList(channel_name, category_id, Top, strWhere, filedOrder)); }
private string GetLinkDomain() { Model.site_channel channelModel = new BLL.site_channel().GetModel(this.channel_id); Model.sites siteModel = new BLL.sites().GetModel(channelModel.site_id); if (siteModel == null || string.IsNullOrEmpty(siteModel.domain)) { return(sysConfig.weburl); } return(siteModel.domain); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.sites GetSiteModel(int channel_id) { int id = new BLL.site_channel().GetSiteId(channel_id); if (id > 0) { return(dal.Get(id)); } return(null); }
/// <summary> /// 返回信息封面图 /// </summary> public string GetImgUrl(int channel_id, int article_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(string.Empty); } return(dal.GetExists(sysdatabaseprefix, channelName, "img_url", "id=" + article_id)); }
/// <summary> /// 是否存在标题 /// </summary> public bool ExistsTitle(int channel_id, int category_id, string title) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(false); } return(dal.ExistsTitle(channelName, category_id, title)); }
/// <summary> /// 获取文章赞次数 /// </summary> public int GetZan(int channel_id, int article_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(0); } return(int.Parse(dal.GetExists(sysdatabaseprefix, channelName, "zan", "id=" + article_id))); }
/// <summary> /// 获取阅读次数 /// </summary> public int GetClick(int channel_id, int article_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(0); } return(dal.GetClick(channelName, article_id)); }
/// <summary> /// 返回数据总数 /// </summary> public int GetCount(int channel_id, string strWhere) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(0); } return(int.Parse(dal.GetExists(sysdatabaseprefix, channelName, "count(*) as H", strWhere))); }
/// <summary> /// 返回数据总数 /// </summary> public int GetCount(int channel_id, string strWhere) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(0); } return(dal.GetCount(channelName, strWhere)); }
/// <summary> /// 是否存在该记录 /// </summary> public bool ArticleExists(string channel_name, int article_id) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { return(false); } return(int.Parse(dal.GetExists(sysdatabaseprefix, channel_name, "count(1)", "id=" + article_id)) > 0); }
/// <summary> /// 修改一列数据 /// </summary> public bool UpdateField(int channel_id, int article_id, string strValue) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(false); } return(dal.UpdateField(channelName, article_id, strValue)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.article GetModel(int channel_id, int article_id) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(null); } return(dal.GetModel(channelName, article_id)); }
/// <summary> /// 获得查询分页数据 /// </summary> public DataSet GetList(int channel_id, int category_id, int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount) { string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { recordCount = 0; return(new DataSet()); } return(dal.GetList(channelName, category_id, pageSize, pageIndex, strWhere, filedOrder, out recordCount)); }
//统计文章数量 public int ArticleCount() { DataTable dt = new BLL.site_channel().FillDataSet(0, "", "").Tables[0]; int count = 0; foreach (DataRow item in dt.Rows) { count += new BLL.article().GetCount(item["name"].ToString(), "status=0"); } return(count); }
/// <summary> /// 根据频道名称获得查询分页数据 /// </summary> public DataSet ArticleList(string channel_name, int category_id, int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount) { Dictionary <int, string> dic = new BLL.site_channel().GetListAll(); if (!dic.ContainsValue(channel_name)) { recordCount = 0; return(new DataSet()); } return(dal.ArticleList(channel_name, category_id, pageSize, pageIndex, strWhere, filedOrder, out recordCount)); }
private void TreeBind() { BLL.site_channel bll = new BLL.site_channel(); DataTable dt = bll.GetList(0, "", "sort_id asc,id desc").Tables[0]; this.ddlChannel.Items.Clear(); this.ddlChannel.Items.Add(new ListItem("不属于频道", "")); foreach (DataRow dr in dt.Rows) { this.ddlChannel.Items.Add(new ListItem(dr["title"].ToString(), dr["name"].ToString())); } }
/// <summary> /// 是否存在该记录 /// </summary> public bool Exists(int channel_id, string call_index) { if (string.IsNullOrEmpty(call_index)) { return(false); } string channelName = new BLL.site_channel().GetChannelName(channel_id);//查询频道名称 if (string.IsNullOrEmpty(channelName)) { return(false); } return(dal.Exists(channelName, call_index)); }
private void ShowInfo(int _id) { BLL.site_channel bll = new BLL.site_channel(); Model.site_channel model = bll.GetModel(_id); txtTitle.Text = model.title; txtName.Text = model.name; txtName.Focus(); //设置焦点,防止JS无法提交 txtName.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_name_validate&old_channel_name=" + Utils.UrlEncode(model.name)); ddlSiteId.SelectedValue = model.site_id.ToString(); if (model.is_lock == 1) { cbIsLock.Checked = false; } if (model.is_comment == 1) { cbIsComment.Checked = true; } if (model.is_albums == 1) { cbIsAlbums.Checked = true; } if (model.is_attach == 1) { cbIsAttach.Checked = true; } if (model.is_spec == 1) { cbIsSpec.Checked = true; } txtSortId.Text = model.sort_id.ToString(); //赋值扩展字段 if (model.channel_fields != null) { for (int i = 0; i < cblAttributeField.Items.Count; i++) { string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值 Model.site_channel_field modelt = model.channel_fields.Find(p => p.field_id == int.Parse(fieldIdArr[1])); //查找对应的字段ID if (modelt != null) { cblAttributeField.Items[i].Selected = true; } } } //绑定URL配置列表 rptList.DataSource = new BLL.url_rewrite().GetList(model.name); rptList.DataBind(); }
//嵌套绑定 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e) { BLL.site_channel bll = new BLL.site_channel(); if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { Repeater rptChannel = (Repeater)e.Item.FindControl("rptChannel"); //找到分类Repeater关联的数据项 DataRowView drv = (DataRowView)e.Item.DataItem; //提取站点ID int siteId = Convert.ToInt32(drv["id"]); //根据分类ID查询并绑定所属频道 rptChannel.DataSource = bll.GetList(0, "site_id=" + siteId, "sort_id asc,id desc"); rptChannel.DataBind(); } }