view MetroWpf/FxRates.Common/FxRate.cs @ 46:8e6458270599

Initial load
author Steven Hollidge <stevenhollidge@hotmail.com>
date Fri, 06 Apr 2012 17:13:35 +0100
parents a8b50a087544
children
line wrap: on
line source

using System;

namespace FxRates.Common
{
    public class FxRate : IFxRate
    {
        private FxRate(Ccy ccy, decimal bid, decimal offer, DateTime timestamp)
        {
            Ccy = ccy;
            Bid = bid;
            PreviousOffer = offer;
            Offer = offer;
            Timestamp = timestamp;
        }

        #region IFxRate Members

        public decimal Bid { get; private set; }
        public Ccy Ccy { get; private set; }
        public decimal Offer { get; private set; }
        public decimal PreviousOffer { get; private set; }
        public DateTime Timestamp { get; private set; }

        #endregion

        public static FxRate Create(Ccy ccy, decimal bid, decimal offer, DateTime timestamp)
        {
            return new FxRate(ccy, bid, offer, timestamp);
        }

        public void UpdatePrice(decimal bid, decimal offer, DateTime timestamp)
        {
            Bid = bid;
            PreviousOffer = Offer;
            Offer = offer;
            Timestamp = timestamp;
        }
    }
}