Пример #1
0
        /// <summary>
        /// Generate a MonetaryValues object which holds all monetary values for the order.
        /// </summary>
        /// <param name="deals"></param>
        /// <param name="baseCost"></param>
        /// <param name="delivery"></param>
        /// <param name="final"></param>
        /// <returns>A Monetaryvalues object which holds a list of deals, and then values for base, delivery and final costs.</returns>
        public static MonetaryValues PopulateMonetaryValues(List <string> deals, decimal baseCost)
        {
            decimal delivery = CalcDeliveryCost(baseCost);

            MonetaryValues money = new MonetaryValues
            {
                OrderDeals   = deals,
                BaseCost     = baseCost,
                DeliveryCost = delivery,
                FinalCost    = delivery += baseCost
            };

            return(money);
        }
Пример #2
0
        /// <summary>
        /// Create and populate a ReceiptModel object using already created objects.
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="items"></param>
        /// <param name="money"></param>
        /// <returns>A complete ReceiptModel object ready for storage.</returns>
        public static ReceiptModel CreateReceipt(CustomerInfo customer, OrderItems items, MonetaryValues money)
        {
            ReceiptModel r = new ReceiptModel
            {
                CustomerName         = customer.Name,
                CustomerAddressLine1 = customer.Address,
                CustomerPostCode     = customer.Postcode,

                PizzaList = items.OrderPizza,
                SideList  = items.OrderSide,
                DrinkList = items.OrderDrink,

                OrderBaseCost     = money.BaseCost,
                OrderDeliveryCost = money.DeliveryCost,
                OrderReceiptCost  = money.FinalCost,

                EmployeeKey = EmployeeAuthenticator.EmployeeKey
            };

            return(r);
        }