Example #1
0
        //SOCCER
        private csGame ScoresSoccer(csGame g, csGame DGS)
        {
            try
            {
                parameters.Add("@pIdEvent", g.EventId);
                dataset = csDonBest.ExecutePA("[dbo].[web_getSoccerScore]", parameters);
                int sum = dataset.Tables[0].Rows.Count;

                if (sum > 0 && sum <= 2)
                {
                    g.VisitorScoreDonBest = 0;
                    g.HomeScoreDonBest    = 0;

                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        g.VisitorScoreDonBest += (!String.IsNullOrWhiteSpace(fila["away_score"].ToString())) ? Convert.ToInt32(fila["away_score"].ToString()) : 0;
                        g.HomeScoreDonBest    += (!String.IsNullOrWhiteSpace(fila["home_score"].ToString())) ? Convert.ToInt32(fila["home_score"].ToString()) : 0;
                    }
                }
            }
            catch (Exception ex)
            {
                g.VisitorScoreDonBest = null;
                g.HomeScoreDonBest    = null;
            }
            return(g);
        }
Example #2
0
        //  Our Lines
        public csBet OurNextLine(csBet b, csGame g)
        {
            try
            {
                parameters.Add("@pDate", b.PlacedDate);
                parameters.Add("@pIdGame", g.IdGame);
                parameters.Add("@pPlay", b.Play);

                dataset = csConnection.ExecutePA("[dbo].[web_getOurNextLine]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    b.OurNextLine = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                }
            }
            catch (Exception ex)
            {
                b.OurJuice  = 0;
                b.OurPoints = 0;
            }
            finally
            {
                parameters.Clear();
            }

            return(b);
        }
Example #3
0
        private csGame GetParent(csGame g)
        {
            if (g != null)
            {
                try
                {
                    parameters.Clear();
                    parameters.Add("@pParentId", g.ParentNumber);
                    dataset = csConnection.ExecutePA("[dbo].[web_getParentScore]", parameters);

                    if (dataset.Tables[0].Rows.Count == 1)
                    {
                        g.IdGame         = Convert.ToInt32(dataset.Tables[0].Rows[0]["IdGame"]);
                        g.HomeNumber     = Convert.ToInt32(dataset.Tables[0].Rows[0]["HomeNumber"]);
                        g.VisitorNumber  = Convert.ToInt32(dataset.Tables[0].Rows[0]["VisitorNumber"]);
                        g.VisitorTeamAux = dataset.Tables[0].Rows[0]["VisitorTeam"].ToString();
                        g.HomeTeamAux    = dataset.Tables[0].Rows[0]["HomeTeam"].ToString();
                        return(g);
                    }
                }
                catch (Exception ex)
                {
                    return(g);
                }
            }
            return(g);
        }
Example #4
0
        private csGame ScoresFighting(csGame g, csGame DGS)
        {
            try
            {
                parameters.Add("@pIdEvent", g.EventId);
                parameters.Add("@pPeriod", CastPeriodScore(g, DGS));
                dataset = csDonBest.ExecutePA("[dbo].[web_GetScore]", parameters);
                int sum = dataset.Tables[0].Rows.Count;

                if (sum == 1)
                {
                    String V = dataset.Tables[0].Rows[0]["away_description"].ToString();
                    String H = dataset.Tables[0].Rows[0]["home_description"].ToString();

                    if (H.ToUpper() == "WIN")
                    {
                        g.VisitorScoreDonBest = 0;
                        g.HomeScoreDonBest    = 1;
                    }
                    else if (V.ToUpper() == "WIN")
                    {
                        g.VisitorScoreDonBest = 1;
                        g.HomeScoreDonBest    = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                g.VisitorScoreDonBest = null;
                g.HomeScoreDonBest    = null;
            }

            return(g);
        }
Example #5
0
        private csGame FindLive(csGame g)
        {
            try
            {
                g.isLive = ((g.VisitorNumber > 9000 || g.VisitorNumber < 10000) && (g.IdSportDonBest == "3" || g.IdSportDonBest == "1")) ? 1 : 0;

                // ******************   is Live   *****************
                if (g.isLive == 1)
                {
                    parameters.Add("@pRot", g.VisitorNumber.ToString().Substring(1, g.VisitorNumber.ToString().Length - 1));
                    parameters.Add("@pDate", g.GameDate);
                    parameters.Add("@pIdSport", Convert.ToInt32(g.IdSportDonBest.Trim()));
                    dataset = csDonBest.ExecutePA("[dbo].[web_findEvent]", parameters);
                    if (dataset.Tables[0].Rows.Count == 1)
                    {
                        g.EventId       = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                        g.VisitorNumber = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_away_rot"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in chech if it is Live: " + ex.Message);
            }
            return(g);
        }
Example #6
0
        //************************************************************************************

        public csGame TotalRisk(csGame g)
        {
            try
            {
                parameters.Clear();
                parameters.Add("@pIdGame", g.IdGame);
                parameters.Add("@pPlay", -1);
                dataset = csG8Apps.ExecutePA("[dbo].[web_betsByGame]", parameters);;

                if (dataset.Tables[0].Rows.Count > 0)
                {
                    ObservableCollection <csLine> data = new ObservableCollection <csLine>();
                    foreach (System.Data.DataRow fila in dataset.Tables[0].Rows)
                    {
                        csLine line = new csLine();
                        line.IdWager   = Convert.ToInt32(fila["IdWager"]);
                        line.WagerPlay = fila["WagerPlay"].ToString().ToUpper();
                        line.Risk      = Convert.ToDouble(fila["RiskAmount"]);
                        line.WagerType = fila["WAGERTYPE"].ToString();
                        data.Add(line);
                    }


                    if (data != null)
                    {
                        List <int> Enteros = new List <int>();
                        foreach (var i in data)
                        {
                            if (!i.WagerType.ToUpper().Contains("STRAIGHT"))
                            {
                                if (!Enteros.Contains(Convert.ToInt32(i.IdWager)))
                                {
                                    Enteros.Add(i.IdWager);
                                    g.RISK += i.Risk;
                                    g.BETS += 1;
                                }
                            }
                            else
                            {
                                g.RISK += i.Risk;
                                g.BETS += 1;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                parameters.Clear();
            }

            return(g);
        }
Example #7
0
        private csGame SetLine(csGame g, string order, int case1, int case2, int?idLineType)
        {
            parameters.Clear();
            parameters.Add("@pIdGame", g.IdGame);
            parameters.Add("@pPlay", case1);
            parameters.Add("@pPlay2", case2);
            parameters.Add("@pFisrtEnd", order);
            parameters.Add("@pIdLineType", idLineType);

            dataset = csConnection.ExecutePA("[dbo].[web_OrderLines]", parameters);

            if (dataset.Tables[0].Rows.Count > 0)
            {
                if (case1 == 0 && order == "E")
                {
                    g.ClSpreadVis = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                    g.ClSpreadHom = dataset.Tables[0].Rows[0]["ChangeValue2"].ToString();
                }
                else if (case1 == 2 && order == "E")
                {
                    g.ClTotalOver  = dataset.Tables[0].Rows[0]["ChangeValue"].ToString().Replace("o", "").Trim();
                    g.ClTotalUnder = dataset.Tables[0].Rows[0]["ChangeValue2"].ToString().Replace("u", "").Trim();
                }
                else if (case1 == 4 && order == "E")
                {
                    g.ClMoneyLineVis = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                    g.ClMoneyLineHom = dataset.Tables[0].Rows[0]["ChangeValue2"].ToString();
                }
                else if (case1 == 6 && order == "E")
                {
                    g.ClDraw = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                }

                // ********************************     FINAL    **********************************+++++

                else if (case1 == 0 && order == "F")
                {
                    g.OpSpreadVis = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                    g.OpSpreadHom = dataset.Tables[0].Rows[0]["ChangeValue2"].ToString();
                }
                else if (case1 == 2 && order == "F")
                {
                    g.OpTotalOver  = dataset.Tables[0].Rows[0]["ChangeValue"].ToString().Replace("o", "").Trim();
                    g.OpTotalUnder = dataset.Tables[0].Rows[0]["ChangeValue2"].ToString().Replace("u", "").Trim();
                }
                else if (case1 == 4 && order == "F")
                {
                    g.OpMoneyLineVis = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                    g.OpMoneyLineHom = dataset.Tables[0].Rows[0]["ChangeValue2"].ToString();
                }
                else if (case1 == 6 && order == "F")
                {
                    g.OpDraw = dataset.Tables[0].Rows[0]["ChangeValue"].ToString();
                }
            }
            return(g);
        }
Example #8
0
 //get the rot between games
 private int CastRot(csGame g)
 {
     if (g.IdSportDonBest == "4" && g.VisitorNumber >= 1000)
     {
         return(Converter(g));
     }
     return((g.Period == 0) ? (g.IdSportDonBest == "5" && g.VisitorNumber > 9000 && g.VisitorNumber < 10000) ? Converter(g) :
            (g.IdSportDonBest == "3" && (g.VisitorNumber > 4000 && g.VisitorNumber < 6000)) ? Converter(g) : g.VisitorNumber
     : Converter(g));
 }
Example #9
0
        public csGame FindEventLight(csGame g)
        {
            try
            {
                parameters.Add("@pRot", CastRot(g));
                parameters.Add("@pDate", g.GameDate);
                parameters.Add("@pIdSport", Convert.ToInt32(g.IdSportDonBest));
                dataset = csDonBest.ExecutePA("[dbo].[web_findEvent]", parameters);

                if (dataset.Tables[0].Rows.Count == 1)
                {
                    g.EventId = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                }
                else
                {
                    if (g.VisitorTeam.ToUpper().Contains("ALT LINE") || g.HomeTeam.ToUpper().Contains("ALT LINE") ||
                        g.LeagueName.ToUpper().Contains("ALTERN"))
                    {
                        parameters.Add("@pVisitorTeam", g.VisitorTeam.ToUpper().Replace("ALT LINE", "").Trim());
                        parameters.Add("@pHomeTeam", g.HomeTeam.ToUpper().Replace("ALT LINE", "").Trim());
                        parameters.Add("@pDate", g.GameDate.Year + "-" + g.GameDate.Month + "-" + g.GameDate.Day);
                        dataset = csDonBest.ExecutePA("[dbo].[web_getGameWithValue]", parameters);

                        if (dataset.Tables[0].Rows.Count == 1)
                        {
                            g.EventId = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                        }
                        else
                        {
                            parameters.Add("@pVisitorTeam", g.VisitorTeam.ToUpper().Replace("ALT LINE", "").Trim());
                            parameters.Add("@pHomeTeam", g.HomeTeam.ToUpper().Replace("ALT LINE", "").Trim());
                            parameters.Add("@pDate", g.GameDate.Year + "-" + g.GameDate.Month + "-" + g.GameDate.Day);
                            dataset = csDonBest.ExecutePA("[dbo].[web_getGameWithValue]", parameters);

                            if (dataset.Tables[0].Rows.Count == 1)
                            {
                                g.EventId = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine("Errot to find the evendId: " + ex.Message + " Wager: " + g.IdGame);
                g.EventId = 0;
            }
            return(g);
        }
Example #10
0
 private string CastPeriod(csGame g)
 {
     if (g.Period == 0)
     {
         return("FG");
     }
     else if (g.Period == 1)
     {
         return("1H");
     }
     else if (g.Period == 2)
     {
         return("2H");
     }
     else if (g.Period == 3)
     {
         return("1Q");
     }
     else if (g.Period == 4)
     {
         return("2Q");
     }
     else if (g.Period == 5)
     {
         return("3Q");
     }
     else if (g.Period == 6)
     {
         return("4Q");
     }
     else if (g.Period == 7)
     {
         return("1P");
     }
     else if (g.Period == 8)
     {
         return("2P");
     }
     else if (g.Period == 9)
     {
         return("3P");
     }
     else if (g.Period == 10)
     {
         return("OT");
     }
     return("");
 }
Example #11
0
        public csGame FindEvent(csGame g)
        {
            parameters.Add("@pRot", CastRot(g));
            parameters.Add("@pDate", g.GameDate);
            parameters.Add("@pIdSport", Convert.ToInt32(g.IdSportDonBest.Trim()));
            dataset = csDonBest.ExecutePA("[dbo].[web_findEvent]", parameters);

            if (dataset.Tables[0].Rows.Count == 1)
            {
                g.EventId = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                //g = FindLive(g);
            }
            else
            {
                if (g.VisitorTeam.ToUpper().Contains("ALT LINE") || g.HomeTeam.ToUpper().Contains("ALT LINE") ||
                    g.LeagueName.ToUpper().Contains("ALTERN"))
                {
                    parameters.Add("@pVisitorTeam", g.VisitorTeam.ToUpper().Replace("ALT LINE", "").Trim());
                    parameters.Add("@pHomeTeam", g.HomeTeam.ToUpper().Replace("ALT LINE", "").Trim());
                    parameters.Add("@pDate", g.GameDate.Year + "-" + g.GameDate.Month + "-" + g.GameDate.Day);
                    dataset = csDonBest.ExecutePA("[dbo].[web_getGameWithValue]", parameters);

                    if (dataset.Tables[0].Rows.Count == 1)
                    {
                        g.EventId = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                    }
                    else
                    {
                        csGame gAux = new csGame();
                        gAux = GetParent(g);
                        parameters.Add("@pVisitorTeam", gAux.VisitorTeamAux.ToUpper().Replace("ALT LINE", "").Trim());
                        parameters.Add("@pHomeTeam", gAux.HomeTeamAux.ToUpper().Replace("ALT LINE", "").Trim());
                        parameters.Add("@pDate", g.GameDate.Year + "-" + g.GameDate.Month + "-" + g.GameDate.Day);
                        dataset = csDonBest.ExecutePA("[dbo].[web_getGameWithValue]", parameters);

                        if (dataset.Tables[0].Rows.Count == 1)
                        {
                            g.EventId = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                        }
                    }
                }
            }

            return(g);
        }
Example #12
0
        public csGame GetGame(int idGame)
        {
            parameters.Add("@pIdGame", idGame);
            dataset = csConnection.ExecutePA("[dbo].[web_getGameById]", parameters);
            csGame g = new csGame();

            if (dataset.Tables[0].Rows.Count == 1)
            {
                g.VisitorNumber  = Convert.ToInt32(dataset.Tables[0].Rows[0]["VisitorNumber"].ToString());
                g.LeagueName     = dataset.Tables[0].Rows[0]["Description"].ToString();
                g.VisitorTeam    = dataset.Tables[0].Rows[0]["VisitorTeam"].ToString();
                g.HomeTeam       = dataset.Tables[0].Rows[0]["HomeTeam"].ToString();
                g.IdSportDGS     = dataset.Tables[0].Rows[0]["IdSport"].ToString();
                g.Period         = Convert.ToInt32(dataset.Tables[0].Rows[0]["Period"].ToString());
                g.IdSportDonBest = CastIdSportDonBest((g.IdSportDGS == "TNT" || g.IdSportDGS == "MU") ? inter.Interpretar(g.LeagueName).Trim() : g.IdSportDGS.Trim()).ToString();
                g.GameDate       = Convert.ToDateTime(dataset.Tables[0].Rows[0]["EventDate"].ToString());
            }

            return(g);
        }
Example #13
0
        private csGame ScoresGeneral(csGame g, csGame DGS)
        {
            try
            {
                parameters.Add("@pIdEvent", g.EventId);
                parameters.Add("@pPeriod", CastPeriodScore(g, DGS));
                dataset = csDonBest.ExecutePA("[dbo].[web_GetScore]", parameters);
                int sum = dataset.Tables[0].Rows.Count;

                if (sum == 1)
                {
                    g.VisitorScoreDonBest = (!String.IsNullOrWhiteSpace(dataset.Tables[0].Rows[0]["away_score"].ToString()))? Convert.ToInt32(dataset.Tables[0].Rows[0]["away_score"].ToString()) : g.VisitorScoreDonBest;
                    g.HomeScoreDonBest    = (!String.IsNullOrWhiteSpace(dataset.Tables[0].Rows[0]["home_score"].ToString())) ? Convert.ToInt32(dataset.Tables[0].Rows[0]["home_score"].ToString()) : g.HomeScoreDonBest;
                }
            }
            catch (Exception ex)
            {
                g.VisitorScoreDonBest = null;
                g.HomeScoreDonBest    = null;
            }
            return(g);
        }
Example #14
0
        private csGame ScoresGolf2(csGame g, csGame DGS)
        {
            try
            {
                parameters.Add("@pIdEvent", g.EventId);
                parameters.Add("@pPeriod", CastPeriodScore(g, DGS));
                dataset = csDonBest.ExecutePA("[dbo].[web_GetScore]", parameters);
                int sum = dataset.Tables[0].Rows.Count;

                if (sum == 1)
                {
                    int V = Convert.ToInt32(dataset.Tables[0].Rows[0]["away_score"].ToString());
                    int H = Convert.ToInt32(dataset.Tables[0].Rows[0]["home_score"].ToString());

                    if (V == H)
                    {
                        g.HomeScoreDonBest    = 1;
                        g.VisitorScoreDonBest = 1;
                    }
                    else if (V > H)
                    {
                        g.HomeScoreDonBest    = 1;
                        g.VisitorScoreDonBest = 0;
                    }
                    else if (V < H)
                    {
                        g.HomeScoreDonBest    = 0;
                        g.VisitorScoreDonBest = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                g.VisitorScoreDonBest = null;
                g.HomeScoreDonBest    = null;
            }
            return(g);
        }
Example #15
0
        public csGame SetValues(csGame g, int?idLineType)
        {
            try
            {
                parameters.Add("@pIdGame", g.IdGame);
                parameters.Add("@pIdLineType", idLineType);
                dataset = csConnection.ExecutePA("[dbo].[spListGameVales]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    DataRow fila = dataset.Tables[0].Rows[0];

                    if (!String.IsNullOrWhiteSpace(fila["VisitorSpread"].ToString()) && !String.IsNullOrWhiteSpace(fila["VisitorSpreadOdds"].ToString()))
                    {
                        g.ClSpreadVis = fila["VisitorSpread"].ToString() + " " + fila["VisitorSpreadOdds"].ToString();
                    }
                    else
                    {
                        g.ClSpreadVis = null;
                    }

                    if (!String.IsNullOrWhiteSpace(fila["HomeSpread"].ToString()) && !String.IsNullOrWhiteSpace(fila["HomeSpreadOdds"].ToString()))
                    {
                        g.ClSpreadHom = fila["HomeSpread"].ToString() + " " + fila["HomeSpreadOdds"].ToString();
                    }
                    else
                    {
                        g.ClSpreadHom = null;
                    }

                    if (!String.IsNullOrWhiteSpace(fila["VisitorOdds"].ToString()))
                    {
                        g.ClMoneyLineVis = fila["VisitorOdds"].ToString();
                    }
                    else
                    {
                        g.ClMoneyLineVis = null;
                    }

                    if (!String.IsNullOrWhiteSpace(fila["HomeOdds"].ToString()))
                    {
                        g.ClMoneyLineHom = fila["HomeOdds"].ToString();
                    }
                    else
                    {
                        g.ClMoneyLineHom = null;
                    }

                    if (!String.IsNullOrWhiteSpace(fila["VisitorSpecialOdds"].ToString()))
                    {
                        g.ClDraw = fila["VisitorSpecialOdds"].ToString();
                    }
                    else
                    {
                        g.ClDraw = null;
                    }

                    if (!String.IsNullOrWhiteSpace(fila["TotalOver"].ToString()) &&
                        !String.IsNullOrWhiteSpace(fila["OverOdds"].ToString()))
                    {
                        g.ClTotalOver = fila["TotalOver"].ToString() + " " + fila["OverOdds"].ToString();
                    }
                    else
                    {
                        g.ClTotalOver = null;
                    }

                    if (!String.IsNullOrWhiteSpace(fila["TotalUnder"].ToString()) &&
                        !String.IsNullOrWhiteSpace(fila["UnderOdds"].ToString()))
                    {
                        g.ClTotalUnder = fila["TotalUnder"].ToString() + " " + fila["UnderOdds"].ToString();
                    }
                    else
                    {
                        g.ClTotalUnder = null;
                    }

                    if (g.ClSpreadVis == null && g.ClSpreadHom == null)
                    {
                        g = SetLine(g, "E", 0, 1, idLineType);
                    }
                    if (g.ClTotalOver == null && g.ClTotalUnder == null)
                    {
                        g = SetLine(g, "E", 2, 3, idLineType);
                    }
                    if (g.ClMoneyLineVis == null && g.ClMoneyLineHom == null)
                    {
                        g = SetLine(g, "E", 4, 5, idLineType);
                    }
                    if (g.ClDraw == null)
                    {
                        g = SetLine(g, "E", 6, 6, idLineType);
                    }

                    if (g.OpSpreadVis == null && g.OpSpreadHom == null)
                    {
                        g = SetLine(g, "F", 0, 1, idLineType);
                    }
                    if (g.OpTotalOver == null && g.OpTotalUnder == null)
                    {
                        g = SetLine(g, "F", 2, 3, idLineType);
                    }
                    if (g.OpMoneyLineVis == null && g.OpMoneyLineHom == null)
                    {
                        g = SetLine(g, "F", 4, 5, idLineType);
                    }
                    if (g.OpDraw == null)
                    {
                        g = SetLine(g, "F", 6, 6, idLineType);
                    }
                }
            }
            catch (Exception ex)
            {
                return(g);
            }
            finally
            {
                parameters.Clear();
            }
            return(g);
        }
Example #16
0
        //CAST PERIOD TO SCORE
        private string CastPeriodScore(csGame g, csGame DGS)
        {
            try
            {
                if (g.IdSportDonBest.Trim() == "1") //football
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 1)
                    {
                        return("1H");
                    }
                    else if (DGS.Period == 2)
                    {
                        return("2H");
                    }
                    else if (DGS.Period == 3)
                    {
                        return("1");
                    }
                    else if (DGS.Period == 4)
                    {
                        return("2");
                    }
                    else if (DGS.Period == 5)
                    {
                        return("3");
                    }
                    else if (DGS.Period == 6)
                    {
                        return("4");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "2") //basketball
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 1)
                    {
                        return("1H");
                    }
                    else if (DGS.Period == 2)
                    {
                        return("2H");
                    }
                    else if (DGS.Period == 3)
                    {
                        return("1");
                    }
                    else if (DGS.Period == 4)
                    {
                        return("2");
                    }
                    else if (DGS.Period == 5)
                    {
                        return("3");
                    }
                    else if (DGS.Period == 6)
                    {
                        return("4");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "3") //baseball
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 1)
                    {
                        return("1H");
                    }
                    else if (DGS.Period == 2)
                    {
                        return("2H");
                    }
                    else if (DGS.Period == 3)
                    {
                        return("1");
                    }
                    else if (DGS.Period == 4)
                    {
                        return("2");
                    }
                    else if (DGS.Period == 5)
                    {
                        return("3");
                    }
                    else if (DGS.Period == 6)
                    {
                        return("4");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "4") //hockey
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 7)
                    {
                        return("1");
                    }
                    else if (DGS.Period == 8)
                    {
                        return("2");
                    }
                    else if (DGS.Period == 9)
                    {
                        return("3");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "5") //soccer
                {
                    if (DGS.Period == 0)
                    {
                        if (DGS.isLive == 1)
                        {
                            if (DGS.VisitorTeam.ToUpper().Contains(" ET") || (DGS.VisitorTeam.ToUpper().Contains("ET ")))
                            {
                                return("ET");
                            }
                            else if (DGS.VisitorTeam.ToUpper().Contains(" PEN") || DGS.VisitorTeam.ToUpper().Contains("PEN "))
                            {
                                return("PK");
                            }
                            else
                            {
                                return("T");
                            }
                        }
                        else
                        {
                            return("T");
                        }
                    }
                    else if (DGS.Period == 1)
                    {
                        return("1");
                    }
                    else if (DGS.Period == 2)
                    {
                        return("2");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("ET");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "6")//boxing
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "7") //golf
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "8") //tennis
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "9") //auto racing
                {
                    if (DGS.Period == 0)
                    {
                        return("T");
                    }
                    else if (DGS.Period == 10)
                    {
                        return("OT");
                    }
                }
                else if (g.IdSportDonBest.Trim() == "10") //other
                {
                    if (DGS.Period == 0)
                    {
                        return("");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return("");
        }
Example #17
0
        private csGame FindEvent(csGame g)
        {
            csGame G1 = null;

            try
            {
                parameters.Add("@pRot", CastRot(g));
                parameters.Add("@pDate", g.GameDate);
                parameters.Add("@pIdSport", Convert.ToInt32(g.IdSportDonBest.Trim()));
                dataset = csDonBest.ExecutePA("[dbo].[web_findEvent]", parameters);

                if (dataset.Tables[0].Rows.Count == 1)
                {
                    G1                = new csGame();
                    G1.EventId        = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                    G1.VisitorNumber  = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_away_rot"].ToString());
                    G1.HomeNumber     = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_home_rot"].ToString());
                    G1.IdSportDonBest = dataset.Tables[0].Rows[0]["sport_id"].ToString();
                    G1.GameDate       = Convert.ToDateTime(dataset.Tables[0].Rows[0]["date"].ToString());
                    G1                = FindLive(G1);
                    G1                = setScoresFromDonBest(G1, g);

                    if (G1.VisitorScoreDonBest == null && G1.HomeScoreDonBest == null)
                    {
                        return(null);
                    }
                }

                if (G1 == null || G1.VisitorScoreDonBest == null || G1.HomeScoreDonBest == null)
                {
                    if (g.VisitorNumber == 225265)
                    {
                        int asfs = 0;
                    }

                    if (g.VisitorTeam.ToUpper().Contains("ALT LINE") || g.HomeTeam.ToUpper().Contains("ALT LINE") ||
                        g.LeagueName.ToUpper().Contains("ALTERN"))
                    {
                        parameters.Add("@pVisitorTeam", g.VisitorTeam.ToUpper().Replace("ALT LINE", "").Trim());
                        parameters.Add("@pHomeTeam", g.HomeTeam.ToUpper().Replace("ALT LINE", "").Trim());
                        parameters.Add("@pDate", g.GameDate.Year + "-" + g.GameDate.Month + "-" + g.GameDate.Day);
                        dataset = csDonBest.ExecutePA("[dbo].[web_getGameWithValue]", parameters);

                        if (dataset.Tables[0].Rows.Count == 1)
                        {
                            G1                = new csGame();
                            G1.EventId        = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                            G1.VisitorNumber  = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_away_rot"].ToString());
                            G1.HomeNumber     = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_home_rot"].ToString());
                            G1.IdSportDonBest = dataset.Tables[0].Rows[0]["sport_id"].ToString();
                            G1.GameDate       = Convert.ToDateTime(dataset.Tables[0].Rows[0]["date"].ToString());
                            // G1 = FindLive(G1);
                            G1 = setScoresFromDonBest(G1, g);
                            if (G1.VisitorScoreDonBest == null && G1.HomeScoreDonBest == null)
                            {
                                return(null);
                            }
                        }
                        else
                        {
                            csGame gAux = new csGame();
                            gAux = GetParent(g);
                            parameters.Add("@pVisitorTeam", gAux.VisitorTeamAux.ToUpper().Replace("ALT LINE", "").Trim());
                            parameters.Add("@pHomeTeam", gAux.HomeTeamAux.ToUpper().Replace("ALT LINE", "").Trim());
                            parameters.Add("@pDate", g.GameDate.Year + "-" + g.GameDate.Month + "-" + g.GameDate.Day);
                            dataset = csDonBest.ExecutePA("[dbo].[web_getGameWithValue]", parameters);

                            if (dataset.Tables[0].Rows.Count == 1)
                            {
                                G1                = new csGame();
                                G1.EventId        = Convert.ToInt32(dataset.Tables[0].Rows[0]["id"].ToString());
                                G1.VisitorNumber  = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_away_rot"].ToString());
                                G1.HomeNumber     = Convert.ToInt32(dataset.Tables[0].Rows[0]["participant_home_rot"].ToString());
                                G1.IdSportDonBest = dataset.Tables[0].Rows[0]["sport_id"].ToString();
                                G1.GameDate       = Convert.ToDateTime(dataset.Tables[0].Rows[0]["date"].ToString());
                                // G1 = FindLive(G1);
                                G1 = setScoresFromDonBest(G1, g);
                                if (G1.VisitorScoreDonBest == null && G1.HomeScoreDonBest == null)
                                {
                                    return(null);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in get Event: " + ex.Message);
            }

            return(G1);
        }
Example #18
0
 private int Converter(csGame g)
 {
     return(Convert.ToInt32(g.VisitorNumber.ToString().Substring(1, g.VisitorNumber.ToString().Length - 1)));
 }
Example #19
0
        // pinnacle lines
        public csBet PinniLines(csBet b, csGame g)
        {
            try
            {
                parameters.Add("@pDate", b.PlacedDate);
                parameters.Add("@pRot", g.HomeNumber);
                parameters.Add("@pPeriod", b.Period);
                parameters.Add("@pRot2", g.VisitorNumber);
                parameters.Add("@pWagerPlay", b.WagerPlay);

                dataset = csPinnacle.ExecutePA("[dbo].[spGetLeansLines]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        if (b.VisHome == "H") // HOME
                        {
                            if (b.WagerPlay == "SP")
                            {
                                try { b.PinniPoints = Convert.ToDouble(fila["homeSpread"]); } catch (Exception) { b.PinniPoints = 0; }
                                try { b.PinniJuice = Convert.ToInt32(fila["homeOdds"]); } catch (Exception) { b.PinniJuice = 0; }
                            }
                            else if (b.WagerPlay == "ML" || b.WagerPlay == "DR")
                            {
                                b.PinniPoints = 0;
                                try { b.PinniJuice = Convert.ToInt32(fila["homeML"]); } catch (Exception) { b.PinniJuice = 0; }
                            }
                            else if (b.WagerPlay == "TOT")
                            {
                                if (b.OverUnder == "u")
                                {
                                    try { b.PinniPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.PinniPoints = 0; }
                                    try { b.PinniJuice = Convert.ToInt32(fila["totalUnder"]); } catch (Exception) { b.PinniJuice = 0; }
                                }
                                else if (b.OverUnder == "o")
                                {
                                    try { b.PinniPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.PinniPoints = 0; }
                                    try { b.PinniJuice = Convert.ToInt32(fila["totalOver"]); } catch (Exception) { b.PinniJuice = 0; }
                                }
                            }
                        }
                        else //VISITOR
                        {
                            if (b.WagerPlay == "SP")
                            {
                                try { b.PinniPoints = Convert.ToDouble(fila["visitorSpread"]); } catch (Exception) { b.PinniPoints = 0; }
                                try { b.PinniJuice = Convert.ToInt32(fila["visitorOdds"]); } catch (Exception) { b.PinniJuice = 0; }
                            }
                            else if (b.WagerPlay == "ML" || b.WagerPlay == "DR")
                            {
                                b.PinniPoints = 0;
                                try { b.PinniJuice = Convert.ToInt32(fila["visitorML"]); } catch (Exception) { b.PinniJuice = 0; }
                            }
                            else if (b.WagerPlay == "TOT")
                            {
                                if (b.OverUnder == "u")
                                {
                                    try { b.PinniPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.PinniPoints = 0; }
                                    try { b.PinniJuice = Convert.ToInt32(fila["totalUnder"]); } catch (Exception) { b.PinniJuice = 0; }
                                }
                                else if (b.OverUnder == "o")
                                {
                                    try { b.PinniPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.PinniPoints = 0; }
                                    try { b.PinniJuice = Convert.ToInt32(fila["totalOver"]); } catch (Exception) { b.PinniJuice = 0; }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                b.PinniJuice  = 0;
                b.PinniPoints = 0;
            }
            finally
            {
                parameters.Clear();
            }

            return(b);
        }
Example #20
0
        public ObservableCollection <csGame> ListGamesFromDGS(string dt1, string dt2, String idSport, string idDonBest, string status)
        {
            ObservableCollection <csGame> DGSList = null;
            string idSportDonBest = (idDonBest == "TNT" || idDonBest == "MU") ? inter.Interpretar(idDonBest).Trim() : idDonBest.Trim();

            if (idDonBest != "-1")
            {
                idSportDonBest = CastIdSportDonBest(idSport.Trim()).ToString();
            }

            try
            {
                parameters.Add("@pStartDate", dt1);
                parameters.Add("@pEndDate", dt2);
                parameters.Add("@pIdSport", idSport.Trim());
                csGame g = null;

                dataset = csConnection.ExecutePA("[dbo].[web_getGamesFilters]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    DGSList = new ObservableCollection <csGame>();
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        g                  = new csGame();
                        g.IdGame           = Convert.ToInt32(fila["IdGame"]);
                        g.HomeTeam         = Convert.ToString(fila["HomeTeam"]);
                        g.VisitorTeam      = Convert.ToString(fila["VisitorTeam"]);
                        g.IdLeague         = Convert.ToInt32(fila["IdLeague"]);
                        g.IdSportDGS       = Convert.ToString(fila["IdSport"]).Trim();
                        g.HomeNumber       = Convert.ToInt32(fila["HomeNumber"]);
                        g.VisitorNumber    = Convert.ToInt32(fila["VisitorNumber"]);
                        g.GameDate         = Convert.ToDateTime(fila["EventDate"]);
                        g.ParentNumber     = Convert.ToInt32(fila["ParentGame"]);
                        g.FamilyNumber     = Convert.ToInt32(fila["FamilyGame"]);
                        g.Period           = Convert.ToInt32(fila["Period"]);
                        g.LeagueName       = Convert.ToString(fila["DESCRIP"]);
                        g.IdSportDonBest   = CastIdSportDonBest((g.IdSportDGS == "TNT" || g.IdSportDGS == "MU") ? inter.Interpretar(g.LeagueName).Trim() : g.IdSportDGS.Trim()).ToString();
                        g.VisitorNumberAux = g.VisitorNumber;
                        g.HomeNumberAux    = g.HomeNumber;
                        g.GamePeriod       = CastPeriod(g);

                        if (!String.IsNullOrWhiteSpace(fila["HomeScore"].ToString()))
                        {
                            g.HomeScoreDGS = Convert.ToInt32(fila["HomeScore"]);
                        }
                        else
                        {
                            g.HomeScoreDGS = null;
                        }
                        if (!String.IsNullOrWhiteSpace(fila["VisitorScore"].ToString()))
                        {
                            g.VisitorScoreDGS = Convert.ToInt32(fila["VisitorScore"]);
                        }
                        else
                        {
                            g.VisitorScoreDGS = null;
                        }

                        if (g.LeagueName.ToUpper().Contains("LIVE"))
                        {
                            g        = GetParent(g);
                            g.isLive = 1;
                        }

                        if (g.HomeScoreDGS != null && g.VisitorScoreDGS != null)
                        {
                            csGame G1 = FindEvent(g);
                            if (G1 != null)
                            {
                                g.HomeScoreDonBest    = G1.HomeScoreDonBest;
                                g.VisitorScoreDonBest = G1.VisitorScoreDonBest;
                                g.Status = (g.VisitorScoreDGS == g.VisitorScoreDonBest && g.HomeScoreDGS == g.HomeScoreDonBest) ? "RIGHT" : "WRONG";
                                if (g.Status.ToUpper().Contains(status))
                                {
                                    DGSList.Add(g);
                                }
                            }
                            else
                            {
                                g.Status = "MISSING";
                                if (g.Status.ToUpper().Contains(status))
                                {
                                    DGSList.Add(g);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error to get Games from DGS: " + ex.Message);
            }
            finally
            {
                parameters.Clear();
            }

            return((DGSList != null && DGSList.Count > 0) ? new ObservableCollection <csGame>(DGSList.OrderByDescending(x => x.Status).ToList()) : null);
        }
Example #21
0
        public ObservableCollection <csGame> ListGamesFromGraph(string dt1, string dt2, String idSport, int?idLeague)
        {
            ObservableCollection <csGame> list = new ObservableCollection <csGame>();

            try
            {
                parameters.Add("@pStartDate", dt1);
                parameters.Add("@pEndDate", dt2);
                parameters.Add("@pIdSport", idSport.Trim());
                parameters.Add("@pIdLeague", idLeague);
                csGame g = null;

                dataset = csConnection.ExecutePA("[dbo].[web_getGames]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        g                = new csGame();
                        g.IdGame         = Convert.ToInt32(fila["IdGame"]);
                        g.HomeTeam       = Convert.ToString(fila["HomeTeam"]);
                        g.VisitorTeam    = Convert.ToString(fila["VisitorTeam"]);
                        g.IdLeague       = Convert.ToInt32(fila["IdLeague"]);
                        g.IdSportDGS     = Convert.ToString(fila["IdSport"]).Trim();
                        g.HomeNumber     = Convert.ToInt32(fila["HomeNumber"]);
                        g.VisitorNumber  = Convert.ToInt32(fila["VisitorNumber"]);
                        g.GameDate       = Convert.ToDateTime(fila["EventDate"]);
                        g.ParentNumber   = Convert.ToInt32(fila["ParentGame"]);
                        g.FamilyNumber   = Convert.ToInt32(fila["FamilyGame"]);
                        g.Period         = Convert.ToInt32(fila["Period"]);
                        g.LeagueName     = Convert.ToString(fila["DESCRIP"]);
                        g.IdSportDonBest = CastIdSportDonBest((g.IdSportDGS == "TNT" || g.IdSportDGS == "MU") ? inter.Interpretar(g.LeagueName).Trim() : g.IdSportDGS.Trim()).ToString();
                        g.GamePeriod     = CastPeriod(g);


                        if (!String.IsNullOrWhiteSpace(fila["HomeScore"].ToString()))
                        {
                            g.HomeScoreDGS = Convert.ToInt32(fila["HomeScore"]);
                        }
                        else
                        {
                            g.HomeScoreDGS = null;
                        }
                        if (!String.IsNullOrWhiteSpace(fila["VisitorScore"].ToString()))
                        {
                            g.VisitorScoreDGS = Convert.ToInt32(fila["VisitorScore"]);
                        }
                        else
                        {
                            g.VisitorScoreDGS = null;
                        }

                        g.Score = g.VisitorScoreDGS + " - " + g.HomeScoreDGS;

                        g = FindEvent(g);

                        g.EventNameWithId = g.VisitorTeam + " vs " + g.HomeTeam;
                        g.EventName       = "[" + g.VisitorNumber + "] " + g.VisitorTeam + " vs  [" + g.HomeNumber + "] " + g.HomeTeam;
                        g = TotalRisk(g);

                        if (g.VisitorTeam.ToUpper().Contains("VS ") || g.VisitorTeam.ToUpper().Contains(" VS") ||
                            g.HomeTeam.ToUpper().Contains("VS ") || g.HomeTeam.ToUpper().Contains(" VS"))
                        {
                            int A = 0;
                        }
                        else
                        {
                            if (g.EventId != 0)
                            {
                                list.Add(g);
                            }
                        }
                    }
                }
                else
                {
                    list = null;
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                parameters.Clear();
            }
            return(list);
        }
Example #22
0
        //  Our Lines
        public csBet OurNextLine(csBet b, csGame g)
        {
            try
            {
                parameters.Add("@pDate", b.PlacedDate);
                parameters.Add("@pIdGame", g.IdGame);
                parameters.Add("@pPlay", b.Play);

                dataset = csG8Apps.ExecutePA("[dbo].[web_GetLeansLine]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        if (b.VisHome == "H")
                        {
                            if (b.WagerPlay == "SP")
                            {
                                try { b.OurPoints = Convert.ToDouble(fila["HomeSpread"]); } catch (Exception) { b.OurJuice = 0; }
                                try { b.OurJuice = Convert.ToInt32(fila["HomeJuice"]); } catch (Exception) { b.OurJuice = 0; }
                            }
                            else if (b.WagerPlay == "ML" || b.WagerPlay == "DR")
                            {
                                b.OurPoints = 0;
                                try { b.OurJuice = Convert.ToInt32(fila["HomeMoneyLine"]); } catch (Exception) { b.OurJuice = 0; }
                            }
                            else if (b.WagerPlay == "TOT")
                            {
                                try
                                {
                                    if (b.OverUnder == "u")
                                    {
                                        try { b.OurPoints = Convert.ToDouble(fila["Total"]); } catch (Exception) { b.OurJuice = 0; }
                                        try { b.OurJuice = Convert.ToInt32(fila["TotalUnderJuice"]); } catch (Exception) { b.OurJuice = 0; }
                                    }
                                    else
                                    {
                                        try { b.OurPoints = Convert.ToDouble(fila["Total"]); } catch (Exception) { b.OurJuice = 0; }
                                        try { b.OurJuice = Convert.ToInt32(fila["TotalOverJuice"]); } catch (Exception) { b.OurJuice = 0; }
                                    }
                                }
                                catch (Exception) { }
                            }
                        }
                        else
                        {
                            if (b.WagerPlay == "SP")
                            {
                                try { b.OurPoints = Convert.ToDouble(fila["AwaySpread"]); } catch (Exception) { b.OurJuice = 0; }
                                try { b.OurJuice = Convert.ToInt32(fila["AwayJuice"]); } catch (Exception) { b.OurJuice = 0; }
                            }
                            else if (b.WagerPlay == "ML" || b.WagerPlay == "DR")
                            {
                                b.OurPoints = 0;
                                try { b.OurJuice = Convert.ToInt32(fila["AwayMoneyLine"]); } catch (Exception) { b.OurJuice = 0; }
                            }
                            else if (b.WagerPlay == "TOT")
                            {
                                try
                                {
                                    if (b.OverUnder == "u")
                                    {
                                        try { b.OurPoints = Convert.ToDouble(fila["Total"]); } catch (Exception) { b.OurJuice = 0; }
                                        try { b.OurJuice = Convert.ToInt32(fila["TotalUnderJuice"]); } catch (Exception) { b.OurJuice = 0; }
                                    }
                                    else
                                    {
                                        try { b.OurPoints = Convert.ToDouble(fila["Total"]); } catch (Exception) { b.OurJuice = 0; }
                                        try { b.OurJuice = Convert.ToInt32(fila["TotalOverJuice"]); } catch (Exception) { b.OurJuice = 0; }
                                    }
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                b.OurJuice  = 0;
                b.OurPoints = 0;
            }
            finally
            {
                parameters.Clear();
            }

            return(b);
        }
Example #23
0
        public csBet CrisLines(csBet b, csGame g, int sportbook)
        {
            try
            {
                parameters.Add("@pDate", b.PlacedDate);
                parameters.Add("@pRot", g.HomeNumber);
                parameters.Add("@pIdSportbook", sportbook);
                parameters.Add("@pPeriod", b.GamePeriod);
                parameters.Add("@pRot2", g.VisitorNumber);
                parameters.Add("@pWagerPlay", b.WagerPlay);

                dataset = csDonBest.ExecutePA("[dbo].[spGetLeansLines]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        if (b.VisHome == "H") // HOME
                        {
                            if (b.WagerPlay == "SP")
                            {
                                try { b.CrisPoints = Convert.ToDouble(fila["ps_home_spread"]); } catch (Exception) { b.CrisPoints = 0; }
                                try { b.CrisJuice = Convert.ToInt32(fila["ps_home_price"]); } catch (Exception) { b.CrisJuice = 0; }
                            }
                            else if (b.WagerPlay == "ML" || b.WagerPlay == "DR")
                            {
                                b.CrisPoints = 0;
                                try { b.CrisJuice = Convert.ToInt32(fila["ml_home_price"]); } catch (Exception) { b.CrisJuice = 0; }
                            }
                            else if (b.WagerPlay == "TOT")
                            {
                                if (b.OverUnder == "u")
                                {
                                    try { b.CrisPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.CrisPoints = 0; }
                                    try { b.CrisJuice = Convert.ToInt32(fila["under_price"]); } catch (Exception) { b.CrisJuice = 0; }
                                }
                                else if (b.OverUnder == "o")
                                {
                                    try { b.CrisPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.CrisPoints = 0; }
                                    try { b.CrisJuice = Convert.ToInt32(fila["over_price"]); } catch (Exception) { b.CrisJuice = 0; }
                                }
                            }
                        }
                        else //VISITOR
                        {
                            if (b.WagerPlay == "SP")
                            {
                                try { b.CrisPoints = Convert.ToDouble(fila["ps_away_spread"]); } catch (Exception) { b.CrisPoints = 0; }
                                try { b.CrisJuice = Convert.ToInt32(fila["ps_away_price"]); } catch (Exception) { b.CrisJuice = 0; }
                            }
                            else if (b.WagerPlay == "ML" || b.WagerPlay == "DR")
                            {
                                b.CrisPoints = 0;
                                try { b.CrisJuice = Convert.ToInt32(fila["ml_away_price"]); } catch (Exception) { b.CrisJuice = 0; }
                            }
                            else if (b.WagerPlay == "TOT")
                            {
                                if (b.OverUnder == "u")
                                {
                                    try { b.CrisPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.CrisPoints = 0; }
                                    try { b.CrisJuice = Convert.ToInt32(fila["under_price"]); } catch (Exception) { b.CrisJuice = 0; }
                                }
                                else if (b.OverUnder == "o")
                                {
                                    try { b.CrisPoints = Convert.ToDouble(fila["total"]); } catch (Exception) { b.CrisPoints = 0; }
                                    try { b.CrisJuice = Convert.ToInt32(fila["over_price"]); } catch (Exception) { b.CrisJuice = 0; }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                b.CrisJuice  = 0;
                b.CrisPoints = 0;
            }
            finally
            {
                parameters.Clear();
            }

            return(b);
        }
Example #24
0
        private csGame ScoresTennis2(csGame g, csGame DGS)
        {
            try
            {
                parameters.Add("@pIdEvent", g.EventId);
                dataset = csDonBest.ExecutePA("[dbo].[web_getTennisScore]", parameters);
                int sum = dataset.Tables[0].Rows.Count;


                if (DGS.VisitorNumber == 8061)
                {
                    int asd = 0;
                }

                if (sum > 0)
                {
                    int homeSum = 0, visSum = 0;
                    int setHom = 0, setVis = 0;
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        int V = (!String.IsNullOrWhiteSpace(fila["away_score"].ToString())) ? Convert.ToInt32(fila["away_score"].ToString()) : 0;
                        int H = (!String.IsNullOrWhiteSpace(fila["home_score"].ToString())) ? Convert.ToInt32(fila["home_score"].ToString()) : 0;

                        if (fila["period"].ToString().Trim() != "5")
                        {
                            homeSum += H;
                            visSum  += V;
                        }

                        if (V == H)
                        {
                            setVis += 1;
                            setHom += 1;
                        }
                        else if (V > H)
                        {
                            setVis += 1;
                        }
                        else if (V < H)
                        {
                            setHom += 1;
                        }
                    }



                    if (homeSum > visSum && setHom < setVis)
                    {
                        g.HomeScoreDonBest    = visSum;
                        g.VisitorScoreDonBest = homeSum;
                    }
                    else if (homeSum < visSum && setHom > setVis)
                    {
                        g.HomeScoreDonBest    = visSum;
                        g.VisitorScoreDonBest = homeSum;
                    }
                    else if (homeSum == visSum)
                    {
                        if (setHom > setVis)
                        {
                            g.HomeScoreDonBest    = homeSum;
                            g.VisitorScoreDonBest = visSum;
                            g.HomeScoreDonBest   += 1;
                        }
                        else if (setHom < setVis)
                        {
                            g.HomeScoreDonBest     = homeSum;
                            g.VisitorScoreDonBest  = visSum;
                            g.VisitorScoreDonBest += 1;
                        }
                    }
                    else
                    {
                        g.HomeScoreDonBest    = homeSum;
                        g.VisitorScoreDonBest = visSum;
                    }
                }
            }
            catch (Exception ex)
            {
                g.VisitorScoreDonBest = null;
                g.HomeScoreDonBest    = null;
            }
            return(g);
        }
Example #25
0
        public ObservableCollection <csBet> BetListFromIdGame(csGame game, string player, bool flag = true)
        {
            ObservableCollection <csBet> data = new ObservableCollection <csBet>();

            try
            {
                parameters.Clear();
                parameters.Add("@pIgGame", game.IdGame);
                parameters.Add("@pPlayer", player);

                dataset = csG8Apps.ExecutePA("[dbo].[web_GetBetsFromLeansByIdGame]", parameters);

                if (dataset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        csBet u = new csBet(
                            Convert.ToInt64(fila["Id_BI"]),
                            Convert.ToInt32(fila["IdWager"]),
                            Convert.ToInt32(fila["IdWagerDetail"]),
                            Convert.ToInt32(fila["IdAgent"]),
                            Convert.ToString(fila["Agent"]),
                            Convert.ToInt32(fila["IdPlayer"]),
                            Convert.ToString(fila["Player"]),
                            Convert.ToInt32(fila["IdLineType"]),
                            Convert.ToString(fila["LineTypeName"]),
                            Convert.ToString(fila["LoginName"]),
                            Convert.ToDouble(fila["WinAmount"]),
                            Convert.ToInt32(fila["RiskAmount"]),
                            Convert.ToString(fila["Result"]),
                            Convert.ToDouble(fila["Net"]),
                            Convert.ToString(fila["GamePeriod"]),
                            Convert.ToString(fila["League"]),
                            Convert.ToString(fila["CompleteDescription"]),
                            Convert.ToString(fila["DetailDescription"]),
                            Convert.ToString(fila["Team"]),
                            Convert.ToInt32(fila["IdGame"]),
                            Convert.ToInt32(fila["IdLeague"]),
                            Convert.ToInt32(fila["Period"]),
                            Convert.ToString(fila["FAV_DOG"]),
                            Convert.ToInt32(fila["Play"]),
                            Convert.ToString(fila["WagerPlay"]),
                            Convert.ToString(fila["IdSport"]),
                            Convert.ToDateTime(fila["SettledDate"]),
                            Convert.ToDateTime(fila["PlacedDate"]),
                            Convert.ToInt32(fila["Odds"]),
                            Convert.ToDouble(fila["Points"]),
                            Convert.ToString(fila["Score"]),
                            Convert.ToString(fila["IP"]),
                            Convert.ToString(fila["BeatLine"]));

                        if (flag)
                        {
                            u = LeansDB.OurNextLine(u, game);
                            u = LeansDB.CrisLines(u, game, 489);
                            u = LeansDB.PinniLines(u, game);
                        }
                        u.EventDate = game.EventDate;
                        u.EventName = game.VisitorTeam + " vs " + game.HomeTeam;
                        u.Pick      = (game.VisitorNumber == u.Rot) ? game.VisitorTeam : game.HomeTeam;

                        data.Add(u);
                    }
                }
                else
                {
                    data = null;
                }
            }
            catch (Exception ex)
            {
                data = null;
                MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                parameters.Clear();
            }

            return(data);
        }
Example #26
0
 private csGame setScoresFromDonBest(csGame g, csGame DGS)
 {
     return(CastSeleccion(g, DGS));
 }
Example #27
0
        public ObservableCollection <csGame> ListGamesFromDGS(string dt1, string dt2, String idSport, int?idLeague, int?idLineType)
        {
            ObservableCollection <csGame> list = new ObservableCollection <csGame>();

            try
            {
                parameters.Add("@pStartDate", dt1);
                parameters.Add("@pEndDate", dt2);
                parameters.Add("@pIdSport", idSport.Trim());
                parameters.Add("@pIdLeague", idLeague);
                csGame g = null;

                dataset = csConnection.ExecutePA("[dbo].[web_getGames]", parameters);
                if (dataset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow fila in dataset.Tables[0].Rows)
                    {
                        g               = new csGame();
                        g.IdGame        = Convert.ToInt32(fila["IdGame"]);
                        g.HomeTeam      = Convert.ToString(fila["HomeTeam"]);
                        g.VisitorTeam   = Convert.ToString(fila["VisitorTeam"]);
                        g.IdLeague      = Convert.ToInt32(fila["IdLeague"]);
                        g.IdSportDGS    = Convert.ToString(fila["IdSport"]).Trim();
                        g.HomeNumber    = Convert.ToInt32(fila["HomeNumber"]);
                        g.VisitorNumber = Convert.ToInt32(fila["VisitorNumber"]);
                        g.GameDate      = Convert.ToDateTime(fila["EventDate"]);
                        g.ParentNumber  = Convert.ToInt32(fila["ParentGame"]);
                        g.FamilyNumber  = Convert.ToInt32(fila["FamilyGame"]);
                        g.Period        = Convert.ToInt32(fila["Period"]);
                        g.LeagueName    = Convert.ToString(fila["DESCRIP"]);
                        g.EventName     = g.HomeTeam + " vs " + g.VisitorTeam;

                        if (!String.IsNullOrWhiteSpace(fila["HomeScore"].ToString()))
                        {
                            g.HomeScoreDGS = Convert.ToInt32(fila["HomeScore"]);
                        }
                        else
                        {
                            g.HomeScoreDGS = null;
                        }
                        if (!String.IsNullOrWhiteSpace(fila["VisitorScore"].ToString()))
                        {
                            g.VisitorScoreDGS = Convert.ToInt32(fila["VisitorScore"]);
                        }
                        else
                        {
                            g.VisitorScoreDGS = null;
                        }

                        if (idLineType != null)
                        {
                            g = SetValues(g, idLineType);
                        }

                        list.Add(g);
                    }
                }
                else
                {
                    list = null;
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                parameters.Clear();
            }

            return(list);
        }
Example #28
0
        private void ShowInfo(Excel.Worksheet ws, int posY, int i, ObservableCollection <csBet> l, int color, csGame g)
        {
            System.Drawing.Color coloring = System.Drawing.Color.FromArgb(198, 239, 206);

            if (color == 1)
            {
                coloring = System.Drawing.Color.FromArgb(198, 239, 206);
            }
            else if (color == 2)
            {
                coloring = System.Drawing.Color.FromArgb(255, 199, 206);
            }
            else if (color == 3)
            {
                coloring = System.Drawing.Color.FromArgb(255, 235, 156);
            }

            ws.Range["A" + (posY + 2).ToString()].Value  = g.VisitorTeam + " vs " + g.HomeTeam;
            ws.Range["B" + (posY + 2).ToString()].Value  = g.EventDate;
            ws.Range["C" + (posY + 2).ToString()].Value  = l[i].IdAgent;
            ws.Range["D" + (posY + 2).ToString()].Value  = l[i].Agent;
            ws.Range["E" + (posY + 2).ToString()].Value  = l[i].IdPlayer;
            ws.Range["F" + (posY + 2).ToString()].Value  = l[i].Player;
            ws.Range["G" + (posY + 2).ToString()].Value  = l[i].IdLineType;
            ws.Range["H" + (posY + 2).ToString()].Value  = l[i].LineTypeName;
            ws.Range["I" + (posY + 2).ToString()].Value  = l[i].LoginName;
            ws.Range["J" + (posY + 2).ToString()].Value  = l[i].WinAmount;
            ws.Range["K" + (posY + 2).ToString()].Value  = l[i].RiskAmount;
            ws.Range["L" + (posY + 2).ToString()].Value  = l[i].Result;
            ws.Range["M" + (posY + 2).ToString()].Value  = l[i].Net;
            ws.Range["N" + (posY + 2).ToString()].Value  = l[i].GamePeriod;
            ws.Range["O" + (posY + 2).ToString()].Value  = l[i].League;
            ws.Range["P" + (posY + 2).ToString()].Value  = l[i].CompleteDescription;
            ws.Range["Q" + (posY + 2).ToString()].Value  = l[i].DetailDescription;
            ws.Range["R" + (posY + 2).ToString()].Value  = l[i].IdGame;
            ws.Range["S" + (posY + 2).ToString()].Value  = l[i].IdLeague;
            ws.Range["T" + (posY + 2).ToString()].Value  = l[i].Period;
            ws.Range["U" + (posY + 2).ToString()].Value  = l[i].FAV_DOG;
            ws.Range["V" + (posY + 2).ToString()].Value  = l[i].Play;
            ws.Range["W" + (posY + 2).ToString()].Value  = l[i].WagerPlay;
            ws.Range["X" + (posY + 2).ToString()].Value  = l[i].IdSport;
            ws.Range["Y" + (posY + 2).ToString()].Value  = l[i].SettledDate;
            ws.Range["Z" + (posY + 2).ToString()].Value  = l[i].PlacedDate;
            ws.Range["AA" + (posY + 2).ToString()].Value = l[i].Odds;
            ws.Range["AB" + (posY + 2).ToString()].Value = l[i].Points;
            ws.Range["AC" + (posY + 2).ToString()].Value = l[i].VisitorScore;
            ws.Range["AD" + (posY + 2).ToString()].Value = l[i].HomeScore;
            ws.Range["AE" + (posY + 2).ToString()].Value = l[i].IP;


            ws.Range["A" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["B" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["C" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["D" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["E" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["F" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["G" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["H" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["I" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["J" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["K" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["L" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["M" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["N" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["O" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["P" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["Q" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["R" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["S" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["T" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["U" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["V" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["W" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["X" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["Y" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["Z" + (posY + 2).ToString()].Interior.Color  = coloring;
            ws.Range["AA" + (posY + 2).ToString()].Interior.Color = coloring;
            ws.Range["AB" + (posY + 2).ToString()].Interior.Color = coloring;
            ws.Range["AC" + (posY + 2).ToString()].Interior.Color = coloring;
            ws.Range["AD" + (posY + 2).ToString()].Interior.Color = coloring;
            ws.Range["AE" + (posY + 2).ToString()].Interior.Color = coloring;



            if (color == 3)
            {
                Bold(ws, "A" + (posY + 2).ToString());
                Bold(ws, "B" + (posY + 2).ToString());
                Bold(ws, "C" + (posY + 2).ToString());
                Bold(ws, "D" + (posY + 2).ToString());
                Bold(ws, "E" + (posY + 2).ToString());
                Bold(ws, "F" + (posY + 2).ToString());
                Bold(ws, "G" + (posY + 2).ToString());
                Bold(ws, "H" + (posY + 2).ToString());
                Bold(ws, "I" + (posY + 2).ToString());
                Bold(ws, "J" + (posY + 2).ToString());
                Bold(ws, "K" + (posY + 2).ToString());
                Bold(ws, "L" + (posY + 2).ToString());
                Bold(ws, "M" + (posY + 2).ToString());
                Bold(ws, "N" + (posY + 2).ToString());
                Bold(ws, "O" + (posY + 2).ToString());
                Bold(ws, "P" + (posY + 2).ToString());
                Bold(ws, "Q" + (posY + 2).ToString());
                Bold(ws, "R" + (posY + 2).ToString());
                Bold(ws, "S" + (posY + 2).ToString());
                Bold(ws, "T" + (posY + 2).ToString());
                Bold(ws, "U" + (posY + 2).ToString());
                Bold(ws, "V" + (posY + 2).ToString());
                Bold(ws, "W" + (posY + 2).ToString());
                Bold(ws, "X" + (posY + 2).ToString());
                Bold(ws, "Y" + (posY + 2).ToString());
                Bold(ws, "Z" + (posY + 2).ToString());
                Bold(ws, "AA" + (posY + 2).ToString());
                Bold(ws, "AB" + (posY + 2).ToString());
                Bold(ws, "AC" + (posY + 2).ToString());
                Bold(ws, "AD" + (posY + 2).ToString());
                Bold(ws, "AE" + (posY + 2).ToString());
            }
        }
Example #29
0
 private csGame CastSeleccion(csGame g, csGame DGS)
 {
     if (g.IdSportDonBest == "1")
     {
         return(ScoresGeneral(g, DGS));
     }
     else if (g.IdSportDonBest == "2")
     {
         return(ScoresGeneral(g, DGS));
     }
     else if (g.IdSportDonBest == "3")
     {
         return(ScoresGeneral(g, DGS));
     }
     else if (g.IdSportDonBest == "4")
     {
         return(ScoresGeneral(g, DGS));
     }
     else if (g.IdSportDonBest == "5")
     {
         if (DGS.Period == 0)
         {
             if (DGS.isLive == 1)
             {
                 if (DGS.VisitorTeam.ToUpper().Contains(" ET") || DGS.VisitorTeam.ToUpper().Contains("ET "))
                 {
                     return(ScoresGeneral(g, DGS));
                 }
                 else if (DGS.VisitorTeam.ToUpper().Contains(" PEN") || DGS.VisitorTeam.ToUpper().Contains("PEN "))
                 {
                     return(ScoresGeneral(g, DGS));
                 }
                 else if (DGS.VisitorTeam.ToUpper().Contains(" FULL") || DGS.VisitorTeam.ToUpper().Contains("FULL "))
                 {
                     return(ScoresGeneral(g, DGS));
                 }
             }
             else
             {
                 return(ScoresSoccer(g, DGS));
             }
         }
         else
         {
             return(ScoresGeneral(g, DGS));
         }
     }
     else if (g.IdSportDonBest == "6")
     {
         return(ScoresFighting(g, DGS));
     }
     else if (g.IdSportDonBest == "7")
     {
         return(ScoresGolf2(g, DGS));
     }
     else if (g.IdSportDonBest == "8")
     {
         return(ScoresTennis2(g, DGS));
     }
     // else if (g.IdSportDonBest == "9") return ScoresTennis(g, DGS);
     return(g);
 }