Ejemplo n.º 1
0
 protected void btnaddTax_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(Request.QueryString["taxId"]))
     {
         Taxonomy_M tax = new Taxonomy_M();
         tax.TaxonomyId   = Convert.ToInt32(Request.QueryString["taxId"]);
         tax.TaxonomyName = txtTaxName.Text;
         tax.Taxonomydesc = txtTaxDesc.Text;
         if (Taxonomy_B.updateTax(tax))
         {
             ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('修改成功');location.href='AdminTax.aspx';</script>");
         }
         else
         {
             ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('修改失败');</script>");
         }
     }
     else
     {
         Taxonomy_M tax = new Taxonomy_M();
         tax.TaxonomyName = txtTaxName.Text;
         tax.Taxonomydesc = txtTaxDesc.Text;
         if (Taxonomy_B.addTax(tax))
         {
             ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('添加成功');</script>");
             txtTaxName.Text = "";
             txtTaxDesc.Text = "";
         }
         else
         {
             ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('添加失败');</script>");
         }
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(Request.QueryString["TaxID"]))
     {
         string     TaxID = Request.QueryString["TaxID"];
         Taxonomy_M tax   = Taxonomy_B.getTaxonomyByID(TaxID);
         txtTax.Text            = tax.TaxonomyName;
         rptPostList.DataSource = Posts_B.PostListByTaxID(TaxID);
         rptPostList.DataBind();
     }
 }
Ejemplo n.º 3
0
        protected void rptPostList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HiddenField categoryID   = e.Item.FindControl("CategoryID") as HiddenField;
            LinkButton  CategoryName = e.Item.FindControl("CategoryName") as LinkButton;

            if (!string.IsNullOrWhiteSpace(categoryID.Value))
            {
                Taxonomy_M tax = Taxonomy_B.getTaxonomyByID(categoryID.Value);
                CategoryName.Text = tax.TaxonomyName;
            }
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         navPostRpt.DataSource = Posts_B.PostListTop3();
         navPostRpt.DataBind();
         navTaxRpt.DataSource = Taxonomy_B.TaxListTop2();
         navTaxRpt.DataBind();
         RptComments.DataSource = Comments_B.CommentsListTop3();
         RptComments.DataBind();
     }
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!string.IsNullOrWhiteSpace(Request.QueryString["taxId"]))
         {
             Taxonomy_M tax = Taxonomy_B.getTaxonomyByID(Request.QueryString["taxId"]);
             txtTaxName.Text = tax.TaxonomyName;
             txtTaxDesc.Text = tax.Taxonomydesc;
             btnaddTax.Text  = "编辑分类";
         }
     }
 }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Posts_B.countPost() > 0)
     {
         post.Text = Posts_B.countPost().ToString() + "篇文章";
     }
     if (Comments_B.commentCount() > 0)
     {
         comment.Text = Comments_B.commentCount().ToString() + "条评论";
     }
     if (Taxonomy_B.TaxCount() > 0)
     {
         cate.Text = Taxonomy_B.TaxCount().ToString() + "个分类";
     }
 }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int order = Taxonomy_B.TaxList().Count();
         pagerCate.RecordCount = order;
         Bind();
     }
     if (!string.IsNullOrWhiteSpace(Request.QueryString["taxId"]))
     {
         if (Taxonomy_B.delTax(Request.QueryString["taxId"]))
         {
             ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('删除成功');location.href='AdminTax.aspx';</script>");
         }
     }
 }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(Request.QueryString["PostId"]))
     {
         Posts_M Post = Posts_B.PostByID(Request.QueryString["PostId"]);
         Page.Title       = Post.Title;
         lblTitle.Text    = Post.Title;
         PostDesc.Text    = Post.Post;
         PublishTime.Text = Post.PublishTime.ToShortDateString();
         int CategoryId = Post.TaxonomyId;
         CategoryName.Text = Taxonomy_B.getTaxonomyByID(CategoryId.ToString()).TaxonomyName;
     }
     else
     {
         Response.Redirect("Index.aspx");
     }
 }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ddlcate.DataSource     = Taxonomy_B.TaxList();
         ddlcate.DataValueField = "TaxonomyId";
         ddlcate.DataTextField  = "TaxonomyName";
         ddlcate.DataBind();
         if (!string.IsNullOrWhiteSpace(Request.QueryString["postId"]))
         {
             Posts_M post = Posts_B.PostByID(Request.QueryString["postId"]);
             txtTitle.Text   = post.Title;
             ddlcate.Text    = post.TaxonomyId.ToString();
             postdesc.Text   = post.Post;
             btnaddpost.Text = "修改";
         }
     }
 }
Ejemplo n.º 10
0
        protected void postList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HiddenField cateID   = e.Item.FindControl("cateID") as HiddenField;
            Label       cateName = e.Item.FindControl("cateName") as Label;

            if (!string.IsNullOrWhiteSpace(cateID.Value))
            {
                Taxonomy_M cate = Taxonomy_B.getTaxonomyByID(cateID.Value);
                cateName.Text = cate.TaxonomyName;
            }
            HiddenField postID       = e.Item.FindControl("postID") as HiddenField;
            Label       commentCount = e.Item.FindControl("commentCount") as Label;

            if (!string.IsNullOrWhiteSpace(postID.Value))
            {
                int count = Comments_B.commentCountByPostID(postID.Value);
                commentCount.Text = count.ToString() + "条评论";
            }
        }
Ejemplo n.º 11
0
 void Bind()
 {
     cateList.DataSource = Taxonomy_B.TaxListPager(pagerCate.PageSize.ToString(), pagerCate.CurrentPageIndex.ToString());
     cateList.DataBind();
 }