Пример #1
0
 public void AddValue(IValuation valuation)
 {
     Money newValue = ((AvgMarketValue * weight) + (valuation.MarketValue)) / (weight + 1);
     Money newBaseValue = ((AvgBaseMarketValue * weight) + (valuation.BaseMarketValue)) / (weight + 1);
     weight++;
     AvgMarketValue = newValue;
     AvgBaseMarketValue = newBaseValue;
 }
Пример #2
0
 public AverageValuation(IValuation valuation, int period)
 {
     this.instrument = valuation.Instrument;
     this.avgMarketValue = valuation.MarketValue;
     this.avgBaseMarketValue = valuation.BaseMarketValue;
     this.period = period;
     weight = 1;
 }
Пример #3
0
        private void mjButton16_Click(object sender, EventArgs e)
        {
            //#region IoC框架功能(一)
            //IKernel kernel = new StandardKernel();
            //kernel.Bind<IValuation>().To<CommoditySumValuation>();
            //IValuation valuation = kernel.Get<IValuation>();
            //#endregion
            IKernel kernel = new StandardKernel();//(二)

            kernel.Bind <IValuation>().To <CommoditySumValuation>();
            kernel.Bind <IValuationDisCount>().To <DisCount>();
            IValuation valuation = kernel.Get <IValuation>();

            ShoppingCart shoppingCart = new ShoppingCart(valuation);

            MJMessageBox.Show(this, shoppingCart.CommodityTotalPrice().ToString(), "MetroMessagebox", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #4
0
 public ShoppingCart(IValuation valuation)
 {//1.2
     _Valuation = valuation;
 }