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
Assuming your web app supports deep linking, like an AngularJS one would. | |
Assume basic crud of Foo. So list, create, edit and delete. | |
If a user bookmarks in your app an edit page or simply refreshes the page, thanks to deep linking you now skip over the list part of navigation. | |
So the user's browser hits: | |
http://example.org/#/foos/1 |
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 QueryStringTokenConverterExtension | |
{ | |
public static IAppBuilder QueryStringTokenConverter(this IAppBuilder app, string queryStringParameterName = "authorization", string requestHeaderName = "Authorization") | |
{ | |
return app.Use<QueryStringTokenConverter>(queryStringParameterName, requestHeaderName); | |
} | |
} | |
public class QueryStringTokenConverter | |
{ |
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
app.directive("pager", function ($compile) { | |
function generate(currentPage, totalPages, click) { | |
// How many adjacent pages should be shown on each side? | |
var adjacents = 2; | |
//previous page is page - 1 | |
var prev = currentPage - 1; | |
//next page is page + 1 | |
var next = currentPage + 1; |
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
// Route, notice reloadOnSearch is set to false | |
.when('/enquiry', { | |
templateUrl: $base + 'Enquiry/list.cshtml', controller: EnquiryListController, reloadOnSearch: false, resolve: { | |
items: function ($route, enquiryService) { | |
var page = $route.current.params.page; | |
if (page == undefined) page = 1; | |
return enquiryService.list(page); | |
} |
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
var app = angular.module('sample', ['ngSanitize'], function ($routeProvider) { | |
var $base = "/admin/partial?path=Admin/PartialViews/"; | |
$routeProvider | |
.when("/offer", { | |
templateUrl: $base + 'Offer/list.cshtml', controller: OfferListController, resolve: { | |
model: function (offerService) { | |
return offerService.list(); | |
} | |
} |
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
<system.net> | |
<mailSettings> | |
<smtp deliveryMethod="SpecifiedPickupDirectory"> | |
<specifiedPickupDirectory pickupDirectoryLocation="D:\Projects\temp" /> | |
<network host="localhost" /> | |
</smtp> | |
</mailSettings> | |
</system.net> |
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
store.DatabaseCommands.Delete("Raven/Hilo/enquiries", null); |
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
store.DatabaseCommands.DeleteByIndex("Enquiries/MyEnquiryIndexName", | |
new IndexQuery | |
{ | |
Query = "Id:*" | |
}, allowStale: false); |
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
'** Doubles up single quotes to stop breakouts from SQL strings ** | |
Public Shared Function SQLSafe(ByVal strRawText As String) As String | |
Dim strCleanedText As String = "" | |
Dim iCharPos As Integer = 1 | |
Do While iCharPos <= Len(strRawText) | |
'** Double up single quotes, but only if they aren't already doubled ** | |
If Mid(strRawText, iCharPos, 1) = "'" Then | |
strCleanedText = strCleanedText & "''" |
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 QueryableExtensions | |
{ | |
public static IQueryable<T> Paging<T>(this IQueryable<T> query, int currentPage, int defaultPage, int pageSize) | |
{ | |
return query | |
.Skip((currentPage - defaultPage) * pageSize) | |
.Take(pageSize); | |
} | |
} |
NewerOlder