public void Delete(HttpContext context) { int?intParam = base.GetIntParam(context, "id", false); if (!intParam.HasValue) { throw new HidistroAshxException("错误的编号"); } if (ReplyHelper.DeleteReply(intParam.Value)) { base.ReturnSuccessResult(context, "删除成功", 0, true); return; } throw new HidistroAshxException("删除失败!"); }
protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { int num = Globals.ToNum(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { ReplyHelper.DeleteReply(num); this.BindArticleCategory(); this.ShowMsg("删除成功!", true); return; } if (e.CommandName == "Release") { ReplyHelper.UpdateReplyRelease(num); base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true); return; } if (e.CommandName == "Edit") { Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(num); if (reply != null) { switch (reply.MessageType) { case MessageType.Text: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num)); break; case MessageType.News: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num)); return; case (MessageType)3: break; case MessageType.List: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num)); return; default: return; } } } }
private void grdArticleCategories_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex; int num = (int)this.grdArticleCategories.DataKeys[rowIndex].Value; if (e.CommandName == "Delete") { ReplyHelper.DeleteReply(num); base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true); return; } if (e.CommandName == "Release") { ReplyHelper.UpdateReplyRelease(num); base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true); return; } if (e.CommandName == "Edit") { ReplyInfo reply = ReplyHelper.GetReply(num); if (reply != null) { switch (reply.MessageType) { case MessageType.Text: base.Response.Redirect(string.Format("EditReplyOnKey.aspx?id={0}", num)); break; case MessageType.News: base.Response.Redirect(string.Format("EditSingleArticle.aspx?id={0}", num)); return; case (MessageType)3: break; case MessageType.List: base.Response.Redirect(string.Format("EditMultiArticle.aspx?id={0}", num)); return; default: return; } } } }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Globals.ToNum(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { ReplyHelper.DeleteReply(id); base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); } else if (e.CommandName == "Release") { ReplyHelper.UpdateReplyRelease(id); base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); } else if (e.CommandName == "Edit") { Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(id); if (reply != null) { switch (reply.MessageType) { case MessageType.Text: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id)); return; case MessageType.News: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id)); return; case (MessageType.News | MessageType.Text): return; case MessageType.List: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id)); return; } } } }