Beispiel #1
0
        //public MatchInformation MatchInformation { get; set; }

        public PriceDataJson(string[] data)
        {
            TimeStamp1  = Convert.ToDateTime(data[0]);
            TimeStamp2  = Convert.ToDateTime(data[1]);
            SiteId      = Convert.ToInt32(data[2]);
            MarketId    = Convert.ToInt32(data[3]);
            BetTypeId   = Convert.ToInt32(data[4]);
            EventId     = data[5];
            MatchId     = data[6];
            HandicapKey = Convert.ToInt32(data[7]);
            if (data.Length >= 9)
            {
                OddsData = data[8];
                //MatchInformation = data[9];
                //
                var infoSplit = data[9].Split('|');
                HomeScore       = Convert.ToInt32(infoSplit[0]);
                AwayScore       = Convert.ToInt32(infoSplit[1]);
                HomeRedCard     = Convert.ToInt32(infoSplit[2]);
                AwayRedCard     = Convert.ToInt32(infoSplit[3]);
                MatchTimeHalf   = Convert.ToInt32(infoSplit[4]);
                MatchTimeMinute = Convert.ToInt32(infoSplit[5]);
                //
                var BetType_0_2 = OddsData.Split('^');
                FavouriteType = (BetType_0_2.Length > 4) ? (int?)Convert.ToInt32(BetType_0_2[4]) : null;
            }
        }
Beispiel #2
0
        private void fmFastTM_Load(object sender, EventArgs e)
        {
            WinNumberImpl winService = new WinNumberImpl();

            txtIssue.Text           = winService.GetNewIssue().Body;
            this.txtMoney.KeyPress += new KeyPressEventHandler(Common.TextBox_FilterString_KeyPress);
            Common.BindCustomers(cbxCustomer, (sender1, e1) =>
            {
                if (cbxCustomer.SelectedIndex != 0)
                {
                    OrderImpl orderservice = new OrderImpl();
                    textBox1.Text          = orderservice.GetMaxIndex(cbxCustomer.SelectedValue.ToString(), txtIssue.Text.Trim()).Body.ToString();
                }

                OddsImpl oddservice = new OddsImpl();
                var r = oddservice.GetList(cbxCustomer.SelectedValue.ToTryInt());
                tm    = r.Body.FirstOrDefault(x => x.ChildType == childType);
                if (tm == null)
                {
                    MessageEx.ShowWarning("未设置客户赔率");
                    tm            = new OddsData();
                    tm.CustomerId = cbxCustomer.SelectedValue.ToTryInt();
                    tm.PL         = 00.00M;
                    tm.FS         = 0M;
                }
                Common.CustomerId = cbxCustomer.SelectedValue.ToTryInt();
            });
            listView1.GridLines     = true;
            listView1.FullRowSelect = true;
            listView1.View          = View.Details;
            listView1.Scrollable    = true;
            listView1.MultiSelect   = false;
        }
Beispiel #3
0
 public ActionResult Create(OddsData data)
 {
     try
     {
         _oddsLogic.CreateOdds(data);
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception e)
     {
         return(View());
     }
 }
Beispiel #4
0
 public ActionResult Edit(int id, OddsData data)
 {
     try
     {
         data.Id = id;
         _oddsLogic.EditOdds(data);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #5
0
        public void EditOdds(OddsData data)
        {
            var odd = _context.Odds.Find(data.Id);

            if (odd == null)
            {
                throw new NullReferenceException("Odd not found");
            }
            odd.Name = data.Name;
            odd.Home = data.Home;
            odd.Away = data.Away;
            odd.Draw = data.Draw;
            _context.SaveChanges();
        }
Beispiel #6
0
 public int CreateOdds(OddsData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException();
     }
     try
     {
         var odd = new Odd
         {
             Name = data.Name,
             Home = data.Home,
             Away = data.Away,
             Draw = data.Draw
         };
         _context.Odds.Add(odd);
         _context.SaveChanges();
         return(odd.Id);
     }
     catch (Exception e)
     {
         return(0);
     }
 }
Beispiel #7
0
 public async Task ActionEditOdds(OddsData data)
 {
     _oddsLogic.EditOdds(data);
     var odds = _oddsLogic.GetOdds(new[] { data.Id });
     await Clients.All.SendAsync(ActionCreateModifyOdds, odds);
 }
        public void ConvertToGame() {
            OddsData game = new OddsData();
            decimal oddsCheck = new decimal();

            /*
            2003-09-04 Jets at Redskins
            Team Name	\tSpread	\tOver/Under
            Jets	\t3	\t39
            Redskins	\t-3	\t39
            */

            foreach (var g in FileList) {
                
                DateTime gameTime = new DateTime();

                var splitLine = g.Split(' ');
                int i = 0;  //Reset counter
                

                while (i < splitLine.Count()) {
                    //firstline(2003-09-04 Jets at Redskins)
                    if ((DateTime.TryParse(splitLine[i], out gameTime))) {
                        //Date Parsed
                        game.Date = gameTime;
                        ++i;    //go to next token
                        
                        var temp = i;   //peek variable
                        ++temp; //peek
                        var vTeamFound = TeamNickname.Find(n => n.TrimEnd() == splitLine[i]);

                        if (temp < splitLine.Count() && splitLine[temp] == "at" && vTeamFound != null) { //if at is peek away team found

                            game.VisTeam = vTeamFound.TrimEnd();
                            ++i;    //actual count catch up to peek(temp)
                        }
                        
                        ++i;    //next token past at on to hometeam
                        var hTeamFound = TeamNickname.Find(n => n.TrimEnd() == splitLine[i]);

                        if (hTeamFound != null) {

                            game.HomeTeam = hTeamFound.TrimEnd();
                        }   
                    }
                    
                    //second line(Team Name	\tSpread	\tOver/Under)
                    if (i == 0 && splitLine[i] == "Team")
                        i = splitLine.Count();  //skip, line not needed


                    //third line(Jets	\t3	\t39)
                    if (i == 0 && splitLine[i] == game.VisTeam) {

                        ++i;    //visteam found, add spread
                        game.VisSpread = splitLine[i];
                        ++i;    //nextToken
                        oddsCheck = Convert.ToDecimal(splitLine[i]);
                    }

                    //FourthLine(Redskins	\t-3	\t39)
                    if (i == 0 && splitLine[i] == game.HomeTeam) {
                        ++i;     //hometeam found, add spread, check odds and add
                        game.HomeSpread = splitLine[i];
                        ++i;    //nextToken
                        if (oddsCheck == Convert.ToDecimal(splitLine[i]))
                            game.OverUnder = oddsCheck;
                    }

                    i++;  //prevent inf loop.
                }

                

            }
        }