public IActionResult Index(string year, string month) { month = _lotteryDataRegularization.regularizeMonth(month); bool IsPrizeNumberExist = _eFPrizeNumberRepository.IsDataExist(year, month); if (IsPrizeNumberExist) { _prizeNumberAccess = new AcessDB(); _prizeNumberList = _prizeNumberAccess.getPrizeNumber(year, month); setShowingParameter(); showPrizeInfo(_prizeNumber); } else { _prizeNumberAccess = new AccessWEB(); _prizeNumberList = _prizeNumberAccess.getPrizeNumber(year, month); if (_prizeNumberList != null && _prizeNumberList.Count != 0) { _prizeNumberList = _lotteryDataRegularization.regularString(_prizeNumberList); InsertToDB(year, month); setShowingParameter(); showPrizeInfo(_prizeNumber); } else { ViewBag.NULL = "請輸入日期資訊。"; } } return(View()); }
public IActionResult CheckLottery(PrizeNumberInfo userInfo) { #region Variable LotteryNumberJudgment lotteryNumber; List <string> userData; Dictionary <string, int> result; UserResponse userResponse; ResultParsing resultParsing; #endregion userInfo.Month = _lotteryDataRegularization.regularizeMonth(userInfo.Month); bool IsPrizeNumberExist = _eFPrizeNumberRepository.IsDataExist(userInfo.Year, userInfo.Month); if (IsPrizeNumberExist) { _prizeNumberAccess = new AcessDB(); _prizeNumberList = _prizeNumberAccess.getPrizeNumber(userInfo.Year, userInfo.Month); } else { _prizeNumberAccess = new AccessWEB(); _prizeNumberList = _prizeNumberAccess.getPrizeNumber(userInfo.Year, userInfo.Month); } if (_prizeNumberList != null && _prizeNumberList.Count != 0) { _prizeNumberList = _lotteryDataRegularization.regularString(_prizeNumberList); userData = new List <string>(); userData = _lotteryDataRegularization.processUserData(userInfo.LotteryNumberInfo); lotteryNumber = new LotteryNumberJudgment(userData); result = new Dictionary <string, int>(); userResponse = new UserResponse(); result = lotteryNumber.decidePrizeType(_prizeNumberList); resultParsing = new ResultParsing(); userResponse.WonNumbers = resultParsing.getWiningNumber(result); userResponse.WonName = resultParsing.getWiningNumberName(result); userResponse.LosedNumber = resultParsing.getLosedNumber(userData, result); showResult(userResponse); } return(View()); }