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
namespace VS.Library.Interfaces | |
{ | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Security.AccessControl; | |
public interface IDirectory | |
{ | |
bool Exists(string path); |
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 IEnumerable<Dictionary<string, object>> DataSetToOrder(DataSet orderDetails) | |
{ | |
var s = orderDetails.Tables[0].Rows[0][0].ToString(); | |
var tableDefinitions = s.Replace(", ", ",").Split(','); | |
var tables = tableDefinitions.Select(tableDefinition => tableDefinition.Split('/')).Select(temp => new Tuple<int, int, string>(int.Parse(temp[0]), int.Parse(temp[1]), temp[2])).ToList(); | |
var parent = tables.First(t => t.Item1.Equals(1)); |
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
declare @p2 dbo.Dictionary | |
insert into @p2 values(N'orderReference',N'654') | |
insert into @p2 values(N'earliestRequestedDeliveryDate',N'2013-09-02') | |
insert into @p2 values(N'transactionId',N'123') | |
declare @p3 dbo.IndexedDictionary | |
insert into @p3 values(1,N'productCode',N'59510') | |
insert into @p3 values(1,N'orderedQty',N'1') | |
insert into @p3 values(2,N'productCode',N'62754') | |
insert into @p3 values(2,N'orderedQty',N'3') |
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 MyReader As New _ | |
Microsoft.VisualBasic.FileIO.TextFieldParser("C:\testfile.txt") | |
MyReader.TextFieldType = FileIO.FieldType.Delimited | |
MyReader.SetDelimiters(",") | |
Dim currentRow As String() | |
While Not MyReader.EndOfData | |
Try | |
currentRow = MyReader.ReadFields() | |
Dim currentField As String | |
For Each currentField In currentRow |
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
-- Tables | |
-- Basically the table name (singular) | |
CREATE TABLE [dbo].[Product] (...) | |
-- Columns | |
-- Identity | |
[Id] INT NOT NULL IDENTITY (1, 1) -- Id column with auto increment |
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
/// A description of the regular expression: | |
/// | |
/// Beginning of line or string | |
/// [1]: A numbered capture group. [[^[].*[^]]] | |
/// [^[].*[^]] | |
/// Any character that is NOT in this class: [[] | |
/// Any character, any number of repetitions | |
/// Any character that is NOT in this class: []] | |
/// End of line or string |
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
[Test] | |
public void ShouldReturnModelWithValuesSetCorrectly() | |
{ | |
var formCollection = new NameValueCollection | |
{ | |
{ "page", "5" }, | |
{ "rp", "8" }, | |
{ "query", "smith" }, | |
{ "sortname", "sname" }, | |
{ "sortorder", "sorder" } |
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 class SomeViewModelBinder : DefaultModelBinder | |
{ | |
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
int currentPage = 1; | |
int itemsPerPage = 8; | |
var page = bindingContext.ValueProvider.GetValue("page"); | |
if (page != null) |
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
@echo off | |
echo Pre req checks... | |
echo|set /p=... Running as ADMIN ... | |
reg query "HKU\S-1-5-19" >nul 2>&1 | |
if %errorlevel% == 1 echo FAILED : Not runing as ADMIN | |
if %errorlevel% == 0 echo Passed | |
echo|set /p=... SQL Server ... | |
osql.exe -? >nul 2>&1 |
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
var rows = (List<object><p> | |
)data.GetType().GetProperty("rows").GetValue(data, null); | |
rows.Count.Should().Be(1); | |
this.GetValue(rows[0], "id").Should().Be("98732312"); | |
var cell = rows[0].GetType().GetProperty("cell").GetValue(rows[0], null); | |
this.GetValue(cell, "prop1").Should().Be("a"); |