コード例 #1
0
        /*
         * Queries the service to see if a discount is running for today. If so, it will update the view's discount banner
         */
        private void CheckForDiscounts()
        {
            double       discountPercentage = 0;
            DiscountItem discount           = _service.GetDiscount(DateTime.Now);

            if (discount != null)
            {
                discountPercentage = Math.Round(discount.Size * 100, 0);
                String bannerText = String.Format("{0}% sale ends on {1}!", discountPercentage.ToString(), discount.End.ToShortDateString());
                _view.SetDiscountBanner(bannerText);
            }
        }