Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mike Brind
committed
Dec 27, 2012
0 parents
commit c20c74a
Showing
53 changed files
with
12,199 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
# Auto detect text files and perform LF normalization | |||
* text=auto | |||
|
|||
# Custom for Visual Studio | |||
*.cs diff=csharp | |||
*.sln merge=union | |||
*.csproj merge=union | |||
*.vbproj merge=union | |||
*.fsproj merge=union | |||
*.dbproj merge=union | |||
|
|||
# Standard to msysgit | |||
*.doc diff=astextplain | |||
*.DOC diff=astextplain | |||
*.docx diff=astextplain | |||
*.DOCX diff=astextplain | |||
*.dot diff=astextplain | |||
*.DOT diff=astextplain | |||
*.pdf diff=astextplain | |||
*.PDF diff=astextplain | |||
*.rtf diff=astextplain | |||
*.RTF diff=astextplain |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,161 @@ | |||
################# | |||
## Eclipse | |||
################# | |||
|
|||
*.pydevproject | |||
.project | |||
.metadata | |||
|
|||
tmp/ | |||
*.tmp | |||
*.bak | |||
*.swp | |||
*~.nib | |||
local.properties | |||
.classpath | |||
.settings/ | |||
.loadpath | |||
|
|||
# External tool builders | |||
.externalToolBuilders/ | |||
|
|||
# Locally stored "Eclipse launch configurations" | |||
*.launch | |||
|
|||
# CDT-specific | |||
.cproject | |||
|
|||
# PDT-specific | |||
.buildpath | |||
|
|||
|
|||
################# | |||
## Visual Studio | |||
################# | |||
|
|||
## Ignore Visual Studio temporary files, build results, and | |||
## files generated by popular Visual Studio add-ons. | |||
|
|||
# User-specific files | |||
*.suo | |||
*.user | |||
*.sln.docstates | |||
|
|||
# Build results | |||
[Dd]ebug/ | |||
[Rr]elease/ | |||
*_i.c | |||
*_p.c | |||
*.ilk | |||
*.meta | |||
*.obj | |||
*.pch | |||
*.pdb | |||
*.pgc | |||
*.pgd | |||
*.rsp | |||
*.sbr | |||
*.tlb | |||
*.tli | |||
*.tlh | |||
*.tmp | |||
*.vspscc | |||
.builds | |||
*.dotCover | |||
|
|||
## TODO: If you have NuGet Package Restore enabled, uncomment this | |||
#packages/ | |||
|
|||
# Visual C++ cache files | |||
ipch/ | |||
*.aps | |||
*.ncb | |||
*.opensdf | |||
|
|||
|
|||
# Visual Studio profiler | |||
*.psess | |||
*.vsp | |||
|
|||
# ReSharper is a .NET coding add-in | |||
_ReSharper* | |||
|
|||
# Installshield output folder | |||
[Ee]xpress | |||
|
|||
# DocProject is a documentation generator add-in | |||
DocProject/buildhelp/ | |||
DocProject/Help/*.HxT | |||
DocProject/Help/*.HxC | |||
DocProject/Help/*.hhc | |||
DocProject/Help/*.hhk | |||
DocProject/Help/*.hhp | |||
DocProject/Help/Html2 | |||
DocProject/Help/html | |||
|
|||
# Click-Once directory | |||
publish | |||
|
|||
# Others | |||
[Oo]bj | |||
sql | |||
TestResults | |||
*.Cache | |||
ClientBin | |||
stylecop.* | |||
~$* | |||
*.dbmdl | |||
Generated_Code #added for RIA/Silverlight projects | |||
|
|||
# Backup & report files from converting an old project file to a newer | |||
# Visual Studio version. Backup files are not needed, because we have git ;-) | |||
_UpgradeReport_Files/ | |||
Backup*/ | |||
UpgradeLog*.XML | |||
|
|||
|
|||
|
|||
############ | |||
## Windows | |||
############ | |||
|
|||
# Windows image file caches | |||
Thumbs.db | |||
|
|||
# Folder config file | |||
Desktop.ini | |||
|
|||
|
|||
############# | |||
## Python | |||
############# | |||
|
|||
*.py[co] | |||
|
|||
# Packages | |||
*.egg | |||
*.egg-info | |||
dist | |||
build | |||
eggs | |||
parts | |||
var | |||
sdist | |||
develop-eggs | |||
.installed.cfg | |||
|
|||
# Installer logs | |||
pip-log.txt | |||
|
|||
# Unit test / coverage reports | |||
.coverage | |||
.tox | |||
|
|||
#Translations | |||
*.mo | |||
|
|||
#Mr Developer | |||
.mr.developer.cfg | |||
|
|||
# Mac crap | |||
.DS_Store |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
using Microsoft.AspNet.SignalR.Hubs; | |||
|
|||
public class ChatHub : Hub | |||
{ | |||
public void Send(string name, string message) | |||
{ | |||
Clients.All.broadcastMessage(name, message); | |||
} | |||
|
|||
public void IsTyping(string name){ | |||
Clients.All.sayWhoIsTyping(name); | |||
} | |||
} |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
using Microsoft.AspNet.SignalR.Hubs; | |||
using WebMatrix.Data; | |||
|
|||
public class ProductHub : Hub | |||
{ | |||
public void BuyProduct(int productId) { | |||
using (var db = Database.Open("Northwind")) { | |||
var unitsInStock = db.QueryValue("SELECT UnitsInStock FROM Products WHERE ProductId = @0", productId); | |||
if (unitsInStock > 0) { | |||
db.Execute("UPDATE Products Set UnitsInStock = UnitsInStock - 1 WHERE ProductId = @0", productId); | |||
unitsInStock -= 1; | |||
} | |||
Clients.All.updateAvailableStock(unitsInStock, productId); | |||
} | |||
} | |||
|
|||
public void ReorderProduct(int quantity, int productId){ | |||
using (var db = Database.Open("Northwind")) { | |||
db.Execute("UPDATE Products Set UnitsInStock = UnitsInStock + @0 WHERE ProductId = @1", quantity, productId); | |||
var unitsInStock = db.QueryValue("SELECT UnitsInStock FROM Products WHERE ProductId = @0", productId); | |||
Clients.All.updateAvailableStock(unitsInStock, productId); | |||
} | |||
} | |||
} |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<sources> | |||
<source url="http://go.microsoft.com/fwlink/?LinkID=226946" displayname="Default" filterpreferred="true" /> | |||
<source url="http://go.microsoft.com/fwlink/?LinkID=226948" displayname="Default (All)" filterpreferred="false" /> | |||
</sources> |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
AKBet36DFtlgPrWxiCiZ3PY+ammHL5eX+RGh8MCjYuNayZ2oXKw4Sut6l+dvWvEBaA== |
Binary file not shown.
Binary file added
BIN
+160 KB
...Data/packages/Microsoft.AspNet.Razor.2.0.20710.0/Microsoft.AspNet.Razor.2.0.20710.0.nupkg
Binary file not shown.
Binary file added
BIN
+274 KB
...ackages/Microsoft.AspNet.WebPages.2.0.20710.0/Microsoft.AspNet.WebPages.2.0.20710.0.nupkg
Binary file not shown.
Binary file added
BIN
+56.7 KB
...ges.Administration.2.0.20710.0/Microsoft.AspNet.WebPages.Administration.2.0.20710.0.nupkg
Binary file not shown.
Binary file added
BIN
+28.2 KB
...crosoft.AspNet.WebPages.Data.2.0.20710.0/Microsoft.AspNet.WebPages.Data.2.0.20710.0.nupkg
Binary file not shown.
Binary file added
BIN
+49.7 KB
...t.AspNet.WebPages.WebData.2.0.20710.0/Microsoft.AspNet.WebPages.WebData.2.0.20710.0.nupkg
Binary file not shown.
Binary file added
BIN
+62.9 KB
.../packages/Microsoft.Web.Infrastructure.1.0.0.0/Microsoft.Web.Infrastructure.1.0.0.0.nupkg
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
@{ | |||
|
|||
} | |||
|
|||
<div class="container"> | |||
<div id="isTyping"> </div> | |||
<input type="text" id="message" /> | |||
<input type="button" id="sendmessage" value="Send" /> | |||
<input type="hidden" id="displayname" /> | |||
<ul id="discussion"></ul> | |||
</div> | |||
|
|||
@section script{ | |||
<script type="text/javascript"> | |||
$(function () { | |||
var chat = $.connection.chatHub; | |||
chat.client.broadcastMessage = function (name, message) { | |||
$('#discussion').append('<li><strong>' + name | |||
+ '</strong>: ' + message + '</li>'); | |||
}; | |||
chat.client.sayWhoIsTyping = function (name) { | |||
$('#isTyping').html('<em>' + name + ' is typing</em>'); | |||
setTimeout(function () { | |||
$('#isTyping').html(' '); | |||
}, 3000); | |||
}; | |||
$('#displayname').val(prompt('Enter your name:', '')); | |||
$('#message').focus(); | |||
$.connection.hub.start().done(function () { | |||
$('#sendmessage').click(function () { | |||
var encodedName = $('<div />').text($('#displayname').val()).html(); | |||
var encodedMsg = $('<div />').text($('#message').val()).html(); | |||
chat.server.send(encodedName, encodedMsg); | |||
$('#message').val('').focus(); | |||
}); | |||
$('#message').keypress(function () { | |||
var encodedName = $('<div />').text($('#displayname').val()).html(); | |||
chat.server.isTyping(encodedName); | |||
}); | |||
}); | |||
}); | |||
</script> | |||
} |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
@{ | |||
Page.Title = "SignalR Samples"; | |||
|
|||
} | |||
|
|||
<ul> | |||
<li><a href="~/Chat/">Chat</a></li> | |||
<li><a href="~/Knockout/">Knockout</a></li> | |||
</ul> |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
@{ | |||
var db = Database.Open("Northwind"); | |||
var sql = "SELECT CategoryId, CategoryName FROM Categories"; | |||
var data = db.Query(sql); | |||
Response.ContentType = "application/json"; | |||
Json.Write(data, Response.Output); | |||
} |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
@{ | |||
if (UrlData[0].IsEmpty() || !UrlData[0].IsInt()) { | |||
Response.SetStatus(HttpStatusCode.BadRequest); | |||
Response.End(); | |||
} | |||
var db = Database.Open("Northwind"); | |||
var sql = @"SELECT ProductId, ProductName, ContactTitle, ContactName, | |||
CompanyName, QuantityPerUnit, UnitPrice, UnitsInStock, ReorderLevel | |||
FROM Products INNER JOIN Suppliers | |||
ON Products.SupplierID = Suppliers.SupplierID | |||
WHERE ProductId = @0"; | |||
var data = db.Query(sql, UrlData[0]); | |||
if(data.Count() == 0){ | |||
Response.SetStatus(HttpStatusCode.BadRequest); | |||
Response.End(); | |||
} | |||
Response.ContentType = "application/json"; | |||
Json.Write(data, Response.Output); | |||
} |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
@{ | |||
if (UrlData[0].IsEmpty() || !UrlData[0].IsInt()) { | |||
Response.SetStatus(HttpStatusCode.BadRequest); | |||
Response.End(); | |||
} | |||
var db = Database.Open("Northwind"); | |||
var sql = "SELECT ProductId, ProductName From Products Where CategoryId = @0"; | |||
var data = db.Query(sql, UrlData[0]); | |||
if(data.Count() == 0){ | |||
Response.SetStatus(HttpStatusCode.BadRequest); | |||
Response.End(); | |||
} | |||
Response.ContentType = "application/json"; | |||
Json.Write(data, Response.Output); | |||
} |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
@{ | |||
Layout = null; | |||
} |
Oops, something went wrong.