public ForumCategoryWrapper(ThreadCategory category, IEnumerable <Thread> threads) { Title = category.Title; Updated = Created = (ApiDateTime)category.CreateDate; Description = category.Description; Threads = (from thread in threads where thread.IsApproved select new ForumThreadWrapper(thread)).ToList(); }
public static string RenderForumCategory(ThreadCategory category, List <Thread> threads) { var sb = new StringBuilder(); sb.Append("<div class='borderBase cornerAll tintLight' id='forum_categoryBox_" + category.ID + "' name='" + category.ID + "' style='margin-bottom:5px;'>"); sb.Append("<table cellpadding=0 cellspacing=0 style='width:100%;'>"); sb.Append("<tr valign=top>"); sb.Append("<td id='forum_categoryBoxHandle_" + category.ID + "' class='moveBackground' align=center style='padding-bottom:15px; width:10px;'>"); sb.Append("<a href=\"javascript:ForumMakerProvider.ToggleThreadCategory('" + category.ID + "');\"><img id=\"forum_categoryState_" + category.ID + "\" style=\"border:0px;\" align='absmiddle' src=\"" + WebImageSupplier.GetAbsoluteWebPath("minus.png") + "\"/></a>"); sb.Append("</td>"); sb.Append("<td style='padding-left:10px;'>"); sb.Append("<div class='clearFix' style='padding:3px;'>"); sb.Append("<div style='float:left; width:70%; max-width:600px; overflow: hidden;'>"); sb.Append("<div class='headerPanel'>" + category.Title.HtmlEncode() + "</div>"); sb.Append("<div class='describe-text' style='margin-top:3px;'>" + category.Description.HtmlEncode().Replace("\r\n", "</br>").Replace("\n", "</br>").Replace(" ", " ") + "</div>"); sb.Append("</div>"); sb.Append("<div align=right style='margin-right:8px; padding-top:5px; float:right;'>"); sb.Append("<a class = 'link' href=\"javascript:ForumMakerProvider.ShowEditCategoryDialog('" + category.ID + "','" + category.Title.HtmlEncode().ReplaceSingleQuote() + "','" + category.Description.HtmlEncode().ReplaceSingleQuote() + "');\">" + Resources.ForumResource.EditShortButton + "</a>"); sb.Append("<span class='splitter'>|</span>"); sb.Append("<a class = 'link' href=\"javascript:ForumMakerProvider.RemoveCategory('" + category.ID + "');\">" + Resources.ForumResource.DeleteButton + "</a>"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div id='forum_threadListBox_" + category.ID + "' name='" + category.ID + "'>"); threads.Sort((t1, t2) => Comparer <int> .Default.Compare(t1.SortOrder, t2.SortOrder)); foreach (var thread in threads) { sb.Append(RenderThread(thread)); } sb.Append("<div id='forum_threadBox_" + Guid.NewGuid() + "' style='display:none;' name='empty'></div> "); sb.Append("</div>"); sb.Append("</td>"); sb.Append("</tr>"); sb.Append("</table>"); sb.Append("</div>"); return(sb.ToString()); }
public JavaDebugThread(JavaDebugProgram program, IThreadReference thread, ThreadCategory category) { Contract.Requires <ArgumentNullException>(program != null, "program"); Contract.Requires <ArgumentNullException>(thread != null, "thread"); _program = program; _thread = thread; _category = category; CreateStepRequests(); }
public JavaDebugThread(JavaDebugProgram program, IThreadReference thread, ThreadCategory category) { Contract.Requires<ArgumentNullException>(program != null, "program"); Contract.Requires<ArgumentNullException>(thread != null, "thread"); _program = program; _thread = thread; _category = category; CreateStepRequests(); }
public async Task DeleteCategory(int id) { ThreadCategory category = new ThreadCategory { Id = id }; this.Db.ThreadCategories.Attach(category); this.Db.ThreadCategories.Remove(category); await this.Db.SaveChangesAsync(); }
public AjaxResponse CreateCategory(string name, string description) { var resp = new AjaxResponse(); if (!ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null)) { resp.rs1 = "0"; resp.rs2 = "<div class='errorBox'>" + Resources.ForumResource.ErrorAccessDenied + "</div>"; return(resp); } if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(name.Trim())) { resp.rs1 = "0"; resp.rs2 = "<div class='errorBox'>" + Resources.ForumResource.ErrorEmptyName + "</div>"; return(resp); } var category = new ThreadCategory() { Title = name.Trim(), Description = description ?? "", SortOrder = 100 }; try { category.ID = ForumDataProvider.CreateThreadCategory(TenantProvider.CurrentTenantID, category.Title, category.Description, category.SortOrder); resp.rs1 = "1"; resp.rs2 = RenderForumCategory(category, new List <Thread>()); } catch { resp.rs1 = "0"; resp.rs2 = "<div>" + Resources.ForumResource.ErrorCreateThreadCategory + "</div>"; } return(resp); }
public async Task SaveCategory(int productId, ThreadCategoryViewModel viewModel) { ThreadCategory category; if (viewModel.Id.HasValue) { category = await this.Db.Products .Where(x => x.Id == productId) .SelectMany(x => x.Categories) .FirstOrDefaultAsync(x => x.Id == viewModel.Id.Value); } else { category = new ThreadCategory(); this.Db.ThreadCategories.Add(category); } category.Name = viewModel.Name; category.ThreadType = viewModel.ThreadType; category.ProductId = productId; await this.Db.SaveChangesAsync(); }
public void RemoveAttachments(ThreadCategory threadCategory) { ClearDirectory(threadCategory.ID.ToString()); }