protected void Page_Load(object sender, EventArgs e) { if (Session["AdminID"] == null) { Response.Write("<script>alert('账户过期请重新登录!');location='login.aspx'</script>"); } else if (!IsPostBack) { //大分类显示“请选择” ListItem lt = new ListItem(); lt.Text = "-->请选择类别<--"; lt.Selected = true; DplistCategory.Items.Add(lt); //默认显示资讯的 _DT = RptRecoverListBind("资讯"); pds_dt = _DT.Copy(); JumpPage(pds_dt, 1); //删除过期记录 DelHelper del = new DelHelper(); del.dellongtimelog(); } }
protected void RptRecoverList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "jumpPage") { string[] argv = e.CommandArgument.ToString().Split(','); string id = argv[0]; string link = argv[1]; if (link == "#") { string postUrl = ""; //说明用 id 来跳转详情页面 if (DplistCategory.SelectedValue == "资讯") //跳资讯 { postUrl = "/PassageEditor.aspx?id=" + e.CommandArgument.ToString().Trim(); } else //跳活动 { postUrl = "/ActivityEditor.aspx?id=" + e.CommandArgument.ToString().Trim(); } Response.Write("<script>window.open('" + postUrl + "','_blank')</script>"); } else { //说明是短趣,用链接跳转 //link 必须以 http://开头 Response.Write("<script>window.open('" + link + "','_blank')</script>"); } } else if (e.CommandName == "jumpAdmin") { //打开管理员信息的窗口---弹窗形式 string ID = e.CommandArgument.ToString(); string link = "/AdminInfo.aspx?id=" + ID; Response.Write("<script language='javascript'>window.open('" + link + "', 'newwindow', 'height=600, width=300, top='+Math.round((window.screen.height-200)/2)+',left='+Math.round((window.screen.width-300)/2)+', toolbar=no,menubar = no, scrollbars = no, resizable = no, location = no, status = no')</script>"); } else if (e.CommandName == "recover") { string[] argv = e.CommandArgument.ToString().Split(','); int id = Convert.ToInt32(argv[0]); int category = Convert.ToInt32(argv[1]); //调用 DelHelper 类 DelHelper delOp = new DelHelper(category, id); delOp.recoverDel(); //刷新表格 _DT = RptRecoverListBind(DplistCategory.SelectedValue); pds_dt = _DT.Copy(); JumpPage(pds_dt, 1); DplistCategory.SelectedValue = DplistCategory.Text; } }
protected void Rpt_ItemCommand(object source, RepeaterCommandEventArgs e) { int activeId = Convert.ToInt32(e.CommandArgument); int adminId = Convert.ToInt32(Session["AdminID"].ToString()); DelHelper delc = new DelHelper(3, activeId, adminId); if (e.CommandName == "delete") { if (delc.delItem()) { Response.Write("<script>alert('删除成功,并且保存在最近删除中!');window.location.href='NewsList.aspx';</script>"); } else { Response.Write("<script>alert('删除失败,请重试!');window.location.href='NewsList.aspx';</script>"); } } }