Selvbetjening

Error executing template "/Designs/Paragraph/Banner_B1.cshtml"
System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b66b263863e64327b7e96d14ca1a97a7.AffaldsVidenFunc.GetMadaffaldTilEl(Int32 months) in C:\home\site\wwwroot\DinForsyning\Files\Templates\Designs\Paragraph\Banner_B1.cshtml:line 82
   at CompiledRazorTemplates.Dynamic.RazorEngine_b66b263863e64327b7e96d14ca1a97a7.Execute() in C:\home\site\wwwroot\DinForsyning\Files\Templates\Designs\Paragraph\Banner_B1.cshtml:line 195
   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.Net 2 @using System.Text 3 @functions{ 4 public class AffaldsVidenFunc { 5 // private static readonly string API_KEY = "Hdj!^$Pn9Dl*uXTeZ&7fZEmdPG9s&Yg4DQMy13yw"; 6 // 7 // public static Newtonsoft.Json.Linq.JToken GetHKode(string kommune, string hkode) { 8 // var cacheKey = "AffaldsVidenFunc:GetHKode(" + kommune + ", " + hkode + ")"; 9 // var result = default(Newtonsoft.Json.Linq.JToken); 10 // 11 // if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 12 // using (var wc = new WebClient()) { 13 // wc.Headers["X-API-KEY"] = API_KEY; 14 // wc.Encoding = Encoding.UTF8; 15 // 16 // var json = wc.DownloadString("https://api.affaldsviden.info/kommune-" + kommune + "/hkode-" + hkode); 17 // 18 // result = Newtonsoft.Json.Linq.JToken.Parse(json); 19 // 20 // Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 21 // AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 22 // }); 23 // } 24 // } 25 // 26 // return result; 27 // } 28 // 29 // public static Newtonsoft.Json.Linq.JToken GetGenbrugsprocent(string kommune) { 30 // var cacheKey = "AffaldsVidenFunc:GetGenbrugsprocent(" + kommune + ")"; 31 // var result = default(Newtonsoft.Json.Linq.JToken); 32 // 33 // if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 34 // using (var wc = new WebClient()) { 35 // wc.Headers["X-API-KEY"] = API_KEY; 36 // wc.Encoding = Encoding.UTF8; 37 // 38 // var json = wc.DownloadString("https://api.affaldsviden.info/kommune-" + kommune + "/genbrugsprocent"); 39 // 40 // result = Newtonsoft.Json.Linq.JToken.Parse(json); 41 // 42 // Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 43 // AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 44 // }); 45 // } 46 // } 47 // 48 // return result; 49 // } 50 // 51 // public static Newtonsoft.Json.Linq.JToken GetMadaffaldTilEl(string kommune) { 52 // var cacheKey = "AffaldsVidenFunc:GetMadaffaldTilEl(" + kommune + ")"; 53 // var result = default(Newtonsoft.Json.Linq.JToken); 54 // 55 // if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 56 // using (var wc = new WebClient()) { 57 // wc.Headers["X-API-KEY"] = API_KEY; 58 // wc.Encoding = Encoding.UTF8; 59 // 60 // var json = wc.DownloadString("https://api.affaldsviden.info/kommune-" + kommune + "/madaffald-til-el"); 61 // 62 // result = Newtonsoft.Json.Linq.JToken.Parse(json); 63 // 64 // Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 65 // AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 66 // }); 67 // } 68 // } 69 // 70 // return result; 71 // } 72 73 public static Newtonsoft.Json.Linq.JToken GetMadaffaldTilEl(int months) { 74 var cacheKey = "AffaldsVidenFunc:GetMadaffaldTilEl(" + months + ")"; 75 var result = default(Newtonsoft.Json.Linq.JToken); 76 77 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 78 using (var wc = new WebClient()) { 79 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 80 wc.Encoding = Encoding.UTF8; 81 82 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?madaffald-til-el=" + months); 83 84 result = Newtonsoft.Json.Linq.JToken.Parse(json); 85 86 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 87 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 88 }); 89 } 90 } 91 92 return result; 93 } 94 95 public static Newtonsoft.Json.Linq.JToken GetReelGenanvendelse(int months) { 96 var cacheKey = "AffaldsVidenFunc:GetReelGenanvendelse(" + months + ")"; 97 var result = default(Newtonsoft.Json.Linq.JToken); 98 99 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 100 using (var wc = new WebClient()) { 101 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 102 wc.Encoding = Encoding.UTF8; 103 104 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?reel-genanvendelse=" + months); 105 106 result = Newtonsoft.Json.Linq.JToken.Parse(json); 107 108 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 109 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(60.0 * 12) 110 }); 111 } 112 } 113 114 return result; 115 } 116 117 public static Newtonsoft.Json.Linq.JToken GetReelGenanvendelseYear() { 118 var cacheKey = "AffaldsVidenFunc:GetReelGenanvendelseYear()"; 119 var result = default(Newtonsoft.Json.Linq.JToken); 120 121 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 122 using (var wc = new WebClient()) { 123 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 124 wc.Encoding = Encoding.UTF8; 125 126 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?reel-genanvendelse-year"); 127 128 result = Newtonsoft.Json.Linq.JToken.Parse(json); 129 130 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 131 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(60.0 * 12) 132 }); 133 } 134 } 135 136 return result; 137 } 138 139 public static Newtonsoft.Json.Linq.JToken GetDe10Fraktioner(int months) { 140 var cacheKey = "AffaldsVidenFunc:GetDe10Fraktioner(" + months + ")"; 141 var result = default(Newtonsoft.Json.Linq.JToken); 142 143 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 144 using (var wc = new WebClient()) { 145 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 146 wc.Encoding = Encoding.UTF8; 147 148 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?de-10-fraktioner=" + months); 149 150 result = Newtonsoft.Json.Linq.JToken.Parse(json); 151 152 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 153 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 154 }); 155 } 156 } 157 158 return result; 159 } 160 161 public static Newtonsoft.Json.Linq.JToken GetDe10FraktionerYear() { 162 var cacheKey = "AffaldsVidenFunc:GetDe10FraktionerYear()"; 163 var result = default(Newtonsoft.Json.Linq.JToken); 164 165 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 166 using (var wc = new WebClient()) { 167 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 168 wc.Encoding = Encoding.UTF8; 169 170 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?de-10-fraktioner-year"); 171 172 result = Newtonsoft.Json.Linq.JToken.Parse(json); 173 174 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 175 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 176 }); 177 } 178 } 179 180 return result; 181 } 182 } 183 } 184 @using System.Globalization 185 @{ 186 var paragraphId = GetInteger("ParagraphID"); 187 var pageId = GetInteger("ParagraphPageID"); 188 189 var show_laesmere = Pageview.Page.ID != 5515; 190 191 var total_ton = "0"; 192 var total_hus = "0"; 193 var goto_url = "/Default.aspx?Id=5515"; 194 195 var jTkn = AffaldsVidenFunc.GetMadaffaldTilEl(12); 196 var tons = jTkn?.Sum(o => (double)o["maengde"]); 197 var huss = jTkn?.Sum(o => (double)o["elForbrugHusstande"]); 198 199 total_ton = tons.HasValue && tons.Value > 0.0 ? tons.Value.ToString("N1", CultureInfo.CurrentCulture).Replace(",0", string.Empty) : total_ton; 200 total_hus = huss.HasValue && huss.Value > 0.0 ? huss.Value.ToString("N2", CultureInfo.CurrentCulture).Replace(",00", string.Empty) : total_hus; 201 } 202 203 <div class="col-sm-12"> 204 <div id="banner_@(paragraphId)"> 205 <div id="animation_container_@(paragraphId)" style="background-color: rgba(255, 255, 255, 1.00); width: 1170px; height: 300px"> 206 <canvas id="canvas_@(paragraphId)" width="1170" height="300" style="position: absolute; display: none; background-color: rgba(255, 255, 255, 1.00);"></canvas> 207 <div id="dom_overlay_container_@(paragraphId)" style="pointer-events: none; overflow: hidden; width: 1170px; height: 300px; position: absolute; left: 0; top: 0; display: none;"></div> 208 </div> 209 <div id="_preload_div_@(paragraphId)" style="position: absolute; top: 0; left: 0; display: inline-block; height: 300px; width: 1170px; text-align: center;"> 210 <span style="display: inline-block; height: 100%; vertical-align: middle;"></span> 211 <img src="/Files/Files/DINFORSYNING_DK/Affald/API-Banners/B1/images/_preloader.gif" style="vertical-align: middle; max-height: 100%" /> 212 </div> 213 </div> 214 </div> 215 216 <script src="https://cdn.jsdelivr.net/npm/createjs@1.0.1/builds/1.0.0/createjs.min.js"></script> 217 <script src="/Files/Files/DINFORSYNING_DK/Affald/API-Banners/B1/b1.js"></script> 218 <script type="text/javascript"> 219 $(function() { 220 function init() { 221 var $banner = document.getElementById('banner_@(paragraphId)'); 222 var $canvas = document.getElementById('canvas_@(paragraphId)'); 223 var $anim_container = document.getElementById('animation_container_@(paragraphId)'); 224 var $dom_overlay_container = document.getElementById('dom_overlay_container_@(paragraphId)'); 225 var $preloader = document.getElementById('_preload_div_@(paragraphId)'); 226 227 var comp = AdobeAn.getComposition('4979601E3BE81F4DAA2B8A4352DD1D9F'); 228 var lib = comp.getLibrary(); 229 var loader = new createjs.LoadQueue(false); 230 231 loader.addEventListener('fileload', function(evt) { 232 handleFileLoad(evt, comp); 233 }); 234 235 loader.addEventListener('complete', function(evt) { 236 handleComplete(evt, comp, $banner, $canvas, $anim_container, $dom_overlay_container, $preloader); 237 }); 238 239 loader.loadManifest(lib.properties.manifest); 240 } 241 242 function handleFileLoad(evt, comp) { 243 var images = comp.getImages(); 244 245 if (evt && (evt.item.type == 'image')) { 246 images[evt.item.id] = evt.result; 247 } 248 } 249 250 function handleComplete(evt, comp, $banner, $canvas, $anim_container, $dom_overlay_container, $preloader) { 251 var lib = comp.getLibrary(); 252 var ss = comp.getSpriteSheet(); 253 var queue = evt.target; 254 var ssMetadata = lib.ssMetadata; 255 256 for (var i = 0; i < ssMetadata.length; i++) { 257 ss[ssMetadata[i].name] = new createjs.SpriteSheet({ images: [queue.getResult(ssMetadata[i].name)], frames: ssMetadata[i].frames }); 258 } 259 260 $preloader.style.display = 'none'; 261 $canvas.style.display = 'block'; 262 263 var exportRoot = new lib.b1(); 264 var stage = new lib.Stage($canvas); 265 266 exportRoot.bannerInit = handleBannerInit; 267 268 stage.enableMouseOver(); 269 comp.setExportRoot(exportRoot); 270 271 function fnStartAnimation() { 272 stage.addChild(exportRoot); 273 createjs.Ticker.framerate = lib.properties.fps; 274 createjs.Ticker.addEventListener('tick', stage); 275 } 276 277 AdobeAn.makeResponsive(stage, true, 'width', false, 1, [$canvas, $preloader, $anim_container, $dom_overlay_container], $banner); 278 AdobeAn.compositionLoaded(lib.properties.id); 279 fnStartAnimation(); 280 } 281 282 init(); 283 284 /*-----------------------------------------------------------------------------------*/ 285 function handleBannerInit(lib) { 286 var show_laesmere = @(show_laesmere ? "true" : "false"); 287 var $this = this; 288 289 $this.stop(); 290 291 function createCounter(target, value) { 292 var values = value.split('').reduceRight(function(acc, cur) { 293 if (cur == '.' || cur == ',') 294 acc.push({ v: cur }); 295 else 296 acc.push({ v: parseInt(cur) }); 297 298 return acc; 299 }, []).reverse(); 300 301 var mc = new createjs.MovieClip(); 302 303 values.forEach(function(item, i) { 304 item.mc = mc.addChild(new (item.v == '.' ? lib.cntdot : item.v == ',' ? lib.cntcomma : lib.cnt)()); 305 306 if (i > 0) { 307 var prev = values[i - 1].mc; 308 309 item.mc.x = (prev.x + prev.getBounds().width) - 6; 310 } 311 }); 312 313 target.addChild(mc); 314 315 return { 316 mc: mc, 317 animate: function() { 318 return Promise.all(values.filter(function(o) { 319 return !(o.v == '.' || o.v == ','); 320 }).map(function(o, i) { 321 var step = 119.2; 322 var goTo = o.v; 323 324 if ((goTo <= 0 || goTo > 10) && i > 0) 325 goTo = 10; 326 327 var destY = o.mc.numbers.regY - (step * goTo); 328 329 return new Promise(function(resolve) { 330 createjs.Tween.get(o.mc.numbers, { override: true }).to({ y: destY }, 2500, createjs.Ease.quartInOut).call(resolve); 331 }); 332 })); 333 } 334 }; 335 } 336 337 function step_1() { 338 [$this.ct2_text_daek, $this.ct2_text_hus, $this.ct2_hus, $this.ct2_laesmere].forEach(function(o) { 339 o.alpha = 0; 340 o.visible = false; 341 }); 342 343 var cnt = createCounter($this, '@(total_ton)'); 344 var cnt_spaceX = 10; 345 346 $this.ct1_cnt = cnt.mc; 347 $this.ct1_text_tons.setTransform(); 348 349 var bounds_cnt = $this.ct1_cnt.getTransformedBounds(); 350 var bounds_text_tons = $this.ct1_text_tons.getTransformedBounds(); 351 352 // scale 353 while ((bounds_cnt.width + cnt_spaceX + bounds_text_tons.width) > (lib.properties.width - 80)) { 354 $this.ct1_text_tons.scale -= 0.1; 355 356 bounds_text_tons = $this.ct1_text_tons.getTransformedBounds(); 357 } 358 359 // y 360 var top = 67; 361 $this.ct1_cnt.y = top; 362 $this.ct1_text_tons.y = top + ($this.ct1_text_tons.scale < 1 ? (Math.floor(bounds_cnt.height) - Math.floor(bounds_text_tons.height)) * $this.ct1_text_tons.scale : 0); 363 364 // x 365 var left = (lib.properties.width - (bounds_cnt.width + cnt_spaceX + bounds_text_tons.width)) * 0.5; 366 $this.ct1_cnt.x = left; 367 $this.ct1_text_tons.x = left + bounds_cnt.width + cnt_spaceX; 368 369 return (new Promise(function(resolve) { 370 setTimeout(resolve, 800); 371 })).then(function() { 372 return cnt.animate(); 373 }); 374 } 375 376 function step_2() { 377 var cnt = createCounter($this, '@(total_hus)'); 378 var cnt_spaceX = 10; 379 380 $this.ct2_cnt = cnt.mc; 381 $this.ct2_text_daek.setTransform(); 382 $this.ct2_text_hus.setTransform(); 383 $this.ct2_hus.setTransform(); 384 385 $this.ct2_cnt.alpha = 0; 386 $this.ct2_cnt.visible = false; 387 388 var bounds_cnt = $this.ct2_cnt.getTransformedBounds(); 389 var bounds_text_daek = $this.ct2_text_daek.getTransformedBounds(); 390 var bounds_text_hus = $this.ct2_text_hus.getTransformedBounds(); 391 var bounds_hus = $this.ct2_hus.getBounds(); 392 393 // scale 394 while ((bounds_text_daek.width + cnt_spaceX + bounds_cnt.width + cnt_spaceX + bounds_text_hus.width) > (lib.properties.width - 80)) { 395 $this.ct2_text_daek.scale -= 0.1; 396 $this.ct2_text_hus.scale -= 0.1; 397 398 bounds_text_daek = $this.ct2_text_daek.getTransformedBounds(); 399 bounds_text_hus = $this.ct2_text_hus.getTransformedBounds(); 400 } 401 402 // y 403 var top = 67; 404 $this.ct2_cnt.y = top; 405 $this.ct2_text_daek.y = top + ($this.ct2_text_daek.scale < 1 ? (Math.floor(bounds_cnt.height) - Math.floor(bounds_text_daek.height)) * $this.ct2_text_daek.scale : 0); 406 $this.ct2_text_hus.y = top + ($this.ct2_text_hus.scale < 1 ? (Math.floor(bounds_cnt.height) - Math.floor(bounds_text_hus.height)) * $this.ct2_text_hus.scale : 0); 407 408 // x 409 var left = (lib.properties.width - (bounds_text_daek.width + cnt_spaceX + bounds_cnt.width + cnt_spaceX + bounds_text_hus.width)) * 0.5; 410 $this.ct2_cnt.x = left + bounds_text_daek.width + cnt_spaceX; 411 $this.ct2_text_daek.x = left; 412 $this.ct2_text_hus.x = left + bounds_text_daek.width + cnt_spaceX + bounds_cnt.width + cnt_spaceX; 413 414 // hus 415 $this.ct2_hus.x = 80; 416 $this.ct2_hus.y = 188; //lib.properties.height - bounds_hus.height; 417 418 return (new Promise(function(resolve) { 419 setTimeout(resolve, 800); 420 })).then(function() { 421 [$this.ct2_cnt, $this.ct2_text_daek, $this.ct2_text_hus, $this.ct2_hus, show_laesmere && $this.ct2_laesmere].filter(Boolean).forEach(function(o) { 422 o.visible = true; 423 }); 424 425 return Promise.all([$this.ct1_cnt, $this.ct1_text_tons, $this.ct1_affald].map(function(o) { 426 return new Promise(function(resolve) { 427 createjs.Tween.get(o, { override: true }).to({ alpha: 0 }, 1000, createjs.Ease.quartInOut).call(resolve); 428 }); 429 }).concat([$this.ct2_cnt, $this.ct2_text_daek, $this.ct2_text_hus, $this.ct2_hus, show_laesmere && $this.ct2_laesmere].filter(Boolean).map(function(o) { 430 return new Promise(function(resolve) { 431 createjs.Tween.get(o, { override: true }).to({ alpha: 1 }, 1000, createjs.Ease.quartInOut).call(resolve); 432 }); 433 }))); 434 }).then(function() { 435 [$this.ct1_cnt, $this.ct1_text_tons, $this.ct1_affald].forEach(function(o) { 436 o.visible = false; 437 }); 438 439 show_laesmere && $this.ct2_laesmere.on('click', function() { 440 location.href = '@(goto_url)'; 441 }); 442 443 return Promise.all([ 444 cnt.animate(), 445 new Promise(function(resolve) { 446 var destX = lib.properties.width - bounds_hus.width - 80; 447 448 createjs.Tween.get($this.ct2_hus, { override: true }).to({ x: destX }, 2500, createjs.Ease.quartInOut).call(resolve); 449 }) 450 ]); 451 }); 452 } 453 454 step_1().then(function() { 455 return step_2(); 456 }); 457 } 458 }); 459 </script>

Statistik om madaffald i Varde Kommune

EU har udarbejdet fælles regler i medlemslandene, så vi sammen kan gøre en forskel; genbruge og genanvende mere, presse producenter og sikre grundlaget for innovation og udvikling. Det er derfor EU-direktiver, der danner grundlaget for indsamling af madaffald i Varde Kommune.

Vores restaffald ender i affaldsforbrændingen, hvor det bliver til varme i radiatoren og el. Miljømæssigt er løsningen dog uholdbar, fordi vi brænder de naturlige råstoffer op.

Hvert år indsamler vi cirka 13.500 tons restaffald i Varde Kommune. Det svarer til 410 kg. per husstand om året. Med den gamle skraldespand blev alt indholdet kørt direkte til forbrændingen i Esbjerg. Det er 0 % genbrug.

Madaffald er 100 % genbrug

Madaffaldet tæller som genbrug. Det bliver kørt til et biogasanlæg, hvor der udvindes biogas. Størstedelen af biogassen bliver omdannet til el.

Det er svært at beregne, præcist hvor meget el, der produceres, da det kommer an på mange faktorer. Et pænt gennemsnit af forskellige undersøgelser er, at vi producerer ca. 250 kWh per tons madaffald.

Restproduktet fra bioforgasningen indeholder fosfor. Det bliver kørt på landbrugsjord som direkte erstatning for kunstgødning. Dermed sparer vi udvinding af nyt fosfor til produktion af kunstgødning. Med udvinding af biogas og fosfor kan vi sige, at 100 % af madaffaldet bliver genanvendt.

Error executing template "/Designs/Paragraph/Chart_B1.cshtml"
System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at CompiledRazorTemplates.Dynamic.RazorEngine_fe531132253f4c1291a1b0cb241406fa.AffaldsVidenFunc.GetMadaffaldTilEl(Int32 months) in C:\home\site\wwwroot\DinForsyning\Files\Templates\Designs\Paragraph\Chart_B1.cshtml:line 82
   at CompiledRazorTemplates.Dynamic.RazorEngine_fe531132253f4c1291a1b0cb241406fa.Execute() in C:\home\site\wwwroot\DinForsyning\Files\Templates\Designs\Paragraph\Chart_B1.cshtml:line 188
   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.Net 2 @using System.Text 3 @functions{ 4 public class AffaldsVidenFunc { 5 // private static readonly string API_KEY = "Hdj!^$Pn9Dl*uXTeZ&7fZEmdPG9s&Yg4DQMy13yw"; 6 // 7 // public static Newtonsoft.Json.Linq.JToken GetHKode(string kommune, string hkode) { 8 // var cacheKey = "AffaldsVidenFunc:GetHKode(" + kommune + ", " + hkode + ")"; 9 // var result = default(Newtonsoft.Json.Linq.JToken); 10 // 11 // if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 12 // using (var wc = new WebClient()) { 13 // wc.Headers["X-API-KEY"] = API_KEY; 14 // wc.Encoding = Encoding.UTF8; 15 // 16 // var json = wc.DownloadString("https://api.affaldsviden.info/kommune-" + kommune + "/hkode-" + hkode); 17 // 18 // result = Newtonsoft.Json.Linq.JToken.Parse(json); 19 // 20 // Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 21 // AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 22 // }); 23 // } 24 // } 25 // 26 // return result; 27 // } 28 // 29 // public static Newtonsoft.Json.Linq.JToken GetGenbrugsprocent(string kommune) { 30 // var cacheKey = "AffaldsVidenFunc:GetGenbrugsprocent(" + kommune + ")"; 31 // var result = default(Newtonsoft.Json.Linq.JToken); 32 // 33 // if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 34 // using (var wc = new WebClient()) { 35 // wc.Headers["X-API-KEY"] = API_KEY; 36 // wc.Encoding = Encoding.UTF8; 37 // 38 // var json = wc.DownloadString("https://api.affaldsviden.info/kommune-" + kommune + "/genbrugsprocent"); 39 // 40 // result = Newtonsoft.Json.Linq.JToken.Parse(json); 41 // 42 // Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 43 // AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 44 // }); 45 // } 46 // } 47 // 48 // return result; 49 // } 50 // 51 // public static Newtonsoft.Json.Linq.JToken GetMadaffaldTilEl(string kommune) { 52 // var cacheKey = "AffaldsVidenFunc:GetMadaffaldTilEl(" + kommune + ")"; 53 // var result = default(Newtonsoft.Json.Linq.JToken); 54 // 55 // if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 56 // using (var wc = new WebClient()) { 57 // wc.Headers["X-API-KEY"] = API_KEY; 58 // wc.Encoding = Encoding.UTF8; 59 // 60 // var json = wc.DownloadString("https://api.affaldsviden.info/kommune-" + kommune + "/madaffald-til-el"); 61 // 62 // result = Newtonsoft.Json.Linq.JToken.Parse(json); 63 // 64 // Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 65 // AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 66 // }); 67 // } 68 // } 69 // 70 // return result; 71 // } 72 73 public static Newtonsoft.Json.Linq.JToken GetMadaffaldTilEl(int months) { 74 var cacheKey = "AffaldsVidenFunc:GetMadaffaldTilEl(" + months + ")"; 75 var result = default(Newtonsoft.Json.Linq.JToken); 76 77 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 78 using (var wc = new WebClient()) { 79 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 80 wc.Encoding = Encoding.UTF8; 81 82 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?madaffald-til-el=" + months); 83 84 result = Newtonsoft.Json.Linq.JToken.Parse(json); 85 86 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 87 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 88 }); 89 } 90 } 91 92 return result; 93 } 94 95 public static Newtonsoft.Json.Linq.JToken GetReelGenanvendelse(int months) { 96 var cacheKey = "AffaldsVidenFunc:GetReelGenanvendelse(" + months + ")"; 97 var result = default(Newtonsoft.Json.Linq.JToken); 98 99 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 100 using (var wc = new WebClient()) { 101 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 102 wc.Encoding = Encoding.UTF8; 103 104 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?reel-genanvendelse=" + months); 105 106 result = Newtonsoft.Json.Linq.JToken.Parse(json); 107 108 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 109 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(60.0 * 12) 110 }); 111 } 112 } 113 114 return result; 115 } 116 117 public static Newtonsoft.Json.Linq.JToken GetReelGenanvendelseYear() { 118 var cacheKey = "AffaldsVidenFunc:GetReelGenanvendelseYear()"; 119 var result = default(Newtonsoft.Json.Linq.JToken); 120 121 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 122 using (var wc = new WebClient()) { 123 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 124 wc.Encoding = Encoding.UTF8; 125 126 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?reel-genanvendelse-year"); 127 128 result = Newtonsoft.Json.Linq.JToken.Parse(json); 129 130 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 131 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(60.0 * 12) 132 }); 133 } 134 } 135 136 return result; 137 } 138 139 public static Newtonsoft.Json.Linq.JToken GetDe10Fraktioner(int months) { 140 var cacheKey = "AffaldsVidenFunc:GetDe10Fraktioner(" + months + ")"; 141 var result = default(Newtonsoft.Json.Linq.JToken); 142 143 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 144 using (var wc = new WebClient()) { 145 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 146 wc.Encoding = Encoding.UTF8; 147 148 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?de-10-fraktioner=" + months); 149 150 result = Newtonsoft.Json.Linq.JToken.Parse(json); 151 152 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 153 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 154 }); 155 } 156 } 157 158 return result; 159 } 160 161 public static Newtonsoft.Json.Linq.JToken GetDe10FraktionerYear() { 162 var cacheKey = "AffaldsVidenFunc:GetDe10FraktionerYear()"; 163 var result = default(Newtonsoft.Json.Linq.JToken); 164 165 if (!Dynamicweb.Caching.Cache.Current.TryGet<Newtonsoft.Json.Linq.JToken>(cacheKey, out result)) { 166 using (var wc = new WebClient()) { 167 wc.Headers["Authorization"] = "Basic VmFyZGU6ZExsXjdeRUR5a0VkNDl1amYk"; 168 wc.Encoding = Encoding.UTF8; 169 170 var json = wc.DownloadString("https://affaldsviden.info/vardeapi.php?de-10-fraktioner-year"); 171 172 result = Newtonsoft.Json.Linq.JToken.Parse(json); 173 174 Dynamicweb.Caching.Cache.Current.Set(cacheKey, result, new Dynamicweb.Caching.CacheItemPolicy { 175 AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5.0) 176 }); 177 } 178 } 179 180 return result; 181 } 182 } 183 } 184 @{ 185 var paragraphId = GetInteger("ParagraphID"); 186 var pageId = GetInteger("ParagraphPageID"); 187 188 var jTkn = AffaldsVidenFunc.GetMadaffaldTilEl(12); 189 var tons = jTkn?.Select(o => { 190 var maengde = (double)o["maengde"]; 191 192 return new { 193 DT = new DateTime(int.Parse((string)o["year"]), int.Parse((string)o["month"]), 1), 194 Tons = maengde > 0.0 ? (double?)maengde : (double?)null 195 }; 196 }).OrderBy(o => o.DT).ToArray(); 197 } 198 199 <div class="col-sm-12"> 200 <div id="chart_@(paragraphId)" style="margin-bottom: 20px;"></div> 201 </div> 202 203 <style type="text/css"> 204 #chart_@(paragraphId) .highcharts-color-0 { fill: #f39124; stroke: #f39124; } 205 </style> 206 <script src="https://cdn.jsdelivr.net/npm/highcharts@8.2.2/highcharts.js"></script> 207 <script type="text/javascript"> 208 $(function() { 209 var chartOpt = { 210 chart: { 211 type : 'column', 212 spacing : [30, 20, 30, 20], 213 borderWidth : 1, 214 borderColor : '#2d3587', 215 height : 500, 216 style : { 217 fontFamily : "'MuseoSans-300', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'" 218 }, 219 }, 220 221 credits: { 222 enabled: false 223 }, 224 225 legend: { 226 enabled: false 227 }, 228 229 title: { 230 text : 'Indsamling af madaffald i Varde Kommune', 231 margin : 20, 232 233 style: { 234 color : '#2d3587', 235 fontSize : '20px', 236 fontWeight : 'bold' 237 } 238 }, 239 240 plotOptions: { 241 series: { 242 dataLabels: { 243 enabled : true, 244 useHTML : true, 245 format : '{point.y:.0f} tons', 246 crop : false, 247 overflow : 'allow', 248 249 style: { 250 color : '#2d3587', 251 fontSize : '12px', 252 fontWeight : 'bold' 253 } 254 } 255 } 256 }, 257 258 tooltip: { 259 enabled : false, 260 valueDecimals : 3, 261 shared : true, 262 useHTML : true, 263 backgroundColor : '#f7f7f7', 264 headerFormat : '<span style="font-size: 10px">{point.key}</span><table>', 265 pointFormat : '<tr><td><i class="fa fa-circle" style="color: {point.color};" aria-hidden="true"></i> {series.name}: </td><td style="text-align: right"><b>{point.y} tons</b></td></tr>', 266 footerFormat : '</table>' 267 }, 268 269 xAxis: { 270 crosshair : true, 271 categories : @(Newtonsoft.Json.JsonConvert.SerializeObject(tons.Select(o => o.DT.ToString("MMM yyyy")))) 272 }, 273 274 yAxis: { 275 labels: { 276 format: '{value} tons' 277 }, 278 title: { 279 text: null 280 } 281 }, 282 283 series: [{ 284 data: @(Newtonsoft.Json.JsonConvert.SerializeObject(tons.Select(o => o.Tons))) 285 }] 286 }; 287 288 var chart = Highcharts.chart('chart_@(paragraphId)', chartOpt); 289 }); 290 </script>

Ovenfor kan du se, hvor meget madaffald vi indsamler fra helårshuse, lejligheder og virksomheder i Varde Kommune.

Kom med input

Vi vil gerne gøre denne side endnu mere relevant for dig. Har du nogle data, du mangler, så skriv til webmaster@dinforsyning.dk. Så kan vi tage dine input med videre og udvikle siden.

Vent venligst...