protected void New_Tags_relationships(string postcode) { posts = new PostBLL(); tags_relationships = new Tags_relationshipsBLL(); List <Post> lstP = posts.ListPostWithPostCode(postcode); Post pp = lstP.FirstOrDefault(); int postid = pp.ID; List <TagsPost> lstp = new List <TagsPost>(); foreach (ListItem itm in cbltags.Items) { if (itm.Selected) { lstp.Add(new TagsPost() { id = int.Parse(itm.Value), name = itm.Text }); } } List <TagsPost> newlt = lstp.OrderBy(r => r.id).ToList(); foreach (TagsPost tp in newlt) { this.tags_relationships.NewTags_relationships(postid, tp.id); } }
protected void load_Checkcbltag(int postid) { tags_relationships = new Tags_relationshipsBLL(); List <Tags_relationships> lstTR = tags_relationships.getTagsWithPostID(postid); foreach (Tags_relationships itm in lstTR) { cbltags.Items.FindByValue(itm.TagsID.ToString()).Selected = true; } }
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); } }