Beispiel #1
0
        public ActionResult NormaliseOddSelection(string normal)
        {
            if (System.IO.File.Exists(BetConstants.normalizedFilePath))
            {
                NormalisedSelections = FileUtility.LoadFromXML <NormalisedSelection>(BetConstants.normalizedFilePath);
            }
            if (!string.IsNullOrWhiteSpace(normal) & NormalisedSelections != null)
            {
                SubmittedNormal = NormalisedSelections.FirstOrDefault(m => m.Normal == normal);
            }

            var bet9jaMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.bet9jaFilePath).OrderByDescending(m => m.Odds.Count());

            var sportyBetMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.sportyBetFilePath).OrderByDescending(m => m.Odds.Count());

            var betPawaMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.betPawaFilePath).OrderByDescending(m => m.Odds.Count());

            var merryBetMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.merryBetFilePath).OrderByDescending(m => m.Odds.Count());

            var largestSelectionMatchBet9ja    = bet9jaMatches.First();
            var largestSelectionMatchBetPawa   = betPawaMatches.First();
            var largestSelectionMatchMerryBet  = merryBetMatches.First();
            var largestSelectionMatchSportyBet = sportyBetMatches.First();

            if (NormalisedSelections != null)
            {
                largestSelectionMatchBet9ja.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.Bet9ja == null?false: m.Bet9ja.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
                largestSelectionMatchBetPawa.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.BetPawa == null ? false : m.BetPawa.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
                largestSelectionMatchMerryBet.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.MerryBet == null ? false : m.MerryBet.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
                largestSelectionMatchSportyBet.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.SportyBet == null ? false : m.SportyBet.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
            }

            ViewBag.Bet9jaOdds    = largestSelectionMatchBet9ja.Odds.OrderBy(m => m.SelectionFull).ToList();
            ViewBag.BetPawaOdds   = largestSelectionMatchBetPawa.Odds.OrderBy(m => m.SelectionFull).ToList();
            ViewBag.MerryBetOdds  = largestSelectionMatchMerryBet.Odds.OrderBy(m => m.SelectionFull).ToList();
            ViewBag.SportyBetOdds = largestSelectionMatchSportyBet.Odds.OrderBy(m => m.SelectionFull).ToList();

            return(View(SubmittedNormal));
        }
Beispiel #2
0
        public ActionResult NormaliseOddSelection(string nval, NormalisedSelection NS)
        {
            var folder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "xml/");

            if (System.IO.File.Exists(BetConstants.normalizedFilePath))
            {
                NormalisedSelections = FileUtility.LoadFromXML <NormalisedSelection>(BetConstants.normalizedFilePath);
            }
            else
            {
                NormalisedSelections = new List <NormalisedSelection>();
            }

            if (string.IsNullOrWhiteSpace(NS.Normal))
            {
                ViewBag.Msg = "Error! The Normal nust not be empty.";
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(nval) && NormalisedSelections != null && NS.Normal == nval)
                {
                    var editNormal = NormalisedSelections.FirstOrDefault(n => n.Normal == nval);
                    if (editNormal == null)
                    {
                        ViewBag.Msg = "Error! The Normal to edit does not exist.";
                    }
                    else
                    {
                        editNormal.NairaBet  = NS.NairaBet;
                        editNormal.MerryBet  = NS.MerryBet;
                        editNormal.Bet9ja    = NS.Bet9ja;
                        editNormal.BetPawa   = NS.BetPawa;
                        editNormal.SportyBet = NS.SportyBet;

                        ViewBag.Msg = FileUtility.SaveToXML(NormalisedSelections, BetConstants.normalizedFilePath);
                    }
                }
                else if (NormalisedSelections != null && NormalisedSelections.Any(m => m.Normal == NS.Normal))
                {
                    ViewBag.Msg = "Error! The Normal already exists.";
                }
                else
                {
                    NormalisedSelections.Add(NS);
                    ViewBag.Msg = FileUtility.SaveToXML(NormalisedSelections, BetConstants.normalizedFilePath);
                }
            }

            var bet9jaMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.bet9jaFilePath).OrderByDescending(m => m.Odds.Count());

            var sportyBetMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.sportyBetFilePath).OrderByDescending(m => m.Odds.Count());

            var betPawaMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.betPawaFilePath).OrderByDescending(m => m.Odds.Count());

            var merryBetMatches = FileUtility.LoadFromXML <BetMatch>(BetConstants.merryBetFilePath).OrderByDescending(m => m.Odds.Count());

            var largestSelectionMatchBet9ja    = bet9jaMatches.First();
            var largestSelectionMatchBetPawa   = betPawaMatches.First();
            var largestSelectionMatchMerryBet  = merryBetMatches.First();
            var largestSelectionMatchSportyBet = sportyBetMatches.First();

            if (NormalisedSelections != null)
            {
                largestSelectionMatchBet9ja.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.Bet9ja == null ? false : m.Bet9ja.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
                largestSelectionMatchBetPawa.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.BetPawa == null ? false : m.BetPawa.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
                largestSelectionMatchMerryBet.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.MerryBet == null ? false : m.MerryBet.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
                largestSelectionMatchSportyBet.Odds.RemoveAll(x => NormalisedSelections.Any(m => m.SportyBet == null ? false : m.SportyBet.Replace(" ", "") == x.SelectionFull.Replace(" ", "")));
            }

            ViewBag.Bet9jaOdds    = largestSelectionMatchBet9ja.Odds.OrderBy(m => m.SelectionFull).ToList();
            ViewBag.BetPawaOdds   = largestSelectionMatchBetPawa.Odds.OrderBy(m => m.SelectionFull).ToList();
            ViewBag.MerryBetOdds  = largestSelectionMatchMerryBet.Odds.OrderBy(m => m.SelectionFull).ToList();
            ViewBag.SportyBetOdds = largestSelectionMatchSportyBet.Odds.OrderBy(m => m.SelectionFull).ToList();

            return(View(NS));
        }