Exemplo n.º 1
0
        public static int CalcPrice(CalcParameter param)
        {
            var result = 0;

            for (var i = 0; i < param.Units.Length; i++)
            {
                var lotteryType   = (LotteryType)Enum.ToObject(typeof(LotteryType), i);
                var factory       = new LotteryFactory();
                var targetLottery = factory.Create(lotteryType);
                result += targetLottery.CalcTotalPrice(param.Units[i]);
            }

            return(result);
        }
Exemplo n.º 2
0
        public static IDictionary <string, List <int[]> > MakeLotteryNumbers(CalcParameter param)
        {
            var result = new Dictionary <string, List <int[]> >();

            for (var i = 0; i < param.Units.Length; i++)
            {
                var lotteryName    = Enum.GetName(typeof(LotteryType), i);
                var lotteryNumbers = new List <int[]>();
                for (var j = 0; j < param.Units[i]; j++)
                {
                    lotteryNumbers.Add(MakeLotteryNumbers((LotteryType)Enum.ToObject(typeof(LotteryType), i)));
                }
                result[lotteryName] = lotteryNumbers;
            }

            return(result);
        }