This file contains hidden or 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 FillSelectLists(int? parentPageID) | |
{ | |
ViewBag.ParentPageSelectList = new SelectList(pageBL.GetParentPages(), "PageID", "Title", parentPageID); | |
} |
This file contains hidden or 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 class DbGeographyModelBinder : DefaultModelBinder | |
{ | |
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
var valueProviderResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); | |
string[] latLongStr = valueProviderResult.AttemptedValue.Split(','); | |
string point = string.Format("POINT ({0} {1})",latLongStr[1], latLongStr[0]); | |
//4326 format puts LONGITUDE first then LATITUDE | |
DbGeography result = valueProviderResult == null ? null : | |
DbGeography.FromText(point,4326); |
This file contains hidden or 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 void DeleteAllEntities<T>(this DbContext db) | |
where T : class | |
{ | |
var adapter = (IObjectContextAdapter)db; | |
var objectContext = adapter.ObjectContext; | |
var sql = string.Format("DELETE FROM {0}", objectContext.GetTableName<T>()); | |
var entityConnection = objectContext.ExecuteStoreCommand(sql); | |
} | |
public static string GetTableName<T>(this ObjectContext context) |
This file contains hidden or 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
ko.bindingHandlers.fadeVisible = { | |
init: function(element, valueAccessor) { | |
var shouldDisplay = valueAccessor(); | |
$(element).toggle(shouldDisplay); | |
}, | |
update: function(element, valueAccessor) { | |
// On update, fade in/out | |
var shouldDisplay = valueAccessor(); | |
shouldDisplay ? $(element).fadeIn() : $(element).fadeOut(); | |
} |
This file contains hidden or 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 App() | |
{ | |
ProfileOptimization.SetProfileRoot(@"C:\MyAppFolder"); | |
ProfileOptimization.StartProfile("Startup.Profile"); | |
} |
This file contains hidden or 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 class ObjectExt | |
{ | |
/// <summary> | |
/// Provides a copy/deep clone of the object | |
/// </summary> | |
public static T Copy<T>(this T opSource) where T : class | |
{ | |
//grab the type and create a new instance of that type | |
Type opSourceType = opSource.GetType(); | |
var opTarget = Activator.CreateInstance<T>(); |
This file contains hidden or 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
/// <summary> | |
/// Provides a cached repository of the DM lists | |
/// </summary> | |
internal class CachedRepository | |
{ | |
private readonly ObjectCache cache = MemoryCache.Default; | |
private const string CacheName = "DM.Lists"; | |
private const int ExpiryMinutes = 1; | |
public List<DMList> GetLists() |
This file contains hidden or 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 void Create(User user) | |
{ | |
db.Users.Add(user); | |
var errors = db.GetValidationErrors().ToList(); | |
if (errors.Count() != 0) | |
throw new DbEntityValidationException("Validation errors", errors); | |
int result = db.Database.ExecuteSqlCommand( | |
"exec dbo.CreateUser @FirstName, @Surname, @Email, @Phone, @Postcode, @IsCustomer, @Suitcase, @TravelTypeId", | |
new SqlParameter("FirstName", user.FirstName), |
This file contains hidden or 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
-- Create SQL Key | |
create master key encryption | |
by password = 'Glitch##7' | |
create certificate globe_cert | |
with subject = 'globetrotter encryption certificate', | |
expiry_date = '20200101' | |
create symmetric key globe_key with algorithm = AES_256 | |
encryption by certificate globe_cert |
This file contains hidden or 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
/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=WMSVC /p:MsDeployServiceUrl=https://192.168.203.248:8172/msdeploy.axd /p:AllowUntrustedCertificate=true /p:DeployIISAppPath=dev2.lav.syd\IlluminateCDS /p:username=lav\build /p:password=lavenderbuild13 /p:Configuration=Dev /p:SkipExtraFilesOnServer=True |