/// <summary> /// 处理Repeater操作 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void repList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); if (e.CommandName.Equals("Del")) { try { if (tagKeyInfoBLL.Delete(new int[] { id })) { MessageBox.ShowAndRedirect(this, "删除成功", "Keyword.aspx"); } } catch (Exception) { MessageBox.Show(this, "删除失败"); } } else if (e.CommandName.Equals("Edit")) { btnAdd.CommandName = "Edit"; tagKeyInfoModel = tagKeyInfoBLL.GetModel(id, EyouSoft.Model.NewsStructure.ItemCategory.KeyWord); txtKeyword.Text = tagKeyInfoModel.ItemName; txtUrl.Text = tagKeyInfoModel.ItemUrl; hfID.Value = id.ToString(); } }
/// <summary> /// 初始化资讯列表 /// </summary> private void InitNewsList(int typeId) { lsNews = new List <EyouSoft.Model.NewsStructure.NewsModel>(); //如果是关键字列表 if (Request["TagId"] != null) { string tagName = string.Empty; EyouSoft.BLL.NewsStructure.TagKeyInfo tagBll = new EyouSoft.BLL.NewsStructure.TagKeyInfo(); EyouSoft.Model.NewsStructure.TagKeyInfo tagModel = tagBll.GetModel(int.Parse(Request["TagId"].ToString()), EyouSoft.Model.NewsStructure.ItemCategory.Tag); if (tagModel != null) { tagName = tagModel.ItemName; } this.Page.Title = string.Format(EyouSoft.Common.PageTitle.Information_List_Title, tagName + "-相关内容"); //cateName = tagName == "" ? "行业资讯":tagName; cateName = "行业资讯"; EyouSoft.Model.NewsStructure.SearchOrderInfo queryModel = new EyouSoft.Model.NewsStructure.SearchOrderInfo(); queryModel.Tag = typeId; lsNews = bll.GetList(pageSize, pageIndex, ref recordCount, queryModel); } else { //type<0表示是大类 if (typeId < 0) { queryModel = new EyouSoft.Model.NewsStructure.SearchOrderInfo(); queryModel.Category = (EyouSoft.Model.NewsStructure.NewsCategory)(-typeId); lsNews = bll.GetList(pageSize, pageIndex, ref recordCount, queryModel); cateName = queryModel.Category.ToString(); this.Page.Title = string.Format(EyouSoft.Common.PageTitle.Information_List_Title, cateName); } else { cateName = newTypeBll.GetCategoryById(typeId) == null ? "" : ((EyouSoft.Model.NewsStructure.NewsCategory)newTypeBll.GetCategoryById(typeId)).ToString(); this.Page.Title = cateName; className = newTypeBll.GetNewsTypeName(typeId).ToString(); this.Page.Title = string.Format(EyouSoft.Common.PageTitle.Information_List_Title, className); queryModel = new EyouSoft.Model.NewsStructure.SearchOrderInfo(); queryModel.Type = typeId; lsNews = bll.GetList(pageSize, pageIndex, ref recordCount, queryModel); } } AddMetaTag("keywords", string.Format(EyouSoft.Common.PageTitle.Information_List_Keywords, cateName == "" ? className : cateName)); AddMetaTag("description", string.Format(EyouSoft.Common.PageTitle.Information_List_Des, cateName == "" ? className : cateName)); //如果有数据 if (lsNews != null && lsNews.Count > 0) { rptNewsList.DataSource = lsNews; rptNewsList.DataBind(); BindPage(); BindUpPage(); } }