コード例 #1
0
        /*
         * Check credit card number
         * Calculate total amount of charge (unit price * quantity + tax + shipping)
         * Send confirmation to retailer
         */
        public void ProcessOrder(object parameters)
        {
            object[] boxedParams = (object[])parameters;

            Order order = (Order)boxedParams[0];
            IChickenFarmCallback callBack = (IChickenFarmCallback)boxedParams[1];

            ProcessedOrder pOrder;
            if(validateCreditCard(order.CreditCardNumber))
            {
                pOrder = new ProcessedOrder(true, order, mPricingModel.TodaysPrice());
                mPricingModel.AddSale(order.AmountOfChickens);
            }else{
                pOrder = new ProcessedOrder(false, order);
            }

            callBack.OrderConfirmation(pOrder);
        }
コード例 #2
0
        /*
         * Check credit card number
         * Calculate total amount of charge (unit price * quantity + tax + shipping)
         * Send confirmation to retailer
         */
        public void ProcessOrder(object parameters)
        {
            object[] boxedParams = (object[])parameters;

            Order order = (Order)boxedParams[0];
            IChickenFarmCallback callBack = (IChickenFarmCallback)boxedParams[1];

            ProcessedOrder pOrder;

            if (validateCreditCard(order.CreditCardNumber))
            {
                pOrder = new ProcessedOrder(true, order, mPricingModel.TodaysPrice());
                mPricingModel.AddSale(order.AmountOfChickens);
            }
            else
            {
                pOrder = new ProcessedOrder(false, order);
            }

            callBack.OrderConfirmation(pOrder);
        }