private void SaveProduct(Product product) { new FluentCommand<Product>(_sql) .AddInt("id", product.ID) .AddString("code", product.ProductCode) .AddString("name", product.Name) .AddString("mft", product.Manufacturer) .AddString("size", product.Size) .AddBoolean("discontinued", !product.Active) .AddString("barcode", product.BarCode) .AsNonQuery(); }
private void SetAddCommandParameters(OleDbCommand cmd, Product product) { cmd.Parameters[0].Value = product.ID; cmd.Parameters[1].Value = product.ProductCode; cmd.Parameters[2].Value = product.Name; cmd.Parameters[3].Value = product.Manufacturer; cmd.Parameters[4].Value = product.Size; cmd.Parameters[5].Value = !product.Active; cmd.Parameters[6].Value = product.BarCode; }
private List<Product> CreateProductList() { const int ProductCount = 2000; var list = new List<Product>(ProductCount); for (int i = 0; i < ProductCount; i++) { var cust = new Product { ID = i, Name = "TestProduct", Active = true, Manufacturer = "TestMfg", BarCode = i.ToString(), ProductCode = i.ToString(), Size = "Cup" }; list.Add(cust); } return list; }