/// <summary> /// 定义GridView内响应事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvlist_RowCommand(object sender, GridViewCommandEventArgs e) { int RowNow = Convert.ToInt32(e.CommandArgument); Int64 keyId = Convert.ToInt64(gvlist.DataKeys[RowNow].Value); if (keyId <= 0) return; XYECOM.Business.SearchKey BLL = new XYECOM.Business.SearchKey(); XYECOM.Model.SearchKeyInfo info = BLL.GetItem(keyId); if (info == null) return; if (e.CommandName == "SetIsCommend") { LinkButton lb = (LinkButton)gvlist.Rows[RowNow].Cells[7].Controls[0]; if (lb.ToolTip == COMMEND_TOOLTIP) { info.SK_IsCommend = false; } else if (lb.ToolTip == UNCOMMEND_TOOLTIP) { info.SK_IsCommend = true; } BLL.Update(info); } if (e.CommandName == "SetIsRanking") { LinkButton lb = (LinkButton)gvlist.Rows[RowNow].Cells[8].Controls[0]; if (lb.ToolTip == COMMEND_TOOLTIP) { info.SK_IsRanking = false; } else if (lb.ToolTip == UNCOMMEND_TOOLTIP) { info.SK_IsRanking = true; } BLL.Update(info); } BindData(); }
/// <summary> /// 搜索次数归零 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnClear_Click(object sender, EventArgs e) { XYECOM.Business.SearchKey BLL = new XYECOM.Business.SearchKey(); foreach (GridViewRow row in this.gvlist.Rows) { if (((CheckBox)(row.FindControl("chkExport"))).Checked == true) { int id=XYECOM.Core.MyConvert.GetInt32( this.gvlist.DataKeys[row.DataItemIndex].Value.ToString()); XYECOM.Model.SearchKeyInfo info = BLL.GetItem(id); info.SK_Count = 0; BLL.Update(info); } } BindData(); }