public void AddCheckItem(int PartyId, int DinerId, string Type, double Price, int Diviser) { double subtotal = 0; for (int x = 0; x <= Diviser - 1; ++x) { CheckItem item = new CheckItem(); item.PartyId = PartyId; item.DinerId = DinerId; item.Type = Type; item.Diviser = Diviser; if ((x + 1) == Diviser) { //account for rounding item.Price = Math.Round((Price - subtotal), 2); } else { item.Price = Math.Round((Price / Diviser), 2); subtotal += item.Price; } items.Add(item); } }
public List <CheckItem> GetCheckItems(Check Check) { foreach (var Id in Check.items) { CheckItem checkItem = new CheckItem(); items.Add(checkItem); } return(items); }
public void AddCheckItem(int PartyID, int DinerId, string Type, double Price) { CheckItem item = new CheckItem(); item.PartyId = PartyID; item.DinerId = DinerId; item.Type = Type; item.Price = Price; item.Diviser = 1; items.Add(item); }