Error executing template "Designs/Dwsimple/Paragraph/KalenderListe.cshtml"
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
   at System.Net.HttpWebRequest.GetResponse()
   at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at CompiledRazorTemplates.Dynamic.RazorEngine_e796b3ad40644827a6381a88d8ee2924.<kasse>b__24_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Skovbo Data\shkirker.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\KalenderListe.cshtml:line 1428
   at CompiledRazorTemplates.Dynamic.RazorEngine_e796b3ad40644827a6381a88d8ee2924.<kalendertype>b__19_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Skovbo Data\shkirker.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\KalenderListe.cshtml:line 427
   at CompiledRazorTemplates.Dynamic.RazorEngine_e796b3ad40644827a6381a88d8ee2924.Execute() in D:\dynamicweb.net\Solutions\Skovbo Data\shkirker.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\KalenderListe.cshtml:line 273
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Xml.Linq; 2 @using System.Text; 3 @using System.Globalization; 4 @using Dynamicweb.Forms; 5 @using System.Web; 6 @using Dynamicweb.Frontend; 7 8 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 9 @{ 10 init(); 11 } 12 13 @functions { 14 private int columnsWritten { get; set; } 15 private int columns { get; set; } 16 17 public void init() 18 { 19 columnsWritten = Dynamicweb.Core.Converter.ToInt32(System.Web.HttpContext.Current.Items["currentColumns"]); 20 columns = GetInteger("Item.Width"); 21 System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + GetInteger("Item.Width"); 22 } 23 24 public void Fluid() 25 { 26 columnsWritten = Dynamicweb.Core.Converter.ToInt32(System.Web.HttpContext.Current.Items["currentColumns"]); 27 columns = 12; 28 System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + 12; 29 } 30 31 public string ColumnClass() 32 { 33 if (GetString("Item.WidthMobile") == "hide"){ 34 return "col-md-" + GetString("Item.Width") + " hidden-xs"; 35 } else { 36 return "col-md-" + GetString("Item.Width") + " col-xs-" + GetString("Item.WidthMobile"); 37 } 38 } 39 40 public string NewRow() 41 { 42 //return columns + " - " + columnsWritten + ">"; 43 44 if (columns + columnsWritten > 12) 45 { 46 System.Web.HttpContext.Current.Items["currentColumns"] = columns; 47 //return "</div><div class=\"row\">"; 48 return "</div><div class=\"flex-container\">"; 49 } 50 else 51 { 52 return string.Empty; 53 } 54 55 } 56 57 public string NewRowParagraphExtended() 58 { 59 if (columns + columnsWritten > 12) 60 { 61 System.Web.HttpContext.Current.Items["currentColumns"] = columns; 62 return "</div><div class=\"flex-container\">"; 63 } 64 else if (columnsWritten == 0) 65 { 66 return "<div class=\"flex-container\">"; 67 } 68 else 69 { 70 return string.Empty; 71 } 72 73 } 74 } 75 @using System.Text.RegularExpressions 76 @using System.Web 77 78 79 @functions{ 80 public class WrapMethods 81 { 82 //Gets the contrasting color 83 public static string getContrastYIQ(string hexcolor) 84 { 85 if (hexcolor != "") 86 { 87 hexcolor = Regex.Replace(hexcolor, "[^0-9a-zA-Z]+", ""); 88 89 int r = Convert.ToByte(hexcolor.Substring(0, 2), 16); 90 int g = Convert.ToByte(hexcolor.Substring(2, 2), 16); 91 int b = Convert.ToByte(hexcolor.Substring(4, 2), 16); 92 int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 93 94 if (yiq >= 128) 95 { 96 return "black"; 97 } 98 else 99 { 100 return "white"; 101 } 102 } 103 else 104 { 105 return "black"; 106 } 107 } 108 109 110 //Truncate text 111 public static string Truncate (string value, int count, bool strip=true) 112 { 113 if (strip == true){ 114 value = StripHtmlTagByCharArray(value); 115 } 116 117 if (value.Length > count) 118 { 119 value = value.Substring(0, count + 1) + "..."; 120 } 121 122 return value; 123 } 124 125 126 //Strip text from HTML 127 public static string StripHtmlTagByCharArray(string htmlString) 128 { 129 char[] array = new char[htmlString.Length]; 130 int arrayIndex = 0; 131 bool inside = false; 132 133 for (int i = 0; i < htmlString.Length; i++) 134 { 135 char let = htmlString[i]; 136 if (let == '<') 137 { 138 inside = true; 139 continue; 140 } 141 if (let == '>') 142 { 143 inside = false; 144 continue; 145 } 146 if (!inside) 147 { 148 array[arrayIndex] = let; 149 arrayIndex++; 150 } 151 } 152 return new string(array, 0, arrayIndex); 153 } 154 155 //Make the correct count of columns 156 public static string ColumnMaker(int Col, string ScreenSize) 157 { 158 string Columns = ""; 159 160 switch (Col) 161 { 162 case 1: 163 Columns = "col-"+ScreenSize+"-12"; 164 break; 165 166 case 2: 167 Columns = "col-"+ScreenSize+"-6"; 168 break; 169 170 case 3: 171 Columns = "col-"+ScreenSize+"-4"; 172 break; 173 174 case 4: 175 Columns = "col-"+ScreenSize+"-3"; 176 break; 177 178 default: 179 Columns = "col-"+ScreenSize+"-3"; 180 break; 181 } 182 183 return Columns; 184 } 185 186 187 private string Custom(string firstoption, string secondoption) 188 { 189 if (firstoption == "custom") 190 { 191 return secondoption; 192 } 193 else 194 { 195 return firstoption; 196 } 197 } 198 } 199 } 200 201 <script type="text/javascript" src="/Files/Templates/Designs/Dwsimple/js/pagination.js"></script> 202 <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> 203 <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script> 204 <script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min.js'></script> 205 <script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.1/js/bootstrap-datepicker.min.js'></script> 206 @{ 207 208 209 <style> 210 211 .datobgcolor { 212 background-color: @GetString("Item.DatoBGColor.Color"); 213 } 214 215 </style> 216 } 217 218 @functions 219 { 220 221 string StartFormdate = HttpContext.Current.Request.Form["dato-start"]; 222 string StartQsdate = HttpContext.Current.Request.QueryString["startd"]; 223 string EndDate = ""; 224 string StartDate = ""; 225 } 226 227 228 @NewRowParagraphExtended() 229 230 <div class="@ColumnClass() dist2nxtblk"> 231 232 @if (@GetString("Item.EqualContentHeight")=="True") 233 { 234 <text> 235 <div class="@GetString("Item.ContentStyle") Special-Col-Style Special-Col-height" style="background-color: @GetString("Item.BackgroundColor.Color")"> 236 </text> 237 } 238 else 239 { 240 <text> 241 <div class="@GetString("Item.ContentStyle") Special-Col-Style" style="background-color: @GetString("Item.BackgroundColor.Color")"> 242 </text> 243 244 } 245 246 @if (GetString("Item.Order") == "title-first" || GetString("Item.Order") == "") 247 { 248 string plac=GetString("Item.TitlePlacement"); 249 250 if (plac=="") 251 { 252 plac="left"; 253 } 254 255 if (GetBoolean("Item.VisTitel") != false){ 256 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 257 <h1 class="dw-section-title" style="text-align: @plac"> 258 <span>@GetString("Item.Titel")</span> 259 </h1> 260 <br> 261 } 262 } else { 263 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 264 } 265 266 267 @RenderImage() 268 269 if (GetBoolean("Item.CalendarSearch") != false){ 270 @daterange()<!-- @daterange() --> 271 } 272 273 @kalendertype() 274 } 275 276 @if (GetString("Item.Order") == "image-first") 277 { 278 string plac=GetString("Item.TitlePlacement"); 279 280 if (plac=="") 281 { 282 plac="left"; 283 } 284 285 @RenderImage() 286 if (GetBoolean("Item.VisTitel") != false){ 287 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 288 <h1 class="dw-section-title" style="text-align: @plac"> 289 <span>@GetString("Item.Titel")</span> 290 </h1> 291 <br> 292 } 293 } else { 294 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 295 } 296 297 298 @kalendertype() 299 } 300 301 302 303 @if (GetString("Item.Order") == "icon-xs") 304 { 305 306 string plac=GetString("Item.TitlePlacement"); 307 308 if (plac=="") 309 { 310 plac="left"; 311 } 312 313 <div class="col-md-2"> 314 @RenderImage() 315 </div> 316 317 <div class="col-md-10"> 318 @if (GetBoolean("Item.VisTitel") != false){ 319 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 320 <h1 class="dw-section-title" style="text-align: @plac"> 321 <span>@GetString("Item.Titel")</span> 322 </h1> 323 <br> 324 } 325 } else { 326 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 327 } 328 329 330 </div> 331 @kalendertype() 332 } 333 334 @if (GetString("Item.Order") == "icon-sm") 335 { 336 337 string plac=GetString("Item.TitlePlacement"); 338 339 if (plac=="") 340 { 341 plac="left"; 342 } 343 344 <div class="col-md-3"> 345 @RenderImage() 346 </div> 347 348 <div class="col-md-9"> 349 @if (GetBoolean("Item.VisTitel") != false){ 350 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 351 <h1 class="dw-section-title" style="text-align: @plac"> 352 <span>@GetString("Item.Titel")</span> 353 <br> 354 </h1> 355 <br> 356 } 357 } else { 358 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 359 } 360 </div> 361 @kalendertype() 362 } 363 364 @if (GetString("Item.Order") == "icon-md") 365 { 366 367 string plac=GetString("Item.TitlePlacement"); 368 369 if (plac=="") 370 { 371 plac="left"; 372 } 373 374 <div class="col-md-4"> 375 @RenderImage() 376 </div> 377 378 <div class="col-md-8"> 379 @if (GetBoolean("Item.VisTitel") != false){ 380 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 381 <h1 class="dw-section-title" style="text-align: @plac"> 382 <span>@GetString("Item.Titel")</span> 383 </h1> 384 <br> 385 } 386 } else { 387 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 388 } 389 390 </div> 391 @kalendertype() 392 } 393 </div> 394 </div> 395 396 @helper daterange(){ 397 398 string pathx=""; 399 <script type="text/javascript">@pathx = window.location.href.split('?')[0] + "/Default.aspx?ID=10593&Purge=True"</script> 400 401 <form method="post" action="@pathx" id="myForm" name="myForm"> 402 <table> 403 <tr> 404 <td><input type="text" id="dato-start" name="dato-start" class="start-date form-control ic-input-small" placeholder="Dato fra" value="" ></td> 405 <td><input type="text" id="dato-slut" name="dato-slut" class="end-date form-control ic-input-small" placeholder="Dato til" value=""></td> 406 <td><button type="submit" class="btn btn-primary fa fa-search ic-button"></button></td> 407 </tr> 408 </table> 409 <br> 410 </form> 411 412 <script type="text/javascript" src="/Files/Templates/Designs/Dwsimple/js/DateRange.js"></script> 413 } 414 415 @helper kalendertype(){ 416 if (@GetString("Item.LayoutMode") == "ballon") { 417 @Ballon() 418 } 419 420 if (@GetString("Item.LayoutMode") == "list") { 421 <p class="list-item-info nomargin">(Tryk på aktiviten for at se detaljer)</p><p></p> 422 423 @List() 424 } 425 426 if (@GetString("Item.LayoutMode") == "kasse") { 427 @kasse() 428 } 429 430 if (@GetString("Item.LayoutMode") == "kompliste") { 431 @kompliste() 432 } 433 434 if (@GetString("Item.LayoutMode") == "billeder") { 435 @Billeder() 436 } 437 } 438 439 @helper Billeder(){ 440 <ul class="list-listings blog-list"> 441 <div class="calendar-view u-flex u-justify-content-center"> 442 <div class="ui link items ui-width"> 443 @{ 444 string sognekode = GetString("Item.Sognekode"); 445 string kalenderkonto = GetString("Item.AccountNumber"); 446 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 447 448 int StartSide = 1; 449 450 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 451 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 452 } 453 454 if (GetBoolean("Item.StartDateNow") == false){ 455 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 456 } 457 458 459 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 460 461 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 462 463 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 464 465 StartDate=HttpContext.Current.Request.QueryString["startd"]; 466 467 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 468 469 StartDate=HttpContext.Current.Request.Form["dato-start"]; 470 471 }else{ 472 473 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 474 475 } 476 477 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 478 479 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 480 } 481 482 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 483 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 484 }else{ 485 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 486 } 487 488 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 489 490 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 491 } 492 493 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 494 495 if (GetString("Item.Show.Filter") != "alle"){ 496 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 497 } 498 499 int tael=0; 500 int antalRecs=1; 501 int rk=1; 502 int skiprecs = 0; 503 504 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 505 506 XDocument xdoc = XDocument.Load(linkstring); 507 var elements = xdoc.Element("DATA").Elements("AFTALE"); 508 509 foreach (var el in elements.Skip(skiprecs)) 510 { 511 string id = "0"; 512 string type = "alle"; 513 DateTime date; 514 string title = "Title"; 515 string description = "Description"; 516 string fulldate = "Date"; 517 string cleanDate = ""; 518 string day = ""; 519 string month = ""; 520 string location = ""; 521 string document = GetString("Item.StdImage"); 522 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 523 524 525 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 526 527 528 529 switch (GetString("Item.Width")){ 530 case "12": 531 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 532 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 533 }else{ 534 rk = 15; 535 } 536 break; 537 case "9": 538 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 539 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 540 }else{ 541 rk = 15; 542 } 543 break; 544 case "6": 545 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 546 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 547 }else{ 548 rk = 10; 549 } 550 break; 551 case "3": 552 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 553 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 554 }else{ 555 rk = 5; 556 } 557 break; 558 case "8": 559 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 560 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 561 }else{ 562 rk = 15; 563 } 564 break; 565 case "4": 566 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 567 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 568 }else{ 569 rk = 5; 570 } 571 break; 572 } 573 574 tael+=1; 575 576 if (tael > antalRecs){ 577 break; 578 } 579 580 if (el.Elements("ID").Any()){ 581 id = el.Element("ID").Value; 582 } 583 584 if (el.Elements("AFTALETYPE").Any()){ 585 type = el.Element("AFTALETYPE").Value; 586 } 587 588 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 589 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 590 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 591 day = date.ToString(" d", new CultureInfo("da-DK")); 592 month = date.ToString("MMM", new CultureInfo("da-DK")); 593 } 594 595 if (el.Elements("OVERSKRIFT").Any()){ 596 title = el.Element("OVERSKRIFT").Value; 597 } 598 599 if (el.Elements("BESKRIVELSE").Any()){ 600 description = el.Element("BESKRIVELSE").Value; 601 } 602 603 if (el.Elements("DATO_FORMATERET").Any()){ 604 fulldate = el.Element("DATO_FORMATERET").Value; 605 } 606 607 if (el.Elements("STED").Any()){ 608 location = el.Element("STED").Value; 609 } 610 611 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 612 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 613 } 614 615 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 616 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 617 } 618 619 <a class="item u-align-items-center page-1 row-1 " id="node-10075788" href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id" style="display: flex;"> 620 621 <div class="ui medium image"> 622 623 @if (document != ""){ 624 if (document_type == "OFFENTLIGT_AFTALE_BILLEDE"){ 625 <img class="img-responsive" src="@document" alt="" id="@(id)_img" style="max-height: 200px; float:right; position: relative;"></img> 626 }else{ 627 <img class="img-responsive" src="@GetString("Item.StdImage")" alt="" id="@(id)_img" style="max-height: 200px; float:right; position: relative;"></img> 628 } 629 } 630 631 <div class="blockdate" style="background-color: @GetString("Item.DatoBGColor.Color")"> 632 <div class="ui header"> 633 <div class="date__day">@day</div> 634 <div class="sub header">@month</div> 635 </div> 636 </div> 637 </div> 638 639 <div class="ic-textelm"> 640 641 <span class="ic-heading">@title</span> 642 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 643 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 644 @if (!string.IsNullOrEmpty(description)) 645 { 646 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-bookmark"></i> @WrapMethods.Truncate(description, int.Parse(TruncateLength()))</p> 647 } 648 </div> 649 </a> 650 } 651 } 652 </div> 653 </div> 654 </ul> 655 656 if (GetBoolean("Item.Pagination") != false){ 657 658 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 659 string[] urlSplit = OrigUrl.Split('?'); 660 661 <!-- Find side indeling --> 662 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 663 } 664 } 665 666 @helper Ballon(){ 667 <ul class="list-listings blog-list"> 668 <div class="calendar-view u-flex u-justify-content-center"> 669 <div class="ui link items ui-width"> 670 @{ 671 string sognekode = GetString("Item.Sognekode"); 672 string kalenderkonto = GetString("Item.AccountNumber"); 673 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 674 675 int StartSide = 1; 676 677 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 678 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 679 } 680 681 if (GetBoolean("Item.StartDateNow") == false){ 682 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 683 } 684 685 686 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 687 688 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 689 690 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 691 692 StartDate=HttpContext.Current.Request.QueryString["startd"]; 693 694 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 695 696 StartDate=HttpContext.Current.Request.Form["dato-start"]; 697 698 }else{ 699 700 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 701 702 } 703 704 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 705 706 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 707 } 708 709 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 710 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 711 }else{ 712 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 713 } 714 715 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 716 717 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 718 } 719 720 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 721 722 if (GetString("Item.Show.Filter") != "alle"){ 723 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 724 } 725 726 int tael=0; 727 int antalRecs=1; 728 int rk=1; 729 int skiprecs = 0; 730 731 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 732 733 XDocument xdoc = XDocument.Load(linkstring); 734 var elements = xdoc.Element("DATA").Elements("AFTALE"); 735 736 foreach (var el in elements.Skip(skiprecs)) 737 { 738 string id = "0"; 739 string type = "alle"; 740 DateTime date; 741 string title = "Title"; 742 string description = "Description"; 743 string fulldate = "Date"; 744 string cleanDate = ""; 745 string day = ""; 746 string month = ""; 747 string location = ""; 748 string document = GetString("Item.StdImage"); 749 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 750 string ShowInfo = "Closed"; 751 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 752 string filnavn= ""; 753 Dictionary<string, string> domains = new Dictionary<string, string>(); 754 755 756 757 switch (GetString("Item.Width")){ 758 case "12": 759 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 760 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 761 }else{ 762 rk = 15; 763 } 764 break; 765 case "9": 766 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 767 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 768 }else{ 769 rk = 15; 770 } 771 break; 772 case "6": 773 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 774 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 775 }else{ 776 rk = 10; 777 } 778 break; 779 case "3": 780 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 781 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 782 }else{ 783 rk = 5; 784 } 785 break; 786 case "8": 787 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 788 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 789 }else{ 790 rk = 15; 791 } 792 break; 793 case "4": 794 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 795 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 796 }else{ 797 rk = 5; 798 } 799 break; 800 } 801 802 tael+=1; 803 804 if (tael > antalRecs){ 805 break; 806 } 807 808 if (el.Elements("ID").Any()){ 809 id = el.Element("ID").Value; 810 } 811 812 if (el.Elements("AFTALETYPE").Any()){ 813 type = el.Element("AFTALETYPE").Value; 814 } 815 816 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 817 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 818 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 819 day = date.ToString(" d", new CultureInfo("da-DK")); 820 month = date.ToString("MMM", new CultureInfo("da-DK")); 821 } 822 823 if (el.Elements("OVERSKRIFT").Any()){ 824 title = el.Element("OVERSKRIFT").Value; 825 } 826 827 if (el.Elements("BESKRIVELSE").Any()){ 828 description = el.Element("BESKRIVELSE").Value; 829 } 830 831 if (el.Elements("DATO_FORMATERET").Any()){ 832 fulldate = el.Element("DATO_FORMATERET").Value; 833 } 834 835 if (el.Elements("STED").Any()){ 836 location = el.Element("STED").Value; 837 } 838 839 840 841 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 842 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 843 } 844 845 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 846 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 847 } 848 <!-- 849 IEnumerable<XElement> allGrandChildren = from elx in elements.Elements("OFFENTLIGE_DOKUMENTER").Elements() select elx; 850 foreach (XElement elx in allGrandChildren){ 851 852 document = "https://kalender.brandsoft.dk/bska/" + elx.Element("URL").Value; 853 filnavn=elx.Element("ORG_FILNAVN").Value; 854 855 if (document_type == "OFFENTLIGT_DOKUMENT"){ 856 domains.Add(@filnavn, @document); 857 } 858 859 } 860 861 --> 862 863 <a href="javascript:void(0);" onclick="toggle_visibility('@id');"> 864 865 <div class="row"> 866 <div class="media col-md-12"> 867 <div class="media-left"> 868 <div class="media-object calendar-date text-center" style="background-color: @GetString("Item.DatoBGColor.Color")"><span>@day</span> @month</div> 869 870 </div> 871 <div class="media-body"> 872 <h2 class="ic-heading">@title</h2> 873 <p class="ic-list-item-info">@type</p> 874 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 875 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 876 877 @{ 878 string isHidden = ""; 879 if (ShowInfo == "Closed" || ShowInfo == "Hidden"){ 880 isHidden = "style=\"display:none;\""; 881 } 882 } 883 884 <div id="@id" @isHidden> 885 <p>@description</p> 886 </div> 887 888 889 </div> 890 891 <div class="media-right" style="width: 33%;"> 892 @if (document != ""){ 893 if (document_type == "OFFENTLIGT_AFTALE_BILLEDE"){ 894 <img class="img-responsive" src="@document" alt="" id="@(id)_img" style="max-height: 100px; float:right; position: relative;"></img> 895 } 896 } 897 </div> 898 899 </div> 900 @if (domains.Count>0) { 901 <p style="font-weight: 700; margin-bottom: -3px">Dokumenter til download:</p> 902 <br> 903 904 foreach (KeyValuePair<string, string> kvp in domains){ 905 <div class="pull-left"> 906 <a href="@kvp.Value" class="btn btn-info pull-right" download>@kvp.Key</a> 907 </div> 908 <br><br><br> 909 } 910 } 911 912 @if (!string.IsNullOrWhiteSpace(description) || !string.IsNullOrWhiteSpace(document)){ 913 if (ShowInfo == "Open"){ 914 <p id="@(id)_chevron" class="text-center chevron"></p> 915 } else if (ShowInfo == "Closed") { 916 <p id="@(id)_chevron" class="text-center chevron bottom"></p> 917 } 918 } 919 </div> 920 </a> 921 <hr> 922 923 924 } 925 } 926 </ul> 927 928 if (GetBoolean("Item.Pagination") != false){ 929 930 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 931 string[] urlSplit = OrigUrl.Split('?'); 932 933 <!-- Find side indeling --> 934 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 935 } 936 } 937 938 @helper List(){ 939 <ul class="list-listings blog-list"> 940 <div class="calendar-view u-flex u-justify-content-center"> 941 <div class="ui link items ui-width"> 942 @{ 943 string sognekode = GetString("Item.Sognekode"); 944 string kalenderkonto = GetString("Item.AccountNumber"); 945 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 946 947 int StartSide = 1; 948 949 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 950 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 951 } 952 953 if (GetBoolean("Item.StartDateNow") == false){ 954 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 955 } 956 957 958 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 959 960 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 961 962 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 963 964 StartDate=HttpContext.Current.Request.QueryString["startd"]; 965 966 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 967 968 StartDate=HttpContext.Current.Request.Form["dato-start"]; 969 970 }else{ 971 972 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 973 974 } 975 976 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 977 978 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 979 } 980 981 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 982 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 983 }else{ 984 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 985 } 986 987 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 988 989 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 990 } 991 992 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 993 994 if (GetString("Item.Show.Filter") != "alle"){ 995 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 996 } 997 998 int tael=0; 999 int antalRecs=1; 1000 int rk=1; 1001 int skiprecs = 0; 1002 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1003 1004 XDocument xdoc = XDocument.Load(linkstring); 1005 var elements = xdoc.Element("DATA").Elements("AFTALE"); 1006 1007 foreach (var el in elements.Skip(skiprecs)) 1008 { 1009 string id = "0"; 1010 string type = "alle"; 1011 DateTime date; 1012 string title = "Title"; 1013 string description = "Description"; 1014 string fulldate = "Date"; 1015 string cleanDate = ""; 1016 string day = ""; 1017 string month = ""; 1018 string location = ""; 1019 string document = GetString("Item.StdImage"); 1020 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 1021 string ShowInfo = "Closed"; 1022 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1023 1024 switch (GetString("Item.Width")){ 1025 case "12": 1026 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1027 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1028 }else{ 1029 rk = 15; 1030 } 1031 break; 1032 case "9": 1033 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1034 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1035 }else{ 1036 rk = 15; 1037 } 1038 break; 1039 case "6": 1040 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 1041 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1042 }else{ 1043 rk = 10; 1044 } 1045 break; 1046 case "3": 1047 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1048 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1049 }else{ 1050 rk = 5; 1051 } 1052 break; 1053 case "8": 1054 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1055 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1056 }else{ 1057 rk = 15; 1058 } 1059 break; 1060 case "4": 1061 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1062 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1063 }else{ 1064 rk = 5; 1065 } 1066 break; 1067 } 1068 1069 tael+=1; 1070 1071 if (tael > antalRecs){ 1072 break; 1073 } 1074 1075 if (el.Elements("ID").Any()){ 1076 id = el.Element("ID").Value; 1077 } 1078 1079 if (el.Elements("AFTALETYPE").Any()){ 1080 type = el.Element("AFTALETYPE").Value; 1081 } 1082 1083 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 1084 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 1085 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 1086 day = date.ToString(" d", new CultureInfo("da-DK")); 1087 month = date.ToString("MMM", new CultureInfo("da-DK")); 1088 } 1089 1090 if (el.Elements("OVERSKRIFT").Any()){ 1091 title = el.Element("OVERSKRIFT").Value; 1092 } 1093 1094 if (el.Elements("BESKRIVELSE").Any()){ 1095 description = el.Element("BESKRIVELSE").Value; 1096 } 1097 1098 if (el.Elements("DATO_FORMATERET").Any()){ 1099 fulldate = el.Element("DATO_FORMATERET").Value; 1100 } 1101 1102 if (el.Elements("STED").Any()){ 1103 location = el.Element("STED").Value; 1104 } 1105 1106 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 1107 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 1108 } 1109 1110 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 1111 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 1112 } 1113 1114 if(GetBoolean("Item.Linjeopdeling")==true){ 1115 <hr> 1116 } 1117 1118 <a href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id" data-toggle="tooltip" data-placement="right" data-html="true" title="@title &#013; &#013Beskrivelse: &#013;@description &#013; &#013;@fulldate"> 1119 <div class="row"> 1120 <div class="media col-md-12"> 1121 <div class="media-body"> 1122 1123 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 1124 <h2 class="ic-heading">@title</h2> 1125 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 1126 1127 </div> 1128 </div> 1129 </div> 1130 </a> 1131 } 1132 } 1133 </ul> 1134 1135 if(GetBoolean("Item.Linjeopdeling")==true){ 1136 <hr> 1137 } 1138 1139 if (GetBoolean("Item.Pagination") != false){ 1140 1141 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 1142 string[] urlSplit = OrigUrl.Split('?'); 1143 1144 <!-- Find side indeling --> 1145 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 1146 } 1147 } 1148 1149 @helper kompliste(){ 1150 <ul class="list-listings blog-list"> 1151 <div class="calendar-view u-flex u-justify-content-center"> 1152 <div class="ui link items ui-width"> 1153 @{ 1154 string sognekode = GetString("Item.Sognekode"); 1155 string kalenderkonto = GetString("Item.AccountNumber"); 1156 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 1157 1158 int StartSide = 1; 1159 1160 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 1161 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 1162 } 1163 1164 if (GetBoolean("Item.StartDateNow") == false){ 1165 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1166 } 1167 1168 1169 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 1170 1171 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1172 1173 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 1174 1175 StartDate=HttpContext.Current.Request.QueryString["startd"]; 1176 1177 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 1178 1179 StartDate=HttpContext.Current.Request.Form["dato-start"]; 1180 1181 }else{ 1182 1183 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1184 1185 } 1186 1187 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 1188 1189 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 1190 } 1191 1192 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 1193 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 1194 }else{ 1195 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1196 } 1197 1198 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 1199 1200 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 1201 } 1202 1203 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 1204 1205 if (GetString("Item.Show.Filter") != "alle"){ 1206 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 1207 } 1208 1209 int tael=0; 1210 int antalRecs=1; 1211 int rk=1; 1212 int skiprecs = 0; 1213 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1214 1215 XDocument xdoc = XDocument.Load(linkstring); 1216 var elements = xdoc.Element("DATA").Elements("AFTALE"); 1217 1218 foreach (var el in elements.Skip(skiprecs)) 1219 { 1220 string id = "0"; 1221 string type = "alle"; 1222 DateTime date; 1223 string title = "Title"; 1224 string description = "Description"; 1225 string fulldate = "Date"; 1226 string cleanDate = ""; 1227 string day = ""; 1228 string month = ""; 1229 string location = ""; 1230 string document = GetString("Item.StdImage"); 1231 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 1232 string ShowInfo = "Closed"; 1233 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1234 1235 switch (GetString("Item.Width")){ 1236 case "12": 1237 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1238 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1239 }else{ 1240 rk = 15; 1241 } 1242 break; 1243 case "9": 1244 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1245 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1246 }else{ 1247 rk = 15; 1248 } 1249 break; 1250 case "6": 1251 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 1252 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1253 }else{ 1254 rk = 10; 1255 } 1256 break; 1257 case "3": 1258 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1259 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1260 }else{ 1261 rk = 5; 1262 } 1263 break; 1264 case "8": 1265 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1266 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1267 }else{ 1268 rk = 15; 1269 } 1270 break; 1271 case "4": 1272 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1273 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1274 }else{ 1275 rk = 5; 1276 } 1277 break; 1278 } 1279 1280 tael+=1; 1281 1282 if (tael > antalRecs){ 1283 break; 1284 } 1285 1286 if (el.Elements("ID").Any()){ 1287 id = el.Element("ID").Value; 1288 } 1289 1290 if (el.Elements("AFTALETYPE").Any()){ 1291 type = el.Element("AFTALETYPE").Value; 1292 } 1293 1294 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 1295 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 1296 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 1297 day = date.ToString(" d", new CultureInfo("da-DK")); 1298 month = date.ToString("MMM", new CultureInfo("da-DK")); 1299 } 1300 1301 if (el.Elements("OVERSKRIFT").Any()){ 1302 title = el.Element("OVERSKRIFT").Value; 1303 } 1304 1305 if (el.Elements("BESKRIVELSE").Any()){ 1306 description = el.Element("BESKRIVELSE").Value; 1307 } 1308 1309 if (el.Elements("DATO_FORMATERET").Any()){ 1310 fulldate = el.Element("DATO_FORMATERET").Value; 1311 } 1312 1313 if (el.Elements("STED").Any()){ 1314 location = el.Element("STED").Value; 1315 } 1316 1317 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 1318 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 1319 } 1320 1321 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 1322 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 1323 } 1324 1325 if(GetBoolean("Item.Linjeopdeling")==true){ 1326 <hr> 1327 } 1328 1329 if(GetBoolean("Item.Listeopdeling")==true){ 1330 <hr> 1331 } 1332 1333 <a href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id" data-toggle="tooltip" data-placement="right" data-html="true" title="@title &#013; &#013Beskrivelse: &#013;@description &#013; &#013;@fulldate"> 1334 <div class="row"> 1335 <div class="media col-md-12"> 1336 <div class="media-body"> 1337 1338 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 1339 <h2 class="ic-heading">@title</h2> 1340 <p class="ic-list-item-info nomargin">@description</p> 1341 1342 </div> 1343 </div> 1344 </div> 1345 </a> 1346 } 1347 } 1348 </ul> 1349 1350 if(GetBoolean("Item.Listeopdeling")==true){ 1351 <hr> 1352 } 1353 1354 if (GetBoolean("Item.Pagination") != false){ 1355 1356 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 1357 string[] urlSplit = OrigUrl.Split('?'); 1358 1359 <!-- Find side indeling --> 1360 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 1361 } 1362 } 1363 1364 @helper kasse(){ 1365 <div class="sqcalendar"> 1366 @{ 1367 string sognekode = GetString("Item.Sognekode"); 1368 string kalenderkonto = GetString("Item.AccountNumber"); 1369 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 1370 1371 int StartSide = 1; 1372 1373 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 1374 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 1375 } 1376 1377 if (GetBoolean("Item.StartDateNow") == false){ 1378 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1379 } 1380 1381 1382 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 1383 1384 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1385 1386 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 1387 1388 StartDate=HttpContext.Current.Request.QueryString["startd"]; 1389 1390 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 1391 1392 StartDate=HttpContext.Current.Request.Form["dato-start"]; 1393 1394 }else{ 1395 1396 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1397 1398 } 1399 1400 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 1401 1402 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 1403 } 1404 1405 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 1406 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 1407 }else{ 1408 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1409 } 1410 1411 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 1412 1413 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 1414 } 1415 1416 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 1417 1418 if (GetString("Item.Show.Filter") != "alle"){ 1419 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 1420 } 1421 1422 int tael=0; 1423 int antalRecs=1; 1424 int rk=1; 1425 int skiprecs = 0; 1426 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1427 1428 XDocument xdoc = XDocument.Load(linkstring); 1429 var elements = xdoc.Element("DATA").Elements("AFTALE"); 1430 1431 foreach (var el in elements.Skip(skiprecs)) 1432 { 1433 string id = "0"; 1434 string type = "alle"; 1435 DateTime date; 1436 string title = "Title"; 1437 string description = "Description"; 1438 string fulldate = "Date"; 1439 string cleanDate = ""; 1440 string day = ""; 1441 string month = ""; 1442 string location = ""; 1443 string document = GetString("Item.StdImage"); 1444 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 1445 string ShowInfo = "Closed"; 1446 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1447 1448 switch (GetString("Item.Width")){ 1449 case "12": 1450 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1451 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1452 }else{ 1453 rk = 15; 1454 } 1455 break; 1456 case "9": 1457 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1458 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1459 }else{ 1460 rk = 15; 1461 } 1462 break; 1463 case "6": 1464 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 1465 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1466 }else{ 1467 rk = 10; 1468 } 1469 break; 1470 case "3": 1471 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1472 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1473 }else{ 1474 rk = 5; 1475 } 1476 break; 1477 case "8": 1478 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1479 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1480 }else{ 1481 rk = 15; 1482 } 1483 break; 1484 case "4": 1485 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1486 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1487 }else{ 1488 rk = 5; 1489 } 1490 break; 1491 } 1492 1493 tael+=1; 1494 1495 if (tael > antalRecs){ 1496 break; 1497 } 1498 1499 if (el.Elements("ID").Any()){ 1500 id = el.Element("ID").Value; 1501 } 1502 1503 if (el.Elements("AFTALETYPE").Any()){ 1504 type = el.Element("AFTALETYPE").Value; 1505 } 1506 1507 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 1508 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 1509 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 1510 day = date.ToString(" d", new CultureInfo("da-DK")); 1511 month = date.ToString("MMM", new CultureInfo("da-DK")); 1512 } 1513 1514 if (el.Elements("OVERSKRIFT").Any()){ 1515 title = el.Element("OVERSKRIFT").Value; 1516 } 1517 1518 if (el.Elements("BESKRIVELSE").Any()){ 1519 description = el.Element("BESKRIVELSE").Value; 1520 } 1521 1522 if (el.Elements("DATO_FORMATERET").Any()){ 1523 fulldate = el.Element("DATO_FORMATERET").Value; 1524 } 1525 1526 if (el.Elements("STED").Any()){ 1527 location = el.Element("STED").Value; 1528 } 1529 1530 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 1531 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 1532 } 1533 1534 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 1535 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 1536 } 1537 1538 if(GetBoolean("Item.Linjeopdeling")==true){ 1539 <hr> 1540 } 1541 1542 if(GetBoolean("Item.Listeopdeling")==true){ 1543 <hr> 1544 } 1545 1546 <div class="sqcalendar-item sqkalender-liste-item-odd"> 1547 <a class="sqcalendar-link" href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id"> 1548 1549 <div class="sqcalendar-date sqevent-date--hide-year" style="background-color: @GetString("Item.DatoBGColor.Color")"> 1550 <div class="sqdate-center"> 1551 1552 <span class="sqdate">@day</span><span class="sqmonth">@month</span> 1553 1554 </div> 1555 </div> 1556 <div class="sqcalendar-desc"> 1557 <div class="sqcalendar-item-info"> 1558 <span class="sqmedia-heading">@title</span> 1559 1560 1561 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 1562 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 1563 @if (!string.IsNullOrEmpty(description)) 1564 { 1565 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-bookmark"></i> @WrapMethods.Truncate(description, int.Parse(TruncateLength()))</p> 1566 } 1567 1568 </div> 1569 </div> 1570 </a> 1571 </div> 1572 } 1573 } 1574 </div> 1575 if(GetBoolean("Item.Listeopdeling")==true){ 1576 <hr> 1577 } 1578 1579 if (GetBoolean("Item.Pagination") != false){ 1580 1581 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 1582 string[] urlSplit = OrigUrl.Split('?'); 1583 1584 <!-- Find side indeling --> 1585 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 1586 } 1587 } 1588 1589 1590 1591 @helper RenderPagination(string currentPageLink, int pageCount, int currentPage, string sd, string ed) 1592 { 1593 1594 if(currentPage == 0){ 1595 currentPage=1; 1596 } 1597 1598 <div class="col-xs-12" align="center"> 1599 <ul class="pagination"> 1600 @{string pageHrefTemplate = string.Format("<a class=\"page-link\" href=\"{0}&PageNum={{0}}&startd={{1}}&slutd={{2}}\">{{0}}</a>", currentPageLink);} 1601 @for (int i = 1; i <= pageCount; i++) 1602 { 1603 var css = i == currentPage 1604 ? "page-item active" 1605 : "page-item"; 1606 <li class="@css"> 1607 @string.Format(pageHrefTemplate, i, sd, ed) 1608 </li> 1609 } 1610 </ul> 1611 </div> 1612 1613 1614 if (sd != DateTime.Now.ToString("dd/MM/yyyy")){ 1615 <script type="text/javascript">document.getElementById("dato-start").value = "@sd"</script> 1616 } 1617 1618 } 1619 1620 @helper RenderImage() 1621 { 1622 if (!string.IsNullOrEmpty(GetString("Item.Image"))) 1623 { 1624 var image = System.Web.HttpContext.Current.Server.UrlEncode(GetString("Item.Image")); 1625 1626 <!-- Choosing the smallest possible width that will work with responsive sizes --> 1627 string optimizedwidth = "1280"; 1628 switch (GetString("Item.Width")){ 1629 case "12": 1630 optimizedwidth = "1280"; 1631 break; 1632 case "9": 1633 optimizedwidth = "960"; 1634 break; 1635 case "6": 1636 optimizedwidth = "722"; 1637 break; 1638 case "3": 1639 optimizedwidth = "722"; 1640 break; 1641 case "8": 1642 optimizedwidth = "960"; 1643 break; 1644 case "4": 1645 optimizedwidth = "722"; 1646 break; 1647 } 1648 1649 if (GetString("Item.ImageStyle") == "ball") { 1650 optimizedwidth = "500&height=500"; 1651 } 1652 1653 1654 if (string.IsNullOrEmpty(GetString("Item.Link"))) 1655 { 1656 <div class="img-responsive dw-std-image"> 1657 <img class="content-image img-responsive img-centered" style="@GetImageBorderCss()" src="/Admin/Public/GetImage.ashx?width=@optimizedwidth&crop=1&Compression=75&image=@image" class="img-responsive" alt=""></img> 1658 </div> 1659 } else { 1660 <a href="@GetString("Item.Link")"> 1661 <div class="img-responsive dw-std-image"> 1662 <img class="content-image img-responsive img-centered" style="@GetImageBorderCss()" src="/Admin/Public/GetImage.ashx?width=@optimizedwidth&crop=1&Compression=75&image=@image" class="img-responsive" alt=""></img> 1663 </div> 1664 </a> 1665 } 1666 } 1667 } 1668 1669 @functions { 1670 1671 private string GetImageBorderCss() 1672 { 1673 if (GetString("Item.ImageStyle") == "cover") 1674 { 1675 return "padding: 8px"; 1676 } 1677 else if (GetString("Item.ImageStyle") == "cover-border") 1678 { 1679 return "padding: 4px; border: 1px solid #e1e1e1; border-radius: 0px !important"; 1680 } 1681 else if (GetString("Item.ImageStyle") == "frame") 1682 { 1683 return "padding: 6px; border: 1px solid #e1e1e1; border-radius: 0px !important"; 1684 } 1685 else if (GetString("Item.ImageStyle") == "rounded") 1686 { 1687 return "border-radius: 8px !important"; 1688 } 1689 else if (GetString("Item.ImageStyle") == "ball") 1690 { 1691 return "border-radius: 1000px !important"; 1692 } 1693 else if (GetString("Item.ImageStyle") == "shadow") 1694 { 1695 return "box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.2)"; 1696 } 1697 else 1698 { 1699 return string.Empty; 1700 } 1701 } 1702 private string GetParagraphWidth() 1703 { 1704 string PctWidth = "100%"; 1705 switch (GetString("Item.Width")){ 1706 case "12": 1707 PctWidth = "100%"; 1708 break; 1709 case "9": 1710 PctWidth = "75%"; 1711 break; 1712 case "6": 1713 PctWidth = "50%"; 1714 break; 1715 case "3": 1716 PctWidth = "25%"; 1717 break; 1718 case "8": 1719 PctWidth = "66%"; 1720 break; 1721 case "4": 1722 PctWidth = "33%"; 1723 break; 1724 } 1725 return PctWidth; 1726 } 1727 1728 private string TruncateLength() 1729 { 1730 string TruncLen = "100"; 1731 switch (GetString("Item.Width")){ 1732 case "12": 1733 TruncLen = "100"; 1734 break; 1735 case "9": 1736 TruncLen = "72"; 1737 break; 1738 case "6": 1739 TruncLen = "40"; 1740 break; 1741 case "3": 1742 TruncLen = "20"; 1743 break; 1744 case "8": 1745 TruncLen = "62"; 1746 break; 1747 case "4": 1748 TruncLen = "25"; 1749 break; 1750 } 1751 return TruncLen; 1752 } 1753 1754 } 1755 <script type="text/javascript"> 1756 1757 1758 function toggle_visibility(id) { 1759 if($('#' + id + "_chevron").length){ 1760 $('#' + id).stop().slideToggle('slow'); 1761 $('#' + id + "_chevron").toggleClass('bottom'); 1762 1763 1764 if(!$('#' + id + "_img").hasClass('bigPic')){ 1765 1766 var container_width = 269; 1767 var image_height; 1768 var natural_width = document.getElementById(id + "_img").naturalWidth; 1769 var natural_height = document.getElementById(id + "_img").naturalHeight; 1770 1771 if(natural_width < container_width){ //> 1772 container_width = natural_width; 1773 } 1774 1775 var res = container_width / natural_width; 1776 //console.log(res); 1777 1778 image_height = natural_height * res; 1779 //console.log(image_height); 1780 1781 if(image_height > 400){ 1782 image_height = 400; 1783 } 1784 1785 //console.log(natural_width + " x " + natural_height); 1786 //console.log(image_height); 1787 $('#' + id + "_img").addClass('bigPic'); 1788 $('#' + id + "_img").css('max-height', image_height + "px"); 1789 }else{ 1790 $('#' + id + "_img").removeClass('bigPic'); 1791 $('#' + id + "_img").css('max-height', "100px"); 1792 } 1793 } 1794 } 1795 </script> 1796 1797
Error executing template "Designs/Dwsimple/Paragraph/KalenderListe.cshtml"
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
   at System.Net.HttpWebRequest.GetResponse()
   at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at CompiledRazorTemplates.Dynamic.RazorEngine_e796b3ad40644827a6381a88d8ee2924.<kasse>b__24_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Skovbo Data\shkirker.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\KalenderListe.cshtml:line 1428
   at CompiledRazorTemplates.Dynamic.RazorEngine_e796b3ad40644827a6381a88d8ee2924.<kalendertype>b__19_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Skovbo Data\shkirker.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\KalenderListe.cshtml:line 427
   at CompiledRazorTemplates.Dynamic.RazorEngine_e796b3ad40644827a6381a88d8ee2924.Execute() in D:\dynamicweb.net\Solutions\Skovbo Data\shkirker.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\KalenderListe.cshtml:line 273
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Xml.Linq; 2 @using System.Text; 3 @using System.Globalization; 4 @using Dynamicweb.Forms; 5 @using System.Web; 6 @using Dynamicweb.Frontend; 7 8 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 9 @{ 10 init(); 11 } 12 13 @functions { 14 private int columnsWritten { get; set; } 15 private int columns { get; set; } 16 17 public void init() 18 { 19 columnsWritten = Dynamicweb.Core.Converter.ToInt32(System.Web.HttpContext.Current.Items["currentColumns"]); 20 columns = GetInteger("Item.Width"); 21 System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + GetInteger("Item.Width"); 22 } 23 24 public void Fluid() 25 { 26 columnsWritten = Dynamicweb.Core.Converter.ToInt32(System.Web.HttpContext.Current.Items["currentColumns"]); 27 columns = 12; 28 System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + 12; 29 } 30 31 public string ColumnClass() 32 { 33 if (GetString("Item.WidthMobile") == "hide"){ 34 return "col-md-" + GetString("Item.Width") + " hidden-xs"; 35 } else { 36 return "col-md-" + GetString("Item.Width") + " col-xs-" + GetString("Item.WidthMobile"); 37 } 38 } 39 40 public string NewRow() 41 { 42 //return columns + " - " + columnsWritten + ">"; 43 44 if (columns + columnsWritten > 12) 45 { 46 System.Web.HttpContext.Current.Items["currentColumns"] = columns; 47 //return "</div><div class=\"row\">"; 48 return "</div><div class=\"flex-container\">"; 49 } 50 else 51 { 52 return string.Empty; 53 } 54 55 } 56 57 public string NewRowParagraphExtended() 58 { 59 if (columns + columnsWritten > 12) 60 { 61 System.Web.HttpContext.Current.Items["currentColumns"] = columns; 62 return "</div><div class=\"flex-container\">"; 63 } 64 else if (columnsWritten == 0) 65 { 66 return "<div class=\"flex-container\">"; 67 } 68 else 69 { 70 return string.Empty; 71 } 72 73 } 74 } 75 @using System.Text.RegularExpressions 76 @using System.Web 77 78 79 @functions{ 80 public class WrapMethods 81 { 82 //Gets the contrasting color 83 public static string getContrastYIQ(string hexcolor) 84 { 85 if (hexcolor != "") 86 { 87 hexcolor = Regex.Replace(hexcolor, "[^0-9a-zA-Z]+", ""); 88 89 int r = Convert.ToByte(hexcolor.Substring(0, 2), 16); 90 int g = Convert.ToByte(hexcolor.Substring(2, 2), 16); 91 int b = Convert.ToByte(hexcolor.Substring(4, 2), 16); 92 int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 93 94 if (yiq >= 128) 95 { 96 return "black"; 97 } 98 else 99 { 100 return "white"; 101 } 102 } 103 else 104 { 105 return "black"; 106 } 107 } 108 109 110 //Truncate text 111 public static string Truncate (string value, int count, bool strip=true) 112 { 113 if (strip == true){ 114 value = StripHtmlTagByCharArray(value); 115 } 116 117 if (value.Length > count) 118 { 119 value = value.Substring(0, count + 1) + "..."; 120 } 121 122 return value; 123 } 124 125 126 //Strip text from HTML 127 public static string StripHtmlTagByCharArray(string htmlString) 128 { 129 char[] array = new char[htmlString.Length]; 130 int arrayIndex = 0; 131 bool inside = false; 132 133 for (int i = 0; i < htmlString.Length; i++) 134 { 135 char let = htmlString[i]; 136 if (let == '<') 137 { 138 inside = true; 139 continue; 140 } 141 if (let == '>') 142 { 143 inside = false; 144 continue; 145 } 146 if (!inside) 147 { 148 array[arrayIndex] = let; 149 arrayIndex++; 150 } 151 } 152 return new string(array, 0, arrayIndex); 153 } 154 155 //Make the correct count of columns 156 public static string ColumnMaker(int Col, string ScreenSize) 157 { 158 string Columns = ""; 159 160 switch (Col) 161 { 162 case 1: 163 Columns = "col-"+ScreenSize+"-12"; 164 break; 165 166 case 2: 167 Columns = "col-"+ScreenSize+"-6"; 168 break; 169 170 case 3: 171 Columns = "col-"+ScreenSize+"-4"; 172 break; 173 174 case 4: 175 Columns = "col-"+ScreenSize+"-3"; 176 break; 177 178 default: 179 Columns = "col-"+ScreenSize+"-3"; 180 break; 181 } 182 183 return Columns; 184 } 185 186 187 private string Custom(string firstoption, string secondoption) 188 { 189 if (firstoption == "custom") 190 { 191 return secondoption; 192 } 193 else 194 { 195 return firstoption; 196 } 197 } 198 } 199 } 200 201 <script type="text/javascript" src="/Files/Templates/Designs/Dwsimple/js/pagination.js"></script> 202 <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> 203 <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script> 204 <script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min.js'></script> 205 <script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.1/js/bootstrap-datepicker.min.js'></script> 206 @{ 207 208 209 <style> 210 211 .datobgcolor { 212 background-color: @GetString("Item.DatoBGColor.Color"); 213 } 214 215 </style> 216 } 217 218 @functions 219 { 220 221 string StartFormdate = HttpContext.Current.Request.Form["dato-start"]; 222 string StartQsdate = HttpContext.Current.Request.QueryString["startd"]; 223 string EndDate = ""; 224 string StartDate = ""; 225 } 226 227 228 @NewRowParagraphExtended() 229 230 <div class="@ColumnClass() dist2nxtblk"> 231 232 @if (@GetString("Item.EqualContentHeight")=="True") 233 { 234 <text> 235 <div class="@GetString("Item.ContentStyle") Special-Col-Style Special-Col-height" style="background-color: @GetString("Item.BackgroundColor.Color")"> 236 </text> 237 } 238 else 239 { 240 <text> 241 <div class="@GetString("Item.ContentStyle") Special-Col-Style" style="background-color: @GetString("Item.BackgroundColor.Color")"> 242 </text> 243 244 } 245 246 @if (GetString("Item.Order") == "title-first" || GetString("Item.Order") == "") 247 { 248 string plac=GetString("Item.TitlePlacement"); 249 250 if (plac=="") 251 { 252 plac="left"; 253 } 254 255 if (GetBoolean("Item.VisTitel") != false){ 256 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 257 <h1 class="dw-section-title" style="text-align: @plac"> 258 <span>@GetString("Item.Titel")</span> 259 </h1> 260 <br> 261 } 262 } else { 263 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 264 } 265 266 267 @RenderImage() 268 269 if (GetBoolean("Item.CalendarSearch") != false){ 270 @daterange()<!-- @daterange() --> 271 } 272 273 @kalendertype() 274 } 275 276 @if (GetString("Item.Order") == "image-first") 277 { 278 string plac=GetString("Item.TitlePlacement"); 279 280 if (plac=="") 281 { 282 plac="left"; 283 } 284 285 @RenderImage() 286 if (GetBoolean("Item.VisTitel") != false){ 287 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 288 <h1 class="dw-section-title" style="text-align: @plac"> 289 <span>@GetString("Item.Titel")</span> 290 </h1> 291 <br> 292 } 293 } else { 294 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 295 } 296 297 298 @kalendertype() 299 } 300 301 302 303 @if (GetString("Item.Order") == "icon-xs") 304 { 305 306 string plac=GetString("Item.TitlePlacement"); 307 308 if (plac=="") 309 { 310 plac="left"; 311 } 312 313 <div class="col-md-2"> 314 @RenderImage() 315 </div> 316 317 <div class="col-md-10"> 318 @if (GetBoolean("Item.VisTitel") != false){ 319 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 320 <h1 class="dw-section-title" style="text-align: @plac"> 321 <span>@GetString("Item.Titel")</span> 322 </h1> 323 <br> 324 } 325 } else { 326 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 327 } 328 329 330 </div> 331 @kalendertype() 332 } 333 334 @if (GetString("Item.Order") == "icon-sm") 335 { 336 337 string plac=GetString("Item.TitlePlacement"); 338 339 if (plac=="") 340 { 341 plac="left"; 342 } 343 344 <div class="col-md-3"> 345 @RenderImage() 346 </div> 347 348 <div class="col-md-9"> 349 @if (GetBoolean("Item.VisTitel") != false){ 350 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 351 <h1 class="dw-section-title" style="text-align: @plac"> 352 <span>@GetString("Item.Titel")</span> 353 <br> 354 </h1> 355 <br> 356 } 357 } else { 358 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 359 } 360 </div> 361 @kalendertype() 362 } 363 364 @if (GetString("Item.Order") == "icon-md") 365 { 366 367 string plac=GetString("Item.TitlePlacement"); 368 369 if (plac=="") 370 { 371 plac="left"; 372 } 373 374 <div class="col-md-4"> 375 @RenderImage() 376 </div> 377 378 <div class="col-md-8"> 379 @if (GetBoolean("Item.VisTitel") != false){ 380 if (!string.IsNullOrEmpty(GetString("Item.Titel"))) { 381 <h1 class="dw-section-title" style="text-align: @plac"> 382 <span>@GetString("Item.Titel")</span> 383 </h1> 384 <br> 385 } 386 } else { 387 <h1 class="dw-section-title" style="text-align: @plac"><span></span></h1> 388 } 389 390 </div> 391 @kalendertype() 392 } 393 </div> 394 </div> 395 396 @helper daterange(){ 397 398 string pathx=""; 399 <script type="text/javascript">@pathx = window.location.href.split('?')[0] + "/Default.aspx?ID=10593&Purge=True"</script> 400 401 <form method="post" action="@pathx" id="myForm" name="myForm"> 402 <table> 403 <tr> 404 <td><input type="text" id="dato-start" name="dato-start" class="start-date form-control ic-input-small" placeholder="Dato fra" value="" ></td> 405 <td><input type="text" id="dato-slut" name="dato-slut" class="end-date form-control ic-input-small" placeholder="Dato til" value=""></td> 406 <td><button type="submit" class="btn btn-primary fa fa-search ic-button"></button></td> 407 </tr> 408 </table> 409 <br> 410 </form> 411 412 <script type="text/javascript" src="/Files/Templates/Designs/Dwsimple/js/DateRange.js"></script> 413 } 414 415 @helper kalendertype(){ 416 if (@GetString("Item.LayoutMode") == "ballon") { 417 @Ballon() 418 } 419 420 if (@GetString("Item.LayoutMode") == "list") { 421 <p class="list-item-info nomargin">(Tryk på aktiviten for at se detaljer)</p><p></p> 422 423 @List() 424 } 425 426 if (@GetString("Item.LayoutMode") == "kasse") { 427 @kasse() 428 } 429 430 if (@GetString("Item.LayoutMode") == "kompliste") { 431 @kompliste() 432 } 433 434 if (@GetString("Item.LayoutMode") == "billeder") { 435 @Billeder() 436 } 437 } 438 439 @helper Billeder(){ 440 <ul class="list-listings blog-list"> 441 <div class="calendar-view u-flex u-justify-content-center"> 442 <div class="ui link items ui-width"> 443 @{ 444 string sognekode = GetString("Item.Sognekode"); 445 string kalenderkonto = GetString("Item.AccountNumber"); 446 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 447 448 int StartSide = 1; 449 450 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 451 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 452 } 453 454 if (GetBoolean("Item.StartDateNow") == false){ 455 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 456 } 457 458 459 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 460 461 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 462 463 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 464 465 StartDate=HttpContext.Current.Request.QueryString["startd"]; 466 467 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 468 469 StartDate=HttpContext.Current.Request.Form["dato-start"]; 470 471 }else{ 472 473 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 474 475 } 476 477 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 478 479 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 480 } 481 482 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 483 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 484 }else{ 485 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 486 } 487 488 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 489 490 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 491 } 492 493 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 494 495 if (GetString("Item.Show.Filter") != "alle"){ 496 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 497 } 498 499 int tael=0; 500 int antalRecs=1; 501 int rk=1; 502 int skiprecs = 0; 503 504 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 505 506 XDocument xdoc = XDocument.Load(linkstring); 507 var elements = xdoc.Element("DATA").Elements("AFTALE"); 508 509 foreach (var el in elements.Skip(skiprecs)) 510 { 511 string id = "0"; 512 string type = "alle"; 513 DateTime date; 514 string title = "Title"; 515 string description = "Description"; 516 string fulldate = "Date"; 517 string cleanDate = ""; 518 string day = ""; 519 string month = ""; 520 string location = ""; 521 string document = GetString("Item.StdImage"); 522 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 523 524 525 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 526 527 528 529 switch (GetString("Item.Width")){ 530 case "12": 531 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 532 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 533 }else{ 534 rk = 15; 535 } 536 break; 537 case "9": 538 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 539 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 540 }else{ 541 rk = 15; 542 } 543 break; 544 case "6": 545 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 546 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 547 }else{ 548 rk = 10; 549 } 550 break; 551 case "3": 552 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 553 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 554 }else{ 555 rk = 5; 556 } 557 break; 558 case "8": 559 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 560 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 561 }else{ 562 rk = 15; 563 } 564 break; 565 case "4": 566 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 567 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 568 }else{ 569 rk = 5; 570 } 571 break; 572 } 573 574 tael+=1; 575 576 if (tael > antalRecs){ 577 break; 578 } 579 580 if (el.Elements("ID").Any()){ 581 id = el.Element("ID").Value; 582 } 583 584 if (el.Elements("AFTALETYPE").Any()){ 585 type = el.Element("AFTALETYPE").Value; 586 } 587 588 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 589 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 590 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 591 day = date.ToString(" d", new CultureInfo("da-DK")); 592 month = date.ToString("MMM", new CultureInfo("da-DK")); 593 } 594 595 if (el.Elements("OVERSKRIFT").Any()){ 596 title = el.Element("OVERSKRIFT").Value; 597 } 598 599 if (el.Elements("BESKRIVELSE").Any()){ 600 description = el.Element("BESKRIVELSE").Value; 601 } 602 603 if (el.Elements("DATO_FORMATERET").Any()){ 604 fulldate = el.Element("DATO_FORMATERET").Value; 605 } 606 607 if (el.Elements("STED").Any()){ 608 location = el.Element("STED").Value; 609 } 610 611 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 612 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 613 } 614 615 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 616 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 617 } 618 619 <a class="item u-align-items-center page-1 row-1 " id="node-10075788" href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id" style="display: flex;"> 620 621 <div class="ui medium image"> 622 623 @if (document != ""){ 624 if (document_type == "OFFENTLIGT_AFTALE_BILLEDE"){ 625 <img class="img-responsive" src="@document" alt="" id="@(id)_img" style="max-height: 200px; float:right; position: relative;"></img> 626 }else{ 627 <img class="img-responsive" src="@GetString("Item.StdImage")" alt="" id="@(id)_img" style="max-height: 200px; float:right; position: relative;"></img> 628 } 629 } 630 631 <div class="blockdate" style="background-color: @GetString("Item.DatoBGColor.Color")"> 632 <div class="ui header"> 633 <div class="date__day">@day</div> 634 <div class="sub header">@month</div> 635 </div> 636 </div> 637 </div> 638 639 <div class="ic-textelm"> 640 641 <span class="ic-heading">@title</span> 642 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 643 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 644 @if (!string.IsNullOrEmpty(description)) 645 { 646 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-bookmark"></i> @WrapMethods.Truncate(description, int.Parse(TruncateLength()))</p> 647 } 648 </div> 649 </a> 650 } 651 } 652 </div> 653 </div> 654 </ul> 655 656 if (GetBoolean("Item.Pagination") != false){ 657 658 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 659 string[] urlSplit = OrigUrl.Split('?'); 660 661 <!-- Find side indeling --> 662 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 663 } 664 } 665 666 @helper Ballon(){ 667 <ul class="list-listings blog-list"> 668 <div class="calendar-view u-flex u-justify-content-center"> 669 <div class="ui link items ui-width"> 670 @{ 671 string sognekode = GetString("Item.Sognekode"); 672 string kalenderkonto = GetString("Item.AccountNumber"); 673 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 674 675 int StartSide = 1; 676 677 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 678 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 679 } 680 681 if (GetBoolean("Item.StartDateNow") == false){ 682 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 683 } 684 685 686 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 687 688 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 689 690 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 691 692 StartDate=HttpContext.Current.Request.QueryString["startd"]; 693 694 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 695 696 StartDate=HttpContext.Current.Request.Form["dato-start"]; 697 698 }else{ 699 700 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 701 702 } 703 704 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 705 706 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 707 } 708 709 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 710 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 711 }else{ 712 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 713 } 714 715 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 716 717 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 718 } 719 720 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 721 722 if (GetString("Item.Show.Filter") != "alle"){ 723 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 724 } 725 726 int tael=0; 727 int antalRecs=1; 728 int rk=1; 729 int skiprecs = 0; 730 731 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 732 733 XDocument xdoc = XDocument.Load(linkstring); 734 var elements = xdoc.Element("DATA").Elements("AFTALE"); 735 736 foreach (var el in elements.Skip(skiprecs)) 737 { 738 string id = "0"; 739 string type = "alle"; 740 DateTime date; 741 string title = "Title"; 742 string description = "Description"; 743 string fulldate = "Date"; 744 string cleanDate = ""; 745 string day = ""; 746 string month = ""; 747 string location = ""; 748 string document = GetString("Item.StdImage"); 749 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 750 string ShowInfo = "Closed"; 751 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 752 string filnavn= ""; 753 Dictionary<string, string> domains = new Dictionary<string, string>(); 754 755 756 757 switch (GetString("Item.Width")){ 758 case "12": 759 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 760 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 761 }else{ 762 rk = 15; 763 } 764 break; 765 case "9": 766 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 767 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 768 }else{ 769 rk = 15; 770 } 771 break; 772 case "6": 773 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 774 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 775 }else{ 776 rk = 10; 777 } 778 break; 779 case "3": 780 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 781 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 782 }else{ 783 rk = 5; 784 } 785 break; 786 case "8": 787 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 788 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 789 }else{ 790 rk = 15; 791 } 792 break; 793 case "4": 794 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 795 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 796 }else{ 797 rk = 5; 798 } 799 break; 800 } 801 802 tael+=1; 803 804 if (tael > antalRecs){ 805 break; 806 } 807 808 if (el.Elements("ID").Any()){ 809 id = el.Element("ID").Value; 810 } 811 812 if (el.Elements("AFTALETYPE").Any()){ 813 type = el.Element("AFTALETYPE").Value; 814 } 815 816 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 817 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 818 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 819 day = date.ToString(" d", new CultureInfo("da-DK")); 820 month = date.ToString("MMM", new CultureInfo("da-DK")); 821 } 822 823 if (el.Elements("OVERSKRIFT").Any()){ 824 title = el.Element("OVERSKRIFT").Value; 825 } 826 827 if (el.Elements("BESKRIVELSE").Any()){ 828 description = el.Element("BESKRIVELSE").Value; 829 } 830 831 if (el.Elements("DATO_FORMATERET").Any()){ 832 fulldate = el.Element("DATO_FORMATERET").Value; 833 } 834 835 if (el.Elements("STED").Any()){ 836 location = el.Element("STED").Value; 837 } 838 839 840 841 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 842 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 843 } 844 845 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 846 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 847 } 848 <!-- 849 IEnumerable<XElement> allGrandChildren = from elx in elements.Elements("OFFENTLIGE_DOKUMENTER").Elements() select elx; 850 foreach (XElement elx in allGrandChildren){ 851 852 document = "https://kalender.brandsoft.dk/bska/" + elx.Element("URL").Value; 853 filnavn=elx.Element("ORG_FILNAVN").Value; 854 855 if (document_type == "OFFENTLIGT_DOKUMENT"){ 856 domains.Add(@filnavn, @document); 857 } 858 859 } 860 861 --> 862 863 <a href="javascript:void(0);" onclick="toggle_visibility('@id');"> 864 865 <div class="row"> 866 <div class="media col-md-12"> 867 <div class="media-left"> 868 <div class="media-object calendar-date text-center" style="background-color: @GetString("Item.DatoBGColor.Color")"><span>@day</span> @month</div> 869 870 </div> 871 <div class="media-body"> 872 <h2 class="ic-heading">@title</h2> 873 <p class="ic-list-item-info">@type</p> 874 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 875 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 876 877 @{ 878 string isHidden = ""; 879 if (ShowInfo == "Closed" || ShowInfo == "Hidden"){ 880 isHidden = "style=\"display:none;\""; 881 } 882 } 883 884 <div id="@id" @isHidden> 885 <p>@description</p> 886 </div> 887 888 889 </div> 890 891 <div class="media-right" style="width: 33%;"> 892 @if (document != ""){ 893 if (document_type == "OFFENTLIGT_AFTALE_BILLEDE"){ 894 <img class="img-responsive" src="@document" alt="" id="@(id)_img" style="max-height: 100px; float:right; position: relative;"></img> 895 } 896 } 897 </div> 898 899 </div> 900 @if (domains.Count>0) { 901 <p style="font-weight: 700; margin-bottom: -3px">Dokumenter til download:</p> 902 <br> 903 904 foreach (KeyValuePair<string, string> kvp in domains){ 905 <div class="pull-left"> 906 <a href="@kvp.Value" class="btn btn-info pull-right" download>@kvp.Key</a> 907 </div> 908 <br><br><br> 909 } 910 } 911 912 @if (!string.IsNullOrWhiteSpace(description) || !string.IsNullOrWhiteSpace(document)){ 913 if (ShowInfo == "Open"){ 914 <p id="@(id)_chevron" class="text-center chevron"></p> 915 } else if (ShowInfo == "Closed") { 916 <p id="@(id)_chevron" class="text-center chevron bottom"></p> 917 } 918 } 919 </div> 920 </a> 921 <hr> 922 923 924 } 925 } 926 </ul> 927 928 if (GetBoolean("Item.Pagination") != false){ 929 930 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 931 string[] urlSplit = OrigUrl.Split('?'); 932 933 <!-- Find side indeling --> 934 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 935 } 936 } 937 938 @helper List(){ 939 <ul class="list-listings blog-list"> 940 <div class="calendar-view u-flex u-justify-content-center"> 941 <div class="ui link items ui-width"> 942 @{ 943 string sognekode = GetString("Item.Sognekode"); 944 string kalenderkonto = GetString("Item.AccountNumber"); 945 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 946 947 int StartSide = 1; 948 949 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 950 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 951 } 952 953 if (GetBoolean("Item.StartDateNow") == false){ 954 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 955 } 956 957 958 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 959 960 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 961 962 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 963 964 StartDate=HttpContext.Current.Request.QueryString["startd"]; 965 966 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 967 968 StartDate=HttpContext.Current.Request.Form["dato-start"]; 969 970 }else{ 971 972 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 973 974 } 975 976 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 977 978 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 979 } 980 981 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 982 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 983 }else{ 984 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 985 } 986 987 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 988 989 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 990 } 991 992 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 993 994 if (GetString("Item.Show.Filter") != "alle"){ 995 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 996 } 997 998 int tael=0; 999 int antalRecs=1; 1000 int rk=1; 1001 int skiprecs = 0; 1002 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1003 1004 XDocument xdoc = XDocument.Load(linkstring); 1005 var elements = xdoc.Element("DATA").Elements("AFTALE"); 1006 1007 foreach (var el in elements.Skip(skiprecs)) 1008 { 1009 string id = "0"; 1010 string type = "alle"; 1011 DateTime date; 1012 string title = "Title"; 1013 string description = "Description"; 1014 string fulldate = "Date"; 1015 string cleanDate = ""; 1016 string day = ""; 1017 string month = ""; 1018 string location = ""; 1019 string document = GetString("Item.StdImage"); 1020 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 1021 string ShowInfo = "Closed"; 1022 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1023 1024 switch (GetString("Item.Width")){ 1025 case "12": 1026 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1027 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1028 }else{ 1029 rk = 15; 1030 } 1031 break; 1032 case "9": 1033 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1034 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1035 }else{ 1036 rk = 15; 1037 } 1038 break; 1039 case "6": 1040 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 1041 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1042 }else{ 1043 rk = 10; 1044 } 1045 break; 1046 case "3": 1047 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1048 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1049 }else{ 1050 rk = 5; 1051 } 1052 break; 1053 case "8": 1054 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1055 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1056 }else{ 1057 rk = 15; 1058 } 1059 break; 1060 case "4": 1061 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1062 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1063 }else{ 1064 rk = 5; 1065 } 1066 break; 1067 } 1068 1069 tael+=1; 1070 1071 if (tael > antalRecs){ 1072 break; 1073 } 1074 1075 if (el.Elements("ID").Any()){ 1076 id = el.Element("ID").Value; 1077 } 1078 1079 if (el.Elements("AFTALETYPE").Any()){ 1080 type = el.Element("AFTALETYPE").Value; 1081 } 1082 1083 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 1084 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 1085 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 1086 day = date.ToString(" d", new CultureInfo("da-DK")); 1087 month = date.ToString("MMM", new CultureInfo("da-DK")); 1088 } 1089 1090 if (el.Elements("OVERSKRIFT").Any()){ 1091 title = el.Element("OVERSKRIFT").Value; 1092 } 1093 1094 if (el.Elements("BESKRIVELSE").Any()){ 1095 description = el.Element("BESKRIVELSE").Value; 1096 } 1097 1098 if (el.Elements("DATO_FORMATERET").Any()){ 1099 fulldate = el.Element("DATO_FORMATERET").Value; 1100 } 1101 1102 if (el.Elements("STED").Any()){ 1103 location = el.Element("STED").Value; 1104 } 1105 1106 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 1107 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 1108 } 1109 1110 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 1111 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 1112 } 1113 1114 if(GetBoolean("Item.Linjeopdeling")==true){ 1115 <hr> 1116 } 1117 1118 <a href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id" data-toggle="tooltip" data-placement="right" data-html="true" title="@title &#013; &#013Beskrivelse: &#013;@description &#013; &#013;@fulldate"> 1119 <div class="row"> 1120 <div class="media col-md-12"> 1121 <div class="media-body"> 1122 1123 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 1124 <h2 class="ic-heading">@title</h2> 1125 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 1126 1127 </div> 1128 </div> 1129 </div> 1130 </a> 1131 } 1132 } 1133 </ul> 1134 1135 if(GetBoolean("Item.Linjeopdeling")==true){ 1136 <hr> 1137 } 1138 1139 if (GetBoolean("Item.Pagination") != false){ 1140 1141 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 1142 string[] urlSplit = OrigUrl.Split('?'); 1143 1144 <!-- Find side indeling --> 1145 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 1146 } 1147 } 1148 1149 @helper kompliste(){ 1150 <ul class="list-listings blog-list"> 1151 <div class="calendar-view u-flex u-justify-content-center"> 1152 <div class="ui link items ui-width"> 1153 @{ 1154 string sognekode = GetString("Item.Sognekode"); 1155 string kalenderkonto = GetString("Item.AccountNumber"); 1156 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 1157 1158 int StartSide = 1; 1159 1160 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 1161 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 1162 } 1163 1164 if (GetBoolean("Item.StartDateNow") == false){ 1165 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1166 } 1167 1168 1169 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 1170 1171 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1172 1173 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 1174 1175 StartDate=HttpContext.Current.Request.QueryString["startd"]; 1176 1177 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 1178 1179 StartDate=HttpContext.Current.Request.Form["dato-start"]; 1180 1181 }else{ 1182 1183 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1184 1185 } 1186 1187 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 1188 1189 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 1190 } 1191 1192 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 1193 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 1194 }else{ 1195 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1196 } 1197 1198 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 1199 1200 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 1201 } 1202 1203 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 1204 1205 if (GetString("Item.Show.Filter") != "alle"){ 1206 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 1207 } 1208 1209 int tael=0; 1210 int antalRecs=1; 1211 int rk=1; 1212 int skiprecs = 0; 1213 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1214 1215 XDocument xdoc = XDocument.Load(linkstring); 1216 var elements = xdoc.Element("DATA").Elements("AFTALE"); 1217 1218 foreach (var el in elements.Skip(skiprecs)) 1219 { 1220 string id = "0"; 1221 string type = "alle"; 1222 DateTime date; 1223 string title = "Title"; 1224 string description = "Description"; 1225 string fulldate = "Date"; 1226 string cleanDate = ""; 1227 string day = ""; 1228 string month = ""; 1229 string location = ""; 1230 string document = GetString("Item.StdImage"); 1231 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 1232 string ShowInfo = "Closed"; 1233 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1234 1235 switch (GetString("Item.Width")){ 1236 case "12": 1237 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1238 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1239 }else{ 1240 rk = 15; 1241 } 1242 break; 1243 case "9": 1244 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1245 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1246 }else{ 1247 rk = 15; 1248 } 1249 break; 1250 case "6": 1251 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 1252 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1253 }else{ 1254 rk = 10; 1255 } 1256 break; 1257 case "3": 1258 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1259 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1260 }else{ 1261 rk = 5; 1262 } 1263 break; 1264 case "8": 1265 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1266 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1267 }else{ 1268 rk = 15; 1269 } 1270 break; 1271 case "4": 1272 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1273 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1274 }else{ 1275 rk = 5; 1276 } 1277 break; 1278 } 1279 1280 tael+=1; 1281 1282 if (tael > antalRecs){ 1283 break; 1284 } 1285 1286 if (el.Elements("ID").Any()){ 1287 id = el.Element("ID").Value; 1288 } 1289 1290 if (el.Elements("AFTALETYPE").Any()){ 1291 type = el.Element("AFTALETYPE").Value; 1292 } 1293 1294 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 1295 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 1296 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 1297 day = date.ToString(" d", new CultureInfo("da-DK")); 1298 month = date.ToString("MMM", new CultureInfo("da-DK")); 1299 } 1300 1301 if (el.Elements("OVERSKRIFT").Any()){ 1302 title = el.Element("OVERSKRIFT").Value; 1303 } 1304 1305 if (el.Elements("BESKRIVELSE").Any()){ 1306 description = el.Element("BESKRIVELSE").Value; 1307 } 1308 1309 if (el.Elements("DATO_FORMATERET").Any()){ 1310 fulldate = el.Element("DATO_FORMATERET").Value; 1311 } 1312 1313 if (el.Elements("STED").Any()){ 1314 location = el.Element("STED").Value; 1315 } 1316 1317 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 1318 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 1319 } 1320 1321 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 1322 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 1323 } 1324 1325 if(GetBoolean("Item.Linjeopdeling")==true){ 1326 <hr> 1327 } 1328 1329 if(GetBoolean("Item.Listeopdeling")==true){ 1330 <hr> 1331 } 1332 1333 <a href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id" data-toggle="tooltip" data-placement="right" data-html="true" title="@title &#013; &#013Beskrivelse: &#013;@description &#013; &#013;@fulldate"> 1334 <div class="row"> 1335 <div class="media col-md-12"> 1336 <div class="media-body"> 1337 1338 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 1339 <h2 class="ic-heading">@title</h2> 1340 <p class="ic-list-item-info nomargin">@description</p> 1341 1342 </div> 1343 </div> 1344 </div> 1345 </a> 1346 } 1347 } 1348 </ul> 1349 1350 if(GetBoolean("Item.Listeopdeling")==true){ 1351 <hr> 1352 } 1353 1354 if (GetBoolean("Item.Pagination") != false){ 1355 1356 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 1357 string[] urlSplit = OrigUrl.Split('?'); 1358 1359 <!-- Find side indeling --> 1360 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 1361 } 1362 } 1363 1364 @helper kasse(){ 1365 <div class="sqcalendar"> 1366 @{ 1367 string sognekode = GetString("Item.Sognekode"); 1368 string kalenderkonto = GetString("Item.AccountNumber"); 1369 String Limit = int.Parse(GetString("Item.Days"), NumberStyles.AllowThousands).ToString(); 1370 1371 int StartSide = 1; 1372 1373 if(string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-start"]) || string.IsNullOrEmpty(@HttpContext.Current.Request.Form["dato-slut"])){ 1374 StartSide = Convert.ToInt32(HttpContext.Current.Request.QueryString["PageNum"]); 1375 } 1376 1377 if (GetBoolean("Item.StartDateNow") == false){ 1378 EndDate = GetDate("Item.Start_Dato").AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1379 } 1380 1381 1382 if(DateTime.Now.ToString("dd/MM/yyyy") == HttpContext.Current.Request.QueryString["startd"]){ 1383 1384 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1385 1386 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["startd"])){ 1387 1388 StartDate=HttpContext.Current.Request.QueryString["startd"]; 1389 1390 }else if(!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-start"])){ 1391 1392 StartDate=HttpContext.Current.Request.Form["dato-start"]; 1393 1394 }else{ 1395 1396 StartDate=DateTime.Now.ToString("dd/MM/yyyy"); 1397 1398 } 1399 1400 if (StartDate!=DateTime.Now.ToString("dd/MM/yyyy")){ 1401 1402 <script type="text/javascript">document.getElementById("dato-start").value = "@StartDate"</script> 1403 } 1404 1405 if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["dato-slut"])){ 1406 EndDate=HttpContext.Current.Request.Form["dato-slut"]; 1407 }else{ 1408 EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy"); 1409 } 1410 1411 if (EndDate!=DateTime.Now.AddDays(GetInteger("Item.Days")).ToString("dd/MM/yyyy")){ 1412 1413 <script type="text/javascript">document.getElementById("dato-slut").value = "@EndDate"</script> 1414 } 1415 1416 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+kalenderkonto+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate+"&InSognekode="+sognekode; 1417 1418 if (GetString("Item.Show.Filter") != "alle"){ 1419 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); 1420 } 1421 1422 int tael=0; 1423 int antalRecs=1; 1424 int rk=1; 1425 int skiprecs = 0; 1426 skiprecs=(StartSide-1)*int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1427 1428 XDocument xdoc = XDocument.Load(linkstring); 1429 var elements = xdoc.Element("DATA").Elements("AFTALE"); 1430 1431 foreach (var el in elements.Skip(skiprecs)) 1432 { 1433 string id = "0"; 1434 string type = "alle"; 1435 DateTime date; 1436 string title = "Title"; 1437 string description = "Description"; 1438 string fulldate = "Date"; 1439 string cleanDate = ""; 1440 string day = ""; 1441 string month = ""; 1442 string location = ""; 1443 string document = GetString("Item.StdImage"); 1444 string document_type = "OFFENTLIGT_AFTALE_BILLEDE"; 1445 string ShowInfo = "Closed"; 1446 antalRecs=int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands); 1447 1448 switch (GetString("Item.Width")){ 1449 case "12": 1450 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1451 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1452 }else{ 1453 rk = 15; 1454 } 1455 break; 1456 case "9": 1457 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1458 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1459 }else{ 1460 rk = 15; 1461 } 1462 break; 1463 case "6": 1464 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 10){ 1465 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1466 }else{ 1467 rk = 10; 1468 } 1469 break; 1470 case "3": 1471 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1472 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1473 }else{ 1474 rk = 5; 1475 } 1476 break; 1477 case "8": 1478 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 15){ 1479 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1480 }else{ 1481 rk = 15; 1482 } 1483 break; 1484 case "4": 1485 if (elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs) < 5){ 1486 rk=elements.Count()/antalRecs+ Math.Sign(elements.Count() % antalRecs); 1487 }else{ 1488 rk = 5; 1489 } 1490 break; 1491 } 1492 1493 tael+=1; 1494 1495 if (tael > antalRecs){ 1496 break; 1497 } 1498 1499 if (el.Elements("ID").Any()){ 1500 id = el.Element("ID").Value; 1501 } 1502 1503 if (el.Elements("AFTALETYPE").Any()){ 1504 type = el.Element("AFTALETYPE").Value; 1505 } 1506 1507 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { 1508 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); 1509 cleanDate = date.ToString("dddd 'd.' d. MMMM kl. HH:mm", new CultureInfo("da-DK")); 1510 day = date.ToString(" d", new CultureInfo("da-DK")); 1511 month = date.ToString("MMM", new CultureInfo("da-DK")); 1512 } 1513 1514 if (el.Elements("OVERSKRIFT").Any()){ 1515 title = el.Element("OVERSKRIFT").Value; 1516 } 1517 1518 if (el.Elements("BESKRIVELSE").Any()){ 1519 description = el.Element("BESKRIVELSE").Value; 1520 } 1521 1522 if (el.Elements("DATO_FORMATERET").Any()){ 1523 fulldate = el.Element("DATO_FORMATERET").Value; 1524 } 1525 1526 if (el.Elements("STED").Any()){ 1527 location = el.Element("STED").Value; 1528 } 1529 1530 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ 1531 document = "https://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; 1532 } 1533 1534 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ 1535 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; 1536 } 1537 1538 if(GetBoolean("Item.Linjeopdeling")==true){ 1539 <hr> 1540 } 1541 1542 if(GetBoolean("Item.Listeopdeling")==true){ 1543 <hr> 1544 } 1545 1546 <div class="sqcalendar-item sqkalender-liste-item-odd"> 1547 <a class="sqcalendar-link" href="Kalenderaftale?kalenderkonto=@kalenderkonto&aftaleid=@id"> 1548 1549 <div class="sqcalendar-date sqevent-date--hide-year" style="background-color: @GetString("Item.DatoBGColor.Color")"> 1550 <div class="sqdate-center"> 1551 1552 <span class="sqdate">@day</span><span class="sqmonth">@month</span> 1553 1554 </div> 1555 </div> 1556 <div class="sqcalendar-desc"> 1557 <div class="sqcalendar-item-info"> 1558 <span class="sqmedia-heading">@title</span> 1559 1560 1561 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @cleanDate</p> 1562 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> 1563 @if (!string.IsNullOrEmpty(description)) 1564 { 1565 <p class="ic-list-item-info nomargin"><i class="fa fa-fw fa-bookmark"></i> @WrapMethods.Truncate(description, int.Parse(TruncateLength()))</p> 1566 } 1567 1568 </div> 1569 </div> 1570 </a> 1571 </div> 1572 } 1573 } 1574 </div> 1575 if(GetBoolean("Item.Listeopdeling")==true){ 1576 <hr> 1577 } 1578 1579 if (GetBoolean("Item.Pagination") != false){ 1580 1581 string OrigUrl=@GetGlobalValue("Global:Pageview.Url"); 1582 string[] urlSplit = OrigUrl.Split('?'); 1583 1584 <!-- Find side indeling --> 1585 @RenderPagination(@urlSplit[0] + "?Purge=True", @rk, @StartSide, @StartDate, @EndDate) 1586 } 1587 } 1588 1589 1590 1591 @helper RenderPagination(string currentPageLink, int pageCount, int currentPage, string sd, string ed) 1592 { 1593 1594 if(currentPage == 0){ 1595 currentPage=1; 1596 } 1597 1598 <div class="col-xs-12" align="center"> 1599 <ul class="pagination"> 1600 @{string pageHrefTemplate = string.Format("<a class=\"page-link\" href=\"{0}&PageNum={{0}}&startd={{1}}&slutd={{2}}\">{{0}}</a>", currentPageLink);} 1601 @for (int i = 1; i <= pageCount; i++) 1602 { 1603 var css = i == currentPage 1604 ? "page-item active" 1605 : "page-item"; 1606 <li class="@css"> 1607 @string.Format(pageHrefTemplate, i, sd, ed) 1608 </li> 1609 } 1610 </ul> 1611 </div> 1612 1613 1614 if (sd != DateTime.Now.ToString("dd/MM/yyyy")){ 1615 <script type="text/javascript">document.getElementById("dato-start").value = "@sd"</script> 1616 } 1617 1618 } 1619 1620 @helper RenderImage() 1621 { 1622 if (!string.IsNullOrEmpty(GetString("Item.Image"))) 1623 { 1624 var image = System.Web.HttpContext.Current.Server.UrlEncode(GetString("Item.Image")); 1625 1626 <!-- Choosing the smallest possible width that will work with responsive sizes --> 1627 string optimizedwidth = "1280"; 1628 switch (GetString("Item.Width")){ 1629 case "12": 1630 optimizedwidth = "1280"; 1631 break; 1632 case "9": 1633 optimizedwidth = "960"; 1634 break; 1635 case "6": 1636 optimizedwidth = "722"; 1637 break; 1638 case "3": 1639 optimizedwidth = "722"; 1640 break; 1641 case "8": 1642 optimizedwidth = "960"; 1643 break; 1644 case "4": 1645 optimizedwidth = "722"; 1646 break; 1647 } 1648 1649 if (GetString("Item.ImageStyle") == "ball") { 1650 optimizedwidth = "500&height=500"; 1651 } 1652 1653 1654 if (string.IsNullOrEmpty(GetString("Item.Link"))) 1655 { 1656 <div class="img-responsive dw-std-image"> 1657 <img class="content-image img-responsive img-centered" style="@GetImageBorderCss()" src="/Admin/Public/GetImage.ashx?width=@optimizedwidth&crop=1&Compression=75&image=@image" class="img-responsive" alt=""></img> 1658 </div> 1659 } else { 1660 <a href="@GetString("Item.Link")"> 1661 <div class="img-responsive dw-std-image"> 1662 <img class="content-image img-responsive img-centered" style="@GetImageBorderCss()" src="/Admin/Public/GetImage.ashx?width=@optimizedwidth&crop=1&Compression=75&image=@image" class="img-responsive" alt=""></img> 1663 </div> 1664 </a> 1665 } 1666 } 1667 } 1668 1669 @functions { 1670 1671 private string GetImageBorderCss() 1672 { 1673 if (GetString("Item.ImageStyle") == "cover") 1674 { 1675 return "padding: 8px"; 1676 } 1677 else if (GetString("Item.ImageStyle") == "cover-border") 1678 { 1679 return "padding: 4px; border: 1px solid #e1e1e1; border-radius: 0px !important"; 1680 } 1681 else if (GetString("Item.ImageStyle") == "frame") 1682 { 1683 return "padding: 6px; border: 1px solid #e1e1e1; border-radius: 0px !important"; 1684 } 1685 else if (GetString("Item.ImageStyle") == "rounded") 1686 { 1687 return "border-radius: 8px !important"; 1688 } 1689 else if (GetString("Item.ImageStyle") == "ball") 1690 { 1691 return "border-radius: 1000px !important"; 1692 } 1693 else if (GetString("Item.ImageStyle") == "shadow") 1694 { 1695 return "box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.2)"; 1696 } 1697 else 1698 { 1699 return string.Empty; 1700 } 1701 } 1702 private string GetParagraphWidth() 1703 { 1704 string PctWidth = "100%"; 1705 switch (GetString("Item.Width")){ 1706 case "12": 1707 PctWidth = "100%"; 1708 break; 1709 case "9": 1710 PctWidth = "75%"; 1711 break; 1712 case "6": 1713 PctWidth = "50%"; 1714 break; 1715 case "3": 1716 PctWidth = "25%"; 1717 break; 1718 case "8": 1719 PctWidth = "66%"; 1720 break; 1721 case "4": 1722 PctWidth = "33%"; 1723 break; 1724 } 1725 return PctWidth; 1726 } 1727 1728 private string TruncateLength() 1729 { 1730 string TruncLen = "100"; 1731 switch (GetString("Item.Width")){ 1732 case "12": 1733 TruncLen = "100"; 1734 break; 1735 case "9": 1736 TruncLen = "72"; 1737 break; 1738 case "6": 1739 TruncLen = "40"; 1740 break; 1741 case "3": 1742 TruncLen = "20"; 1743 break; 1744 case "8": 1745 TruncLen = "62"; 1746 break; 1747 case "4": 1748 TruncLen = "25"; 1749 break; 1750 } 1751 return TruncLen; 1752 } 1753 1754 } 1755 <script type="text/javascript"> 1756 1757 1758 function toggle_visibility(id) { 1759 if($('#' + id + "_chevron").length){ 1760 $('#' + id).stop().slideToggle('slow'); 1761 $('#' + id + "_chevron").toggleClass('bottom'); 1762 1763 1764 if(!$('#' + id + "_img").hasClass('bigPic')){ 1765 1766 var container_width = 269; 1767 var image_height; 1768 var natural_width = document.getElementById(id + "_img").naturalWidth; 1769 var natural_height = document.getElementById(id + "_img").naturalHeight; 1770 1771 if(natural_width < container_width){ //> 1772 container_width = natural_width; 1773 } 1774 1775 var res = container_width / natural_width; 1776 //console.log(res); 1777 1778 image_height = natural_height * res; 1779 //console.log(image_height); 1780 1781 if(image_height > 400){ 1782 image_height = 400; 1783 } 1784 1785 //console.log(natural_width + " x " + natural_height); 1786 //console.log(image_height); 1787 $('#' + id + "_img").addClass('bigPic'); 1788 $('#' + id + "_img").css('max-height', image_height + "px"); 1789 }else{ 1790 $('#' + id + "_img").removeClass('bigPic'); 1791 $('#' + id + "_img").css('max-height', "100px"); 1792 } 1793 } 1794 } 1795 </script> 1796 1797

Accepter cookies fra dette website

Dette website bruger cookies til at følge din adfærd og for at forbedre brugeroplevelsen på sitet.

Du kan altid slette gemte cookies i dine browserinstillinger

Jeg accepterer ikke cookies Jeg accepterer kun funktionelle cookies Jeg accepterer alle cookies