Ejemplo n.º 1
0
        private CurrencyRateConverter[,] UpdateCurrenciesArray()
        {
            object o = CacheManager.GetCached(CurrencyRate.CURRENCY_RATE);

            if (o != null)
            {
                CacheManager.ExpireItem(CurrencyRate.CURRENCY_RATE);
            }

            ICriteria crit = NHibernateSession.CreateCriteria(typeof(CurrencyRateView));

            crit.AddOrder(new Order("FromCurrency", true));
            crit.AddOrder(new Order("ToCurrency", true));

            IList <CurrencyRateView> tmp = crit.List <CurrencyRateView>();

            int indice = Convert.ToInt32(Math.Pow(tmp.Count, Convert.ToDouble(1) / 2));

            CurrencyRateConverter[,] lst = new CurrencyRateConverter[indice, indice];
            foreach (CurrencyRateView currencyRateView in tmp)
            {
                lst[currencyRateView.FromCurrency.ID - 1, currencyRateView.ToCurrency.ID - 1] = new CurrencyRateConverter(currencyRateView.ToCurrency.Description, currencyRateView.Rate);
            }
            o = lst;

            CacheManager.AddItem(CurrencyRate.CURRENCY_RATE, o);

            return(lst);
        }
        /// <summary>
        /// Registers all components needed for a normal wash tunnel.
        /// The tunnel will wash a vehicle regardless if it is 'clean' or 'dirty'.
        /// </summary>
        public static IContainer AddWashTunnel(this IContainer container)
        {
            container.AddSingleton <IMotherboard, Motherboard>();
            container.AddSingleton <IMemory, RandomAccessMemory>();
            container.AddSingleton <IWashStepNotifier, WashStepNotifier>();

            container.AddTransient <IUserPanel, UserPanel>();
            container.AddTransient <IWashTunnel, WashTunnel>();

            ILegacyCurrencyRateConverter legacyConverter = LegacyCurrencyRateConverterProxy.Instance.Authenticate("solid-tunnel-00F1BDE0-AC18-452B-A628-B8FB0335DAB6");
            ICurrencyRateConverter       converter       = new CurrencyRateConverter(legacyConverter, ConfigMap.GetLegacyCurrencies());

            container.AddSingleton(() => converter);
            container.AddSingleton <IPriceCalculatorFactory>(() => new PriceCalculatorFactory(ConfigMap.GetPriceCalculators(converter)));

            container.AddTransient <IInvoiceBuilder, InvoiceBuilder>();
            container.AddTransient <ICustomWashProgramBuilder, CustomWashProgramBuilder>();
            container.AddSingleton <IWashProgramFactory>(() => new WashProgramFactory(ConfigMap.GetWashPrograms()));

            return(container);
        }