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 System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Web.Http.Metadata; | |
using System.Web.Http.Validation; | |
using System.Web.Http.Validation.Providers; | |
using System.Web.Http.Validation.Validators; | |
namespace My.Web.Code.Binder |
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 System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Web.Mvc; | |
namespace My.Web.Code.Binder | |
{ | |
/// <summary> | |
/// Inside Global.asax: |
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
/// <summary> | |
/// Usage: [JsonConverter(typeof(JsonDateTimeConverter), "MM\\/dd\\/yyyy")]. | |
/// Dates created/set in JS had time-zones appended. By using string, this issue won't persist... | |
/// </summary> | |
public class JsonDateTimeConverter : DateTimeConverterBase | |
{ | |
private string CustomFormat { get; } | |
public JsonDateTimeConverter(string customFormat) | |
{ |
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 static TransactionScope New(TransactionScopeOption transactionScopeOption = TransactionScopeOption.Required, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, TimeSpan? timeout = null) | |
{ | |
// NOTE: this is a fix, to avoid inner transaction timeout's to shorten the outer one... | |
if (Transaction.Current != null && transactionScopeOption == TransactionScopeOption.Required) | |
timeout = TimeSpan.FromMinutes(15); | |
var options = new TransactionOptions | |
{ | |
IsolationLevel = isolationLevel, | |
Timeout = timeout ?? TransactionManager.DefaultTimeout |
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
// | |
// COMMON DLL | |
// | |
public interface IStatusCode | |
{ | |
int? StatusCode { get; set; } | |
} | |
public static class IStatusCodeEx |
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
import {NgControl} from "@angular/forms"; | |
import {Directive, ElementRef} from "@angular/core"; | |
@Directive({ | |
selector: '[ngModel]', // or 'input, select, textarea' - but then your controls won't be handled and also checking for undefined would be necessary | |
}) | |
export class NativeElementInjectorDirective { | |
constructor(private el: ElementRef, private control : NgControl) { | |
(<any>control.control).nativeElement = el.nativeElement; | |
} |
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 Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Filters; | |
using Microsoft.AspNet.OData; | |
using Microsoft.AspNet.OData.Extensions; | |
using Microsoft.AspNet.OData.Query; | |
using System.Linq; | |
using System; | |
using Newtonsoft.Json; | |
namespace R.Web.Api |
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 System; | |
using System.Linq.Expressions; | |
/// <summary> | |
/// Usage: | |
/// var exp1 = (Expression<Func<Person, string>>) exp1 = i => i.Addresses[0].City; | |
/// var exp2 = (Expression<Func<Person, string>>) exp1 = j => j.Addresses[0].City; | |
/// var exp1String = new ExpressionInitialParameterRenamer().Rename(exp1).ToString(); | |
/// /// </summary> | |
namespace ExpressionHelper |
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
$(document).on('click', '[data-toggle="class"]', function () { | |
var $target = $($(this).data('target')); | |
var toggleClasses = $(this).data('toggle-classes'); | |
if (toggleClasses) | |
$target.toggleClass(toggleClasses); | |
var addClass = $(this).data('add-classes'); | |
if (addClass) | |
$target.addClass(addClass); |
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 System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace R | |
{ |