This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int CalculateAge(DateTime dateOfBirth) | |
{ | |
int age = 0; | |
age = DateTime.Now.Year - dateOfBirth.Year; | |
if (DateTime.Now.DayOfYear < dateOfBirth.DayOfYear) | |
age = age - 1; | |
return age; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string NormalizePostcode(string postcode) | |
{ | |
//removes end and start spaces | |
postcode = postcode.Trim(); | |
//removes in middle spaces | |
postcode = postcode.Replace(" ", ""); | |
switch (postcode.Length) { | |
//add space after 2 characters if length is 5 | |
case 5: temp_postcode = temp_postcode.Insert(2, " "); break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using FileHelpers; | |
namespace MyProject | |
{ | |
[DelimitedRecord(",")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ReadCSVFile(string fileName) | |
{ | |
try | |
{ | |
//file location, better to get it from configuration | |
string fileName = "C:\\temp\\MyProducts.csv"; | |
//create a CSV engine using FileHelpers for your CSV file | |
var engine = new FileHelperEngine(typeof(MyProduct)); | |
//read the CSV file into your object Arrary | |
var products = (MyProduct[])engine.ReadFile(fileName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void WriteCSVFile(List<SomeDataSource> dataSource) | |
{ | |
try | |
{ | |
//filehelper object | |
FileHelperEngine engine = new FileHelperEngine(typeof(MyProdcuts)); | |
//csv object | |
List<MyProduct> csv = new List<MyProduct>(); | |
//convert any datasource to csv based object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define parameters | |
Param( | |
[string]$Prefix = 'sitecore901', | |
[string]$CommerceOpsSiteName = 'CommerceOps_Sc9', | |
[string]$CommerceShopsSiteName = 'CommerceShops_Sc9', | |
[string]$CommerceAuthoringSiteName = 'CommerceAuthoring_Sc9', | |
[string]$CommerceMinionsSiteName = 'CommerceMinions_Sc9', | |
[string]$SitecoreBizFxSiteName = 'SitecoreBizFx', | |
[string]$SitecoreIdentityServerSiteName = 'SitecoreIdentityServer', | |
[string]$SolrService = 'Solr-6.6.2', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define parameters | |
Param( | |
[string]$Prefix = 'sitecore901', | |
[string]$SitecoreSiteName = 'sitecore901.sc', | |
[string]$SolrService = 'Solr-6.6.2', | |
[string]$PathToSolr = 'C:\Solr\Solr-6.6.2', | |
[string]$SqlServer = 'DESKTOP\SQLEXPRESS', | |
[string]$SqlAccount = 'sa', | |
[string]$SqlPassword = 'mysupersecretpassword' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3 | |
param( | |
[string]$SiteName = "sitecore901.sc", | |
[string]$SiteHostHeaderName = "sitecore901.commerce", | |
[string]$SqlDbPrefix = "sitecore901", | |
[string]$CommerceSearchProvider = "SOLR" | |
) | |
$global:DEPLOYMENT_DIRECTORY=Split-Path $MyInvocation.MyCommand.Path | |
$modulesPath=( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "Modules" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS>TerminatingError(Invoke-RestMethod): " IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681 " | |
>> TerminatingError(Invoke-RestMethod): " IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname "sxa.storefront.com" | |
Export-Certificate -Cert cert:\localMachine\my\<thumbprint> -FilePath sxa.storefront.cer | |
Set-Location -Path cert:\CurrentUser\My | |
Import-Certificate -Filepath "C:\deploy\assets\sxa.storefront.com.cer" |