public Prod.Item ProdItemGet(int id, bool includeSkus = false) { if (includeSkus) { var sql = @"select * from item where id=@id;select * from sku where itemid=@id;"; var cmd = SqlBuilder.Raw(sql, new { id }).ToCommand(); using (var reader = StoreConn.QueryMultiple(cmd)) { var o = reader.Read <Prod.Item>().FirstOrDefault(); if (o != null) { o.Skus = reader.Read <Prod.Sku>().ToList(); } return(o); } } else { var cmd = SqlBuilder .Select("*").From("item") .Where("id=@id", new { id }) .ToCommand(); return(StoreConn.QueryFirstOrDefault <Prod.Item>(cmd)); } }
public Prod.Sku ProdSkuGet(int id) { var cmd = SqlBuilder .Select("*").From("sku") .Where("id=@id", new { id }) .ToCommand(); return(StoreConn.QueryFirstOrDefault <Prod.Sku>(cmd)); }
public Prod.ItemDesc ProdItemDescGet(int id) { var cmd = SqlBuilder .Select("*").From("itemdesc") .Where("id=@id", new { id }) .ToCommand(); return(StoreConn.QueryFirstOrDefault <Prod.ItemDesc>(cmd)); }
public User UserGet(int id) { var cmd = SqlBuilder .Select("*").From("user") .Where("id=@id", new { id }) .ToCommand(); return(StoreConn.QueryFirstOrDefault <User>(cmd)); }