Example #1
0
        private void Delete(HttpContext context)
        {
            int categoryId = context.Request["ids"].ToInt(0);

            if (ArticleHelper.DeleteHelpCategory(categoryId))
            {
                base.ReturnSuccessResult(context, "成功删除分类!", 0, true);
            }
        }
Example #2
0
        private void grdHelpCategories_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 categoryId = (int)this.grdHelpCategories.DataKeys[rowIndex].Value;

            if (e.CommandName == "Delete")
            {
                ArticleHelper.DeleteHelpCategory(categoryId);
            }
            else
            {
                if (e.CommandName == "SetYesOrNo")
                {
                    HelpCategoryInfo helpCategory = ArticleHelper.GetHelpCategory(categoryId);
                    if (helpCategory.IsShowFooter)
                    {
                        helpCategory.IsShowFooter = false;
                    }
                    else
                    {
                        helpCategory.IsShowFooter = true;
                    }
                    ArticleHelper.UpdateHelpCategory(helpCategory);
                }
                else
                {
                    int displaySequence        = int.Parse((this.grdHelpCategories.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text);
                    int num                    = 0;
                    int replaceDisplaySequence = 0;
                    if (e.CommandName == "Fall")
                    {
                        if (rowIndex < this.grdHelpCategories.Rows.Count - 1)
                        {
                            num = (int)this.grdHelpCategories.DataKeys[rowIndex + 1].Value;
                            replaceDisplaySequence = int.Parse((this.grdHelpCategories.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text);
                        }
                    }
                    else
                    {
                        if (e.CommandName == "Rise" && rowIndex > 0)
                        {
                            num = (int)this.grdHelpCategories.DataKeys[rowIndex - 1].Value;
                            replaceDisplaySequence = int.Parse((this.grdHelpCategories.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text);
                        }
                    }
                    if (num > 0)
                    {
                        ArticleHelper.SwapHelpCategorySequence(categoryId, num, displaySequence, replaceDisplaySequence);
                    }
                }
            }
            base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
        }
Example #3
0
 private void grdHelpCategories_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     if (ArticleHelper.DeleteHelpCategory((int)grdHelpCategories.DataKeys[e.RowIndex].Value))
     {
         BindHelpCategory();
         ShowMsg("成功删除了选择的帮助分类", true);
     }
     else
     {
         ShowMsg("未知错误", false);
     }
 }