示例#1
0
 protected void gwCategory_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         category = new CategoryBLL();
         post_category_relationships = new Post_Category_RelationshipsBLL();
         int ctID = Convert.ToInt32((gwCategory.Rows[e.RowIndex].FindControl("lblCategoryID") as Label).Text);
         if (this.post_category_relationships.DeleteWithCategoryID(ctID))
         {
             if (this.category.UpdateParent(ctID, 0))
             {
                 if (this.category.Delete(ctID))
                 {
                     this.GetPostCategoryPageWise(1);
                 }
                 else
                 {
                     this.AlertPageValid(true, "False to connect server !", alertPageValid, lblPageValid);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
     }
 }
示例#2
0
    protected void checkedTreeBoxCategory(string postid)
    {
        post_category_relationships = new Post_Category_RelationshipsBLL();
        foreach (TreeNode node in treeboxCategory.Nodes)
        {
            List <Post_Category_Relationships> lstPCR = post_category_relationships.getCategoryWithPostId(int.Parse(postid));

            foreach (Post_Category_Relationships itm in lstPCR)
            {
                checknode(node, itm.CategoryID.ToString());
            }
        }
    }
示例#3
0
    protected void btnPostNew_Click(object sender, EventArgs e)
    {
        try
        {
            post_category_relationships = new Post_Category_RelationshipsBLL();
            category           = new CategoryBLL();
            images             = new ImagesBLL();
            tags               = new TagsBLL();
            tags_relationships = new Tags_relationshipsBLL();
            string dateString = DateTime.Now.ToString("MM-dd-yyyy");
            string PostCode   = RandomName + "-" + dateString;

            if (NewPost(PostCode))
            {
                this.New_Post_Category_relationships(PostCode);
                this.New_Tags_relationships(PostCode);
                Response.Redirect("http://" + Request.Url.Authority + "/Admin/Pages/Post-Update.aspx?PostCode=" + PostCode);
            }
        }
        catch (Exception ex)
        {
            this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
        }
    }
示例#4
0
    protected void New_Post_Category_relationships(string postcode)
    {
        posts = new PostBLL();
        post_category_relationships = new Post_Category_RelationshipsBLL();
        List <Post>         lstP   = posts.ListPostWithPostCode(postcode);
        Post                pp     = lstP.FirstOrDefault();
        int                 postid = pp.ID;
        List <CategoryPost> cp     = new List <CategoryPost>();

        foreach (TreeNode n in treeboxCategory.CheckedNodes)
        {
            // arr.Add(n.Value);
            cp.Add(new CategoryPost()
            {
                id = int.Parse(n.Value), name = n.Text
            });
        }
        List <CategoryPost> newl = cp.OrderBy(r => r.id).ToList();

        foreach (CategoryPost itm in newl)
        {
            this.post_category_relationships.NewPost_Category_Relationships(postid, itm.id);
        }
    }