Error executing template "Designs/bleau-solutionset/ItemPublisher/List/EventListMinimal.cshtml"
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at CompiledRazorTemplates.Dynamic.RazorEngine_40ce148c3f8b445f89f581cebbd1adfd.Execute() in E:\Dynamicweb.net\SolutionsCustom\vallensbaek.devcl.bleaudev.dk_PBL\Files\Templates\Designs\bleau-solutionset\ItemPublisher\List\EventListMinimal.cshtml:line 84
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 3 @using System.Collections.Specialized; 4 @using System.Collections.Generic; 5 @using System.Web; 6 @using System.Web.Script.Serialization; 7 @using System.Text; 8 @using System.Text.RegularExpressions; 9 @using System.Linq; 10 @using System.Globalization; 11 @using System.Security.Claims 12 @using Dynamicweb.Admin.eComBackend 13 @using Dynamicweb.Rendering; 14 @using Dynamicweb.Content; 15 @using Dynamicweb.Environment.Web 16 @using Dynamicweb.SystemTools; 17 @using Dynamicweb.Core; 18 @using Dynamicweb.DataManagement; 19 @using Dynamicweb.Forms; 20 @using Dynamicweb.Ecommerce.Variants; 21 @using Dynamicweb.Content.Items; 22 23 @using Bleau.Calendar.Core.Helper; 24 @using Bleau.Calendar.Core.Models.Events; 25 @using Bleau.Calendar.Events.Helper; 26 27 28 @{ 29 30 ParagraphService ParagraphService = new ParagraphService(); 31 List<string> EventItemTypes = new List<string>(); 32 EventItemTypes.Add("event"); 33 34 int paragraphId = Pageview.CurrentParagraph.ID; 35 36 IEnumerable<LoopItem> eventsList = GetLoop("ItemPublisher:Items.List"); 37 38 IEnumerable<Category> eventsCategories = eventsList.Select(e => e.GetInteger("ItemPublisher:Item.Field.PageId")).Distinct().Select(c => new Category 39 { 40 PageId = c, 41 Name = Dynamicweb.Services.Pages.GetPage(c).MenuText, 42 ItemId = Dynamicweb.Services.Pages.GetPage(c).ItemId 43 }); 44 45 string filterCategory = Sanitize.Parameter("category"), 46 filterStart = Sanitize.Parameter("start", ParameterType.Datetime), 47 filterEnd = Sanitize.Parameter("end", ParameterType.Datetime); 48 49 DateTime filterStartDate = !string.IsNullOrEmpty(filterStart) ? DateTime.Parse(filterStart) : new DateTime(), 50 filterEndDate = !string.IsNullOrEmpty(filterEnd) ? DateTime.Parse(filterEnd) : new DateTime(); 51 52 53 if (!string.IsNullOrEmpty(filterCategory)) 54 { 55 eventsList = eventsList.Where(e => e.GetString("ItemPublisher:Item.Field.PageId").Equals(filterCategory)); 56 57 } 58 59 if (!string.IsNullOrEmpty(filterStart) || !string.IsNullOrEmpty(filterEnd)) 60 { 61 62 eventsList = eventsList.Where(e => 63 { 64 65 bool included = true; 66 67 DateTime eventStartDate = e.GetDate("ItemPublisher:Item.StartDateTime.Value"), 68 eventEndDate = e.GetDate("ItemPublisher:Item.EndDateTime.Value"); 69 70 if (included && !string.IsNullOrEmpty(filterStart)) 71 { 72 included = DateTime.Compare(eventStartDate, filterStartDate) >= 0; 73 } 74 if (included && !string.IsNullOrEmpty(filterEnd)) 75 { 76 included = DateTime.Compare(eventStartDate, filterEndDate) <= 0; 77 } 78 79 return included; 80 81 }); 82 } 83 84 string pageDetailUrl = eventsList.First().GetString("ItemPublisher:Item.DetailsUrl").Split(new[] { "&itemId" }, StringSplitOptions.None)[0]; 85 86 IEnumerable<Event> Events = eventsList.Select(e => { 87 88 Event CalendarEvent = new Event(); 89 90 CalendarEvent.Id = e.GetString("ItemPublisher:Item.Field.Id"); 91 CalendarEvent.Title = e.GetString("ItemPublisher:Item.Title.Value"); 92 CalendarEvent.Description = e.GetString("ItemPublisher:Item.Description.Value"); 93 CalendarEvent.Image = e.GetString("ItemPublisher:Item.Image.Value"); 94 95 CalendarEvent.StartDateTime = e.GetDate("ItemPublisher:Item.StartDateTime.Value"); 96 CalendarEvent.EndDateTime = e.GetDate("ItemPublisher:Item.EndDateTime.Value"); 97 CalendarEvent.IsRecurring = e.GetBoolean("ItemPublisher:Item.IsRecurring.Value"); 98 99 CalendarEvent.Recurring.Repeats = e.GetString("ItemPublisher:Item.RecurringRepeats.Value"); 100 CalendarEvent.Recurring.RepeatsWeeks = e.GetInteger("ItemPublisher:Item.RecurringRepeatsWeeks.Value"); 101 CalendarEvent.Recurring.RepeatsDays = e.GetString("ItemPublisher:Item.RecurringRepeatsDays.Value"); 102 CalendarEvent.Recurring.StopRepeatingAfter = e.GetInteger("ItemPublisher:Item.StopRepeatingAfter.Value"); 103 CalendarEvent.Recurring.StopRepeatingOn = e.GetDate("ItemPublisher:Item.StopRepeatingOn.Value"); 104 105 CalendarEvent.Recurring.DatesExcluded = new List<DateTime>(); 106 CalendarEvent.Recurring.DatesIncluded = new List<DateTime>(); 107 108 CalendarEvent.Recurring.DatesExcluded.Add(e.GetDate("ItemPublisher:Item.DateExcluded1.Value")); 109 CalendarEvent.Recurring.DatesExcluded.Add(e.GetDate("ItemPublisher:Item.DateExcluded2.Value")); 110 CalendarEvent.Recurring.DatesExcluded.Add(e.GetDate("ItemPublisher:Item.DateExcluded3.Value")); 111 112 CalendarEvent.Recurring.DatesIncluded.Add(e.GetDate("ItemPublisher:Item.DateIncluded1.Value")); 113 CalendarEvent.Recurring.DatesIncluded.Add(e.GetDate("ItemPublisher:Item.DateIncluded2.Value")); 114 CalendarEvent.Recurring.DatesIncluded.Add(e.GetDate("ItemPublisher:Item.DateIncluded3.Value")); 115 116 CalendarEvent.Location.Name = e.GetString("ItemPublisher:Item.LocationName.Value"); 117 CalendarEvent.Location.Address = e.GetString("ItemPublisher:Item.LocationAddress.Value"); 118 119 CalendarEvent.Organizer.Name = e.GetString("ItemPublisher:Item.OrganizerName.Value"); 120 CalendarEvent.Organizer.Email = e.GetString("ItemPublisher:Item.OrganizerEmail.Value"); 121 CalendarEvent.Organizer.Phone = e.GetString("ItemPublisher:Item.OrganizerPhone.Value"); 122 CalendarEvent.Organizer.PossiblyUnion = e.GetString("ItemPublisher:Item.OrganizerPossiblyUnion.Value"); 123 124 CalendarEvent.Payment = e.GetString("ItemPublisher:Item.Payment.Value"); 125 CalendarEvent.Price = e.GetDouble("ItemPublisher:Item.Price.Value"); 126 127 CalendarEvent.RequiresRegistration = e.GetBoolean("ItemPublisher:Item.RequiresEventRegistration.Value"); 128 129 CalendarEvent.Registration.HomePage = e.GetString("ItemPublisher:Item.RegistrationHomepage.Value"); 130 131 CalendarEvent.Acceptance = e.GetBoolean("ItemPublisher:Item.Acceptance.Value"); 132 133 CalendarEvent.Category.PageId = e.GetInteger("ItemPublisher:Item.Field.PageId"); 134 135 CalendarEvent.DetailUrl = e.GetString("ItemPublisher:Item.DetailsUrl"); 136 137 Dynamicweb.Content.Page CategoryPage = Dynamicweb.Services.Pages.GetPage(CalendarEvent.Category.PageId); 138 CalendarEvent.Category.Name = CategoryPage.MenuText; 139 CalendarEvent.Category.ItemId = CategoryPage.ItemId; 140 CalendarEvent.Category.Color = CategoryPage.Item != null && CategoryPage.Item["Color"] != null ? CategoryPage.Item["Color"].ToString() : "#0f6b9e"; 141 142 return CalendarEvent; 143 144 }); 145 146 // Start Recurring Events 147 148 IEnumerable<Paragraph> EventParagraphs_All = ParagraphService.GetParagraphsByItemTypes(EventItemTypes), 149 RecurringEventParagraphs_All, 150 RecurringEventParagraphs_Active; 151 152 RecurringEventParagraphs_All = EventParagraphs_All.Any() ? EventParagraphs_All.Where(p => p.ShowParagraph && p.Item["IsRecurring"] != null && Convert.ToBoolean(p.Item["IsRecurring"].ToString()) && p.Item["Approved"] != null && Convert.ToBoolean(p.Item["Approved"].ToString())) : null; 153 RecurringEventParagraphs_Active = RecurringEventParagraphs_All != null && RecurringEventParagraphs_All.Any() ? RecurringEventParagraphs_All.Where(p => p.Item["StopRepeatingOn"] != null && DateTime.Compare(DateTime.Now,Convert.ToDateTime(p.Item["StopRepeatingOn"])) < 0 ) : null; 154 155 if (RecurringEventParagraphs_All != null && RecurringEventParagraphs_All.Any()) 156 { 157 158 foreach (Paragraph RecurringParagraph in RecurringEventParagraphs_Active) 159 { 160 161 Event RecurringEvent = new Event(); 162 163 RecurringEvent.Id = RecurringParagraph.Item.Id; 164 RecurringEvent.Title = RecurringParagraph.Item["Title"] != null ? RecurringParagraph.Item["Title"].ToString() : string.Empty; 165 RecurringEvent.Description = RecurringParagraph.Item["Description"] != null ? RecurringParagraph.Item["Description"].ToString() : string.Empty; 166 RecurringEvent.Image = RecurringParagraph.Item["Image"] != null ? RecurringParagraph.Item["Image"].ToString() : string.Empty; 167 168 RecurringEvent.StartDateTime = RecurringParagraph.Item["StartDateTime"] != null ? Convert.ToDateTime(RecurringParagraph.Item["StartDateTime"].ToString()) : new DateTime(); 169 RecurringEvent.EndDateTime = RecurringParagraph.Item["EndDateTime"] != null ? Convert.ToDateTime(RecurringParagraph.Item["EndDateTime"].ToString()) : new DateTime(); 170 RecurringEvent.IsRecurring = RecurringParagraph.Item["IsRecurring"] != null ? Convert.ToBoolean(RecurringParagraph.Item["IsRecurring"].ToString()) : false; 171 172 RecurringEvent.Recurring.Repeats = RecurringParagraph.Item["RecurringRepeats"] != null ? RecurringParagraph.Item["RecurringRepeats"].ToString() : string.Empty; 173 RecurringEvent.Recurring.RepeatsWeeks = RecurringParagraph.Item["RecurringRepeatsWeeks"] != null ? Convert.ToInt32(RecurringParagraph.Item["RecurringRepeatsWeeks"].ToString()) : 0; 174 RecurringEvent.Recurring.RepeatsDays = RecurringParagraph.Item["RecurringRepeatsDays"] != null ? RecurringParagraph.Item["RecurringRepeatsDays"].ToString() : string.Empty; 175 RecurringEvent.Recurring.StopRepeatingAfter = RecurringParagraph.Item["StopRepeatingAfter"] != null ? Convert.ToInt32(RecurringParagraph.Item["StopRepeatingAfter"].ToString()) : 0; 176 RecurringEvent.Recurring.StopRepeatingOn = RecurringParagraph.Item["StopRepeatingOn"] != null ? Convert.ToDateTime(RecurringParagraph.Item["StopRepeatingOn"].ToString()) : new DateTime(); 177 178 RecurringEvent.Recurring.DatesExcluded = new List<DateTime>(); 179 RecurringEvent.Recurring.DatesIncluded = new List<DateTime>(); 180 181 if (RecurringParagraph.Item["DateExcluded1"] != null) 182 { 183 RecurringEvent.Recurring.DatesExcluded.Add(Convert.ToDateTime(RecurringParagraph.Item["DateExcluded1"].ToString())); 184 } 185 if (RecurringParagraph.Item["DateExcluded2"] != null) 186 { 187 RecurringEvent.Recurring.DatesExcluded.Add(Convert.ToDateTime(RecurringParagraph.Item["DateExcluded2"].ToString())); 188 } 189 if (RecurringParagraph.Item["DateExcluded3"] != null) 190 { 191 RecurringEvent.Recurring.DatesExcluded.Add(Convert.ToDateTime(RecurringParagraph.Item["DateExcluded3"].ToString())); 192 } 193 194 if (RecurringParagraph.Item["DateIncluded1"] != null) 195 { 196 RecurringEvent.Recurring.DatesIncluded.Add(Convert.ToDateTime(RecurringParagraph.Item["DateIncluded1"].ToString())); 197 } 198 if (RecurringParagraph.Item["DateIncluded2"] != null) 199 { 200 RecurringEvent.Recurring.DatesIncluded.Add(Convert.ToDateTime(RecurringParagraph.Item["DateIncluded2"].ToString())); 201 } 202 if (RecurringParagraph.Item["DateIncluded3"] != null) 203 { 204 RecurringEvent.Recurring.DatesIncluded.Add(Convert.ToDateTime(RecurringParagraph.Item["DateIncluded3"].ToString())); 205 } 206 207 RecurringEvent.Location.Name = RecurringParagraph.Item["LocationName"] != null ? RecurringParagraph.Item["LocationName"].ToString() : string.Empty; 208 RecurringEvent.Location.Address = RecurringParagraph.Item["LocationAddress"] != null ? RecurringParagraph.Item["LocationAddress"].ToString() : string.Empty; 209 210 RecurringEvent.Organizer.Name = RecurringParagraph.Item["OrganizerName"] != null ? RecurringParagraph.Item["OrganizerName"].ToString() : string.Empty; 211 RecurringEvent.Organizer.Email = RecurringParagraph.Item["OrganizerEmail"] != null ? RecurringParagraph.Item["OrganizerEmail"].ToString() : string.Empty; 212 RecurringEvent.Organizer.Phone = RecurringParagraph.Item["OrganizerPhone"] != null ? RecurringParagraph.Item["OrganizerPhone"].ToString() : string.Empty; 213 RecurringEvent.Organizer.PossiblyUnion = RecurringParagraph.Item["OrganizerPossiblyUnion"] != null ? RecurringParagraph.Item["OrganizerPossiblyUnion"].ToString() : string.Empty; 214 215 RecurringEvent.Payment = RecurringParagraph.Item["Payment"] != null ? RecurringParagraph.Item["Payment"].ToString() : string.Empty; 216 RecurringEvent.Price = RecurringParagraph.Item["Price"] != null ? Convert.ToDouble(RecurringParagraph.Item["Price"].ToString()) : 0; 217 218 RecurringEvent.RequiresRegistration = RecurringParagraph.Item["RequiresEventRegistration"] != null ? Convert.ToBoolean(RecurringParagraph.Item["RequiresEventRegistration"].ToString()) : false; 219 220 RecurringEvent.Registration.HomePage = RecurringParagraph.Item["RegistrationHomepage"] != null ? RecurringParagraph.Item["RegistrationHomepage"].ToString() : string.Empty; 221 222 RecurringEvent.Acceptance = RecurringParagraph.Item["Acceptance"] != null ? Convert.ToBoolean(RecurringParagraph.Item["Acceptance"].ToString()) : false; 223 224 RecurringEvent.Category.PageId = RecurringParagraph.PageID; 225 226 RecurringEvent.DetailUrl = string.Format("{0}&itemId={1}:{2}", pageDetailUrl, RecurringParagraph.ItemType, RecurringParagraph.Item.Id); 227 228 Dynamicweb.Content.Page CategoryPage = Dynamicweb.Services.Pages.GetPage(RecurringEvent.Category.PageId); 229 RecurringEvent.Category.Name = CategoryPage.MenuText; 230 RecurringEvent.Category.ItemId = CategoryPage.ItemId; 231 RecurringEvent.Category.Color = CategoryPage.Item != null && CategoryPage.Item["Color"] != null ? CategoryPage.Item["Color"].ToString() : "#0f6b9e"; 232 233 if (RecurringEvent.Recurring.DatesIncluded.Any()) 234 { 235 foreach (DateTime IncludedDate in RecurringEvent.Recurring.DatesIncluded) 236 { 237 Event NewRecurringEvent = new Event(); 238 NewRecurringEvent = RecurringEvent.CopyEvent(); 239 240 NewRecurringEvent.StartDateTime = IncludedDate; 241 NewRecurringEvent.EndDateTime = IncludedDate; 242 NewRecurringEvent.DetailUrl = string.Format("{0}&itemId={1}:{2}&d={3}", pageDetailUrl, RecurringParagraph.ItemType, RecurringParagraph.Item.Id, NewRecurringEvent.StartDateTime); 243 244 if (DateTime.Compare(DateTime.Now, NewRecurringEvent.StartDateTime) < 0 && !RecurringEvent.Recurring.DatesExcluded.Any(d => d.Date.Equals(NewRecurringEvent.StartDateTime.Date))) 245 { 246 Events = Events.Append(NewRecurringEvent); 247 } 248 } 249 } 250 251 int weeks_loop = RecurringEvent.Recurring.RepeatsWeeks > 0 ? RecurringEvent.Recurring.RepeatsWeeks : 1, 252 days_loop = 7 * weeks_loop, 253 occurrences_counter = 0, 254 occurrences_max = RecurringEvent.Recurring.StopRepeatingAfter > 0 ? (RecurringEvent.Recurring.StopRepeatingAfter) : 99999999; 255 256 if (RecurringEvent.Recurring.Repeats.Equals("weekly") && string.IsNullOrEmpty(RecurringEvent.Recurring.RepeatsDays)) 257 { 258 for (var EventDay = RecurringEvent.StartDateTime; EventDay <= RecurringEvent.Recurring.StopRepeatingOn.AddDays(1); EventDay = EventDay.AddDays(days_loop)) 259 { 260 occurrences_counter++; 261 262 Event NewRecurringEvent = new Event(); 263 NewRecurringEvent = RecurringEvent.CopyEvent(); 264 265 NewRecurringEvent.StartDateTime = EventDay; 266 NewRecurringEvent.EndDateTime = EventDay; 267 NewRecurringEvent.DetailUrl = string.Format("{0}&itemId={1}:{2}&d={3}", pageDetailUrl, RecurringParagraph.ItemType, RecurringParagraph.Item.Id, NewRecurringEvent.StartDateTime); 268 269 if (DateTime.Compare(DateTime.Now, NewRecurringEvent.StartDateTime) < 0 && 270 !RecurringEvent.Recurring.DatesExcluded.Any(d => d.Date.Equals(NewRecurringEvent.StartDateTime.Date)) && 271 occurrences_counter <= occurrences_max) 272 { 273 Events = Events.Append(NewRecurringEvent); 274 } 275 } 276 } 277 else if (RecurringEvent.Recurring.Repeats.Equals("daily") || !string.IsNullOrEmpty(RecurringEvent.Recurring.RepeatsDays)) 278 { 279 days_loop = 1; 280 281 String[] RepeatsDays = !string.IsNullOrEmpty(RecurringEvent.Recurring.RepeatsDays) ? RecurringEvent.Recurring.RepeatsDays.Split(',') : null; 282 String[] Days = { "sun", "mon", "tue", "wed", "thu", "fri", "sat" }; 283 284 for (var EventDay = RecurringEvent.StartDateTime; EventDay <= RecurringEvent.Recurring.StopRepeatingOn.AddDays(1); EventDay = EventDay.AddDays(days_loop)) 285 { 286 if (RepeatsDays == null || RepeatsDays.Contains(Days[(int)System.Globalization.CultureInfo.InvariantCulture.Calendar.GetDayOfWeek(EventDay)])) 287 { 288 289 occurrences_counter++; 290 291 Event NewRecurringEvent = new Event(); 292 NewRecurringEvent = RecurringEvent.CopyEvent(); 293 294 NewRecurringEvent.StartDateTime = EventDay; 295 NewRecurringEvent.EndDateTime = EventDay; 296 NewRecurringEvent.DetailUrl = string.Format("{0}&itemId={1}:{2}&d={3}", pageDetailUrl, RecurringParagraph.ItemType, RecurringParagraph.Item.Id, NewRecurringEvent.StartDateTime); 297 298 if (DateTime.Compare(DateTime.Now, NewRecurringEvent.StartDateTime) < 0 && 299 !RecurringEvent.Recurring.DatesExcluded.Any(d => d.Date.Equals(NewRecurringEvent.StartDateTime.Date)) && 300 occurrences_counter <= occurrences_max) 301 { 302 Events = Events.Append(NewRecurringEvent); 303 } 304 305 } 306 307 308 } 309 } 310 else if (RecurringEvent.Recurring.Repeats.Equals("monthly")) 311 { 312 for (var EventDay = RecurringEvent.StartDateTime; EventDay <= RecurringEvent.Recurring.StopRepeatingOn.AddDays(1); EventDay = EventDay.AddMonths(1)) 313 { 314 occurrences_counter++; 315 316 Event NewRecurringEvent = new Event(); 317 NewRecurringEvent = RecurringEvent.CopyEvent(); 318 319 NewRecurringEvent.StartDateTime = EventDay; 320 NewRecurringEvent.EndDateTime = EventDay; 321 NewRecurringEvent.DetailUrl = string.Format("{0}&itemId={1}:{2}&d={3}", pageDetailUrl, RecurringParagraph.ItemType, RecurringParagraph.Item.Id, NewRecurringEvent.StartDateTime); 322 323 if (DateTime.Compare(DateTime.Now, NewRecurringEvent.StartDateTime) < 0 && 324 !RecurringEvent.Recurring.DatesExcluded.Any(d => d.Date.Equals(NewRecurringEvent.StartDateTime.Date)) && 325 occurrences_counter <= occurrences_max) 326 { 327 Events = Events.Append(NewRecurringEvent); 328 } 329 } 330 } 331 332 } 333 334 } 335 336 Events = Events.OrderBy(ev => ev.StartDateTime).Take(GetInteger("ItemPublisher:Items.Count")); 337 338 // End Recurring Events 339 340 int eventsCounter = Events.Count(), 341 eventsTotalCount = eventsCounter; 342 343 string eventsPageName = Pageview.Page.MenuText, 344 eventsParagraphName = Pageview.CurrentParagraph.Header, 345 eventsTitle = eventsParagraphName; 346 347 /* Pagination */ 348 349 int itemsPerPage = 12, 350 pageSize = itemsPerPage == 0 ? 12 : itemsPerPage, 351 page = 1, 352 totalItems = eventsCounter; 353 354 int.TryParse(Sanitize.Parameter("p", ParameterType.Number), out page); 355 356 int totalPages = (int) Math.Ceiling((double) totalItems / pageSize); 357 358 if (page > totalPages) 359 { 360 page = totalPages; 361 } 362 else if (page < 1) 363 { 364 page = 1; 365 } 366 367 Events = Events.Skip((page - 1) * pageSize).Take(pageSize); 368 369 bool hasResults = Events.Any(); 370 371 } 372 373 <div id="events-@(paragraphId)" class="events-container events-list-container container-fluid" data-view="List"> 374 <div class="events-list-head"> 375 <h2 class="events-title">@eventsTitle</h2> 376 <div class="events-actions"> 377 <a href="/global/events" class="event-action-button btn btn-primary"> 378 @Translate("All Events", "All Events") 379 </a> 380 <a href="/global/events/create" class="event-action-button btn btn-primary"> 381 @Translate("Create Event", "Create Event") 382 </a> 383 </div> 384 </div> 385 <div class="events-list-container"> 386 387 <div class="events-list-results row" data-has-results="@hasResults"> 388 389 @if (Events.Any()) 390 { 391 <ul class="events-list row"> 392 @foreach (Event CalendarEvent in Events) 393 { 394 395 string eventClass = "event-item col-xs-12 col-md-4", 396 eventDate = string.Empty, 397 eventUrl = string.Format("{0}&cat={1}",CalendarEvent.DetailUrl, CalendarEvent.Category.PageId), 398 eventHeader = string.Format("{0}{1}", CalendarEvent.GetFormatDates(), CalendarEvent.Category.Name.ToLower().Equals("place2book") ? string.Empty : "<br/>"+CalendarEvent.Category.Name); 399 400 bool hasEvent = !string.IsNullOrEmpty(CalendarEvent.Id); 401 402 if (hasEvent) 403 { 404 405 <li class="@(eventClass)" data-color="@(CalendarEvent.Category.Color)"> 406 <a href="@(eventUrl)" title="@Translate("Read More", "Read More")"> 407 <div class="event-item-container"> 408 <div class="event-header" style="border-color: @(CalendarEvent.Category.Color);"> 409 <span style="color: @(CalendarEvent.Category.Color);">@(eventHeader)</span> 410 </div> 411 412 @if (!string.IsNullOrEmpty(CalendarEvent.Image)) 413 { 414 //CalendarEvent.Image = string.Format("{0}?width=600&height=600&anchor=center&mode=crop", CalendarEvent.Image); 415 CalendarEvent.Image = string.Format("/Admin/Public/GetImage.ashx?width=600&height=600&crop=5&Compression=75&image={0}", CalendarEvent.Image); 416 <figure class="event-image"> 417 <img src="@(CalendarEvent.Image)" class="img-responsive" alt="@(CalendarEvent.Title)" /> 418 </figure> 419 } 420 421 @if (!string.IsNullOrEmpty(CalendarEvent.Title)) 422 { 423 <h2 class="event-title"> 424 <span> 425 @(CalendarEvent.Title) 426 </span> 427 </h2> 428 } 429 430 <ul> 431 <li> 432 <span class="event-label">@Translate("Date", "Date"):</span> 433 <div class="event-values"> 434 @CalendarEvent.GetFullDates() 435 </div> 436 </li> 437 438 439 @if (!string.IsNullOrEmpty(CalendarEvent.GetFullTimes())) 440 { 441 <li> 442 <span class="event-label">@Translate("Time", "Time"):</span> 443 <div class="event-values"> 444 @CalendarEvent.GetFullTimes() 445 </div> 446 </li> 447 } 448 449 @if (!string.IsNullOrEmpty(CalendarEvent.Location.Name)) 450 { 451 <li> 452 <span class="event-label">@Translate("Location", "Location"):</span> 453 <div class="event-values"> 454 @(CalendarEvent.Location.Name) 455 </div> 456 </li> 457 458 } 459 460 @if (CalendarEvent.Price > 0 || (!string.IsNullOrEmpty(CalendarEvent.Payment) && !CalendarEvent.Payment.Equals("payment1"))) 461 { 462 <li> 463 <span class="event-label">@Translate("Price", "Price")</span> 464 <div class="event-values"> 465 @(string.Format("{0:0.00}", CalendarEvent.Price)) 466 </div> 467 </li> 468 469 } 470 else 471 { 472 <li> 473 <span class="event-label">@Translate("Free", "Free")</span> 474 </li> 475 476 } 477 </ul> 478 </div> 479 </a> 480 @if (!string.IsNullOrEmpty(CalendarEvent.Registration.HomePage)) 481 { 482 <a href="@(CalendarEvent.Registration.HomePage)" class="event-registration-button btn btn-primary" target="_blank" > 483 @Translate("Signup", "Signup") 484 </a> 485 } 486 @* 487 <a href="@(eventUrl)" class="event-registration-button btn btn-primary"> 488 @Translate("Read More", "Read More") 489 </a> 490 *@ 491 </li> 492 } 493 } 494 </ul> 495 } 496 else 497 { 498 <div class="events-no-results"> 499 <p> 500 <h3>@Translate("No Results", "No Results")</h3> 501 </p> 502 </div> 503 } 504 505 </div> 506 507 </div> 508 509 @if (totalPages > 1 && page < totalPages) 510 { 511 NameValueCollection queryPageParameters = HttpUtility.ParseQueryString(Dynamicweb.Context.Current.Request.Url.Query); 512 queryPageParameters.Set("p", (page + 1).ToString()); 513 System.Uri pageUrl = Urls.BuildUri(Tools.GetCurrentUrl(true) + Dynamicweb.Context.Current.Request.Path, queryPageParameters); 514 515 <div class="events-load-more col-12"> 516 <div class="events-load-more-actions"> 517 <a class="load-more btn btn-primary" href="@pageUrl"> 518 <span>@Translate("View More", "View More")</span> 519 <span class="arrow"></span> 520 </a> 521 </div> 522 </div> 523 } 524 525 </div> 526 527 @SnippetStart("StyleSheetHead") 528 <link rel="stylesheet" href="~/Files/Templates/Designs/bleau-solutionset/assets/stylesheets/jquery-ui.min.css" media="screen"> 529 <link rel="stylesheet" href="~/Files/Templates/Designs/bleau-solutionset/assets/modules/bleau-calendar/css/style.min.css" media="screen"> 530 @SnippetEnd("StyleSheetHead") 531 532 @SnippetStart("JavaScriptHead") 533 <script type="text/javascript" src="~/Files/Templates/Designs/bleau-solutionset/assets/vendor/jquery-ui.min.js"></script> 534 <script type="text/javascript" src="~/Files/Templates/Designs/bleau-solutionset/assets/modules/bleau-calendar/js/main.js"></script> 535 <script type="text/javascript"> 536 $(function () { 537 BleauCalendar.Events().List().load({id:'events-@(paragraphId)'}); 538 }); 539 </script> 540 @SnippetEnd("JavaScriptHead") 541