public static Post ToPost(SupplyM s, bool isLoggedIn) { Post respVal = new Post(); respVal.PopupHtml = toPopupHtml(s, isLoggedIn); respVal.Location = s.LocationArry; return(respVal); }
public static void AddPoints(SupplyM s, Dictionary <string, List <Point> > dict) { List <string> allPpeTypes = s.PpeTypes.ToList(); foreach (string ppeType in allPpeTypes) { string className = Ppe.TypesToClasses[ppeType]; string need = Ppe.NeedFromType(ppeType, s.OtherPpeTypes); Point p = new Point { Location = s.LocationArry, PopupHtml = $"<div class='supply'><h1>Supply</h1>{s.WebsiteHtml}{HtmlHelp.LabelledTag("PPE:", HtmlHelp.ColorBoxHtml(need, className))}{HtmlHelp.LabelledTag("Organisation:", s.Organisation)}{s.PostedHtml}</div>" }; dict[ppeType].Add(p); } }
static string toPopupHtml(SupplyM s, bool isLoggedIn) { StringBuilder sb = new StringBuilder(); sb.Append("<div class='supply'>"); sb.Append("<h1>Supplies Post</h1>"); sb.Append(s.WebsiteHtml); if (isLoggedIn) { sb.Append($"<a class='edit_link' target='_blank' title='View Record' href='/edit-supplies/{s.Id}'><i class='fas fa-link fa-2x'></i></a>"); } sb.Append(HtmlHelp.LabelledTag("Organisation:", s.Organisation)); sb.Append(HtmlHelp.LabelledTag("Description:", s.Description)); sb.Append(HtmlHelp.LabelledList("Supplies:", s.PpeTypes)); sb.Append(HtmlHelp.LabelledTag("Other Supplies:", s.OtherPpeTypes)); sb.Append(HtmlHelp.LabelledTag("Capacity:", s.CapacityNotes)); //TODO:TD switch to compiled info from ppetTypes for new posts //TODO:contact details sb.Append(s.PostedHtml); sb.Append("</div>"); return(sb.ToString()); }