public static decimal GetValue(CoinCompartmentsType coinCompartmentsType) { return(Defination[coinCompartmentsType]); }
public void PickCash(CoinCompartmentsType coinCompartment, decimal amount) { this.CashDrawerValues[coinCompartment] -= amount; }
private KeyValuePair <CoinCompartmentsType, decimal> Payout(decimal changeAmount, CoinCompartmentsType compartmentType, CashRegister cashRegister, out decimal remainingChange) { remainingChange = changeAmount; bool IsDueByThisCoinCompartment = CashDrawerDefination.GetValue(compartmentType) > changeAmount; if (IsDueByThisCoinCompartment) { return(new KeyValuePair <CoinCompartmentsType, decimal>(compartmentType, 0)); } var quantity = Math.Floor(changeAmount / CashDrawerDefination.GetValue(compartmentType)); var cashValue = Math.Min(quantity * CashDrawerDefination.GetValue(compartmentType), cashRegister.CashDrawerValues[compartmentType]); cashRegister.PickCash(compartmentType, cashValue); remainingChange = changeAmount - cashValue; return(new KeyValuePair <CoinCompartmentsType, decimal>(compartmentType, cashValue)); }