Error executing template "Designs/v2/_parsed/memberoffer.parsed.cshtml"
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at CompiledRazorTemplates.Dynamic.RazorEngine_8fb54eb9fb074bca8a82b5d4aa9f39e9.Execute() in e:\dynamicweb.net\solutions\NordicArenaOslo\nao.net.dynamicweb-cms.com\files\Templates\Designs\v2\_parsed\memberoffer.parsed.cshtml:line 202
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 <!DOCTYPE HTML>
2 <!--
3 Based on Industrious by TEMPLATED
4 templated.co (at)templatedco
5 Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
6 ** THE ORIGINAL WORK HAS BEEN MODIFIED **
7 -->
8
9 @using System;
10 @using System.Text;
11 @using System.Data;
12 @using Dynamicweb.Data;
13 @using System.Web;
14
15 @functions{
16
17 int MemberCount(string area)
18 {
19 int count = 0;
20
21 using(var connection = Database.CreateConnection()){
22
23 using (var command = connection.CreateCommand())
24 {
25 string sql = "SELECT count(*) as cnt FROM page WHERE pageitemtype = 'member' AND pageareaid = " + @area + " AND pageactive = 'true'";
26
27 command.CommandText = sql;
28
29 using (var reader = command.ExecuteReader())
30 {
31 while (reader.Read())
32 {
33
34 count = int.Parse(reader[0].ToString());
35 }
36
37 }
38 }
39 }
40 return count;
41 }
42
43 }
44
45 @{
46 var lang = GetGlobalValue("Global:Area.LongLang");
47 var area = GetGlobalValue("Global:Area.ID");
48 var Areaname = GetGlobalValue("Global:Area.Name").Replace("ø", "oe").ToLower();
49
50 var title = GetString("Title");
51 var pageurl = GetGlobalValue("Global:Request.Scheme") + "://" + GetGlobalValue("Global:Request.Host") + GetGlobalValue("Global:Pageview.Url");
52 var pagedescription = GetString("Meta.Description");
53 var defaultshareimg = GetString("Item.Area.ShareImage");
54
55 var navigationtag = GetGlobalValue("Global:Page.NavigationTag");
56 var sitelogo = GetString("Item.Area.Logo");
57 var sitelink = "/" + Areaname;
58 var sitename = GetString("Item.Area.Name");
59 var payoff = GetString("Item.Area.Payoff");
60 var link = GetString("Item.Area.PayoffLink");
61 var linktxt = GetString("Item.Area.LinkText");
62 var symbol_w = GetString("Item.Area.AltSymbol");
63 var symbol = GetString("Item.Area.Symbol");
64 var vat = GetString("Item.Area.VAT");
65 var about = GetString("Item.Area.About");
66 var address = GetString("Item.Area.Address");
67 var address2 = GetString("Item.Area.Address2");
68 var phone = GetString("Item.Area.Phone");
69 var email = GetString("Item.Area.Email");
70 var skype = GetString("Item.Area.Skype");
71 var hours = GetString("Item.Area.Hours");
72
73 bool newsletter = GetBoolean("Item.Area.Newsletter");
74
75 var fblink = GetString("Item.Area.FbLink");
76 var instalink = GetString("Item.Area.InstaLink");
77 var inlink = GetString("Item.Area.InLink");
78 var ytlink = GetString("Item.Area.YtLink");
79 var twlink = GetString("Item.Area.TwLink");
80 var fbpixel = GetString("Item.Area.FbPixel");
81 }
82
83 <html lang='@lang'>
84 <head>
85 <!-- Global site tag (gtag.js) - Google Analytics -->
86 <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-156843986-1"></script>
87 <script>
88 window.dataLayer = window.dataLayer || [];
89 function gtag(){dataLayer.push(arguments);}
90 gtag('js', new Date());
91
92 gtag('config', 'UA-156843986-1', { 'anonymize_ip': true });
93 </script>
94
95 <title>@GetValue("Title")</title>
96 @GetValue("MetaTags")
97 @GetValue("CopyRightNotice")
98
99 <meta charset="utf-8">
100 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
101 <meta http-equiv="content-type" content="text/html; charset=utf-8">
102 <meta http-equiv="X-UA-Compatible" content="IE=edge">
103
104 <meta property="og:url" content="@pageurl">
105 <meta property="og:title" content="@title">
106 <meta property="og:description" content="@pagedescription">
107 <meta property="og:type" content='website'>
108 @RenderSnippet("FbMetaImg")
109 <meta property="og:image:width" content="1200px">
110 <meta property="og:image:height" content="510px">
111
112 <link rel="shortcut icon" href="/Files/Templates/Designs/v2/assets/gfx/favicon.ico" type="image/x-icon">
113 <link rel="icon" href="/Files/Templates/Designs/v2/assets/gfx/favicon.ico" type="image/x-icon">
114 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" type="text/css">
115 <script src="https://kit.fontawesome.com/2b4a6fd4ef.js"></script>
116
117 <link rel="stylesheet" href="/Files/Templates/Designs/v2/assets/css/unslider.css">
118 <link rel="stylesheet" href="/Files/Templates/Designs/v2/assets/css/main.css">
119
120 @if(!String.IsNullOrEmpty(@fbpixel)) {
121 @fbpixel
122 }
123
124 @GetValue("Stylesheets")
125 @GetValue("Javascripts")
126 </head>
127
128 <body class="is-preload @navigationtag">
129
130 <!-- Header -->
131 <div id="header">
132 <div class="inner">
133 <div>
134 <h1><a class="logo" href="@sitelink" style="background-image:url('@sitelogo')">@sitename</a></h1>
135 <div class="members @Areaname"><a href="@sitelink/medlemmer"><span id="membercount"><span id="membercount">@MemberCount(@area)</span></span> Medlemmer</a></div>
136 <div class="signup"><a class="button primary special" href="@sitelink/bli-medlem">Bli medlem</a></div>
137 </div>
138 </div>
139 <div class="menubar">
140 <div class="inner">
141 <h1><a class="symbol" href="@sitelink" style="background-image:url('@symbol_w')">@sitename</a></h1>
142 <div class="menu">
143 @GetValue("DwNavigation(nav)")
144 <a href="#menu" id="navtoggle" title="Meny"><span>Meny</span></a>
145 <!--a href="/kontakt" id="contact" title="Kontakt oss">Kontakt</a-->
146 <div class="social">
147 @if(!String.IsNullOrEmpty(@fblink)) {
148 <a href="@fblink" title="Facebook" target="_blank"><i class="fab fa-facebook-f"></i></a>
149 }
150 @if(!String.IsNullOrEmpty(@instalink)) {
151 <a href="@instalink" title="Instagram" target="_blank"><i class="fab fa-instagram"></i></a>
152 }
153 @if(!String.IsNullOrEmpty(@inlink)) {
154 <a href="@inlink" title="LinkedIn" target="_blank"><i class="fab fa-linkedin-in"></i></a>
155 }
156 @if(!String.IsNullOrEmpty(@ytlink)) {
157 <a href="@ytlink" title="Youtube" target="_blank"><i class="fab fa-youtube"></i></a>
158 }
159 @if(!String.IsNullOrEmpty(@twlink)) {
160 <a href="@twlink" title="Twitter" target="_blank"><i class="fab fa-twitter"></i></a>
161 }
162 </div>
163 </div>
164 </div>
165 </div>
166 </div>
167
168 <nav id="path">
169 <div class="inner">
170 @GetValue("DwNavigation(navpath)")
171 </div>
172 </nav>
173
174 <!-- Content -->
175
176
177
178 @{
179 var image = GetString("Item.Image");
180 }
181
182 @SnippetStart("FbMetaImg")
183 @if(!String.IsNullOrEmpty(@image)) {
184 <meta property="og:image" content='@GetGlobalValue("Global:Request.Scheme")://@GetGlobalValue("Global:Request.Host")@image'>
185 } else {
186 <meta property="og:image" content='@GetGlobalValue("Global:Request.Scheme")://@GetGlobalValue("Global:Request.Host")@defaultshareimg'>
187 }
188 @SnippetEnd("FbMetaImg")
189
190 @{
191
192 int PageAlignment = GetInteger("Item.Page.Alignment");
193
194 var PageId = Dynamicweb.Frontend.PageView.Current().Page.ID;
195 var AreaId = Dynamicweb.Frontend.PageView.Current().Area.ID;
196 var AltTitle = GetString("Item.AltTitle");
197 var Title = GetString("Item.Title");
198 string attachment = GetString("Item.Attachment");
199 string linktext = GetString("Item.LinkText");
200 string FocalPoint = GetString("Item.Image.FocalPointParameters");
201
202 LoopItem member = GetLoop("Item.RelatedMember")[0];
203 var memberTitle = member.GetString("Item.RelatedMember.Title");
204 var memberUrl = member.GetString("Item.RelatedMember.Url");
205
206 string align = "";
207
208 switch(PageAlignment)
209 {
210 case 1:
211 align = "left";
212 break;
213
214 case 2:
215 align = "justify";
216 break;
217 }
218 }
219 <section class="wrapper page memberoffer">
220 <div class="inner">
221 @if(!String.IsNullOrEmpty(@image)){
222 <figure class="image fit">
223 <img src="/Admin/Public/GetImage.ashx?Image=@image&Format=jpg&Width=1600&Height=680&Crop=0&@FocalPoint" alt="@Title">
224 </figure>
225 }
226 <header class="aligned @align">
227 <h2>@if(!String.IsNullOrEmpty(@AltTitle)){
228 @AltTitle
229 } else {
230 @Title
231 }</h2>
232 </header>
233
234 <div class="strong txt aligned @align">
235 @GetString("Item.Teaser")
236 </div>
237
238 <div class="txt aligned @align">
239 @GetString("Item.Text")
240 </div>
241
242
243 <div class="wrapper mini txt aligned @align info">
244 <div class="row gtr-uniform">
245 @if(!String.IsNullOrEmpty(@attachment)) {
246 <div class="col-6 col-12-xsmall">
247 <a href="@attachment" target="_blank">@linktext</a></div>
248 }
249 <div class="col-6 col-12-xsmall">
250 <a href="@memberUrl"><i class="far fa-arrow-square-right fa-lg"></i>Les mer om @memberTitle</a>
251 </div>
252 </div>
253 </div>
254
255 </div>
256 </section>
257
258 <!-- Footer -->
259 <footer id="footer">
260 <div class="inner">
261 <div class="content">
262 <section class="about">
263 <h3 class="logo">
264 <a href="@sitelink" style="background-image:url('@symbol')">@sitename</a>
265 </h3>
266 @if(!String.IsNullOrEmpty(@vat)) {
267 <p><small>Org.nr @vat</small></p>
268 }
269 <p>@payoff</p>
270 @about
271 @GetValue("DwNavigation(about)")
272 </section>
273 @if(newsletter) {
274 <section class="contact">
275 <h4 class="upper">Nyhetsbrev</h4>
276 <div class="signup">
277 <span>Ønsker du at vi holder deg oppdatert?</span>
278 <a href="@sitelink/om-oss/nyhetsbrev" class="button primary">Meld deg på vårt nyhetsbrev</a>
279 </div>
280 </section>
281 }
282 <section id="social">
283 <div class="social">
284 @if(!String.IsNullOrEmpty(@fblink)) {
285 <a href="@fblink" title="Facebook" target="_blank"><i class="fab fa-facebook-f"></i></a>
286 }
287 @if(!String.IsNullOrEmpty(@instalink)) {
288 <a href="@instalink" title="Instagram" target="_blank"><i class="fab fa-instagram"></i></a>
289 }
290 @if(!String.IsNullOrEmpty(@inlink)) {
291 <a href="@inlink" title="LinkedIn" target="_blank"><i class="fab fa-linkedin-in"></i></a>
292 }
293 @if(!String.IsNullOrEmpty(@ytlink)) {
294 <a href="@ytlink" title="Youtube" target="_blank"><i class="fab fa-youtube"></i></a>
295 }
296 @if(!String.IsNullOrEmpty(@twlink)) {
297 <a href="@twlink" title="Twitter" target="_blank"><i class="fab fa-twitter"></i></a>
298 }
299 </div>
300 </section>
301 </div>
302 <div class="copyright">
303 ©@GetGlobalValue("Global:Server.Date.Year") <a href="@sitelink">@sitename</a> • Design og utvikling: <a class="devby" href="https://koment.no" target="_blank">KOMENT</a>
304 </div>
305 </div>
306 </footer>
307
308 <!-- Scripts -->
309 <script src="/Files/Templates/Designs/v2/assets/js/jquery.min.js"></script>
310 <script src="/Files/Templates/Designs/v2/assets/js/browser.min.js"></script>
311 <script src="/Files/Templates/Designs/v2/assets/js/breakpoints.min.js"></script>
312 <script src="/Files/Templates/Designs/v2/assets/js/jquery.scrolly.min.js"></script>
313 <script src="/Files/Templates/Designs/v2/assets/js/jquery.event.move.js"></script>
314 <script src="/Files/Templates/Designs/v2/assets/js/jquery.event.swipe.js"></script>
315 <script src="/Files/Templates/Designs/v2/assets/js/unslider-min.js"></script>
316 <script src="/Files/Templates/Designs/v2/assets/js/countUp.js" type="module"></script>
317 <script src="https://player.vimeo.com/api/player.js"></script>
318 <script src="/Files/Templates/Designs/v2/assets/js/util.js"></script>
319 <script src="/Files/Templates/Designs/v2/assets/js/main.js" type="module"></script>
320
321 </body>
322 </html>