Skip to content

Instantly share code, notes, and snippets.

@JulianRooze
JulianRooze / gist:5156538
Last active December 14, 2015 22:09
BookPriceUpdate
public void BookPriceUpdate(IUnitOfWork work, Product product, decimal oldPrice, decimal oldCost, decimal newPrice, decimal newCost)
{
var stock = product.StockPerOrganizationUnit;
foreach (var s in stock)
{
var onHand = s.Value;
var orgID = s.Key;
var rule = GetRule(work, AccountingTypes.StockRevaluation, product.LedgerClassID, orgID);
@JulianRooze
JulianRooze / Expressions.cs
Created November 26, 2012 17:12
Build expressions
class Employee
{
public IList<Order> Orders { get; set; }
}
class Order
{
public int OrderID { get; set; }
public IList<Customer> Customers { get; set; }
@JulianRooze
JulianRooze / DapperIncludes.cs
Created November 20, 2012 16:01
Dapper includes
public IList<Stock> ListStock(int? productID, int? orgID, StockLabel? label, ProductConditionTypes? condition, IList<string> includes)
{
var builder = new SqlBuilder();
var template = builder.AddTemplate(@"
select /**select**/ from Stock s
/**join**/
/**where**/");
@JulianRooze
JulianRooze / JsvEmptyStrings.cs
Created September 20, 2012 15:03
Empty string correctly serialized, but incorrectly deserialized as null
using ServiceStack.Text;
using System;
namespace JsvEmptyStrings
{
class Program
{
public class Dto
{
public string Foo { get; set; }