Skip to content

Instantly share code, notes, and snippets.

@driscollwebdev
Created May 26, 2011 13:08
Show Gist options
  • Save driscollwebdev/993095 to your computer and use it in GitHub Desktop.
Save driscollwebdev/993095 to your computer and use it in GitHub Desktop.
Interface article sample code
class PerishableItem
{
public string Name { get; set; }
public double Price { get; set; }
public double UnitPrice { get; set; }
public uint SKU { get; set; }
public DateTime SellByDate { get; set; }
public DateTime ExpirationDate { get; set; }
protected delegate void ExpiredItemHandler(object sender,ExpiredItemEventArgs e);
public event ExpiredItemHandler Expired;
protected void OnExpired(object item, ExpiredItemEventArgs eArgs)
{
if (this.Expired != null)
{
Expired(item, eArgs);
}
}
}
class NonPerishableItem
{
string Name { get; set; }
double Price { get; set; }
double UnitPrice { get; set; }
uint SKU { get; set; }
}
class Scanner
{
public void Scan(PerishableItem item)
{
///TODO: Update the inventory database using the product's SKU
///TODO: Add the price of this item to the order subtotal
}
public void Scan(NonPerishableItem item)
{
///TODO: Update the inventory database using the product's SKU
///TODO: Add the price of this item to the order subtotal
}
public void CancelScan(PerishableItem item)
{
///TODO: Update the inventory database using the product's SKU
///TODO: Subtract the price of this item from the order subtotal
}
public void CancelScan(NonPerishableItem item)
{
///TODO: Update the inventory database using the product's SKU
///TODO: Subtract the price of this item from the order subtotal
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment