//保存排序 protected void btnSave_Click(object sender, EventArgs e) { BLL.goods bll = new BLL.goods(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Txt": rptList = this.rptList1; break; default: rptList = this.rptList2; break; } 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, "sort_id=" + 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, DTEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.goods bll = new BLL.goods(); Model.goods model = bll.GetGoodsModel(id); switch (e.CommandName.ToLower()) { case "ibtntop": if (model.is_top == 1) bll.UpdateField(id, "is_top=0"); else bll.UpdateField(id, "is_top=1"); break; case "ibtnred": if (model.is_red == 1) bll.UpdateField(id, "is_red=0"); else bll.UpdateField(id, "is_red=1"); break; } this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc"); }