Skip to content

Instantly share code, notes, and snippets.

View radleta's full-sized avatar

Richard Adleta radleta

View GitHub Profile
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="iShouldKnow.Data.iShouldKnowDataContext" OrderBy="FirstName"
Select="new (Id, LastName, FirstName)" TableName="Persons"
Where="CreatedByUserId == @CreatedByUserId">
<WhereParameters>
<asp:ProfileParameter DbType="Guid" Name="CreatedByUserId" PropertyName="UserId" />
</WhereParameters>
</asp:LinqDataSource>
protected void SiteCreateUserWizard_CreatedUser(object sender, EventArgs e)
{
// get the newly create user and add custom defaults to the profile data
ProfileCommon userProfile = (ProfileCommon)ProfileCommon.Create(this.SiteCreateUserWizard.UserName, true);
// we need to add'l store the UserId of the user in its profile data so that we can obtain
// it later when using object binding
MembershipUser createdUser = Membership.GetUser(this.SiteCreateUserWizard.UserName);
userProfile.UserId = (Guid)createdUser.ProviderUserKey;
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="Company.Data.CompanyDataContext" OrderBy="FirstName"
Select="new (Id, LastName, FirstName)" TableName="Persons"
Where="CreatedByUserId == @CreatedByUserId">
<WhereParameters>
<asp:ProfileParameter DbType="Guid" Name="CreatedByUserId" PropertyName="UserId" />
</WhereParameters>
</asp:LinqDataSource>
ROBOCOPY.EXE "C:\Source" "C:\Destination" /MIR
SET ROBOCOPY_ERRORLEVEL=%ERRORLEVEL%
ECHO Error Level: %ROBOCOPY_ERRORLEVEL%
if %ROBOCOPY_ERRORLEVEL% == 1 set ROBOCOPY_ERRORLEVEL=0
if %ROBOCOPY_ERRORLEVEL% == 2 set ROBOCOPY_ERRORLEVEL=0
if %ROBOCOPY_ERRORLEVEL% == 3 set ROBOCOPY_ERRORLEVEL=0
if %ROBOCOPY_ERRORLEVEL% == 4 set ROBOCOPY_ERRORLEVEL=0
if %ROBOCOPY_ERRORLEVEL% == 5 set ROBOCOPY_ERRORLEVEL=0
if %ROBOCOPY_ERRORLEVEL% == 6 set ROBOCOPY_ERRORLEVEL=0
if %ROBOCOPY_ERRORLEVEL% == 7 set ROBOCOPY_ERRORLEVEL=0
@radleta
radleta / NuGetPackagePublishExample.csproj.xml
Created June 27, 2011 21:41
NuGet Package and Publish Example for MSBUILD
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- snip -->
<PackageDir>Package\$(Configuration)</PackageDir>
</PropertyGroup>
<!-- snip -->
<Target Name="AfterBuild">
<!-- Load up the information from the assembly -->
<GetAssemblyIdentity AssemblyFiles="$(OutputPath)$(AssemblyName).dll">
@radleta
radleta / MsbuildExecutePackagePublishExample.bat
Created June 27, 2011 21:49
Execute MSBUILD for NuGet Package and Publish Example
MSBUILD.exe /t:Build,Package,Publish /p:Configuration=Debug .\MyProject\MyProject.csproj
@radleta
radleta / PropertyHelper.cs
Created July 1, 2011 20:04
Helper Classes to Copy Properties
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;
namespace Helpers
{
/// <summary>
/// Used by the <see cref="PropertyHelper.CopyProperties"/> method to
@radleta
radleta / NuGetPackageManagerDowngradePackage
Created June 13, 2012 21:22
A couple of snips to use when you need to downgrade a project using the Package Manager Console.
$projects = Get-Project -All | Select @{ Name="ProjectName";Expression={$_.ProjectName}}, @{Name="Has";Expression={Get-Package Insight.Database -ProjectName $_.ProjectName}} | where { $_.Has -ne 'Insight.Database 1.1.5' }
$projects | select { Uninstall-Package Insight.Database -ProjectName $_.ProjectName -Force }
$projects | select { Install-Package Insight.Database -Version 1.1.4 -ProjectName $_.ProjectName }
@radleta
radleta / BrList.aspnet-mvc-4.razor
Created September 11, 2012 12:30
MVC 4 Razor Helper: BrList
@helper BrList(IEnumerable<string> list)
{
var first = true;
foreach (var str in list)
{
if (!first)
{
<text><br /></text>
}
else
@radleta
radleta / BullList.aspnet-mvc-4.razor
Created September 11, 2012 12:32
MVC 4 Razor Helper: BullList
@helper BullList(IEnumerable<string> list)
{
var first = true;
foreach (var str in list)
{
if (!first)
{
<text> &bull; </text>
}
else