Skip til hoved indholdet
Error executing template "Designs/bleau-solutionset/Paragraph/Emply.cshtml"
System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at CompiledRazorTemplates.Dynamic.RazorEngine_e1903a715548408c8185bd9aab6b5b99.Execute() in C:\home\site\wwwroot\Files\Templates\Designs\bleau-solutionset\Paragraph\Emply.cshtml:line 133
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using Newtonsoft.Json; 2 @using System.Web; 3 @using System.Net; 4 @using System.IO; 5 @using System.Collections.Generic; 6 @using System.Web.WebPages; 7 @using System.Linq; 8 @using System.Web.Caching; 9 10 @functions 11 { 12 13 14 public class Localization 15 { 16 public string locale { get; set; } 17 public string value { get; set; } 18 } 19 20 public class ApplyUrl 21 { 22 public List<Localization> localization { get; set; } 23 } 24 25 public class AdUrl 26 { 27 public List<Localization> localization { get; set; } 28 } 29 30 public class Title 31 { 32 public List<Localization> localization { get; set; } 33 } 34 35 public class Content 36 { 37 public List<Localization> localization { get; set; } 38 } 39 40 public class Advertisement 41 { 42 public bool @default { get; set; } 43 public Title title { get; set; } 44 public Content content { get; set; } 45 } 46 47 public class DeadlineText 48 { 49 public List<Localization> localization { get; set; } 50 } 51 52 public class Location 53 { 54 public string address { get; set; } 55 public string latitude { get; set; } 56 public string longitude { get; set; } 57 } 58 59 public class Department 60 { 61 public string id { get; set; } 62 public Title title { get; set; } 63 } 64 65 public class Datum 66 { 67 public int type { get; set; } 68 public object value { get; set; } 69 public string id { get; set; } 70 public string jobDetailsId { get; set; } 71 public Title title { get; set; } 72 public int valueType { get; set; } 73 } 74 75 public class Root 76 { 77 public int jobId { get; set; } 78 public ApplyUrl applyUrl { get; set; } 79 public AdUrl adUrl { get; set; } 80 public string timeZone { get; set; } 81 public string mediaId { get; set; } 82 public List<Advertisement> advertisements { get; set; } 83 public Title title { get; set; } 84 public int type { get; set; } 85 public DateTime? created { get; set; } 86 public DateTime? edited { get; set; } 87 public DateTime? deadlineUTC { get; set; } 88 public DateTime? deadline { get; set; } 89 public DeadlineText deadlineText { get; set; } 90 public Location location { get; set; } 91 public Department department { get; set; } 92 public List<object> tags { get; set; } 93 public List<Datum> data { get; set; } 94 } 95 96 public class JobGroup 97 { 98 public string groupTitle { get; set; } 99 public List<Root> jobsInGroup { get; set; } 100 101 } 102 103 public class ContactPerson 104 { 105 public string contactName { get; set; } 106 public string jobTitle { get; set; } 107 public string phoneNumber { get; set; } 108 public string mobileNumber { get; set; } 109 public string officeNumber { get; set; } 110 } 111 } 112 113 @GetValue("ParagraphText") 114 @GetValue("ParagraphModule") 115 @GetValue("ParagraphImage") 116 117 @{ 118 119 var cacheKey = "emplyJobs"; 120 121 var empCode = "d8a7c1a1-6044-43a3-86a9-7a5649825531"; 122 var empBaseUrl = "https://api.emply.com/v1/halsnaes/postings/"; 123 var adID = ""; 124 var url = empBaseUrl + empCode; 125 if (!string.IsNullOrEmpty(HttpContext.Current.Request["adid"])) 126 { 127 adID = HttpContext.Current.Request["adid"]; 128 url = url + "/" + adID; 129 } 130 var result = ""; 131 132 var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); 133 var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); 134 using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) 135 { 136 result = streamReader.ReadToEnd(); 137 } 138 139 140 var list = new List<Root>(); 141 var groups = new List<string>() { "Administration og Ledelse", "Børn, Unge og Undervisning", "Miljø og Teknik", "Voksne, Socialpædagogik og Beskæftigelse", "Ældre, Sundhed og Pleje", "Øvrige/Andre" }; 142 var listdynCount = 0; 143 144 var groupedJobs = new List<JobGroup>(); 145 146 if (adID != "") 147 { 148 //JsonConvert.DeserializeObject<Root>(result); 149 } 150 else 151 { 152 list = JsonConvert.DeserializeObject<List<Root>>(result); 153 154 var listDyn = JsonConvert.DeserializeObject<dynamic>(result); 155 // listdynCount = listDyn.Length; 156 157 158 foreach (var title in groups) 159 { 160 var jobgroup = new JobGroup(); 161 jobgroup.groupTitle = title; 162 jobgroup.jobsInGroup = new List<Root>(); 163 groupedJobs.Add(jobgroup); 164 } 165 166 foreach (var item in listDyn) 167 { 168 foreach (var d in item.data) 169 { 170 if (d.title.localization[0].value.ToString().ToLower().Trim() == "jobområde" || d.title.localization[0].value.ToString().ToLower().Trim() == "job area") 171 { 172 173 if (groups.Contains(d.value[0].title.localization[1].value.ToString())) 174 { 175 176 foreach (var jobgroup in groupedJobs) 177 { 178 if (jobgroup.groupTitle == d.value[0].title.localization[1].value.ToString()) 179 { 180 var root = new Root(); 181 root.jobId = Int32.Parse(item.jobId.ToString()); 182 if (!string.IsNullOrWhiteSpace(item.deadline.ToString())) 183 { 184 root.deadline = DateTime.Parse(item.deadline.ToString()); 185 } 186 187 var lok = new Localization(); 188 lok.value = item.title.localization[0].value.ToString(); 189 var title = new Title(); 190 title.localization = new List<Localization>(); 191 title.localization.Add(lok); 192 root.title = title; 193 194 jobgroup.jobsInGroup.Add(root); 195 } 196 } 197 } 198 } 199 } 200 } 201 202 203 } 204 } 205 206 @SnippetStart("StyleSheetHead") 207 <link href="/Files/Templates/Designs/bleau-solutionset/assets/stylesheets/emply.min.css" rel="stylesheet" /> 208 <link href="/Files/Templates/Designs/bleau-solutionset/assets/socicon/socicon.css" rel="stylesheet" media="screen" /> 209 @SnippetEnd("StyleSheetHead") 210 211 @if (!String.IsNullOrEmpty(GetString("Item.Image"))) 212 { 213 <div class="emplyImage"><img alt='@GetString("Item.Alt")' src='@GetString("Item.Image")'></div> 214 } 215 216 @if (adID == "") 217 { 218 <div class="AdList"> 219 220 @foreach (var gr in groupedJobs) 221 { 222 223 if (@gr.jobsInGroup.Any()) 224 { 225 <h2>@gr.groupTitle</h2> 226 foreach (var job in gr.jobsInGroup) 227 { 228 var detailUrl = GetString("Item.ShowJobPage"); 229 var delimiter = "?"; 230 231 232 if (detailUrl.Contains("?")) { delimiter = "&"; } 233 detailUrl += delimiter + "adID=" + job.jobId; 234 235 <a class="jobsCellLink" href="@detailUrl" target="_blank"> 236 <div class="jobsCell"> 237 <h3>@job.title.localization[0].value</h3> 238 239 <div>Frist: @job.deadline</div> 240 </div> 241 </a> 242 } 243 } 244 else 245 { 246 <h2>@gr.groupTitle</h2> 247 <p class="noJobs">@Translate("Ingen jobs", "Ingen jobs i denne kategori")</p> 248 } 249 250 } 251 </div> 252 <!-- TEMPLATE LISTE END--> 253 } 254 else 255 { 256 <!-- TEMPLATE DETAIL--> 257 //looping all data objects 258 259 var oneAd = JsonConvert.DeserializeObject<dynamic>(result); 260 261 var contactName = ""; 262 var jobTitle = ""; 263 var weeklyHours = ""; 264 var duration = ""; 265 var area = ""; 266 var phone = ""; 267 var mobilePhone = ""; 268 var officePhone = ""; 269 var jobName = ""; 270 var interviews = ""; 271 var conditions = ""; 272 var banner = ""; 273 var bannerName = ""; 274 275 var contactPersonList = new List<ContactPerson>(); 276 277 foreach (var dataObject in oneAd.data) 278 { 279 bool propertyExists = false; 280 var dataTitle = (string)dataObject.title.localization[0].value; 281 var cp = new ContactPerson(); 282 283 switch (dataTitle) 284 { 285 case "Kontaktperson": 286 try 287 { 288 contactName = dataObject.value[0].information.firstName + " " + dataObject.value[0].information.lastName; 289 jobTitle = dataObject.value[0].information.jobTitle; 290 291 mobilePhone = dataObject.value[0].information.mobilePhon; 292 officePhone = dataObject.value[0].information.officePhone; 293 294 propertyExists = true; 295 296 cp.contactName = contactName; 297 cp.jobTitle = jobTitle; 298 cp.officeNumber = officePhone; 299 cp.mobileNumber = mobilePhone; 300 } 301 catch (Exception e) 302 { 303 try 304 { 305 if (!propertyExists)//måske ekstern kontakt person? 306 { 307 contactName = dataObject.value.localization[0].value; 308 cp.contactName = contactName; 309 310 cp.jobTitle = ""; 311 } 312 313 } 314 catch (Exception ee) 315 { 316 317 } 318 319 } 320 321 //if (propertyExists) 322 //{ 323 // try 324 // { 325 // jobTitle = dataObject.value[0].information.jobTitle; 326 // } 327 // catch (Exception ex) 328 // { 329 330 // } 331 //} 332 333 break; 334 335 case "Contact person": 336 try 337 { 338 contactName = dataObject.value[0].information.firstName + " " + dataObject.value[0].information.lastName; 339 jobTitle = dataObject.value[0].information.jobTitle; 340 341 mobilePhone = dataObject.value[0].information.mobilePhon; 342 officePhone = dataObject.value[0].information.officePhone; 343 344 propertyExists = true; 345 346 cp.contactName = contactName; 347 cp.jobTitle = jobTitle; 348 cp.officeNumber = officePhone; 349 cp.mobileNumber = mobilePhone; 350 } 351 catch (Exception e) 352 { 353 try 354 { 355 if (!propertyExists)//måske ekstern kontakt person? 356 { 357 contactName = dataObject.value.localization[0].value; 358 cp.contactName = contactName; 359 360 cp.jobTitle = ""; 361 } 362 363 } 364 catch (Exception ee) 365 { 366 367 } 368 } 369 370 break; 371 372 case "Ansættelsesvilkår": 373 conditions = dataObject.value[0].title.localization[0].value; 374 break; 375 case "Varighed": 376 duration = dataObject.value[0].title.localization[0].value; 377 break; 378 case "Telefonnummer": 379 phone = dataObject.value.localization[0].value; 380 cp.phoneNumber = phone; 381 break; 382 case "Mobilnummer": 383 mobilePhone = dataObject.value.localization[0].value; 384 cp.mobileNumber = mobilePhone; 385 break; 386 case "Jobområde": 387 area = dataObject.value[0].title.localization[0].value; 388 break; 389 case "Stillingsbetegnelse": 390 jobName = dataObject.value.localization[0].value; 391 break; 392 case "Ansættelsessamtaler": 393 interviews = dataObject.value.localization[0].value; 394 break; 395 case "Ugentlig arbejdstid": 396 weeklyHours = dataObject.value.localization[0].value; 397 break; 398 case "Banner": 399 banner = dataObject.value[0].url; 400 bannerName = dataObject.value[0].name; 401 break; 402 } 403 404 contactPersonList.Add(cp); 405 406 } 407 408 if (!string.IsNullOrWhiteSpace(banner)) 409 { 410 <div class="emplyImage"><img src="@banner" alt="@bannerName"></div> 411 } 412 413 414 <div class="AdDetail"> 415 416 @{ 417 <div class="col-sm-8"> 418 419 @SnippetStart("StyleSheetHead") 420 <meta name="description" content="@oneAd.title.localization[0].value"> 421 <meta property="og:title" content="@oneAd.title.localization[0].value"> 422 <meta property="og:url" content="@oneAd.applyUrl.localization[0].value"> 423 <meta property="og:image" content="@banner"> 424 <meta property="og:type" content="website"> 425 426 @SnippetEnd("StyleSheetHead") 427 428 429 <h2>@oneAd.title.localization[0].value</h2> 430 431 <p>@oneAd.advertisements[0].content.localization[0].value</p> 432 @if (adID != "4257" && adID != "4945" && adID != "5067") 433 { 434 <button name="apply" onclick='window.open("@oneAd.applyUrl.localization[0].value");'>Ansøg</button> 435 } 436 437 438 </div> 439 440 <div class="col-sm-4" id="details"> 441 442 <div class="data"><h3>Frist:</h3> @oneAd.deadline </div> 443 444 @if (contactPersonList.Count > 0) 445 { 446 foreach (var p in contactPersonList) 447 { 448 if (!string.IsNullOrWhiteSpace(p.contactName)) 449 { 450 <div class="data"> 451 <h3>Kontaktperson:</h3> 452 453 @if (!string.IsNullOrWhiteSpace(p.jobTitle)) 454 { 455 @p.jobTitle <br /> 456 } 457 @if (!string.IsNullOrWhiteSpace(p.contactName)) 458 { 459 @p.contactName<br /> 460 } 461 462 @if (!string.IsNullOrWhiteSpace(p.mobileNumber) && @p.mobileNumber.Length > 3) 463 { 464 465 if(p.mobileNumber.Replace(" ","").Length == 8){ 466 <a href="tel:+45 @p.mobileNumber" style="color:white">+45 @p.mobileNumber</a><br/> 467 } 468 else{ 469 <a href="tel:@p.mobileNumber" style="color:white">@p.mobileNumber </a><br/> 470 } 471 472 } 473 474 @if (!string.IsNullOrWhiteSpace(p.officeNumber) && @p.officeNumber.Length > 3) 475 { 476 477 if(!string.IsNullOrWhiteSpace(p.mobileNumber) ){ 478 479 if(@p.officeNumber.Replace(" ","") != @p.mobileNumber.Replace(" ","") && @p.officeNumber.Replace("+45","") != @p.mobileNumber.Replace("+45","")){ 480 <a href="tel:@p.officeNumber" style="color:white">@p.officeNumber</a> 481 } 482 } 483 else{ 484 485 if(p.officeNumber.Replace(" ","").Length == 8){ 486 <a href="tel:+45 @p.officeNumber" style="color:white">+45 @p.officeNumber</a> 487 } 488 else{ 489 <a href="tel:@p.officeNumber" style="color:white">@p.officeNumber</a> 490 } 491 } 492 493 } 494 </div> 495 } 496 if (!string.IsNullOrWhiteSpace(p.phoneNumber) && @p.phoneNumber.Length > 3 ) 497 { 498 <div class="data"><h3>Telefonnummer:</h3> 499 @if(p.phoneNumber.Replace(" ","").Length == 8){ 500 <a href="tel:+45 @p.phoneNumber" style="color:white">+45 @p.phoneNumber</a> 501 } 502 else{ 503 <a href="tel:@p.phoneNumber" style="color:white">@p.phoneNumber</a> 504 } 505 </div> 506 } 507 508 } 509 } 510 511 512 @if (!string.IsNullOrWhiteSpace(area)) 513 { 514 515 <div class="data"><h3>@Translate("Area(Emply)", "Jobområde"):</h3> <p>@area</p> </div> 516 } 517 518 519 520 521 @if (!string.IsNullOrWhiteSpace(area)) 522 { 523 <div class="data"><h3>@Translate("Afdeling(Emply)", "Afdeling"):</h3> <p>@oneAd.department.title.localization[0].value</p> </div> 524 } 525 @if (!string.IsNullOrWhiteSpace(duration)) 526 { 527 <div class="data"><h3>@Translate("Duration(Emply)", "Varighed"):</h3> <p>@duration</p> </div> 528 } 529 @if (!string.IsNullOrWhiteSpace(conditions)) 530 { 531 <div class="data"><h3>@Translate("Ansættelsesvilkår(Emply)", "Ansættelsesvilkår"):</h3> <p>@conditions</p> </div> 532 } 533 @if (!string.IsNullOrWhiteSpace(interviews)) 534 { 535 <div class="data"><h3>@Translate("Interviews(Emply)", "Ansættelsessamtaler"):</h3> @interviews </div> 536 } 537 @if (!string.IsNullOrWhiteSpace(jobName)) 538 { 539 <div class="data"><h3>@Translate("JobName(Emply)", "Stillingsbetegnelse"):</h3> <p>@jobName</p> </div> 540 } 541 @if (!string.IsNullOrWhiteSpace(weeklyHours)) 542 { 543 <div class="data"><h3>@Translate("WeeklyHours(Emply)", "Ugentlig arbejdstid"):</h3> <p>@weeklyHours</p> </div> 544 } 545 546 547 @if (adID != "4257" && adID != "4945" && adID != "5067") 548 { 549 550 <div> 551 <h3>Ansøg:</h3> <a class="link" href="@oneAd.applyUrl.localization[0].value" target="_blank">Link til ansøgning</a> 552 </div> 553 } 554 555 556 557 <div class="data"><h3>Lokation:</h3> @oneAd.location.address </div> 558 559 <div>&nbsp;</div> 560 561 <div class="mapouter"> 562 <div class="gmap_canvas"> 563 <iframe width="100%" height="250" id="gmap_canvas" src="https://maps.google.com/maps?q=@oneAd.location.latitude.ToString().Replace(",", "."),@oneAd.location.longitude.ToString().Replace(",", ".")&hl=da&z=15&amp;output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe> 564 </div> 565 </div> 566 567 <div>&nbsp;</div> 568 569 </div> 570 571 <div class="col-sm-4 leftSidebar-subpage"> 572 <div class="main-content" style="padding:0"> 573 <div class="green-box-list"> 574 <a href="https://halsnaes.career.emply.com/jobagent" target="_blank" class="green-box-link" role="button"> 575 <div class="green-box" title="Opret jobagent"> 576 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve" data-inject-url="https://halsnaes.dk/Files/Ikoner/Pencil.svg"> 577 <metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata> 578 <g><g><g><path d="M912.2,87.8C821.6-2.9,753.5,10.7,753.5,10.7L436.2,328.1L73.4,690.8L10,990l299.2-63.5l362.7-362.7l317.4-317.3C989.3,246.5,1002.9,178.5,912.2,87.8z M291.4,890.6l-102,22c-9.9-18.4-21.7-36.8-43.4-58.5c-21.7-21.7-40.1-33.5-58.5-43.4l22-102l29.5-29.5c0,0,55.5,1.1,118.2,63.8c62.7,62.7,63.8,118.2,63.8,118.2L291.4,890.6z"></path></g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></g> 579 </svg> 580 <h3 class="title">Opret jobagent</h3> 581 </div> 582 </a> 583 </div> 584 </div> 585 </div> 586 587 588 <div class="data" style="float:left"> 589 590 <div class="social-box " id="SocialBoxTitles" title="Social Box Titles"> 591 <script> 592 $(document).ready(function () { 593 594 var n = encodeURIComponent(window.location.href), 595 f = window.location.pathname, 596 t = "https://www.facebook.com/sharer/sharer.php?u=" + n, 597 i = "http://www.twitter.com/intent/tweet?url=" + n + "&text=&summary=&source=", 598 u = "https://www.linkedin.com/shareArticle?mini=true&url=" + n + "&title=&summary=&source="; 599 e = "mailto:modtager@mail.dk?subject=Stilling i Halsnæs Kommune&body=@oneAd.title.localization[0].value"; 600 $("#facebook-share").attr("data-href", t); 601 $("#twitter-share").attr("data-href", i); 602 $("#linkedin-share").attr("data-href", u); 603 $("#email-share").attr("data-href", e); 604 }); 605 </script> 606 <ul> 607 <li><a onclick='window.open(this.getAttribute("data-href"), "mywindow","menubar=1,resizable=1,width=350,height=250")' id="facebook-share" title="Del indholdet Facebook"><span class="socicon circle socicon-facebook"></span></a> 608 <li><a onclick='window.open(this.getAttribute("data-href"), "mywindow","menubar=1,resizable=1,width=350,height=250")' id="twitter-share" title="Del indholdet Twitter"><span class="socicon circle socicon-twitter"></span></a> 609 <li><a onclick='window.open(this.getAttribute("data-href"), "mywindow","menubar=1,resizable=1,width=350,height=250")' id="linkedin-share" title="Del indholdet LinkedIn"><span class="socicon circle socicon-linkedin"></span></a> 610 <li><a onclick='window.open(this.getAttribute("data-href"), "","")' id="email-share" title="Del via e-mail"><span class="socicon circle socicon-mailru"></span></a> 611 </ul> 612 </div> 613 614 </div> 615 } 616 617 </div> 618 <!-- TEMPLATE DETAIL END--> 619 }