Blog posts by Jeff Wallace
2013-08-14T18:48:59.0000000Z
/blogs/Jeff-Wallace/
Optimizely World
EPiServer Most Valuable Professional Program
/blogs/Jeff-Wallace/Dates/2013/8/EPiServer-Most-Valuable-Professional-Program/
2013-08-14T18:48:59.0000000Z
<p><a href="/link/d12b6d2169014149a83ae34f1e551a60.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/fd3cac454a0d4d279ede9379e693199d.png" width="244" height="81" /></a></p> <p>The EPiServer Most Valued Professional Program, more commonly known as the EMVP Program, is designed to promote professionals within the EPiServer developer community who are contributing with high class content (e.g. blogs, forums posts, code samples, etc.). It is the highest rank a developer can get in the community. </p> <p>The current members, at the time of authoring this blog, total 16 people out of the 20,000+ member community. The EMVP names should look familiar to most as they truly represent key contributors and provide great information and assistance to many here on EPiServer World.</p> <ul> <li>Alexander Haneng </li> <li>Anders Hattestad </li> <li>Anders Nordby </li> <li>Arild Henrichsen </li> <li>Daniel Berg </li> <li>David Knipe </li> <li>Deane Barker </li> <li>Erik Nordin </li> <li>Frederik Vig </li> <li>Fredrik Haglund </li> <li>Joel Abrahamsson </li> <li>Lee Crowe </li> <li>Mark Everard </li> <li>Mathias Kunto </li> <li>Stefan Forsberg </li> <li>Ted Nyberg </li> </ul> <p> </p> <p><strong><font size="3"></font></strong></p> <p><strong><font size="3">EMVP Benefits</font></strong></p> <ul> <li>Partners can use EMVP logo in their marketing (see the logo at the top of this blog) </li> <li>EMVPs can use EMVP logo in their personal marketing </li> <li>EMVP logo is displayed next to name in EPiServer World content (blogs, forums, comments, etc.) </li> <li>Access to private discussion groups and forums </li> <li>Invitations to special developer meetings and webinars where feedback is welcome </li> <li>Automatic access to all future early adopter programs (e.g. <a href="http://world.episerver.com/Articles/Items/EPiServer-Early-Adoption-programs/">TAP</a>) </li> <li>Free EPiServer license to be used on personal site </li> <li>Speaking slots at some EPiServer events </li> <li>VIP treatment at some EPiServer events </li> <li>And on occasion, EMVPs might receive some interesting EPiServer goodies </li> </ul> <p> </p> <p><strong><font size="3">EMVP Requirements</font></strong></p> <p>It is important to note that reaching this status is entirely based on personal achievements not the partner company achievements. Each EMVP being considered must have demonstrated high skills in EPiServer solution development. They must leverage this personal expertise to assist others. This includes, but is not limited to, contributing to the EPiServer World community via blogs, forums posts, code samples, Add-ons, organizing meet ups, speaking at events, and more.</p> <p> </p> <p><strong><font size="3">EMVP Process</font></strong></p> <p>The EMVP board consists of a number of senior EPiServer employees with <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/?encryptedcurrentid=utbEnDQBhuc%3d">Allan Thraen</a> heading things up as the chairman of the board. The board monitors contributions throughout the year and schedules regular meetings quarterly to review this activity. In cases where community members are closely tracking towards EMVP status they may be notified via email to incent them to continue their good work. In January of each year the board meets to review contributions from the previous year. New EMVP prospects are approved or disapproved by the board at this time. Existing EMVP status is also reviewed at the same time. The expectation is that once an individual has achieved EMVP status they will continue to contribute in a similar manner to what earned them this status in the first place. Anyone at risk of losing EMVP status is notified with enough advance warning to allow them to take the appropriate measures to maintain status. Each year new EMVPs are announced on EPiServer World. An example of this can be seen <a href="http://world.episerver.com/Blogs/Allan-Thran/Dates/2013/2/We-welcome-2-new-EMVPs-Go-Norway/">here</a>. You’ll find similar posts for many years past if you search.</p> <p> </p> <p><font size="3"><strong>Future Considerations</strong></font></p> <p>Below are a few examples of additional items being *considered* for EMVPs:</p> <ul> <li>Global EMVP Summit </li> <li>Special EMVP section on EPiServer World </li> <li>The number of EMVPs a given partner has noted on their <a href="http://www.episerver.com">www.episerver.com</a> partner page (similar to the number of certified developers which is already present) </li> </ul> <p><em>Note, the above are considerations subject to change.</em></p> <p> </p> <p><strong><font size="3">How to Become an EMVP?</font></strong></p> <p>As noted in the “EMVP Process” section the board meets regularly to discuss key contributors. If you are doing all of the things in the “EMVP Requirements” section at a level comparable to other EMVPs this is a great start. While the board monitors activity regularly, if you believe you have a good candidate on your team, you are always welcome to submit the candidate for consideration to your preferred contact at EPiServer. Please do this by December of the year in which you believe they should be considered.</p>
Special Promotions and Offers for Customer Segments in EPiServer Commerce
/blogs/Jeff-Wallace/Dates/2013/8/Special-Promotions-and-Offers-for-Customer-Segments-in-EPiServer-Commerce/
2013-08-09T00:00:08.0000000Z
<p><em>Based on EPiServer CMS 7.1, Commerce 1 R3, and the Enoteca Templates</em></p> <p><a href="http://world.episerver.com/Blogs/Shannon-Gray/">Shannon Gray</a> recently wrote an excellent blog on how to “<a href="http://world.episerver.com/Blogs/Shannon-Gray/Dates/2013/7/Do-A-Lot-More-With-EPiServer-Commerce-Promotions-With-a-Little-Code/">Do A Lot More With EPiServer Commerce Promotions With a Little Code</a>”. Inspired by this blog, as well as a similar presentation Shannon gave at the <a href="http://www.episerver.com/Events/2013-North-American-Partner-Summit-1/">EPiServer 2013 North American Partner Summit</a>, I thought I’d use some of his tips and code to add the ability to use Visitor Groups in Commerce promotions in my demo environment. The end result is the ability to provide special promotions and offers to customers segments (via <a href="http://www.youtube.com/watch?v=bqxaDannqIU">Visitor Groups</a>). Powerful!</p> <p>I chose to take what appeared to be the best possible path in Shannon’s blog which is covered in his “Extending the Promotion Engine Further” section. This explains how to create a new Promotion Provider. I suggest you read <a href="http://world.episerver.com/Blogs/Shannon-Gray/Dates/2013/7/Do-A-Lot-More-With-EPiServer-Commerce-Promotions-With-a-Little-Code/">his blog</a> as a starting point to understand this provider and some of the other concepts applied here. In summary I followed his summary steps, copied <a href="http://world.episerver.com/Code/Shannon-Gray/Promotion-PromotionEntry-Provider-Implementation-Example/">the provider</a>, and added the logic I wanted. The outcome was fantastic.</p> <p><strong><font size="4"></font></strong></p> <p><strong><font size="4">The End Result</font></strong></p> <p>The end result, again, is the ability to set up customer segments via <a href="http://www.youtube.com/watch?v=bqxaDannqIU">EPiServer Visitor Groups</a>…</p> <p><a href="/link/fca7ee686cf740d4bd868b6badb86c27.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/76e6461c335b4bbebae3535a18da9035.png" width="629" height="371" /></a></p> <p>and target them with special promotions and offers in product listings,…</p> <p><a href="/link/9c85b166ba83408a8320437a933cc52a.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/f648cd38938d47458dccf8a28e701dd3.png" width="629" height="543" /></a></p> <p>on product detail pages,…</p> <p><a href="/link/57ac5cf06568484f85df8cb3cc47e244.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/a419e71a0abf4799be7f32e4b8a98503.png" width="358" height="542" /></a></p> <p>and on the cart summary page.</p> <p><a href="/link/e80d9ac50bf44617ab5a3999ae6f80a7.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/8901b456c30f453d9edbca42590ea6e9.png" width="629" height="393" /></a></p> <p><strong><font size="4"></font></strong></p> <p><strong><font size="4">How to Build It</font></strong></p> <p>In this section I’ll start from the beginning and take you through the whole process one step at a time. I’ll also provide the project and code in the “How to Get the Code” section at the tail of this blog.</p> <p><font style="background-color: #ffff00"></font><strong><em>Set up the Meta Field and Class</em></strong><font style="background-color: #ffff00"></font></p> <ul> <li>Navigate the Commerce Manager. </li> <li>Create a new Meta Field to be used later to store a list of Visitor Groups the current visitor is a member of. Navigate to the Administration~Order System~Meta Fields and add a new Meta Field similar to the following. </li> </ul> <blockquote> <p><a href="/link/ecc16d3a96b44e0eb0d921d1978ebc40.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="/link/855815a5859f48d3a5e0cff426763036.jpg" width="625" height="555" /></a></p> </blockquote> <ul> <li>Select the “OK” button when complete to save. </li> <li>We’ll be working with applying a discount to a line item based on membership in a Visitor Group. Now that you’ve created the Meta Field add it to the relevant Meta Class. Navigate to Administration~Order System~Meta Classes. </li> <li>Select “Line Item” for the “Element” setting. </li> </ul> <blockquote> <p><a href="/link/06d248f5ca94406f97ce88108a17e5e7.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002[11]" border="0" alt="clip_image002[11]" src="/link/c3c64cae187248cfb23d10779b9d8236.jpg" width="631" height="602" /></a></p> </blockquote> <ul> <li>Scroll to the bottom and select the check box next to the “Visitor Group” Meta Field to add it to the “LineItem” Meta Class. </li> </ul> <blockquote> <p><a href="/link/fac20ee148fd4e3db4cf247b339723c6.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002[13]" border="0" alt="clip_image002[13]" src="/link/f37c61b8173b4d7da3703cb11aa1c6e0.jpg" width="631" height="117" /></a></p> </blockquote> <ul> <li>Select the “OK” button when complete to save. </li> <li>After adding the new Line Item Meta Fields reset IIS to ensure the new field(s) appear in Commerce Manager.</li> </ul> <p><strong><em><font size="4"></font></em></strong></p> <p><strong><em>Set up the Promotion Provider</em></strong></p> <ul> <li>Create a new web project in the “modules” folder of the Enoteca project. I used the ASP.NET Empty Web Application. </li> </ul> <blockquote> <p><a href="/link/b9b53117fa4e4938af6f1e36608e96e1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/deb8797f1e664f05b242bee687f54078.png" width="632" height="114" /></a></p> </blockquote> <ul> <li>Add the assemblies pictured below to your project references. </li> </ul> <blockquote> <p><a href="/link/2e6012025a0047e58e59417a0a096002.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/32cf537e27c24c658f9daf861c14dcba.png" width="380" height="239" /></a></p> </blockquote> <ul> <li>Add one class file (.cs) and name it “CustomPromotionEntryPopulate”. </li> <li>I recommend that you take the easiest route and copy my provider code from the code snippet below and paste it into your CustomPromotionEntryPopulate.cs file replacing all previously existing code. </li> </ul> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">using</span> EPiServer.Personalization.VisitorGroups;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> <span style="color: #0000ff">using</span> EPiServer.Security;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <span style="color: #0000ff">using</span> EPiServer.ServiceLocation;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Catalog;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Catalog.Objects;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Marketing;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Orders;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Pricing;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span> <span style="color: #0000ff">using</span> Mediachase.MetaDataPlus.Configurator;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> <span style="color: #0000ff">using</span> System;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12"> 12:</span> <span style="color: #0000ff">using</span> System.Collections.Generic;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13"> 13:</span> <span style="color: #0000ff">using</span> System.Security.Principal;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14"> 14:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15"> 15:</span> <span style="color: #0000ff">namespace</span> EPiServer.Commerce.Addons.Promotions</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16"> 16:</span> { </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17"> 17:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CustomPromotionEntryPopulate : IPromotionEntryPopulate</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18"> 18:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19"> 19:</span> <span style="color: #008000">// Methods</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20"> 20:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Populate(PromotionEntry entry, LineItem lineItem)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21"> 21:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22"> 22:</span> entry.Quantity = lineItem.Quantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23"> 23:</span> entry.Owner = lineItem;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24"> 24:</span> entry[<span style="color: #006080">"LineItemId"</span>] = lineItem.LineItemId;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25"> 25:</span> entry[<span style="color: #006080">"ShippingAddressId"</span>] = lineItem.ShippingAddressId;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26"> 26:</span> entry[<span style="color: #006080">"ExtendedPrice"</span>] = lineItem.ExtendedPrice;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27"> 27:</span> entry[<span style="color: #006080">"MinQuantity"</span>] = lineItem.MinQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28"> 28:</span> entry[<span style="color: #006080">"MaxQuantity"</span>] = lineItem.MaxQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29"> 29:</span> entry[<span style="color: #006080">"LineItemDiscountAmount"</span>] = lineItem.LineItemDiscountAmount;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30"> 30:</span> entry[<span style="color: #006080">"OrderLevelDiscountAmount"</span>] = lineItem.OrderLevelDiscountAmount;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31"> 31:</span> entry[<span style="color: #006080">"ShippingMethodName"</span>] = lineItem.ShippingMethodName ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32"> 32:</span> entry[<span style="color: #006080">"ExtendedPrice"</span>] = lineItem.ExtendedPrice;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33"> 33:</span> entry[<span style="color: #006080">"Description"</span>] = lineItem.Description ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34"> 34:</span> entry[<span style="color: #006080">"Status"</span>] = lineItem.Status ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35"> 35:</span> entry[<span style="color: #006080">"DisplayName"</span>] = lineItem.DisplayName ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36"> 36:</span> entry[<span style="color: #006080">"AllowBackordersAndPreorders"</span>] = lineItem.AllowBackordersAndPreorders;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37"> 37:</span> entry[<span style="color: #006080">"InStockQuantity"</span>] = lineItem.InStockQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38"> 38:</span> entry[<span style="color: #006080">"PreorderQuantity"</span>] = lineItem.PreorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39"> 39:</span> entry[<span style="color: #006080">"BackorderQuantity"</span>] = lineItem.BackorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40"> 40:</span> entry[<span style="color: #006080">"InventoryStatus"</span>] = lineItem.InventoryStatus;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41"> 41:</span> <span style="color: #0000ff">foreach</span> (MetaField field <span style="color: #0000ff">in</span> lineItem.MetaClass.MetaFields)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42"> 42:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43"> 43:</span> entry[field.Name] = lineItem[field];</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44"> 44:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45"> 45:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46"> 46:</span> PopulateVisitorGroupEntry(<span style="color: #0000ff">ref</span> entry);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47"> 47:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48"> 48:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49"> 49:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> PopulateVisitorGroupEntry(<span style="color: #0000ff">ref</span> PromotionEntry entry)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50"> 50:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51"> 51:</span> <span style="color: #008000">// Retrieve the last time we made this check and the principal user at the time from the cache</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52"> 52:</span> IPrincipal lastPrincipal = <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53"> 53:</span> <span style="color: #0000ff">double</span> lastTime = 0;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54"> 54:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55"> 55:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56"> 56:</span> lastPrincipal = CacheManager.Get(<span style="color: #006080">"promoLastPrincipal"</span>) <span style="color: #0000ff">as</span> IPrincipal;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57"> 57:</span> lastTime = (<span style="color: #0000ff">double</span>)CacheManager.Get(<span style="color: #006080">"promoLastTime"</span>);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58"> 58:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59"> 59:</span> <span style="color: #0000ff">catch</span> (NullReferenceException)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60"> 60:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61"> 61:</span> <span style="color: #008000">// Catch any nulls on the double case above. Then continue...</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum62"> 62:</span> } </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum63"> 63:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum64"> 64:</span> <span style="color: #008000">// KLUDGE: For demo purposes only. For performance, only re-check VG's if more than 5 seconds have passed or</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum65"> 65:</span> <span style="color: #008000">// if the principal has changed.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum66"> 66:</span> <span style="color: #0000ff">if</span> (((DateTime.Now.TimeOfDay.TotalSeconds - lastTime) >= 5) || (!PrincipalInfo.CurrentPrincipal.Equals(lastPrincipal))) </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum67"> 67:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum68"> 68:</span> <span style="color: #008000">// Get all the VG repository and all roles available within it</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum69"> 69:</span> VisitorGroupRoleRepository vgRepository = VisitorGroupRole.GetRepository();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum70"> 70:</span> IEnumerable<<span style="color: #0000ff">string</span>> vgRoles = vgRepository.GetAllRoles();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum71"> 71:</span> VisitorGroupHelper vgHelper = <span style="color: #0000ff">new</span> VisitorGroupHelper();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum72"> 72:</span> <span style="color: #0000ff">string</span> tempVisitorRoles = <span style="color: #006080">""</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum73"> 73:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum74"> 74:</span> <span style="color: #008000">// Loop through all VG's to see if the current visitor is a member of any</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum75"> 75:</span> <span style="color: #0000ff">foreach</span>(<span style="color: #0000ff">string</span> role <span style="color: #0000ff">in</span> vgRoles)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum76"> 76:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum77"> 77:</span> <span style="color: #008000">// Is the visitor in the role?</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum78"> 78:</span> <span style="color: #0000ff">if</span> (vgHelper.IsPrincipalInGroup(PrincipalInfo.CurrentPrincipal, role))</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum79"> 79:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum80"> 80:</span> <span style="color: #008000">// If there is a match add the role to the temp string with a comma delimiter. This will allow for creating of</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum81"> 81:</span> <span style="color: #008000">// an expression in the Commerce Manager Promotions area for any number of visitor groups. For example, you </span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum82"> 82:</span> <span style="color: #008000">// can specify if the Visitor Group "Contains" the "US Visitor" VG, give 10% off.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum83"> 83:</span> tempVisitorRoles = tempVisitorRoles + role + <span style="color: #006080">","</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum84"> 84:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum85"> 85:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum86"> 86:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum87"> 87:</span> <span style="color: #008000">// Update the entry with all roles the visitor is a member of</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum88"> 88:</span> entry[<span style="color: #006080">"VisitorGroup"</span>] = tempVisitorRoles;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum89"> 89:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum90"> 90:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum91"> 91:</span> <span style="color: #008000">// Cache the last time we made this check and the principal user at the time</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum92"> 92:</span> CacheManager.Add(<span style="color: #006080">"promoLastTime"</span>, DateTime.Now.TimeOfDay.TotalSeconds);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum93"> 93:</span> CacheManager.Add(<span style="color: #006080">"promoLastPrincipal"</span>, PrincipalInfo.CurrentPrincipal); </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum94"> 94:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum95"> 95:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum96"> 96:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Populate(<span style="color: #0000ff">ref</span> PromotionEntry promotionEntry, <span style="color: #0000ff">object</span> val)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum97"> 97:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum98"> 98:</span> <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotSupportedException(<span style="color: #006080">"This method is obsolete."</span>);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum99"> 99:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum100"> 100:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum101"> 101:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Populate(PromotionEntry entry, Entry catalogEntry, MarketId marketId, Currency currency)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum102"> 102:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum103"> 103:</span> entry.Quantity = 1M;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum104"> 104:</span> entry.Owner = catalogEntry;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum105"> 105:</span> entry[<span style="color: #006080">"Id"</span>] = catalogEntry.ID;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum106"> 106:</span> <span style="color: #0000ff">if</span> (catalogEntry.ItemAttributes != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum107"> 107:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum108"> 108:</span> entry[<span style="color: #006080">"MinQuantity"</span>] = catalogEntry.ItemAttributes.MinQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum109"> 109:</span> entry[<span style="color: #006080">"MaxQuantity"</span>] = catalogEntry.ItemAttributes.MaxQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum110"> 110:</span> <span style="color: #0000ff">if</span> (catalogEntry.ItemAttributes.Attribute != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum111"> 111:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum112"> 112:</span> <span style="color: #0000ff">foreach</span> (ItemAttribute attribute <span style="color: #0000ff">in</span> catalogEntry.ItemAttributes.Attribute)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum113"> 113:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum114"> 114:</span> <span style="color: #0000ff">if</span> ((attribute.Value != <span style="color: #0000ff">null</span>) && (attribute.Value.Length > 0))</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum115"> 115:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum116"> 116:</span> entry[attribute.Name] = attribute.Value[0];</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum117"> 117:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum118"> 118:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum119"> 119:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum120"> 120:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum121"> 121:</span> <span style="color: #0000ff">if</span> (catalogEntry.Inventory != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum122"> 122:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum123"> 123:</span> entry[<span style="color: #006080">"AllowBackordersAndPreorders"</span>] = !catalogEntry.Inventory.AllowBackorder ? ((<span style="color: #0000ff">object</span>) 0) : ((<span style="color: #0000ff">object</span>) catalogEntry.Inventory.AllowPreorder);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum124"> 124:</span> entry[<span style="color: #006080">"InStockQuantity"</span>] = catalogEntry.Inventory.InStockQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum125"> 125:</span> entry[<span style="color: #006080">"PreorderQuantity"</span>] = catalogEntry.Inventory.PreorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum126"> 126:</span> entry[<span style="color: #006080">"BackorderQuantity"</span>] = catalogEntry.Inventory.BackorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum127"> 127:</span> entry[<span style="color: #006080">"InventoryStatus"</span>] = catalogEntry.Inventory.InventoryStatus;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum128"> 128:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum129"> 129:</span> IPriceValue value2 = ServiceLocator.Current.GetInstance<IPriceService>().GetDefaultPrice(marketId, FrameworkContext.Current.CurrentDateTime, <span style="color: #0000ff">new</span> CatalogKey(catalogEntry), currency);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum130"> 130:</span> <span style="color: #0000ff">if</span> (value2 != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum131"> 131:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum132"> 132:</span> entry[<span style="color: #006080">"ExtendedPrice"</span>] = value2.UnitPrice.Amount;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum133"> 133:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum134"> 134:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum135"> 135:</span> PopulateVisitorGroupEntry(<span style="color: #0000ff">ref</span> entry);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum136"> 136:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum137"> 137:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum138"> 138:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> PopulateCustom(PromotionEntry promotionEntry, <span style="color: #0000ff">object</span> obj)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum139"> 139:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum140"> 140:</span> <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotSupportedException();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum141"> 141:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum142"> 142:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum143"> 143:</span> }</pre>
<!--CRLF--></div>
</div>
<ul>
<li>The core of my changes from <a href="http://world.episerver.com/Code/Shannon-Gray/Promotion-PromotionEntry-Provider-Implementation-Example/">Shannon’s provider</a> are primarily contained in one method, PopulateVisitorGroupEntry(), and the important code is as follows. I’ve added some comments in an attempt to maximize readability. It basically does the following:
<ul>
<li>Gets  the Visitor Group repository </li>
<li>Gets all the Visitor Groups from that repository </li>
<li>Iterates through all the Visitor Groups and checks if the current principal is a member of that group </li>
<li>If so, it adds them to a comma delimited string (you can deliver a more robust solution in your code as needed) </li>
<li>Once done iterating it adds the string to the promotion entry so that the promotion can validate against this string </li>
</ul>
</li>
</ul>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #008000">// Get all the VG repository and all roles available within it</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> VisitorGroupRoleRepository vgRepository = VisitorGroupRole.GetRepository();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> IEnumerable<<span style="color: #0000ff">string</span>> vgRoles = vgRepository.GetAllRoles();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> VisitorGroupHelper vgHelper = <span style="color: #0000ff">new</span> VisitorGroupHelper();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <span style="color: #0000ff">string</span> tempVisitorRoles = <span style="color: #006080">""</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span> <span style="color: #008000">// Loop through all VG's to see if the current visitor is a member of any</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span> <span style="color: #0000ff">foreach</span>(<span style="color: #0000ff">string</span> role <span style="color: #0000ff">in</span> vgRoles)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span> <span style="color: #008000">// Is the visitor in the role?</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> <span style="color: #0000ff">if</span> (vgHelper.IsPrincipalInGroup(PrincipalInfo.CurrentPrincipal, role))</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12"> 12:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13"> 13:</span> <span style="color: #008000">// If there is a match add the role to the temp string with a comma delimiter. This will allow for creating of</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14"> 14:</span> <span style="color: #008000">// an expression in the Commerce Manager Promotions area for any number of visitor groups. For example, you </span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15"> 15:</span> <span style="color: #008000">// can specify if the Visitor Group "Contains" the "US Visitor" VG, give 10% off.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16"> 16:</span> tempVisitorRoles = tempVisitorRoles + role + <span style="color: #006080">","</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17"> 17:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18"> 18:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19"> 19:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20"> 20:</span> <span style="color: #008000">// Update the entry with all roles the visitor is a member of</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21"> 21:</span> entry[<span style="color: #006080">"VisitorGroup"</span>] = tempVisitorRoles;</pre>
<!--CRLF--></div>
</div>
<ul>
<li>PopulateVisitorGroupEntry() is called from the two core Populate() methods in the provider.
<ul>
<li><em>public void Populate(PromotionEntry entry, LineItem lineItem)</em> – Called when calculating the price for the entire shopping cart, allowing the visitor to see the discount in their cart/basket page. </li>
<li><em>public void Populate(PromotionEntry entry, Entry catalogEntry, MarketId marketId, Currency currency)</em> - Called when calculating the price of an individual SKU, allowing the visitor to see the discount in a product listing (when the listing includes price) or the product page. </li>
</ul>
</li>
</ul>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">using</span> EPiServer.Personalization.VisitorGroups;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> <span style="color: #0000ff">using</span> EPiServer.Security;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <span style="color: #0000ff">using</span> EPiServer.ServiceLocation;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Catalog;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Catalog.Objects;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Marketing;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Orders;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> <span style="color: #0000ff">using</span> Mediachase.Commerce.Pricing;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span> <span style="color: #0000ff">using</span> Mediachase.MetaDataPlus.Configurator;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> <span style="color: #0000ff">using</span> System;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12"> 12:</span> <span style="color: #0000ff">using</span> System.Collections.Generic;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13"> 13:</span> <span style="color: #0000ff">using</span> System.Security.Principal;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14"> 14:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15"> 15:</span> <span style="color: #0000ff">namespace</span> EPiServer.Commerce.Addons.Promotions</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16"> 16:</span> { </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17"> 17:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CustomPromotionEntryPopulate : IPromotionEntryPopulate</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18"> 18:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19"> 19:</span> <span style="color: #008000">// Methods</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20"> 20:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Populate(PromotionEntry entry, LineItem lineItem)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21"> 21:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22"> 22:</span> entry.Quantity = lineItem.Quantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23"> 23:</span> entry.Owner = lineItem;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24"> 24:</span> entry[<span style="color: #006080">"LineItemId"</span>] = lineItem.LineItemId;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25"> 25:</span> entry[<span style="color: #006080">"ShippingAddressId"</span>] = lineItem.ShippingAddressId;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26"> 26:</span> entry[<span style="color: #006080">"ExtendedPrice"</span>] = lineItem.ExtendedPrice;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27"> 27:</span> entry[<span style="color: #006080">"MinQuantity"</span>] = lineItem.MinQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28"> 28:</span> entry[<span style="color: #006080">"MaxQuantity"</span>] = lineItem.MaxQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29"> 29:</span> entry[<span style="color: #006080">"LineItemDiscountAmount"</span>] = lineItem.LineItemDiscountAmount;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30"> 30:</span> entry[<span style="color: #006080">"OrderLevelDiscountAmount"</span>] = lineItem.OrderLevelDiscountAmount;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31"> 31:</span> entry[<span style="color: #006080">"ShippingMethodName"</span>] = lineItem.ShippingMethodName ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32"> 32:</span> entry[<span style="color: #006080">"ExtendedPrice"</span>] = lineItem.ExtendedPrice;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33"> 33:</span> entry[<span style="color: #006080">"Description"</span>] = lineItem.Description ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34"> 34:</span> entry[<span style="color: #006080">"Status"</span>] = lineItem.Status ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35"> 35:</span> entry[<span style="color: #006080">"DisplayName"</span>] = lineItem.DisplayName ?? <span style="color: #0000ff">string</span>.Empty;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36"> 36:</span> entry[<span style="color: #006080">"AllowBackordersAndPreorders"</span>] = lineItem.AllowBackordersAndPreorders;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37"> 37:</span> entry[<span style="color: #006080">"InStockQuantity"</span>] = lineItem.InStockQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38"> 38:</span> entry[<span style="color: #006080">"PreorderQuantity"</span>] = lineItem.PreorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39"> 39:</span> entry[<span style="color: #006080">"BackorderQuantity"</span>] = lineItem.BackorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40"> 40:</span> entry[<span style="color: #006080">"InventoryStatus"</span>] = lineItem.InventoryStatus;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41"> 41:</span> <span style="color: #0000ff">foreach</span> (MetaField field <span style="color: #0000ff">in</span> lineItem.MetaClass.MetaFields)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42"> 42:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43"> 43:</span> entry[field.Name] = lineItem[field];</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44"> 44:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45"> 45:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46"> 46:</span> PopulateVisitorGroupEntry(<span style="color: #0000ff">ref</span> entry);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47"> 47:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48"> 48:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49"> 49:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> PopulateVisitorGroupEntry(<span style="color: #0000ff">ref</span> PromotionEntry entry)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50"> 50:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51"> 51:</span> <span style="color: #008000">// KLUDGE: For demo purposes only. Retrieve the last time we made this check and the principal user at the </span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52"> 52:</span> <span style="color: #008000">// time from the cache.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53"> 53:</span> IPrincipal lastPrincipal = <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54"> 54:</span> <span style="color: #0000ff">double</span> lastTime = 0;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55"> 55:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56"> 56:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57"> 57:</span> lastPrincipal = CacheManager.Get(<span style="color: #006080">"promoLastPrincipal"</span>) <span style="color: #0000ff">as</span> IPrincipal;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58"> 58:</span> lastTime = (<span style="color: #0000ff">double</span>)CacheManager.Get(<span style="color: #006080">"promoLastTime"</span>);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59"> 59:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60"> 60:</span> <span style="color: #0000ff">catch</span> (NullReferenceException)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61"> 61:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum62"> 62:</span> <span style="color: #008000">// Catch any nulls on the double case above. Then continue...</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum63"> 63:</span> } </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum64"> 64:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum65"> 65:</span> <span style="color: #008000">// KLUDGE: For demo purposes only. For performance, only re-check VG's if more than 5 seconds have passed or</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum66"> 66:</span> <span style="color: #008000">// if the principal has changed.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum67"> 67:</span> <span style="color: #0000ff">if</span> (((DateTime.Now.TimeOfDay.TotalSeconds - lastTime) >= 5) || (!PrincipalInfo.CurrentPrincipal.Equals(lastPrincipal))) </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum68"> 68:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum69"> 69:</span> <span style="color: #008000">// Get all the VG repository and all roles available within it</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum70"> 70:</span> VisitorGroupRoleRepository vgRepository = VisitorGroupRole.GetRepository();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum71"> 71:</span> IEnumerable<<span style="color: #0000ff">string</span>> vgRoles = vgRepository.GetAllRoles();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum72"> 72:</span> VisitorGroupHelper vgHelper = <span style="color: #0000ff">new</span> VisitorGroupHelper();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum73"> 73:</span> <span style="color: #0000ff">string</span> tempVisitorRoles = <span style="color: #006080">""</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum74"> 74:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum75"> 75:</span> <span style="color: #008000">// Loop through all VG's to see if the current visitor is a member of any</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum76"> 76:</span> <span style="color: #0000ff">foreach</span>(<span style="color: #0000ff">string</span> role <span style="color: #0000ff">in</span> vgRoles)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum77"> 77:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum78"> 78:</span> <span style="color: #008000">// Is the visitor in the role?</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum79"> 79:</span> <span style="color: #0000ff">if</span> (vgHelper.IsPrincipalInGroup(PrincipalInfo.CurrentPrincipal, role))</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum80"> 80:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum81"> 81:</span> <span style="color: #008000">// If there is a match add the role to the temp string with a comma delimiter. This will allow for creating of</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum82"> 82:</span> <span style="color: #008000">// an expression in the Commerce Manager Promotions area for any number of visitor groups. For example, you </span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum83"> 83:</span> <span style="color: #008000">// can specify if the Visitor Group "Contains" the "US Visitor" VG, give 10% off.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum84"> 84:</span> tempVisitorRoles = tempVisitorRoles + role + <span style="color: #006080">","</span>;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum85"> 85:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum86"> 86:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum87"> 87:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum88"> 88:</span> <span style="color: #008000">// Update the entry with all roles the visitor is a member of</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum89"> 89:</span> entry[<span style="color: #006080">"VisitorGroup"</span>] = tempVisitorRoles;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum90"> 90:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum91"> 91:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum92"> 92:</span> <span style="color: #008000">// KLUDGE: For demo purposes only. Cache the last time we made this check and the principal user at the time.</span></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum93"> 93:</span> CacheManager.Add(<span style="color: #006080">"promoLastTime"</span>, DateTime.Now.TimeOfDay.TotalSeconds);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum94"> 94:</span> CacheManager.Add(<span style="color: #006080">"promoLastPrincipal"</span>, PrincipalInfo.CurrentPrincipal); </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum95"> 95:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum96"> 96:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum97"> 97:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Populate(<span style="color: #0000ff">ref</span> PromotionEntry promotionEntry, <span style="color: #0000ff">object</span> val)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum98"> 98:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum99"> 99:</span> <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotSupportedException(<span style="color: #006080">"This method is obsolete."</span>);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum100"> 100:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum101"> 101:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum102"> 102:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Populate(PromotionEntry entry, Entry catalogEntry, MarketId marketId, Currency currency)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum103"> 103:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum104"> 104:</span> entry.Quantity = 1M;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum105"> 105:</span> entry.Owner = catalogEntry;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum106"> 106:</span> entry[<span style="color: #006080">"Id"</span>] = catalogEntry.ID;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum107"> 107:</span> <span style="color: #0000ff">if</span> (catalogEntry.ItemAttributes != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum108"> 108:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum109"> 109:</span> entry[<span style="color: #006080">"MinQuantity"</span>] = catalogEntry.ItemAttributes.MinQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum110"> 110:</span> entry[<span style="color: #006080">"MaxQuantity"</span>] = catalogEntry.ItemAttributes.MaxQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum111"> 111:</span> <span style="color: #0000ff">if</span> (catalogEntry.ItemAttributes.Attribute != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum112"> 112:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum113"> 113:</span> <span style="color: #0000ff">foreach</span> (ItemAttribute attribute <span style="color: #0000ff">in</span> catalogEntry.ItemAttributes.Attribute)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum114"> 114:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum115"> 115:</span> <span style="color: #0000ff">if</span> ((attribute.Value != <span style="color: #0000ff">null</span>) && (attribute.Value.Length > 0))</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum116"> 116:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum117"> 117:</span> entry[attribute.Name] = attribute.Value[0];</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum118"> 118:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum119"> 119:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum120"> 120:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum121"> 121:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum122"> 122:</span> <span style="color: #0000ff">if</span> (catalogEntry.Inventory != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum123"> 123:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum124"> 124:</span> entry[<span style="color: #006080">"AllowBackordersAndPreorders"</span>] = !catalogEntry.Inventory.AllowBackorder ? ((<span style="color: #0000ff">object</span>) 0) : ((<span style="color: #0000ff">object</span>) catalogEntry.Inventory.AllowPreorder);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum125"> 125:</span> entry[<span style="color: #006080">"InStockQuantity"</span>] = catalogEntry.Inventory.InStockQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum126"> 126:</span> entry[<span style="color: #006080">"PreorderQuantity"</span>] = catalogEntry.Inventory.PreorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum127"> 127:</span> entry[<span style="color: #006080">"BackorderQuantity"</span>] = catalogEntry.Inventory.BackorderQuantity;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum128"> 128:</span> entry[<span style="color: #006080">"InventoryStatus"</span>] = catalogEntry.Inventory.InventoryStatus;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum129"> 129:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum130"> 130:</span> IPriceValue value2 = ServiceLocator.Current.GetInstance<IPriceService>().GetDefaultPrice(marketId, FrameworkContext.Current.CurrentDateTime, <span style="color: #0000ff">new</span> CatalogKey(catalogEntry), currency);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum131"> 131:</span> <span style="color: #0000ff">if</span> (value2 != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum132"> 132:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum133"> 133:</span> entry[<span style="color: #006080">"ExtendedPrice"</span>] = value2.UnitPrice.Amount;</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum134"> 134:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum135"> 135:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum136"> 136:</span> PopulateVisitorGroupEntry(<span style="color: #0000ff">ref</span> entry);</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum137"> 137:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum138"> 138:</span>  </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum139"> 139:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> PopulateCustom(PromotionEntry promotionEntry, <span style="color: #0000ff">object</span> obj)</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum140"> 140:</span> {</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum141"> 141:</span> <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotSupportedException();</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum142"> 142:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum143"> 143:</span> }</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum144"> 144:</span> }</pre>
<!--CRLF--></div>
</div>
<ul>
<li>The provider is called a number of times to check promotions, in some cases multiple times. For example, on the cart page it will be called three times. To enhance performance I put in a bit of a kludge to ensure this isn’t called too many times repeatedly. You’ll see that the code checks the last time the code was executed and the last principal before executing the code to validate the current principals Visitor Groups again. Essentially it says if less than five seconds have passed and the principal is the same do not check again. <strong>THIS IS INTENDED FOR DEMO PERPOSES ONLY!</strong> In the real world this would not be a likely best practice. Since any visitor behavior on the site could cause them to be added to or removed from a particular Visitor Group you may choose cache the Visitor Groups for a user and hook into some related event using this to invalidate that cache rather than using the code I just described. This solution should suffice for my demo environment however. </li>
<li>Change the project settings via your preferred method to ensure the DLL is found when the site runs. I simply changed the Output directory to the site bin folder. You could copy the DLL in the post build event, put in modulesbin, etc. depending on your preference. But you already knew this! </li>
</ul>
<blockquote>
<p><a href="/link/afde8c29f5064c76bb72ad413814a1ee.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/d874c62af97e448d803820072d6631b5.png" width="567" height="255" /></a></p>
</blockquote>
<ul>
<li>Build the project and validate the DLL is in the expected directory. </li>
</ul>
<p><strong><em><font size="4"></font></em></strong></p>
<p><strong><em>Change the Default Promotion Provider</em></strong></p>
<ul>
<li>Navigate to the site root “Configs” folder. </li>
<li>Open the ecf.marketing.config file. </li>
</ul>
<blockquote>
<p><a href="/link/d1f69bddc211409a8263689cf556449a.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/1cb9e14c4c7a411094c5289aef085e62.png" width="480" height="224" /></a></p>
</blockquote>
<ul>
<li>Remove or comment out the existing PromotionEntryPopulateFunctionType line. </li>
<li>Add a new one similar to the one in my code below. The first part of the “name” configuration should be the full class name including namespace, in my case: EPiServer.Commerce.Addons.Promotions.CustomPromotionEntryPopulate. The second part should be the DLL name, in my case: EPiServer.Commerce.Addons.Promotions. </li>
</ul>
<blockquote>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <?xml version=<span style="color: #006080">"1.0"</span>?></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> <Marketing></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <Connection connectionStringName=<span style="color: #006080">"EcfSqlConnection"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> <Cache enabled=<span style="color: #006080">"true"</span> promotionTimeout=<span style="color: #006080">"0:1:0"</span> campaignTimeout=<span style="color: #006080">"0:1:0"</span> policyTimeout=<span style="color: #006080">"0:1:0"</span> segmentTimeout=<span style="color: #006080">"0:1:0"</span> expressionTimeout=<span style="color: #006080">"0:1:0"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <MappedTypes></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span> <ExpressionValidatorType name=<span style="color: #006080">"Mediachase.Commerce.Marketing.Validators.RulesExprValidator,Mediachase.Commerce.Marketing.Validators"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span> <!-- <PromotionEntryPopulateFunctionType name=<span style="color: #006080">"Mediachase.Commerce.Marketing.Validators.PromotionEntryPopulate,Mediachase.Commerce.Marketing.Validators"</span> /> --></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span> <PromotionEntryPopulateFunctionType name=<span style="color: #006080">"EPiServer.Commerce.Addons.Promotions.CustomPromotionEntryPopulate, EPiServer.Commerce.Addons.Promotions"</span> /> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> </MappedTypes></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span> <Roles /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> </Marketing></pre>
<!--CRLF--></div>
</div>
</blockquote>
<ul>
<li>Save the file. </li>
</ul>
<p><font size="4"></font></p>
<p><strong><em>Create a Visitor Group</em></strong></p>
<ul>
<li>Below is the definition of the Visitor Group I used for my testing, a “Frequent Orderer”  segment for anyone who has ordered five times in a thirty day period. Creating a Visitor Group to segment your visitor is beyond the scope of this blog post. Please refer to EPiServer <a href="http://webhelp.episerver.com/CMS/7.1/EN/#PersonalizationContent/Admin_CreateVisitorGroup.htm?Highlight=visitor group">Web Help</a> or <a href="/link/8c5aeb4ee4914707b6c0fe59df1893e7.aspx?epslanguage=en">User Manuals</a> for more info on this process. </li>
</ul>
<blockquote>
<p><a href="/link/855cb7e12b7a4e118be5d69e85d1ea53.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/b44ffa73d57a4852b1885910d5e9b950.png" width="629" height="371" /></a></p>
</blockquote>
<p><strong><em></em></strong></p>
<p><strong><em>Set up a Promotion Targeting a Visitor Group</em></strong></p>
<ul>
<li>You should now be able to set up promotions targeting Visitor Groups. </li>
<li>Navigate the Commerce Manager. </li>
<li>Navigate to Marketing~Promotions. </li>
<li>Select the “Promotions” node. Note, this assumes you have set up any necessary Campaigns or Customer Segments you might wish to use in the Commerce Manager. Creating Promotions, Campaigns, and Customer Segments is beyond the scope of this blog post. Please refer to the <a href="http://webhelp.episerver.com/Commerce/1.2/#User Guide/Marketing/Marketing.htm">Web Help</a> for more info on this process. I will walk you through the related configuration for targeting a Visitor Group. </li>
<li>Create a “Catalog Entry: Build Your Own Discount” promotion. Follow the relevant steps noted in the previously referenced Web Help. </li>
<li>The important part as it relates to this blog is the “Purchase Condition and Reward” section. When you select the Purchase Condition you should now see “Visitor Group” listed as an option. Select this. </li>
</ul>
<blockquote>
<p><a href="/link/03162f1c786d4d3cb52fa6ac26e93c74.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/2eb74e474ba5414195173a658c6316ff.png" width="286" height="281" /></a></p>
</blockquote>
<ul>
<li>The visitor could be part of multiple Visitor Groups and if you recall we used a comma separated string to store these. So, for the operator in the conditions use “Contains”. </li>
<li>In the “Text” portion add the name, or names using an “Or”, of the Visitor Groups you wish to target. In my example I named the Visitor Group “Frequent Order” so this is what I used here. </li>
</ul>
<blockquote>
<p><a href="/link/806faf9e5dea4e7fb1f48552a81ddd8c.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/4cc87765b688407889f45b78d53c3732.png" width="631" height="332" /></a></p>
</blockquote>
<ul>
<li>Finish configuring the promotion and select the “OK” button to save. My example promotions entire definition can be seen below. </li>
</ul>
<blockquote>
<p><a href="/link/227c23db720c4ded8958f56b4bbf0ebf.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/b222edc144234ceeb20f14d6c1282f26.png" width="426" height="675" /></a></p>
</blockquote>
<p><strong><font size="4"></font></strong></p>
<p><strong><font size="4"></font></strong></p>
<p><strong><font size="4"></font></strong></p>
<p><strong><font size="4">Shipping and Order <strong><font size="4">Promotions</font></strong></font></strong></p>
<p>The same code already added in the provider also enables you to apply similar discounts for shipping and order promotions.</p>
<p><strong><em>Shipping</em></strong></p>
<ul>
<li>Create a “Shipping: Build Your Own Discount” promotion. </li>
<li>The important part as it relates to this blog is the “Purchase Condition and Reward” section. In the first statement select “Shipment.LineItems”.</li>
<li>Set the conditional statement to Any Equals True.</li>
<li>Add an additional condition where Visitor Group Contains <your visitor group name>. In my case I used the “Frequent Orderer” Visitor Group. Remember that we use “Contains” because the visitor could be part of multiple Visitor Groups.</li>
</ul>
<blockquote>
<p><a href="/link/5de51eeeb95246c5a31e9f083cd4ca88.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/7030ed9d618444b3b1018a750d875e4e.png" width="626" height="298" /></a></p>
</blockquote>
<ul>
<li>My example promotions entire definition can be seen below. </li>
</ul>
<blockquote>
<p><a href="/link/ef99cdbe360743f488f8ae8e4b0cf292.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image_thumb23" border="0" alt="image_thumb23" src="/link/3a25390970b34748891c57f476be193a.png" width="426" height="693" /></a></p>
</blockquote>
<ul>
<li>You can see the resulting shipping discount below. Note the “Shipping Cost” is zero.</li>
</ul>
<blockquote>
<p><a href="/link/fc91f11f866b4706bcdd10658834d8b7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image_thumb20" border="0" alt="image_thumb20" src="/link/c3b2ec6978374ab38b4946fd00c5f75e.png" width="609" height="358" /></a></p>
</blockquote>
<p><strong><em></em></strong></p>
<p><strong><em>Orders</em></strong></p>
<ul>
<li>Create a “Order: Build Your Own Discount” promotion. </li>
<li>The important part as it relates to this blog is the “Purchase Condition and Reward” section. In the first statement select “OrderForm.LineItems”.</li>
<li>Set the conditional statement to Any Equals True.</li>
<li>Add an additional condition where Visitor Group Contains <your visitor group name>. In my case I used the “Frequent Orderer” Visitor Group. Remember that we use “Contains” because the visitor could be part of multiple Visitor Groups.</li>
</ul>
<blockquote>
<p><a href="/link/c8017a4da79945359fd5291e2bb9adf4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/64d5aaa8e21b4f9e9ec6c69cad694d7e.png" width="627" height="300" /></a></p>
</blockquote>
<ul>
<li>My example promotions entire definition can be seen below. </li>
</ul>
<blockquote>
<p><a href="/link/9e1badad51874652b71ab932ca89d78f.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/4df4b4a70a734c658191dd0a00c13c2e.png" width="427" height="760" /></a></p>
</blockquote>
<ul>
<li>You can see the resulting order discount below in the “Order Discount”.</li>
</ul>
<blockquote>
<p><a href="/link/15c74b82f5584c72b0edcc7dd6d87846.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image_thumb[1]" border="0" alt="image_thumb[1]" src="/link/5885048ad1634aa981ca3e838c2cd930.png" width="659" height="378" /></a></p>
</blockquote>
<p><strong><font size="4"></font></strong></p>
<p><strong><font size="4">How to Get the Code</font></strong></p>
<p>If you wish to simply utilize my project and code you can download a zip file containing it below:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:589a776e-2899-4cf0-8a6b-2ed5d0c94f68" class="wlWriterEditableSmartContent"><p> <a href="/link/652ebcc78656419797ea935675f4766d.zip" target="_blank">Download</a></p></div>
<p>Based on this you can skip the “Set up the Promotion Provider” section but follow the others:</p>
<ul>
<li>Set up the Meta Field and Class </li>
<li>Change the Default Promotion Provider </li>
<li>Create a Visitor Group </li>
<li>Set up a Promotion Targeting a Visitor Group
<br /></li>
</ul>
<hr />
<p>Assuming all went as expected you should now be able to target Visitor Groups with the relevant promotion types. The result should be as shown in the “The End Result” section near the top of this blog.</p>
<p>Special thanks to <a href="http://world.episerver.com/Blogs/Shannon-Gray/">Shannon Gray</a> for his excellent blog and his assistance in getting this all set up. Enjoy!</p>
<hr />
<ol>
<li><em>This is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk.</em> </li>
</ol>
RSS Reader Block
/blogs/Jeff-Wallace/Dates/2013/5/RSS-Reader-Block/
2013-05-06T23:16:55.0000000Z
<p><em>Based on EPiServer 7.1</em></p> <p>EPiServer customers often want to use RSS on their sites. Some want to create RSS output from their pages, others may want to view it in a dashboard report, and others may simply want to consume a RSS source and syndicate it. Fortunately there are solutions for all of these. In this post however, I’m going to share a simple RSS Reader Block I’ve created. Once added to your site properly the usage is quite simple:</p> <p> </p> <p>1. Create a new “RSS Reader Block”:</p> <p><a href="/link/8192f194b6b445398ce9a278be1b4d0d.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/21b1688ab73b45e9b6b5d0ee2eee5654.png" width="244" height="223" /></a></p> <p> </p> <p>2. Configure the content items you desire:</p> <blockquote> <ul> <li>RSS Feed URL (required) - URL for the RSS feed</li> <li>Heading (optional) – Heading for the feed</li> <li>Description Text (optional) – Descriptive text for the feed</li> <li>Max Count (optional) – Maximum number of items to show in the list</li> <li>Include Publish Date (optional) – Whether or not to include publish date in the list</li> </ul> <p> </p> </blockquote> <p><a href="/link/6c7620e94b8940da888e9b011b926977.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/d8067b0710cd492eaa35f51a2e3918e1.png" width="508" height="589" /></a> </p> <p> </p> <p>3. Preview:</p> <p><a href="/link/106935b7a7a043fba4e72c3835172572.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/9b04913578324f6b8823478d858ae9d4.png" width="508" height="374" /></a> </p> <p> </p> <p>4. Publish</p> <p><a href="/link/bea25a518ee2478f9aa3264fae3d1b3a.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/50bcb44b26204c2fa4dd2e1b5fef38fb.png" width="508" height="555" /></a></p> <p> </p> <p>Additional example on Enoteca:</p> <p><a href="/link/956d6d914245421498669a9080e30b03.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/5165e478aed44e0e8bc9b795a1b6753f.png" width="508" height="401" /></a></p> <p> </p> <p>Get the code here…</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:5a89b616-9f88-44fc-895e-918faa6b3355" class="wlWriterEditableSmartContent"><p> <a href="/link/5c38e86cd9ce49dea447b82f9da22313.nupkg" target="_blank">NuGet Package</a></p></div> <p>Enjoy!</p> <hr /> <ol> <li><em>I made use of some of the styling from the Alloy Templates. As a result you may wish to tweak the styling a bit for your own needs. I left some commented out HTML in the view class in case it helps.</em> </li> <li><em>The folder structure is based on one that mirrors the Alloy Templates thought installing on an Alloy site is not required.</em> </li> <li><em>This NuGet package is a developer Add-on. This means it should be installed through Visual Studio and compiled as part of your project, not through the Add-on store UI in EPiServer.</em> </li> <li><em>This is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk.</em> </li> </ol>
Divider “Layout” Block
/blogs/Jeff-Wallace/Dates/2013/3/Divider-Layout-Block/
2013-03-18T01:00:39.0000000Z
<p><em>Based on EPiServer 7 and the Alloy Templates</em></p> <p>The new Alloy templates released with EPiServer 7 are based on a grid layout. The grid contains a number of rows in which content  blocks will automatically resize and fit on the same row or flow to different rows based on the space available. <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/?encryptedcurrentid=lm/59bt041nvW%2bnSHorBHp59lt4xiOw6">Ted Nyberg</a> explains this concept well in  his <a href="http://world.episerver.com/Articles/Items/Alloy-Templates-for-EPiServer-CMS-7/">article on the template package</a>. This is fantastic stuff, especially in the mobile world.</p> <p> </p> <p>In some cases editors or marketers may want to create a page and have a little more control over this automatic flow. For example, if they were using the Alloy templates “Landing Page”. I’ve created a “Divider Block” for this exact case. It doesn’t really do anything other than what the title says, adds a divider. </p> <p><a href="/link/d55250e9ee81401e819351155a11281f.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/cdd9720c82524951a2806af66e1555e1.png" width="244" height="147" /></a></p> <p>Let’s say, for example, you have three items in a row:</p> <p><img alt="Third block" src="/link/9c6035f600ed4fa3b9ea85c803ac28f2.png" width="413" height="121" /></p> <p>But you really wanted two items in the top row and the third block to push to the next row row similar to what’s pictured below:</p> <p><img alt="Second block" src="/link/a13c07798e6a4d3ca4c2d01d926414c6.png" width="413" height="120" /></p> <p><a href="/link/ca73f797be434c0f8f816f67ac52dad2.png"><img style="display: inline" title="image" alt="image" src="/link/fdaed9056a1d4fdd91dea9900198d239.png" width="413" height="124" /></a></p> <p>No problem! Just add the divider block after the second block and that’s exactly what will happen! </p> <p><img alt="Second block" src="/link/a13c07798e6a4d3ca4c2d01d926414c6.png" width="413" height="120" /></p> <p><a href="/link/c2ed497915494a63904fd53c426ee81f.png"><img style="display: inline" title="image" alt="image" src="/link/6ed63eeed2c24f4081b5a0c7cde9d9d5.png" width="413" height="57" /></a></p> <p><a href="/link/512ee8c3d4e0480da8507ae92d2e4cf5.png"><img style="margin: 0px; display: inline" title="image" alt="image" src="/link/3f97678d722048489520a25ca5fae597.png" width="413" height="124" /></a></p> <p>If you’re wondering about mobile, well, everything will continue to flow as expected for mobile devices. Simple, yet effective in enabling an additional level of control for the layout. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="/link/31b59a9df0794808bbc002741a12fec9.png" /> </p> <p> </p> <p>Get the code here…</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:b0be5dec-9ec6-4228-ae12-8ea0f7853ac7" class="class"> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:8f6a350a-5083-4331-8882-230ee7adc164" class="wlWriterEditableSmartContent"><p> <a href="/link/0f5d0027fc25436eb7e3fdfd16c648ab.nupkg" target="_blank">Nuget Package</a></p></div> </div> <p>Enjoy!</p> <hr /> <ol> <li><em>This is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. </em></li> <li><em>If you install on a site that does not include the Alloy Templates you should expect that you will need to make a few minor updates to get it working as desired.</em> </li> <li><em>Block photos above (First block, Second block, Third block, etc) were taken from </em><a href="http://world.episerver.com/Articles/Items/Alloy-Templates-for-EPiServer-CMS-7/"><em>Ted Nyberg’s article on the Alloy Templates</em></a><em>.</em> </li> </ol>
YouTube Block
/blogs/Jeff-Wallace/Dates/2013/3/YouTube-Block/
2013-03-17T21:49:38.0000000Z
<p><em>Based on EPiServer 7 and Alloy Templates</em></p> <p>The title says it all! My colleague <a href="/link/5341f632537c4b0ab6b8fb651bd310f8.aspx?epslanguage=en&encryptedcurrentid=n1xoKQeNMf8%3d">Janaka Fernando</a> was kind enough to share a YouTube block with me that he created. I tweaked it a bit to add a few extras including a responsive flow. The result of our combined effort is described below.</p> <p>Configurable items include:</p> <ul> <li>YouTube Link (required) – URL to the YouTube video </li> <li>Heading – Heading for the video </li> <li>Video Text – Descriptive text for the video </li> </ul> <p>Example of block configuration:</p> <p><a href="/link/2b30c7c83c644f038d73c338f2b6cda7.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/592d4649388e4e3aac3f78b8a4ae39a7.png" width="430" height="402" /></a></p> <p> </p> <p>Example of block preview in the editorial interface:</p> <p><a href="/link/d220db9fa6e442b096f85b65b348a4a2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/fecbe6fe9e1e4ef7971828dcfc0ae495.png" width="431" height="533" /></a></p> <p> </p> <p>What the site visitor will see:</p> <p><a href="/link/efb7f6f994e644b39571cf33b6fdf250.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/dc4e7f00eb8f47ec9e0139c890903c38.png" width="431" height="354" /></a></p> <p> </p> <p>Mobile view:</p> <p><a href="/link/58121d16d807484fa037e0dfc708e02a.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/3bae167014b0433b8bef56ba0e807de1.png" width="281" height="459" /></a></p> <p> </p> <p>I’ve uploaded the code to the EPiServer Nuget feed and it should appear there once approved. In the mean time you can get it here…</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:b0be5dec-9ec6-4228-ae12-8ea0f7853ac7" class="wlWriterEditableSmartContent"><p> <a href="/link/ce6f51d9f46649d9920a857ebcf0a0a4.nupkg" target="_blank">Nuget Package</a></p></div> <p>And if you find this exciting, well, then you should really watch the full RebBull Stratos YouTube video. Amazing!</p> <p>Enjoy!</p> <hr /> <ol> <li><em>This is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. </em></li> <li><em>If you install on a site that does not include the Alloy Templates you should expect that you will need to make a few minor updates to get it working as desired. Also, in a production environment you may wish to tweak to improve the performance.</em> </li> </ol>
iFrame Block
/blogs/Jeff-Wallace/Dates/2013/3/iFrame-Block/
2013-03-17T19:39:20.0000000Z
<p><em>Based on EPiServer 7 and Alloy Templates</em></p> <p>Have you ever needed to display some content on an EPiServer site in an iFrame? My colleague <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/?encryptedcurrentid=iTnavH3Bjx82DyZ3hW%2boRF8OyPMG6U8EP%2bjRCQwz1gg%3d">Bill Murray</a> and I created a simple block for this purpose. </p> <p>Configurable items include:</p> <ul> <li>URL (required) – URL you would like to display in the iFrame </li> <li>Heading – Heading for the information being displayed </li> <li>Text  - Descriptive text for the information being displayed </li> <li>Width – Width of the iFrame </li> <li>Height – Height of the iFrame </li> <li>Scrollable – Whether or not the iFrame should include scrollbars </li> </ul> <p>Example of block configuration:</p> <p><a href="/link/b947ec58f24941ae997c9a3fbe14064d.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/eee2294d11d54a7a809d63e78b544b5c.png" width="420" height="363" /></a></p> <p> </p> <p>Example of block preview in the editorial interface:</p> <p><a href="/link/cc06e15df6bf47ffa91b3590a0fce548.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/ec2ae183ab4342feaf4295e702ceffc2.png" width="548" height="319" /></a></p> <p><em></em></p> <p>Granted, this is not a real world scenario since I’m actually iFraming in a login page for Exact Target’s member site, I think it illustrates the point of the possibilities for usage.</p> <p>I’ve uploaded the code to the EPiServer Nuget feed and it should appear there once approved. In the mean time you can get it here…</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:7f0f2f39-4df2-483d-ab91-66390f6b4be0" class="wlWriterEditableSmartContent"><p> <a href="/link/d4fdffb7e36843318eb48ffdb0f63b2c.nupkg" target="_blank">Nuget Package</a></p></div> <p>Enjoy!</p> <hr /> <ol> <li><em>This is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. </em></li> <li><em>If you install on a site that does not include the Alloy Templates you should expect that you will need to make a few minor updates to get it working as desired.</em> </li> </ol>
Visual Studio Extension – Error When Creating a New Site
/blogs/Jeff-Wallace/Dates/2012/12/Visual-Studio-Extension--Error-When-Creating-a-New-Site/
2012-12-11T19:29:51.0000000Z
<p><em>Based on EPiServer 7, Windows Server 2008 SP2 Web Edition, and IIS Express 7.5</em></p> <p>EPiServer provided the Visual Studio Extension along with the EPiServer 7 release. Using this extension in its entirety requires installation of IIS Express. A couple of us in the US office, all using Window Server 2008, have seen an error when attempting to create a new project. The error seems to be more of a Microsoft issue than an EPiServer one, and related to various versions of operating systems or software, as most people will never see the problem at all. While I have my own theories, rather than troubleshooting every detail I’ve decided to provide the background and workaround. I welcome comments from others who wish to share their expertise.</p> <p>The error:</p> <p><a href="/link/b2cd035145104de2bc52be4b32707b6a.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/c90f0e9b5ea04be6839251630995ecf2.png" width="571" height="420" /></a></p> <p> <br />If you open up the applicationhost.config file mentioned in the error you will find an applicationPools section that looks something like what follows, with a few lines referencing the CLRConfigFile attribute.</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 152.49%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 202px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <system.applicationHost></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> <applicationPools></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <add name=<span style="color: #006080">"Clr4IntegratedAppPool"</span> managedRuntimeVersion=<span style="color: #006080">"v4.0"</span> managedPipelineMode=<span style="color: #006080">"Integrated"</span> CLRConfigFile=<span style="color: #006080">"%IIS_USER_HOME%\config\aspnet.config"</span> autoStart=<span style="color: #006080">"true"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> <add name=<span style="color: #006080">"Clr4ClassicAppPool"</span> managedRuntimeVersion=<span style="color: #006080">"v4.0"</span> managedPipelineMode=<span style="color: #006080">"Classic"</span> CLRConfigFile=<span style="color: #006080">"%IIS_USER_HOME%\config\aspnet.config"</span> autoStart=<span style="color: #006080">"true"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <add name=<span style="color: #006080">"Clr2IntegratedAppPool"</span> managedRuntimeVersion=<span style="color: #006080">"v2.0"</span> managedPipelineMode=<span style="color: #006080">"Integrated"</span> CLRConfigFile=<span style="color: #006080">"%IIS_USER_HOME%\config\aspnet.config"</span> autoStart=<span style="color: #006080">"true"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span> <add name=<span style="color: #006080">"Clr2ClassicAppPool"</span> managedRuntimeVersion=<span style="color: #006080">"v2.0"</span> managedPipelineMode=<span style="color: #006080">"Classic"</span> CLRConfigFile=<span style="color: #006080">"%IIS_USER_HOME%\config\aspnet.config"</span> autoStart=<span style="color: #006080">"true"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span> <add name=<span style="color: #006080">"UnmanagedClassicAppPool"</span> managedRuntimeVersion=<span style="color: #006080">""</span> managedPipelineMode=<span style="color: #006080">"Classic"</span> autoStart=<span style="color: #006080">"true"</span> /></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span> <applicationPoolDefaults managedRuntimeLoader=<span style="color: #006080">"v4.0"</span> ></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> <processModel/></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span> </applicationPoolDefaults></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> </applicationPools></pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12"> 12:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13"> 13:</span> ...</pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14"> 14:</span> </pre>
<!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15"> 15:</span> </system.applicationHost></pre>
<!--CRLF--></div>
</div>
<p>You can find more information on the CLRConfigFile attribute in various <a href="http://msdn.microsoft.com/en-us/library/aa347554(VS.90).aspx">MSDN</a> doc. I also found a <a href="http://weblogs.asp.net/owscott/archive/2011/12/01/setting-an-aspnet-config-file-per-application-pool.aspx">blog from Scott Forsyth</a> which has a pretty good summary:</p>
<p><em>“In Windows Server 2008 R2 (IIS 7.5) support was added to allow different settings per application pool. Where previously the settings had to be applied to the whole framework version, now they can be specific to each app pool. It does this by allowing you to create a custom aspnet.config file per app pool. You can save them wherever you want on disk and IIS will pick them up when the app pool starts.</em></p>
<p><em>This is supported by a new attribute for the IIS app pool called CLRConfigFile mentioned in </em><a href="http://msdn.microsoft.com/en-us/library/aa347554(VS.90).aspx"><em>this MSDN article</em></a><em>.  There is no default value which means that if you don’t set it, it will read the framework’s aspnet.config file and not look for additional files.”</em></p>
<p><em></em></p>
<p><em></em></p>
<p>What does this mean for you and I? Well, personally I don’t need different settings per application pool so to fix the error mentioned I simply removed the references to it in my applicationHost.config. For example, for each line that referenced CLRConfigFile I deleted the parts that looked like the following yellow highlighted area.</p>
<p><font face="Consolas"><add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" <font style="background-color: #ffff00">CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config"</font> autoStart="true" /></font></p>
<p>That’s it! Error fixed. The VS Integration will now rely on default application pool settings. Should you need to use custom ones, please review the MSDN documentation on getting this set up properly.</p>
<p>Special thanks to <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Eddy%20Dugan/">Eddy Dugan</a> for doing some investigation as well and being the first to hit delete on that yellow blob. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="/link/67c112b94f4946038bf8ee8cf38259d5.png" /></p>
Developers: Before You Build that Alloy 7 Project…
/blogs/Jeff-Wallace/Dates/2012/11/Developers-Before-You-Build-that-Alloy-7-Project/
2012-11-02T22:30:11.0000000Z
<p><em>Based on EPiServer 7 and the new Alloy templates</em></p> <p>If you have been able to get your hands on EPiServer 7 or experienced any kind of demo you’ll probably be pretty excited about it.  It’s pretty slick!  Since there’s plenty of blogs that tell this story already I won’t re-hash the greatness in this one.  Instead I want to make sure you are aware of a change to the Alloy template project before you build for the first time.</p> <p> </p> <p>The new project includes some post build steps that will copy some of the configs from a new location in the file/project structure over to the root.  </p> <p> </p> <p><a href="/link/cf3df4e21fd54d6ea6ddb10ca11e9e40.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/718b857dad9d4f2081b96d969bdc503a.png" width="553" height="258" /></a></p> <p><em>Post Build Events</em></p> <p><em></em></p> <p> </p> <p>One of my colleagues explained this process based on some information that was presented at one of the summits this week:</p> <p> <br /><em>“Every time the project is built, the following is executed by the MSBuild scripts in the [MSBuild] folder: <br /></em></p> <p><em>1. Retrieve default EPiServer configuration files from the "[Configuration]\EPiServer" folder <br />2. Apply common config transforms from the "[Configuration]\Common" folder <br />3. Apply build configuration-specific transforms from the "[Configuration]\BUILDCONFIGNAME" folder <br />(where BUILDCONFIGNAME is the current build configuration name, such as "Debug" or "Release") <br />4. Overwrite any existing configuration files in the site root <br /></em></p> <p><em>Note: The MSBuild scripts are executed through a post-build event. <br />Make sure all files in this folder have their Build Action set to "None" to avoid this folder being included when performing a Publish”</em></p> <p> </p> <p>You’ll also find the above conveniently placed in “_ReadMe.txt” in the Alloy project under the “[Configuration]” folder.</p> <p> </p> <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody> <tr> <td valign="top" width="200"><a href="/link/3f04527883eb47ec805c9b47f878d5f2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/21e4eb8afddf484ca2c5865785cac4be.png" width="272" height="315" /></a></td> <td valign="top" width="200"><a href="/link/c18355731fb54b309a6043c0955c8e6e.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/2077ad9c4cdd4dca8d61f8cf5a9b4cb2.png" width="249" height="315" /></a></td> </tr> </tbody></table> <p><em>[MSBuild] folder and [Configuration] folders</em></p> <p><em></em></p> <p> </p> <p>You might notice the “Web.config.ReadMe.txt” file in the site root also reads as follows: </p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em>“Note that the Web.config file in the root should not be modified directly as it will be overwritten every time the web application is built (because of config transforms).</em></p> <p><em>Configuration changes should be done in the [Configuration] folder.</em></p> <p><em>See the readme file in the [Configuration] folder for detail”</em></p> <p><em></em></p> <p> </p> <p>Obviously, in general, this is good knowledge to have for Alloy.  Developers who build Add-on modules that update configs, via Nuget or otherwise, may want to account for this in the current project state or if this approach is to be carried forward in other projects.  If developers do not account for this by adding these changes below the “[Configuration]” folder their changes may be overwritten when a build occurs.  Site owner Add-ons should not update the configs but that’s a different story. </p> <p> </p> <p>It appears that the CMO module has this issue since it updates configs such as web.config, episerverframework.config, connectionstrings.config, etc at the site root.  It does not update the files under [Configuration] currently.  What this means to you is that if you install CMO on a standard Alloy 7 site and build your project the CMO configs will be overwritten and CMO will no longer be available in the UI.</p> <p> </p> <p>For the time being you have a couple of obvious choices:</p> <p>1) Update the configs appropriately under the “[Configuration]” folder to included any necessary changes</p> <p>2) Remove the post build steps – this is more of a  workaround of the intended build process so not the best long term approach</p> <p> </p> <p>UPDATE: <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Ted/">Ted Nyberg</a> has provided an <a href="http://world.episerver.com/Articles/Items/Alloy-Templates-for-EPiServer-CMS-7/">excellent article</a> explaining technical details on the new templates including the config transforms.</p> <p> </p> <p>Now that you are “in the know” get back to enjoying this excellent new release!</p>
Uninstalling EPiServer CMS Visual Studio Integration Extension
/blogs/Jeff-Wallace/Dates/2012/9/Uninstalling-EPiServer-CMS-Visual-Studio-Integration-Extension/
2012-09-21T20:18:00.0000000Z
<p><em>Based on Visual Studio 2010 and the CMS 7 Preview + CMS CTP10</em></p>
<p>EPiServer 7 will include some excellent additions to the Visual Studio integration in order to continue to make your development experience easy.</p>
<p><a href="/link/e14847d510a943bcb9606bbbc779c4e5.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/cf39f7e97ffb4282a5045d43d66b77dc.png" border="0" alt="image" width="521" height="525" /></a></p>
<p>The mechanism for installing the integration, however, has changed from previous releases. While multiple <a href="http://msdn.microsoft.com/en-us/library/dd393694.aspx">options still exist for deployment</a> in Microsoftland, EPiServer, which previously used an MSI, is now using the VSIX approach. If you’re testing out a CTP and have installed an earlier version, or if for any reason a new release comes out, you may wish to uninstall this and update your environment with the latest and greatest. But how? Poking around the web you will find a variety of methods including information, or misinformation, about where the files are located, manual removal steps (i.e. delete files), etc. But let’s forget about all of that! There is an easier way to remove the integration than digging around and manually deleting things.</p>
<p><strong><em>Steps:</em></strong></p>
<ul>
<li>Start Visual Studio</li>
<li>If you already have Visual Studio started and have an open/unsaved project now is probably a good time to save it</li>
<li>Navigate to the Tools~Extension Manager menu</li>
</ul>
<blockquote>
<p><a href="/link/c73479b0c00d467f80b62612666ff925.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/b6bc2112a0f44b34b086317db9d66334.png" border="0" alt="image" width="528" height="349" /></a></p>
</blockquote>
<ul>
<li>Look for the somewhat obvious “EPiServer CMS Visual Studio Integration” item</li>
<li>Select the “Uninstall” button</li>
</ul>
<blockquote>
<p><a href="/link/245b7ea909304a238a4693a2405c2230.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/71c1d75beeb24be5958022dd8aad93a8.png" border="0" alt="image" width="525" height="136" /></a></p>
</blockquote>
<ul>
<li>Select “Yes” when asked to confirm the uninstall action</li>
</ul>
<blockquote>
<p><a href="/link/80f40636854447669582c6f1ac7e125e.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/f5988a3d30fb45b6a1cf1fba14d99cd0.png" border="0" alt="image" width="359" height="133" /></a></p>
</blockquote>
<ul>
<li>Visual Studio will notify you that it needs to restart in order for the changes to take effect. If you’re willing select the “Restart Now” button</li>
</ul>
<blockquote>
<p><a href="/link/cf7bb9f367b64fdb9ae8522a46db9991.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/799cdf60844041b680e5e8a723e6485e.png" border="0" alt="image" width="527" height="250" /></a></p>
</blockquote>
<ul>
<li>If you had a project open and you didn’t save it as I mentioned in one of the first steps above hopefully Visual Studio is smart enough to ask you if you want to save first. In my case it was:</li>
</ul>
<blockquote>
<p><a href="/link/9c62bfb037f145408b25d389c884ea7b.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/2611b5b4773245b199135a25830f8e0c.png" border="0" alt="image" width="364" height="262" /></a></p>
</blockquote>
<ul>
<li>Smile and carry on with whatever you were doing which hopefully includes installing the best EPiServer Visual Studio Integration in the history of mankind</li>
</ul>
<p>Note: Based my brief poking around my own file system it appears we were installing the files here in the CMS 7 Preview as well as CTP10: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\EPiServer.</p>
<p>For additional info on installing, managing, and removing Visual Studio extensions please reference: <a href="http://msdn.microsoft.com/en-us/library/dd293638.aspx">http://msdn.microsoft.com/en-us/library/dd293638.aspx</a></p>
Alloy Technologies Video Page Type
/blogs/Jeff-Wallace/Dates/2012/8/Alloy-Technologies-Video-Page-Type/
2012-08-24T18:58:00.0000000Z
<p><em>Based on EPiServer CMS 6 R2 and the Alloy Technologies Templates</em></p>
<p>Recently I was working with a customer who wanted a nice Video-based Page Type. In their own search they came across some of the video pages on <a href="http://www.episerver.com/AddOns/Screen9/">episerver.com</a> for a few of our Add-ons. The customer informed me that this was similar to what they were looking for. Perfect! Following my typical fashion I figured I could hi-jack most of someone else’s good code and make a useful Page Type. You know how I love to do that!</p>
<p>I reached out to the EPiServer web team to see if I could take a look at the code. Of course, they were all sleeping, a few beers closer to sleeping, shoveling snow (it was July in Sweden after all),…or something like that. I viewed the page source to borrow/steal as much as I could and got my basic page working. Then I made some additions to suit my needs. <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Sebastian%20Lundh/">Sebastian Lundh</a> was kind enough to hook me up with the real code the next day so I could review my efforts. Aren’t we just a happy helpful sharing bunch of colleagues? Of course!</p>
<p>Anyway, with this I was able to clean up my code slightly and probably make a mess of some other areas. The actual episerver.com code was written by <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/pappabj0rn/">Gregor Oloffson</a> but you can assume anything you don’t like was authored by me! <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="/link/1aa398472599429587a90192168766ee.png" alt="Winking smile" /></p>
<p>Enough babbling already! Here’s the result…</p>
<p>This is a Video Page Type designed specifically for the Alloy Technologies templates. This should be great for demonstrations purposes. If you want to add it to another site I suggest you install into Alloy and manually move/modify the relevant bits of code. </p>
<p>The Video Page Type was intended to support either:</p>
<ul>
<li>YouTube videos
<ul>
<li>In which case the thumbnail will be automatically generated for you</li>
</ul>
</li>
<li>SWF videos added to the EPiServer File Manager locally
<ul>
<li>In which case you should upload a image to use for the thumbnail</li>
</ul>
</li>
</ul>
<p><strong><span style="font-size: small;">YouTube Video Example</span></strong></p>
<p><em>Adding content in Edit Mode</em></p>
<p><a href="/link/921f2675331a4525a881f53edfe736eb.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/0f07e782abcf40569712bf1353f59df2.png" border="0" alt="image" width="467" height="521" /></a></p>
<p> </p>
<p><em>The resulting page</em></p>
<p><a href="/link/8eb1d5911019482583c91f0bd4813a18.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/b5d4347bb9b64493908d63b682f8fff8.png" border="0" alt="image" width="572" height="258" /></a></p>
<p> </p>
<p><em>The result when clicking the video thumbnail on the right</em></p>
<p><a href="/link/c295d9a34aaf49a99a3596626506c0be.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/46002c26016c4d7aa836458896e4d829.png" border="0" alt="image" width="573" height="393" /></a></p>
<p>And sure, I know what you’re all wondering…is that me in the video on the board? It is true that I was able to experience the wonder of <a href="http://en.wikipedia.org/wiki/%C3%85re_Ski_Area">Åre</a> last January but alas this is not me. They must have lost that intense video demonstrating my expert skillset and settled for this clip.</p>
<p> </p>
<p><strong><span style="font-size: small;">SWF Video Example</span></strong></p>
<p><em>Adding content in Edit Mode (notice I set the thumbnail Property)</em></p>
<p><a href="/link/eb75402e13e9454793a1d3a1966b3761.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/ae3e1c8cbebf44d29c8905202a9aba19.png" border="0" alt="image" width="431" height="478" /></a></p>
<p> </p>
<p><em>The resulting page</em></p>
<p><a href="/link/384d061cbcd3461db3c41a32258b18ec.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/d481cdcf77814cd39f6f4cc517ad7cd7.png" border="0" alt="image" width="572" height="219" /></a></p>
<p> </p>
<p><em>The result when clicking the video thumbnail on the right</em></p>
<p><a href="/link/6dbb523f6145484497c3919f38b322cd.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/47978d3c00d54895979f1941190c2491.png" border="0" alt="image" width="574" height="408" /></a></p>
<p> </p>
<p>This is not intended to be the “end all” Video Page Type and there’s plenty of room for improvements. However, this should be a good starting point for your Video Page needs and great for demos in Alloy Technologies as is!</p>
<p>Special thanks to <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Sebastian%20Lundh/">Sebastian Lundh</a> for helping me out and <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/pappabj0rn/">Gregor Oloffson</a> for authoring the original code!</p>
<p> </p>
<p><strong>How do you get it and set it up?</strong></p>
<p>You can download the Nuget package here and install manually: <a title="Download Nuget Package" href="/link/4c3e57674c8f4c1ea4d264638faf5bf4.nupkg">Download</a>.</p>
<p>The Nuget package will put everything needed into your project so you simply need to compile:</p>
<ul>
<li>Video Page Template – the template code for the Page Type</li>
<li>Video Master Page – this is essentially a copy of the original Alloy Technologies default Master Page with the fancybox javascript added. I didn’t want to mess with others master pages but you can of course tweak this how you like</li>
<li><a href="http://fancybox.net/">fancybox</a> scripts and images – 3rd party tool used for the video. Be sure to review their licensing agreements, especially if you plan to use this on a commercial site</li>
</ul>
<p>After that the Page Type needs to be imported to EPiServer. If you added this to your project via the Nuget package you can find the import file in your sites root directory in a folder called “install”. To import…</p>
<ol>
<li>Log in to EPiServer</li>
<li>Navigate to Admin Mode</li>
<li>Select the Admin tab</li>
<li>Scroll down to Tools and select “Import Data”<ol>
<li><a href="/link/e362558d65604e9e9bd7c02fd3bb1a8f.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/ee7c7760081743ac878bf4cf45a05eec.png" border="0" alt="image" width="154" height="306" /></a></li>
</ol></li>
<li>In the right-hand window select the “Browse” button</li>
<li>Select the import file (.episerverdata file) from your sites root directory in a folder called “install”<ol>
<li><a href="/link/68628fbd7fb34d6d961a6e57e6cac3cf.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/f57ea10552c44b0d9935534f3388e7fb.png" border="0" alt="image" width="495" height="137" /></a></li>
</ol></li>
<li>Select the “Begin Import” button</li>
<li>If all goes well the resulting window should indicate 1 Page Type was successfully imported<ol>
<li><a href="/link/d4ff3e8d6f1b4ff0b2418b5b5fc48923.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/6c5e3246e7a74613990c04b657e286bd.png" border="0" alt="image" width="192" height="244" /></a></li>
</ol></li>
</ol>
<p>Test it out and enjoy!</p>
<p><em>Please note, this is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. Good luck and enjoy!</em></p>
Multisite Publish Plug-in
/blogs/Jeff-Wallace/Dates/2012/8/Multisite-Publish-Plug-in/
2012-08-10T18:31:00.0000000Z
<p><em>Based on CMS 6 R2</em></p>
<p>Many EPiServer customers today have an enterprise environment allowing them to manage multiple sites from a single EPiServer instance with the possibility of sharing content and functionality between them. In some cases this may be as simple as a main corporate site and a separate mobile site or the corporate Facebook page. In other cases there may be many micro, or other, sites.</p>
<p>EPiServer’s out-of-the-box capabilities make sharing content between these sites extremely easy at the smaller content item level (e.g. Property), the page level, etc. When content is updated in the “master” location it is automatically reflected across others. In some cases overriding at another level is also easily possible.</p>
<p>The request to publish an entire piece of content (e.g. a page) from one site to many others at the same time is becoming increasingly common, and hopefully, I’m about to make it even easier.</p>
<p>Several months ago myself and a couple of colleagues were locked in a room coding up a storm for a demo and my old friend <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Paul%20S/">Paul Smith</a> whipped up a module that utilized categories, a scheduled job, and some configuration in web.config to push content to different sites. At the time this was exactly what we needed. While considering this recently I decided to dig up the code and remove some of the complexities to simplify it. The idea was to provide more of an “on demand” approach, removing the use of categories, but still providing the multisite publish feature. So, here is is:</p>
<p> </p>
<p>First, the web.config contains a new section that allows you to set up as many other site nodes as you want to be able to share content with. This can be nodes on the same site, separate sites being managed by the same EPiServer instance, etc. Give it a logical name, set the destination page ID, and optionally set Page Type you’d like it to use on the destination site. If you don’t set a Page Type it will use the same type as the current page.</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 153.34%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 111px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060;"> 1:</span> <multisitepublishing></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;"> 2:</span> <multisites></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;"> 3:</span> <add name=<span style="color: #006080;">"Customer Zone News"</span> destinationPageId=<span style="color: #006080;">"495"</span> pageTypeName=<span style="color: #006080;">"[AlloyTech] News item"</span>/></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;"> 4:</span> <add name=<span style="color: #006080;">"Alloy Mobile News"</span> destinationPageId=<span style="color: #006080;">"488"</span> pageTypeName=<span style="color: #006080;">"[MobilePack] Standard Page"</span>/></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;"> 5:</span> </multisites></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;"> 6:</span> </multisitepublishing></pre>
<!--CRLF--></div>
</div>
<p>In Edit Mode, when a content item is selected, you’ll see a new tab with the “Multisite Publish” heading. The site nodes listed in the config above will be presented as checkboxes in this UI. To publish the current content item to these other locations simply check the ones you want to publish to and select the “Publish to Sites” button.</p>
<p><a href="/link/07229e40643f4f80918eba374711276e.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/d64e38dc6779460384a3ac8e44161cb8.png" border="0" alt="image" width="396" height="179" /></a></p>
<p>…and voilà, you’re done. Simple! A new content item will be created below the previously specified site nodes and will respect whatever styling is set for that area of the site. You will note that the current implementation does not create a copy of the data but uses the <em>Fetch Data </em>feature in EPiServer to retrieve from the same data source. This means an update to the content in the master location will result in a change reflected everywhere this content is being re-used. Of course, you could change this to an alternate method of your preference, but re-using the content was the goal here. As you probably know <em>Fetch Data</em> also lets you override individual content items on the fetching page when needed so this would still be possible here.</p>
<p><strong><em>Customer Zone News:</em></strong></p>
<p><a href="/link/03df32d272d849f58dadf65df4a1d28e.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/bc6a047951a642fb9e1ac3151966f726.png" border="0" alt="image" width="578" height="293" /></a></p>
<p><strong><em>Alloy Mobile News:</em></strong></p>
<p><a href="/link/42a09a7d7d1f44069ff90179d2993dcd.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/ea691936368e4c57a690d87dd8192fde.png" border="0" alt="image" width="579" height="445" /></a></p>
<p>This could easily be extended with a fancier UI, the web.config settings replaced with a page selector property added in Edit Mode, a scheduling option, saving the state of the areas you published to, and much more. However, I believe this is a great starting point for your multisite publish needs.</p>
<p>The tagging, shared Block, and Display Template features in the upcoming CMS 7 release will surely provide some enhanced possibilities.</p>
<p>Thanks to Paul Smith for providing the code to read the config, create the new content item, and fetch the data making my life much easier. <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="/link/2fefe3181a9e47a58db62c29b495a268.png" alt="Smile" /></p>
<p><strong>How do you get it?</strong></p>
<p>I’ve uploaded it to the <a href="http://nuget.episerver.com/">EPiServer Nuget</a> feed <a href="http://nuget.episerver.com/en/OtherPages/Package/?packageId=MultisitePublish">here</a>. You can also download the Nuget package here and install manually if you desire: <a href="/link/729affceb26c40d8bad17640ce230b6f.nupkg">Download</a>. The EPiServer Nuget feed is probably safest to ensure you get any updates that <em>might</em> come later.</p>
Set Up EPiServer Mail “Developer” Environment
/blogs/Jeff-Wallace/Dates/2012/4/Set-Up-EPiServer-Mail-Developer-Environment/
2012-04-05T23:31:17.0000000Z
<p><em>Based on CMS 6 R2, Mail 5 R2, and Windows Server 2008</em></p> <p><em></em></p> <p>This blog is intended for a partner or EPiServer employee looking to set up a EPiServer Mail in a demo or test environment or perhaps even a customer testing the product out in a similar environment before purchasing.  The title of this blog says “Developer” environment simply because it utilizes the EPiServer Mail <em>developer</em> license.  I will walk you through the basic steps get set up based on my specific environment and software versions.  If your environment varies the step details will likely vary as well but the overall may still serve as a valid guideline.  </p> <p> </p> <p>I’m going to start by assuming you’ve already installed EPiServer Mail on your site.  If not, please refer to the instructions on EPiServer World or the templates you are using.  For more information on EPiServer mail go <a href="http://world.episerver.com/Download/Categories/Modules/EPiServer-Mail/">here</a>.  Next I’m going to walk through setting up a basic SMTP server on your local webserver, ordering your EPiServer Mail developer license, and putting that in place.  Keep in mind there are multiple ways you could set up a SMTP server and that this will only serve as one example.  My focus is not to set up a robust secure SMTP server but simply to get the basics going.  After all, I probably shouldn’t be re-writing Microsoft’s and there are many people with greater expertise in this area than myself.  However, it can’t hurt to help out the community a bit by including a sample.  If you want to set up a more complex environment you can seek out this information via your trusty friend <a href="http://www.google.com/">Google</a> (oh, sorry Microsoft, or <a href="http://www.bing.com/">Bing</a>).</p> <p> </p> <p>The EPiServer Mail developer license has some restrictions.  For more information on this please navigate to the Activating Account and Handling Licenses section on the <a href="http://world.episerver.com/Documentation/Items/Installation-Instructions/EPiServer-Mail/Installation-Instructions---EPiServer-Mail-5-R2/">Installation and Instructions EPiServer Mail R2</a> page.</p> <p> </p> <p><strong>Set Up SMTP</strong></p> <ul> <li>If you have not already set up SMTP you need to do so.  To set it up (or validate it’s set up) open the Server Manager console. </li> <li>Select “Features”. </li> </ul> <blockquote> <p><a href="/link/6f249076b171444c89e6c9e5f2295935.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/743decc8c5054c02b64473107751f1d8.png" width="225" height="244" /></a></p> </blockquote> <ul> <li>Select “Add Features”. </li> </ul> <blockquote> <p><a href="/link/20f3fb9484df48a1909a29751e267314.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/0e9e4dcb722e498099d136bc14c0ad0b.png" width="566" height="224" /></a></p> </blockquote> <ul> <li>Scroll down on the “Add Features Wizard” window until you see “SMTP Server”.   If it’s installed, it will be checked off.  If not, select this checkbox.  If SMTP is already installed skip to the step that starts with  “Now that SMTP is installed…” below, otherwise continue. </li> </ul> <blockquote> <p><a href="/link/31350ad9c69e4ea4a94dfe2784cf5112.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/50dee217457148f2800de69b4232e493.png" width="566" height="428" /></a></p> </blockquote> <ul> <li>Continue with the installation selecting the many “Next”, “Next”, “Next” buttons.  Note that you may be asked to add a necessary role service.  Assuming this is your demo/test environment and you have no concerns, please do so.  <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="/link/e5dec08c6c8a4acab4929df44c6e9b1b.png" /> </li> <li>Select the “Install” button. </li> <li>When the installation is complete select the “Close” button. </li> <li>Now that SMTP is installed navigate to the Windows Start menu. </li> <li>Navigate to Administrative Tools. </li> <li>Select “Internet Information Services (IIS) 6.0 Manager”. </li> </ul> <blockquote> <p><a href="/link/4db05bd80cfc48edb55182b3dd48dc39.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/79a4f9527ecc4575b016c17cc44cbfdc.png" width="237" height="491" /></a></p> </blockquote> <ul> <li>Select the relevant SMTP Virtual Server. </li> </ul> <blockquote> <p><a href="/link/a910b244c7fc416a988070885efaad83.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/46074329c2a34637b61d945a34e3fe22.png" width="569" height="401" /></a></p> </blockquote> <ul> <li>If it is not already started, right click on the SMTP Virtual Server and select “Start”. </li> </ul> <blockquote> <p><a href="/link/15ddfe462efb4ccbbf3a6a056841a3a8.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/1642cdb208a24e4da0f4dca958723b82.png" width="568" height="401" /></a></p> </blockquote> <ul> <li>Now that the SMTP server is started right click on it again and select “Properties”. </li> </ul> <blockquote> <p><a href="/link/a89e3f88ba9d4b0d9746f0e8993cd373.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/3008ec29b52648e39710de055053cd15.png" width="569" height="402" /></a></p> </blockquote> <ul> <li>Select the “Access” tab. </li> </ul> <blockquote> <p><a href="/link/81718abadb524ad5bba2002c4b6766b2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/b375e7a30d5f4ad08bb1a1324f27b41c.png" width="332" height="369" /></a></p> </blockquote> <ul> <li>Select the “Relay” button. </li> </ul> <blockquote> <p><a href="/link/87e433ebc4214af683fa1fea3c67fdaf.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/65ffb69f9c1e402aa3be9b741ab44cd8.png" width="332" height="369" /></a></p> </blockquote> <ul> <li>Select the “Add” button. </li> </ul> <blockquote> <p><a href="/link/adc2c8fe6c58492cbf7a9f17a051d73b.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/6780b90a9ef546439a6070c25a5b2b8b.png" width="333" height="325" /></a></p> </blockquote> <ul> <li>Select the “Single computer” radio button. </li> <li>Enter 127.0.0.1 for the IP if you are using localhost (or whatever is relevant for you) </li> </ul> <blockquote> <p><a href="/link/2fed06adb2ad492ea353e4f98dfeb8f4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/8494d4e9e5ad4549aeff9bfc5f40fffe.png" width="333" height="291" /></a></p> </blockquote> <ul> <li>Select “OK”. </li> </ul> <blockquote> <p><a href="/link/5d37bd28f1a24be1b80679aaaf8b261f.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/32ebb642ffbc4452a676a90b92707af2.png" width="333" height="325" /></a></p> </blockquote> <ul> <li>Select “Apply”. </li> </ul> <blockquote> <p><a href="/link/ede0ccdea1394e30be4342208fa18e9d.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/a14adc3b496540b092ef8fb867cc940a.png" width="333" height="370" /></a></p> </blockquote> <ul> <li>Select “OK”. </li> </ul> <blockquote> <p><a href="/link/bbf540e229b645b7b1b4a3aec042ba44.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/0c18da765aa84f82805645182a63b7da.png" width="332" height="369" /></a></p> </blockquote> <ul> <li>Close the IIS 6.0 Manager. </li> </ul> <p> </p> <p><strong>Configure the SMTP Server for the EPiServer Site in IIS</strong></p> <ul> <li>Open up the current version of IIS (the above is an older manager version). </li> <li>Navigate to and select the site you intend to set up EPiServer Mail on. </li> <li>Open the SMTP E-mail settings </li> </ul> <blockquote> <p><a href="/link/6401107a9f444a99960080f7ba1647d2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/8f3e1c84817543a0a19b89948be83c05.png" width="568" height="211" /></a></p> </blockquote> <ul> <li>Enter the relevant information you want to be used when sending email from the SMTP server and configure it for localhost on port 25 as identified below. </li> </ul> <blockquote> <p><a href="/link/08fecf0f49664936add28a1a6e1de5bd.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/e63a07fe6614412fb7539e2f716ee113.png" width="568" height="410" /></a></p> </blockquote> <ul> <li>Select the “Apply” button. </li> </ul> <p> </p> <p><strong>Activate EPiServer Mail Developer License</strong></p> <ul> <li>Log into EPiServer. </li> <li>Select the “Mail” menu item in the top level navigation. </li> <li>Select the “Add New Mailing” button. </li> </ul> <blockquote> <p><a href="/link/45e0528e0a5b4bccb2372f48f329afa6.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/0369528d1f2c43d28b0c9dd759c68566.png" width="571" height="216" /></a></p> </blockquote> <ul> <li>You should see a message indication the installation is not yet activated.  Select the “create an account” link. </li> </ul> <blockquote> <p><a href="/link/a789310c609b48de9a821af6adced50f.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/1f726c3693544141a794fb3fdfe96f70.png" width="571" height="232" /></a></p> </blockquote> <ul> <li>Enter your information to set up the account.  Partners should enter their VAT No.  If you are a customer or a partner that does not know their VAT please contact the appropriate EPiServer sales manager.  If you are an internal EPiServer employee please contact your manager or relevant member of the technical team. </li> </ul> <blockquote> <p><a href="/link/59fa9d1cf57a4ef38a71e4aa1db97880.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/1e008e7213684a4dba1d1b71422e00cb.png" width="571" height="289" /></a></p> </blockquote> <ul> <li>Read the license agreement and if you agree select the check box accepting this agreement. </li> </ul> <blockquote> <p><a href="/link/79200ce92df94bf1a9a6a26875cc9bea.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/c57c8097f06b47058d63b634c2c02dfe.png" width="353" height="174" /></a></p> </blockquote> <ul> <li>Select the “Activate account” button. </li> </ul> <blockquote> <p><a href="/link/fffa61f31eef4c2c92a4ec473f81558a.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/6d1d4c2b8f844716a3182dd34bc93315.png" width="230" height="312" /></a></p> </blockquote> <ul> <li>If all goes well you should see a message similar to the following. </li> </ul> <blockquote> <p><a href="/link/281cfb7d5e5b40bf8274d9fa8120b275.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/f1e6acb16ce244339118b9a841e43da1.png" width="526" height="176" /></a></p> </blockquote> <ul> <li>Shortly after, again if all is well, you should see an email that looks similar to the following. </li> </ul> <blockquote> <p><a href="/link/95d1b6ff16444c85ada85204c4f0400a.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/9992905dd94844b199873ae83c2ef010.png" width="527" height="276" /></a></p> </blockquote> <ul> <li>Copy the EPiServerMail.config file from the email and place it in the root directory of the site you are setting up EPiServer Mail on. </li> </ul> <blockquote> <p><a href="/link/cc1a8202e7044d76b7e081d73bae1bd0.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/2c4661b38b464f508a5e06aa70bab262.png" width="527" height="325" /></a></p> </blockquote> <ul> <li>If all goes well you should now be able to send mail. </li> </ul> <blockquote> <p><a href="/link/f0bf94048ca942efae1f555ac8616c94.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/fe84db374ddf44e8a7037d41b1341085.png" width="527" height="354" /></a></p> </blockquote> <p> </p> <p>Enjoy!</p> <p> </p> <p><strong>Additional Information:</strong></p> <p><a title="http://msdn.microsoft.com/en-us/library/8b83ac7t.aspx" href="http://msdn.microsoft.com/en-us/library/8b83ac7t.aspx">http://msdn.microsoft.com/en-us/library/8b83ac7t.aspx</a></p>
Forcefully Unlock Administrative User in EPiServer Commerce
/blogs/Jeff-Wallace/Dates/2012/4/Forcefully-Unlock-User-Administrative-in-EPiServer-Commerce/
2012-04-03T17:42:28.0000000Z
<p><em>Based on CMS 6 R2, Commerce 1 R2 SP1 (or SP2), and SQL Server 2008</em></p> <p> </p> <p>So you went on vacation (or holiday depending on your country’s term for that time we all look forward to), had a long weekend, or just did a fresh install of EPiServer Commerce and either totally forgot or have no idea what your administrator users password is.  You try logging in with a variety of your favorite passwords without luck.  Unfortunately you realize you probably did this too many times and can no longer log in because your account has been locked due to excessive failed login attempts.  This is also the moment where you realize you probably should have created two or more admin users.  Oops!  If you have access to the database, have no fear, you can undo your wrong, get back to work, and not feel guilty having a few beers again next weekend and forgetting that password all over again.  <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="/link/93eb83ee9fbb423091f78fa5f03da986.png" /></p> <p> </p> <p>Please note, the EPiServer Commerce Manager allows you to unlock users through the backend user interface which is the most typical approach in a real environment. This is for the case where you’ve locked your only administrator account, likely in a new install, demo environment, or something comparable.</p> <p> </p> <ul> <li>Log into SQL Server Management Studio (assuming you’ve installed it, otherwise you’ll need to open up your favorite command line tool). </li> <li>Navigate to the Commerce Manager database for the site with the locked user. </li> <li>Expand the database and the “Tables” node. </li> </ul> <blockquote> <p><a href="/link/19e894aebf2542bcbd47e939df69fa6b.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001" border="0" alt="clip_image001" src="/link/cc996bb9530f4591b4a464fdf459084c.png" width="299" height="298" /></a></p> </blockquote> <ul> <li>Navigate to the “aspnet_Membership” table </li> <li>Select the option to “Edit Top 200  Rows”.  (If you have more than 200 users use your preferred standard SQL methods to get to the locked user). </li> </ul> <blockquote> <p><a href="/link/3d1d54d2a36c46f29dc2ad5907bd5085.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="/link/a60ea4c9229c4e41b82506273c388a07.png" width="319" height="270" /></a></p> </blockquote> <ul> <li>Locate the locked user and scroll the table to the right to find the “IsLockedOut” field.  If the user is locked it will be set to “True”. </li> <li>Change this field to “False” </li> </ul> <blockquote> <p><a href="/link/9e1cc5b1f7ae4ae0bcd42225997ad782.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/41d49539873e457cb2f12b4ebe849186.png" width="762" height="165" /></a></p> </blockquote> <ul> <li>You should now be able to go back to your site and log in. </li> </ul> <p> </p> <p>Cheers!</p>
Video - Searching Customers/Orders and Placing Orders in EPiServer Commerce
/blogs/Jeff-Wallace/Dates/2011/12/Video---Searching-CustomersOrders-and-Placing-Orders-in-EPiServer-Commerce/
2011-12-09T16:59:00.0000000Z
<p><em>Based on EPiServer CMS R2 and Commerce R2 SP1</em></p>
<p>Below you will find a brief video demonstrating the following:</p>
<ul>
<li>Searching customers and orders</li>
<li>Placing orders from the Customer Management and Order Management subsystems</li>
</ul>
<p>I've uploaded to YouTube so you can watch it there or watch locally with the Flash player.</p>
<p>
<object width="620" height="395" data="http://www.youtube.com/v/BioKYRw-mpc?version=3&feature=player_detailpage" type="application/x-shockwave-flash">
<param name="data" value="http://www.youtube.com/v/BioKYRw-mpc?version=3&feature=player_detailpage" />
<param name="src" value="http://www.youtube.com/v/BioKYRw-mpc?version=3&feature=player_detailpage" />
</object>
</p>
Video – Managing Multilingual Content with EPiServer
/blogs/Jeff-Wallace/Dates/2011/12/Video--Managing-Multilingual-Content-with-EPiServer/
2011-12-01T17:58:00.0000000Z
<p><em>Based on CMS 6 R2</em></p>
<p>Back in May of 2011 EPiServer US presented a webinar alongside its partner <a href="http://www.experis.com/">Experis</a> regarding “Mastering the Globalization Spectrum” with a focus on localization. The larger webinar was roughly 50 minutes long. Somewhere near the middle I provided a 10 minute demonstration on managing multilingual content with EPiServer. I had planned to extract the demonstration snippet and provide it in a video so that others could view the powerful multilingual features available in EPiServer in shorter form. Sure, it took me a while, but here it is! Please ignore the beep as someone <em>enters</em> the WebEx (there’s no way they were leaving my amazing demo <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="/link/aef9c079da7345ef81952e167b8c0ffd.png" alt="Winking smile" />).</p>
<p>
<object style="width: 620px; height: 395px;" width="620" height="395" data="http://www.youtube.com/v/edmiudqG5Qc&feature" type="application/x-shockwave-flash">
<param name="src" value="http://www.youtube.com/v/edmiudqG5Qc&feature" />
</object>
</p>
<p>For anyone interested in the longer webinar, you can obtain that <a title="Mastering the Globalization Spectrum Webinar" href="https://episerver.webex.com/episerver/lsr.php?AT=pb&SP=EC&rID=38211997&rKey=C92B845274DFBF27" target="_blank">here</a>.</p>
<p>Enjoy! </p>
Filter Commerce SEO Tab Properties by Language
/blogs/Jeff-Wallace/Dates/2011/11/Filter-Commerce-SEO-Tab-Properties-by-Language/
2011-11-18T00:00:00.0000000Z
<p><em>Based on CMS 6 R2 and Commerce R2 SP1</em></p>
<p>Recently <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Jacob%20Khan/">Jacob Khan</a> posted a <a href="http://world.episerver.com/Blogs/Jacob-Khan/Dates/2011/11/Commerce-Manager-filter-meta-properties-by-language/">blog and code</a> for filtering the EPiServer Commerce product catalog /properties/metadata by language. This is of course a fabulous enhancement and one that many customers will likely want to utilize to provide an improved user experience when editing the catalog. I thought I’d take advantage of my colleague's good work and add the same for the SEO tab since it also contains properties differentiated by each language. </p>
<p> </p>
<p>In an ideal world I could have stolen the base of his code, implemented things in the same manner, and it simply would have worked. Unfortunately since the SEO tab contains child controls in a placeholder I actually had to think about it for a minute and write a few more lines of code. So much for just stealing from others and claiming glory in the blog post, even though that’s basically what I did, with a few extra bits of effort. <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="/link/35354128e3e24fd58bfadc01ea8b0038.png" alt="Smile" /> Anyway, alas it does indeed work. I also created a language selector helper class for the dropdown so the two tabs in the UI can share this functionality. The code is commented out with explanation where it differs from the core Commerce code. If you intend to use it in a production environment you’ll probably want to remove this.</p>
<p> </p>
<p><a href="/link/9199f751f49c4f3bbe160d7265597a6b.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/1d9014d22ec44be5906d11e4b6601b04.png" border="0" alt="image" width="578" height="293" /></a></p>
<p> </p>
<p>Note that just like Jacob's code, if you change languages in the drop down without saving, the previous languages updates will be lost. So, in the current state you should select the OK button with each language change. Some may not like this experience and you’re more than welcome to provide additional updates to this code and feed it back into the community. <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="/link/0ec84506b3404685af4823227f5e24b7.png" alt="Winking smile" /> There’s different ways this could be handled but I’ll let you decide…unless a find a few more cycles to burn and tackle it myself.</p>
<p> </p>
<p>Get the code <a title="Download code" href="/link/30ed5f6c2cef47048f2d2767f9b4af01.zip">here</a>. It includes Jacob's code as well as my own. I’ve also included an updated ReadMe.txt file for the setup steps.</p>
<p> </p>
<p>For a good introduction to customizing EPiServer Commerce, check out Roger Cevung's article. </p>
<p> </p>
<p><em>Please note, this is intended as a starting point for you to customize for your project needs. </em><em>This code is provided “as is” without warranty or guarantee of operation. Use at your own risk. Good luck and enjoy!</em></p>
Category Listing Composer Block
/blogs/Jeff-Wallace/Dates/2011/9/Category-Listing-Composer-Block/
2011-09-26T22:52:00.0000000Z
<p><em>Based on CMS 6 R2, Composer 4 R2, and Composer 4 R2 Blocks</em></p>
<p>Earlier this month I wrote a blog about a <a href="http://world.episerver.com/Blogs/Jeff-Wallace/Dates/2011/9/Category-Listing/">Category Listing Dynamic Content Module</a> which allows content authors to create listings based on one-to-many categories. I also referenced a blog by <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Allan%20Thr%C3%A6n/">Allan Thraen</a> and his <a href="http://world.episerver.com/Blogs/Allan-Thran/Dates/2011/8/Summer-of-Code-CategoryProvider--Alternate-navigation/">blog</a> regarding using Page Providers to display an alternate navigation based on categories. Continuing down this same path <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Jacob%20Khan/">Jacob Kahn</a> and I co-authored a Composer Block which borrows code from the Dynamic Content module to yield a Composer Block with similar functionality.</p>
<p> </p>
<p><strong><span style="font-size: small;">How do you use the Category Listing Composer Block?</span></strong></p>
<p>The basics of how to use this are as follows. After entering “Composer – Edit on Page” mode…</p>
<p> </p>
<p>1) Select “Category Listing” from the Composer Toolbox Content Blocks.</p>
<p><a href="/link/54452a136190442e8219bec949208896.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/82cd3147d3eb4a949b67fbc05ea9b26c.png" border="0" alt="image" width="240" height="286" /></a></p>
<p>2) Optionally enter a “Heading” for the listing.</p>
<p>3) Select the “StartPoint” for the area of the tree structure where you want the module to begin searching categories.</p>
<p>4) Enter one-to-many category names that the listing will be based on.</p>
<blockquote>
<p>a) If a category exists in the system as you type it will be presented for you. Simply select it.</p>
<p><a href="/link/2dd298ebad88418da5bb68c66a38b002.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/b9ecacc049924fc888d915720672d616.png" border="0" alt="image" width="377" height="54" /></a></p>
<p>b) If you enter a category that is not already present in the system, select the “+” button, and it will be added below the category control as well as to the category list in the backend.</p>
</blockquote>
<p>5) Optionally enter a “Start” and “End” date to filter the items in the listing based on the “Start publish” date. This is useful if you only want to list items that were published within a certain timeframe.</p>
<p>6) Select a “Sorting” order.</p>
<p>7) Select “ShowDate” if you want a date to be included in the listing.</p>
<p>8) Select “ShowPreviewText” if you want the preview text to be included in the listing.</p>
<p><a href="/link/97f40805427c421e89fc20664acbfec8.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/44ef53245f974213b19f9e5a6b64ef8d.png" border="0" alt="image" width="475" height="376" /></a></p>
<p> </p>
<p>9) Select “Save” to Save the settings.</p>
<p>10) Save the page by your preferred method (“Save and View”, etc)</p>
<p> </p>
<p><a href="/link/42fabcdfc4134413a2c09307ea803538.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/ccc4ed04056f4b2a9b9e3fa5b9659e6f.png" border="0" alt="image" width="580" height="165" /></a></p>
<p> </p>
<p>11) View the result:</p>
<p> </p>
<p><a href="/link/d2ae9a95b6e743ca8ee555de3960a736.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/0722ac0b1385406993e3a3a94e3dd81f.png" border="0" alt="image" width="580" height="210" /></a></p>
<p> </p>
<p><strong><span style="font-size: small;">How do you set up the Category Listing Composer Block?</span></strong></p>
<p>Great question. A lot of people are using <a href="http://nuget.episerver.com/">NuGet</a> or EPiServer module files to deploy add-on modules these days. Since this is a Composer block, a sample project existing that’s easy to add to, and maybe because I’m writing this on a Monday I’m going to provide the manual approach for the time being. I may rethink this later and provide an updated blog. For now, the steps are below and are based on the assumption that you’ve already set up a site with EPiServer CMS, Composer, and the Composer Blocks.</p>
<p>1) <a title="Download code and import file" href="/link/b613c1f75f944a16abc840b6228a946e.zip">Download the code and import file</a>.</p>
<p>2) Decompress the downloaded zip file with your tool of choice (Windows Explorer, WinZip, WinRar, etc).</p>
<p>3) Locate the “ComposerSampleTemplates” project. This file is typically located at your site installation path (e.g. C:\EPiServer\Sites\<em><mySiteName></em>\ComposerSampleTemplates.csproj).</p>
<p>4) Open the ComposerSampleTemplates.csproj file in Visual Studio.</p>
<p>5) In “Windows Explorer”, locate the CategoryListing folder that was extracted in step 2 above.</p>
<p>6) Add the entire contents of this folder to the ComposerSampleTemplates project in Visual Studio under the Composer\Functions folder path. The easiest way to do this is probably to simply drag-and-drop the CategoryListing folder that was extracted from the zip file onto the Functions folder in your project.</p>
<p><a href="/link/fd0cf23c61c14a6899416c0c1969b0dd.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/62cf15234e4345fbb056ddcb32abd565.png" border="0" alt="image" width="218" height="271" /></a></p>
<p>7) Build the project. This should update the assembly in the bin directory with the new code.</p>
<p>8) Navigate to EPiServer CMS Admin Mode.</p>
<p>9) Navigate to the “Admin” tab.</p>
<p>10) Select “EPiServer Composer – Import/Export”</p>
<p><a href="/link/9d5a3d9b696240229a2da4427a89e826.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/b62e235698744cf9a60e06fd89fb88e0.png" border="0" alt="image" width="168" height="435" /></a></p>
<p>11) Use the “Browse” button to locate the ContentListingComposerData.xml folder that was extracted in step 2 above.</p>
<p><a href="/link/ed6a0f25c43f4ee89fd22d619ef9d2fb.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/7f60fcf8b8ef49cfba082cf5b602fee4.png" border="0" alt="image" width="310" height="154" /></a></p>
<p>12) Select the “Begin Import” button.</p>
<p><a href="/link/6697fac0e4f94ff3b241f1191ca5c30a.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/841d64bbc6cd4bc3ab570b09bae7d776.png" border="0" alt="image" width="312" height="155" /></a></p>
<p>13) Assuming all is successful, this should add the “Category Listing” block to your list of “Block Types” for Composer which you can configure as you would any other Composer blocks. See the <a href="http://world.episerver.com/Documentation/Categories/Modules/EPiServer-Composer/">EPiServer Composer documentation</a> for more information on configuring Rules, Access Rights, etc.</p>
<p><a href="/link/c7062337d9a740f588819d958dc7d4fe.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/d7170f670af84149ba35804743877354.png" border="0" alt="image" width="513" height="333" /></a></p>
<p><em> </em></p>
<p>You should now be able to use the Category Listing Composer Block as noted in the “How do you use the Category Listing Composer Block?” section above.</p>
<p><em> </em></p>
<p><em>Please note, this is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. Good luck and enjoy!</em></p>
Manual Removal of MobilePack v0.4 and Update to v0.9
/blogs/Jeff-Wallace/Dates/2011/9/Manual-Removal-of-MobilePack-v04-and-Update-to-v09/
2011-09-16T17:39:52.0000000Z
<p><em>Based on 6 CMS R2</em></p> <p>A lot of people are checking out the EPiServer <a href="http://world.episerver.com/Blogs/Allan-Thran/Dates/2011/9/New-Open-Source-MobilePack-version-09-Beta/">MobilePack</a> add-on for their initial efforts getting started in the mobile space.  The latest version, Beta v0.9 adds some great enhancements and features.  If you haven’t checked it out yet take a <a href="http://world.episerver.com/Blogs/Allan-Thran/Dates/2011/9/New-Open-Source-MobilePack-version-09-Beta/">look</a>.  But what if you had already installed the Alpha v0.4 on a site?  How do you remove it and update to the latest?</p> <p>Below you will find manual steps to remove v0.4 and update to v0.9.  I believe this should cover 98% of it.  I’m leaving some room for error as I haven’t tracked exactly what goes into the database so I’ll call this the “dirty” clean up.  For your demo, development, and similar environments this should work acceptably.</p> <p> </p> <p><strong>Remove Alpha v0.4</strong></p> <ul> <li>Log into EPiServer Edit Mode with an appropriately privileged user (i.e. someone who can access Edit Mode <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="/link/716134d88e0a4d918c21245f5385a17d.png" /> ).</li> <li>Locate any areas of the tree structure where a Redirection rule has been set and navigate to the “Redirection” tab.</li> <li>Delete the Redirection rules.</li> </ul> <blockquote> <p><a href="/link/0aa3c105e224450aaa2e78d38dc481cd.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/d7a8a68a277b4046a612557cd1316b11.png" width="532" height="178" /></a></p> </blockquote> <ul> <li>Navigate to “Visitor Groups” on the top level navigation.</li> <li><a href="/link/4fadd7e1901a42f0be37ed4379703b70.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/30ab56a9bf444ed58ccb9695075f01af.png" width="366" height="57" /></a></li> <li>Delete the “Mobile Users” Visitor Group (otherwise you may soon find a less than pleasant error on your site).</li> </ul> <blockquote> <p><a href="/link/f094e5bd9abc486e8bd3e55a7954cdcb.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/11e749b10ba94b939ae0845324feb442.png" width="531" height="228" /></a></p> </blockquote> <ul> <li>If you imported the MobilePack sample templates during your v0.4 setup, navigate to this area of the tree structure.</li> </ul> <blockquote> <p><a href="/link/3e509ac621f14e21bd73bf9c9c82a989.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/55c20c6bdeab430088cd2901b06137ca.png" width="211" height="402" /></a></p> </blockquote> <ul> <li>Delete the top most mobile site node and its children.</li> </ul> <blockquote> <p><a href="/link/34d9d813ab4e4e0bb531a8e989d2c17c.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/df59773ebc754689bae41eb7de95f9d8.png" width="215" height="244" /></a></p> </blockquote> <ul> <li>Navigate to your sites root directory in Windows Explorer or your preferred tool for working with the file system.</li> <li>Navigate to the “modules” directory.</li> <li>Delete the \modules\MobilePack directory.</li> <li>Navigate to the “bin” directory.</li> <li>Delete \bin\MobilePack.dll.</li> <li>Navigate to EPiServer Admin Mode with an appropriately privileged user.</li> <li>Select the “Page Type” tab.</li> </ul> <blockquote> <p><a href="/link/1bf84effefee4ec99a2e2fd11db8dae6.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/20da5fdf16444e3c863420fa4c6e7f5d.png" width="225" height="91" /></a></p> </blockquote> <ul> <li>Locate the three [MobilePack]xxx Page Types listed under “Page Types” and any other custom ones you might have added:</li> <ul> <li>[MobilePack]Mobile Site</li> <li>[MobilePack]SiteConnect</li> <li>[MobilePack]Standard Page</li> </ul> <li>Delete each Page Type by selecting it, its settings tab, and the associated “Delete” button.</li> </ul> <blockquote> <p><a href="/link/154b67d1abc545c0a12b5c62ce4c8f2a.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/cc4b250a842d48f58907da3c47ceacb8.png" width="527" height="283" /></a></p> </blockquote> <p><strong></strong></p> <p><strong>Install Beta v0.9 and the Sample Templates</strong></p> <ul> <li>Install MobilePack.0.9.epimodule via the <a href="http://world.episerver.com/Blogs/Jeff-Wallace/Dates/2010/8/EPiServer-CMS---Install-a-Module-From-a-Compressed-File/">compressed file option</a> or one of the alternate methods referenced in <a href="http://world.episerver.com/Blogs/Allan-Thran/Dates/2011/9/New-Open-Source-MobilePack-version-09-Beta/">Allan’s blog</a>, after having downloaded it from <a href="http://mobilepack.codeplex.com/releases/view/73286">codeplex</a>.</li> <li>Open “MobilePack.0.9.epimodule” via WinZip, WinRar, or your preferred file compression tool.</li> <ul> <li>Rename the file extension “epimodule” to “zip” to make this easier.</li> </ul> <li>Extract the “MobilePack.episerverdata” file from the “Setup” directory.</li> <li>Navigate to the “Admin” tab in Admin Mode.</li> </ul> <blockquote> <p><a href="/link/d77f89d05f1e4e8099059087e7c17aa7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/1cf1ba33cd0e49a89c819037ea0a60ed.png" width="228" height="89" /></a></p> </blockquote> <ul> <li>Navigate to the “Tools” area and select “Import Data”.</li> <li>Select the “MobilePack.episerverdata” file for the Sselect an export file and upload” setting.</li> <li>Select your desired page destination for the Sample Templates for the “Select page destination” setting.</li> <li>Select the “Begin Import” button and wait for the job to complete.</li> </ul> <blockquote> <p><a href="/link/58a665f15cd7469a8578873fe179a90e.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/link/e46b4c2774664628bb38733986628f28.png" width="525" height="177" /></a> <br /></p> </blockquote> <p>Enjoy the simple power of the new version of MobilePack!</p>
Category Listing Dynamic Content Module
/blogs/Jeff-Wallace/Dates/2011/9/Category-Listing/
2011-09-13T22:54:00.0000000Z
<p><em>Based on CMS 6 R2</em></p>
<p>From time to time we receive requests for displaying listings based on categories. Simple enough to code, right?</p>
<p> </p>
<p><a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Allan%20Thr%C3%A6n/">Allan Thraen</a> recently posted a <a href="http://world.episerver.com/Blogs/Allan-Thran/Dates/2011/8/Summer-of-Code-CategoryProvider--Alternate-navigation/">blog</a> regarding using Page Providers to display an alternate navigation based on categories, with the idea in mind, that you could also use this same kind of functionality to create listings for things such as “Latest News” or something similar. Great stuff!</p>
<p> </p>
<p>Prior to this <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Joe%20Bianco/">Joe Bianco</a> and I had kicked around some ideas for a Dynamic Content module that would allow content contributors to create listings based on categories. It seemed like before we could even finish our complete thoughts <a href="http://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/Jacob%20Khan/">Jacob Kahn</a> had already written the first round of code. We discussed some additional possibilities which Jacob then applied. Alas we have a nice usable and configurable “Content Listing” module. </p>
<p> </p>
<p><em>The basics of how to use this are as follows:</em></p>
<p> </p>
<p>1) Create a new EPiServer page.</p>
<p>2) Select the Dynamic Content button on the rich text editor.</p>
<p><a href="/link/9ea7f9bed25f4fbf9763316772db7c0b.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/ca7eca1c20274f6b8a6d76f22d0262ca.png" border="0" alt="image" width="607" height="253" /></a></p>
<p>3) Select “Category Listing” from the drop down.</p>
<p><a href="/link/704bdbc55ea844619862f9592849fbc7.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/f54ece09a6a54efeb32dee21c17eec75.png" border="0" alt="image" width="607" height="260" /></a></p>
<p>4) Select the “StartPoint” for the area of the tree structure where you want the module to begin searching categories.</p>
<p>5) Enter one-to-many category names that the listing will be based on. </p>
<blockquote>
<p>a) If a category exists in the system as you type it will be presented for you. Simply select it.</p>
<p><a href="/link/79c2732b329c4c4398c04f1b62157885.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/8dafd893e1e3403f9d3d35be8b276f0e.png" border="0" alt="image" width="409" height="105" /></a></p>
<p>b) If you enter a category that is not already present in the system, select the “+” button, and it will be added below the category control as well as to the category list in the backend.</p>
</blockquote>
<p>6) Optionally enter a “Start” and “End” date to filter the items in the listing based on the “Start publish” date. This is useful if you only want to list items that were published within a certain timeframe.</p>
<p><a href="/link/dfe3c435a24e4261b3fd0fd2055fa1c3.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/e40a7d28ae1c43348e4270d7f059dc05.png" border="0" alt="image" width="607" height="391" /></a></p>
<p>7) Select a “Sorting” order.</p>
<p><a href="/link/12f8713262e0437c9d60db2038c75dd3.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/20a246071a474fdabdad7456806e542c.png" border="0" alt="image" width="367" height="123" /></a></p>
<p>8) Select “ShowDate” if you want a date to be included in the listing.</p>
<p>9) Select “ShowPreviewText” if you want the preview text to be included in the listing.</p>
<p><a href="/link/6813861b5a1140849e6fb31096abff55.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/2e24d316a67b445f8c6090cbd3842b8e.png" border="0" alt="image" width="607" height="366" /></a></p>
<p> </p>
<p><em>Example result with “ShowDate” and “ShowPreviewText” selected:</em></p>
<p><a href="/link/d37c0f13c6e441d9af1c12154691a85c.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/0287de8e4bec436eac6ea2aa335783f2.png" border="0" alt="image" width="609" height="382" /></a></p>
<p> </p>
<p><em>Example result with “ShowDate” and “ShowPreviewText” NOT selected:</em></p>
<p><a href="/link/30fd8064277b4d41919083ee349ff81f.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/5bb242a8e0524d598779ce03876cc1e0.png" border="0" alt="image" width="610" height="315" /></a></p>
<p> </p>
<p><a title="Download epimodule file" href="/link/8f53788424864d4cb60d2a705747cd1a.epimodule">Download the EPiServer module file</a> and use the <a href="http://world.episerver.com/Blogs/Jeff-Wallace/Dates/2010/8/EPiServer-CMS---Install-a-Module-From-a-Compressed-File/">install from a compressed file</a> option.</p>
<p><a title="Dowload code" href="/link/e9addb1da16e455ba4474982a7c8d23b.zip">Download the code</a>.</p>
<p> </p>
<p><em>Please note, this is intended as a starting point for you to customize for your project needs. </em><em>The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. Good luck and enjoy!</em></p>
Setting up the YouTube Video Playlist for the Composer 4 R2 Blocks
/blogs/Jeff-Wallace/Dates/2011/8/Setting-up-the-YouTube-Video-playlist-for-the-Composer-4-R2-Blocks/
2011-08-26T18:08:00.0000000Z
<p><em>Based on CMS 6 R2, Composer 4 R2, and the Composer 4 R2 Blocks</em></p>
<p>Prior to the Composer 4 R2 Blocks the YouTube block in Composer was based on an edit field where the user simply added a URL. </p>
<p><em> </em></p>
<p><em>The old way:</em></p>
<p><a href="/link/a2769a52783942d3ac972fbd9f8974eb.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="/link/d282fd0dee0648d7b8fe91b2ff99dfcb.png" border="0" alt="image" width="461" height="368" /></a></p>
<p> </p>
<p>In Composer 4 R2 this has changed to make things easier for the content contributor by allowing them to select from one or more playlists instead of typing a URL, a manual process which could be more prone to typos and errors. </p>
<p> </p>
<p><em>The new way:</em></p>
<p><a href="/link/8a5832a3db90414f9bcbc0615a696d50.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/e5b349f5bf0d4780b6e4198b1a219752.png" border="0" alt="image" width="462" height="369" /></a></p>
<p><em> </em></p>
<p> </p>
<p>This change has a side effect. It means that administrators or other privileged users must do some initial set up to establish the playlist, or playlists, to pull from. The steps do do this are documented below:</p>
<p> </p>
<ul>
<li>
<div>The first thing you need to do is to set up a <em><strong>YouTube channel, a playlist area, and one to many playlists</strong></em>. I’m not an expert in creating YouTube channels so I’ll leave that to you to work through. My expertise lies more in watching YouTube videos. I must say, I can be pretty good at this! <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="/link/de9885e9cc204bf7b1a4dfb4fcc970f2.png" alt="Winking smile" /> Just make sure that you understand the previously mentioned items identified in italic bold are all needed. You can see an example screen shot of the EPiServer channel below. Notice there is a list of playlists on the right hand side of the page. One to many videos exist within each playlist.</div>
</li>
</ul>
<blockquote>
<p><a href="/link/7b9ac0dd0d474943a2b56c3339409e2b.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/3525f817af394657b1939e672ebcdc03.png" border="0" alt="image" width="579" height="325" /></a></p>
</blockquote>
<ul>
<li>Once you have the playlist (s) set up you can select one and obtain the URL that is needed for the EPiServer YouTube video Composer block.</li>
</ul>
<blockquote>
<p><a href="/link/beb94c19be9542109a691f7ec6d9f912.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/80eaf9b94b57465d94a2d97232a85a07.png" border="0" alt="image" width="580" height="365" /></a></p>
</blockquote>
<ul>
<li>Navigate to the CMS Admin Mode.</li>
<li>Select the “Page Type” tab.</li>
<li>Select “Edit Custom Property Types” link.</li>
</ul>
<blockquote>
<p><a href="/link/b3f5ee6e03c645ef805069e0c1e48988.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/95bde620ef4941929e1e2a0cd3d04e30.png" border="0" alt="image" width="236" height="241" /></a></p>
</blockquote>
<ul>
<li>You should find a “YouTube Picker Property” available. This is the property that the YouTube Composer block uses.</li>
<li>Select the “YouTube Picker Property” link.</li>
</ul>
<blockquote>
<p><a href="/link/0b450cf47e0a456dbcced673cf835e80.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/61b5ba503a864e458b5c4c91c1e1f3d3.png" border="0" alt="image" width="576" height="155" /></a></p>
</blockquote>
<ul>
<li>From here you can edit the existing setting or add one to many others. Each setting is designed to point to one YouTube playlist.</li>
</ul>
<blockquote>
<p><a href="/link/0aeb5b3103314264afae9728586a7da6.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/99d5362144834e4ba1c883268cb95872.png" border="0" alt="image" width="576" height="288" /></a></p>
</blockquote>
<ul>
<li>To add a new setting select the “Add Setting” button.</li>
<li>Give the setting a name, description, and add the YouTube URL that you took note of earlier based on the playlist you want to expose to content contributors.</li>
</ul>
<blockquote>
<p><a href="/link/037d19e1acf6434cb02f0de169b3b2a8.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/0f23c8e064e44d7eb872379f63a268bf.png" border="0" alt="image" width="578" height="281" /></a></p>
</blockquote>
<ul>
<li>Select the “Save” button.</li>
<li>You should now see your new setting available.</li>
</ul>
<blockquote>
<p><a href="/link/9b77af8d35604cfe9d4f87a065541755.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/a941ead1c2df4045a405cc36ca1ebe12.png" border="0" alt="image" width="579" height="316" /></a></p>
</blockquote>
<ul>
<li>You can set any one of these settings as the default. This effectively makes it just that, the default that is used when someone uses this Property. Typically this would be the channel for your organization most commonly used by your content contributors. In my example I’ll leave the previously existing default.</li>
<li>Select the “Save” button.</li>
<li>Composer blocks are based on EPiServer pages. Since you already selected the Admin~Page Type tab in Admin Mode, navigate to and select the “YouTube video” Page Type.</li>
</ul>
<blockquote>
<p><a href="/link/f2492f0800f542abb8b02b9ea4fd0313.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/66f9a19f757c4646ba0d38a6c58925da.png" border="0" alt="image" width="216" height="218" /></a></p>
</blockquote>
<ul>
<li>Select the “YouTubeLink” Property link.</li>
</ul>
<blockquote>
<p><a href="/link/50cbed4b9e5546f9a27d088c22a835d4.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/817e5cd66f2b4d518baea19ab56f5214.png" border="0" alt="image" width="580" height="403" /></a></p>
</blockquote>
<ul>
<li>As of the last few releases of EPiServer, many Properties have custom settings that you can configure. In this case, this also holds true for our “YouTubeLink” Property. Select the “Custom Settings” tab.</li>
</ul>
<blockquote>
<p><a href="/link/71f5ea924088470ea8e8c6c54ca75697.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/366a10ddd7654ef5a0b95f2c59cc1920.png" border="0" alt="image" width="581" height="310" /></a></p>
</blockquote>
<ul>
<li>From here you can either “Manage global settings” to make some global changes for all users of this Property. You can also simply edit the custom settings for this page type and manually enter the URL. In our case we already set up a global setting for our new channel. This allows us to simply select it from the “Use global settings” drop down. Select the setting you added previously in the steps above.</li>
</ul>
<blockquote>
<p><a href="/link/4c203cf8e8314237a220a9f4261e89a0.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/693d0eb094b4425bb5feab6c15c95684.png" border="0" alt="image" width="582" height="304" /></a></p>
</blockquote>
<ul>
<li>Select the “Save” button.</li>
<li>Navigate to Edit Mode and create a new Composer-based Page Type adding a YouTube block to the page. Please refer to the <a href="http://world.episerver.com/Documentation/Categories/Modules/EPiServer-Composer/">Composer documentation</a> for more details on how to do this.</li>
<li>Select “Edit” on the YouTube block or double click it to enter edit mode for the module.</li>
<li>You should now see the videos associated with your new channel!</li>
</ul>
<blockquote>
<p><a href="/link/9d9c595a476b44be9b0340deb15429e8.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="/link/69aedb4cba91402faf9e04d1e9552f13.png" border="0" alt="image" width="473" height="377" /></a></p>
</blockquote>
<p> </p>
<p>Some people may like the previous method of entering a direct URL in the Composer block. However, for others who want the simplified content contributor experience, and to limit what videos they can add, this is an excellent addition. The good news is that you have access to the code for both on EPiServer World for the <a href="http://world.episerver.com/Download/Categories/Modules/EPiServer-Composer/">Composer Download</a> area. So, you can use either or perhaps even build your own customization which provides a mix of both options.</p>
<p> </p>
<p>I hope this helps!</p>