//保存排序 protected void btnSave_Click(object sender, EventArgs e) { BLL.ArticleBll bll = new BLL.ArticleBll(); 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("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "SortID=" + sortId.ToString()); } JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel(channel_id, ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(id); switch (e.CommandName.ToLower()) { case "ibtnred": if (model.IsRecommend == 1) bll.UpdateField(id, "IsRecommend=0"); else bll.UpdateField(id, "IsRecommend=1"); break; case "ibtnhot": if (model.IsHot == 1) bll.UpdateField(id, "IsHot=0"); else bll.UpdateField(id, "IsHot=1"); break; } this.RptBind("ID>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "SortID asc,AddTime desc"); }