Esempio n. 1
0
        public string GetOdds1x2(string scheduleID)
        {
            try
            {
                WebClientBLL bll    = new WebClientBLL();
                string       actual = bll.UpdateOdds1x2Content(scheduleID);

                JArray data = new JArray();
                //获取赔率原始数据
                Regex reg = new Regex("game\\=Array\\(\"" + "\\w[^;" + "]*;");
                Match mat = reg.Match(actual);
                if (mat != null)
                {
                    //所有公司数据
                    string source = mat.Value.Substring(12, mat.Value.Length - 10 - 4);
                    //分解出每个公司数据
                    string[] compstrs = Regex.Split(source, "\",\"", RegexOptions.IgnoreCase);
                    DataSet  ds       = dal.GetCompanyGroupOddsCount(scheduleID);
                    foreach (string compstr in compstrs)
                    {
                        JObject  item    = new JObject();
                        string[] oddsArr = compstr.Replace("\"", "").Split('|');

                        for (int i = 0; i < oddsArr.Length; i++)
                        {
                            item.Add("Odds_" + i, oddsArr[i]);
                        }
                        AddGameInfo(actual, item);
                        if (ds.Tables[0].Select("companyid='" + oddsArr[0] + "'").Length > 0)
                        {
                            item.Add("OddsCount", int.Parse(ds.Tables[0].Select("companyid='" + oddsArr[0] + "'")[0]["oddscount"].ToString()));
                        }
                        data.Add(item);
                    }
                }
                JObject result = new JObject();
                result.Add(new JProperty("totlalCount", data.Count));
                result.Add(new JProperty("data", data));
                return(result.ToString());
            }
            catch (Exception)
            {
                return("");
            }
        }
Esempio n. 2
0
        public void updateOdds1x2Stat(string scheduleID)
        {
            try
            {
                ScheduleAnalysisBLL scheduleAnalysisBLL = new ScheduleAnalysisBLL();
                ScheduleBLL scheduleBLL = new ScheduleBLL();
                WebClientBLL bll = new WebClientBLL();
                string actual = bll.UpdateOdds1x2Content(scheduleID);

                //获取赔率原始数据
                Regex reg = new Regex("game\\=Array\\(\"" + "\\w[^;" + "]*;");
                Match mat = reg.Match(actual);
                if (mat != null && !String.IsNullOrEmpty(mat.Value))
                {

                    List<string> swhereList = new List<string>();
                    List<string> ewhereList = new List<string>();
                    List<decimal> swlist = new List<decimal>();
                    List<decimal> sdlist = new List<decimal>();
                    List<decimal> sllist = new List<decimal>();
                    List<decimal> ewlist = new List<decimal>();
                    List<decimal> edlist = new List<decimal>();
                    List<decimal> ellist = new List<decimal>();

                    //所有公司数据
                    string source = mat.Value.Substring(12, mat.Value.Length - 10 - 4);
                    //分解出每个公司数据
                    string[] oddsArr = Regex.Split(source, "\",\"", RegexOptions.IgnoreCase);
                    foreach (string oddsStr in oddsArr)
                    {
                        string[] oddsArray = oddsStr.Replace("\"", "").Split('|');
                        swhereList.Add("(companyid=" + oddsArray[0] + " and s_win=" + oddsArray[3] +
                                    " and s_draw=" + oddsArray[4] + " and s_lost=" + oddsArray[5] + ")");
                        swlist.Add(Convert.ToDecimal(oddsArray[6]));
                        sdlist.Add(Convert.ToDecimal(oddsArray[7]));
                        sllist.Add(Convert.ToDecimal(oddsArray[8]));
                        if (!string.IsNullOrEmpty(oddsArray[10]) && !string.IsNullOrEmpty(oddsArray[11]) && !string.IsNullOrEmpty(oddsArray[12]) && !string.IsNullOrEmpty(oddsArray[13]) && !string.IsNullOrEmpty(oddsArray[14]) && !string.IsNullOrEmpty(oddsArray[15]))
                        {
                            ewhereList.Add("(companyid=" + oddsArray[0] + " and e_win=" + oddsArray[10] +
                                    " and e_draw=" + oddsArray[11] + " and e_lost=" + oddsArray[12] + ")");
                            ewlist.Add(Convert.ToDecimal(oddsArray[13]));
                            edlist.Add(Convert.ToDecimal(oddsArray[14]));
                            ellist.Add(Convert.ToDecimal(oddsArray[15]));
                        }
                    }
                    DataSet sds = scheduleBLL.statOddsHistory("(" + String.Join(" or ", swhereList.ToArray()) + ")");
                    DataSet eds = scheduleBLL.statOddsHistory("(" + String.Join(" or ", ewhereList.ToArray()) + ")");
                    if (sds != null && eds != null)
                    {
                        ScheduleAnalysis model = new ScheduleAnalysis();
                        model.scheduleid = Convert.ToInt32(scheduleID);
                        model.oddswin = ewlist.Average() - swlist.Average();
                        model.oddsdraw = edlist.Average() - sdlist.Average();
                        model.oddslost = ellist.Average() - sllist.Average();
                        model.perwin = Convert.ToDecimal(eds.Tables[0].Rows[0][0]) - Convert.ToDecimal(sds.Tables[0].Rows[0][0]);
                        model.perdraw = Convert.ToDecimal(eds.Tables[0].Rows[0][1]) - Convert.ToDecimal(sds.Tables[0].Rows[0][1]);
                        model.perlost = Convert.ToDecimal(eds.Tables[0].Rows[0][2]) - Convert.ToDecimal(sds.Tables[0].Rows[0][2]);
                        model.time = DateTime.Now;
                        if (!scheduleAnalysisBLL.Exists(model))
                        {
                            scheduleAnalysisBLL.Add(model);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 3
0
        public void updateOdds1x2(string scheduleID)
        {
            try
            {
                OddsDAO oddsDAO = new OddsDAO();
                CompanyDAO companyDAO = new CompanyDAO();
                WebClientBLL bll = new WebClientBLL();
                string actual = bll.UpdateOdds1x2Content(scheduleID);

                //获取赔率原始数据
                Regex reg = new Regex("game\\=Array\\(\"" + "\\w[^;" + "]*;");
                Match mat = reg.Match(actual);
                if (mat != null && !String.IsNullOrEmpty(mat.Value))
                {

                    //所有公司数据
                    string source = mat.Value.Substring(12, mat.Value.Length - 10 - 4);
                    //分解出每个公司数据
                    string[] compstrs = Regex.Split(source, "\",\"", RegexOptions.IgnoreCase);
                    foreach (string compstr in compstrs)
                    {
                        JObject item = new JObject();
                        string[] oddsArr = compstr.Replace("\"", "").Split('|');

                        #region 插入公司数据
                        if (!companyDAO.Exists(int.Parse(oddsArr[0])) && oddsArr.Length > 22)
                        {
                            SeoWebSite.Model.Company company = new SeoWebSite.Model.Company();
                            company.id = int.Parse(oddsArr[0]);
                            company.fullname = oddsArr[21];
                            company.name = oddsArr[2];
                            company.isprimary = Convert.ToBoolean(int.Parse(oddsArr[22]));
                            company.isexchange = Convert.ToBoolean(int.Parse(oddsArr[23]));
                            companyDAO.Add(company);
                        }
                        #endregion

                        #region 插入欧赔数据
                        if (!oddsDAO.Exists(int.Parse(oddsArr[1])))
                        {
                            Odds odds = new Odds();
                            odds.scheduleid = int.Parse(scheduleID);
                            odds.companyid = int.Parse(oddsArr[0]);
                            odds.id = int.Parse(oddsArr[1]);
                            odds.s_win = decimal.Parse(oddsArr[3]);
                            odds.s_draw = decimal.Parse(oddsArr[4]);
                            odds.s_lost = decimal.Parse(oddsArr[5]);
                            odds.s_winper = decimal.Parse(oddsArr[6]);
                            odds.s_drawper = decimal.Parse(oddsArr[7]);
                            odds.s_lostper = decimal.Parse(oddsArr[8]);
                            if (!String.IsNullOrEmpty(oddsArr[9]))
                            {
                                odds.s_return = decimal.Parse(oddsArr[9]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[10]))
                            {
                                odds.e_win = decimal.Parse(oddsArr[10]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[11]))
                            {
                                odds.e_draw = decimal.Parse(oddsArr[11]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[12]))
                            {
                                odds.e_lost = decimal.Parse(oddsArr[12]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[13]))
                            {
                                odds.e_winper = decimal.Parse(oddsArr[13]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[14]))
                            {
                                odds.e_drawper = decimal.Parse(oddsArr[14]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[15]))
                            {
                                odds.e_lostper = decimal.Parse(oddsArr[15]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[16]))
                            {
                                odds.e_return = decimal.Parse(oddsArr[16]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[17]))
                            {
                                odds.winkelly = decimal.Parse(oddsArr[17]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[18]))
                            {
                                odds.drawkelly = decimal.Parse(oddsArr[18]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[19]))
                            {
                                odds.lostkelly = decimal.Parse(oddsArr[19]);
                            }
                            string[] timeArr = oddsArr[20].Split(',');
                            odds.lastupdatetime = new DateTime(int.Parse(timeArr[0]), int.Parse(timeArr[1].Remove(2)), int.Parse(timeArr[2]), int.Parse(timeArr[3]), int.Parse(timeArr[4]), int.Parse(timeArr[5])).AddHours(8);
                            oddsDAO.Add(odds);
                        }
                        #endregion
                    }
                }
            }
            catch (WebException e)
            {
                HttpWebResponse response = (HttpWebResponse)e.Response;
                if (response != null)  //排除对象为空的错误
                {
                    if (response.StatusCode == HttpStatusCode.NotFound)  //判断是否是404错误
                        sdal.Delete(Convert.ToInt32(scheduleID));
                }
            }
        }
Esempio n. 4
0
        public string GetOdds1x2(string scheduleID)
        {
            try
            {
                WebClientBLL bll = new WebClientBLL();
                string actual = bll.UpdateOdds1x2Content(scheduleID);

                JArray data = new JArray();
                //获取赔率原始数据
                Regex reg = new Regex("game\\=Array\\(\"" + "\\w[^;" + "]*;");
                Match mat = reg.Match(actual);
                if (mat != null)
                {

                    //所有公司数据
                    string source = mat.Value.Substring(12, mat.Value.Length - 10 - 4);
                    //分解出每个公司数据
                    string[] compstrs = Regex.Split(source, "\",\"", RegexOptions.IgnoreCase);
                    DataSet ds = dal.GetCompanyGroupOddsCount(scheduleID);
                    foreach (string compstr in compstrs)
                    {
                        JObject item = new JObject();
                        string[] oddsArr = compstr.Replace("\"", "").Split('|');

                        for (int i = 0; i < oddsArr.Length; i++)
                        {
                            item.Add("Odds_" + i, oddsArr[i]);
                        }
                        AddGameInfo(actual, item);
                        if (ds.Tables[0].Select("companyid='" + oddsArr[0] + "'").Length > 0)
                        {
                            item.Add("OddsCount", int.Parse(ds.Tables[0].Select("companyid='" + oddsArr[0] + "'")[0]["oddscount"].ToString()));
                        }
                        data.Add(item);
                    }
                }
                JObject result = new JObject();
                result.Add(new JProperty("totlalCount", data.Count));
                result.Add(new JProperty("data", data));
                return result.ToString();
            }
            catch (Exception)
            {
                return "";
            }
        }
Esempio n. 5
0
        public void updateOdds1x2(string scheduleID)
        {
            try
            {
                OddsDAO      oddsDAO    = new OddsDAO();
                CompanyDAO   companyDAO = new CompanyDAO();
                WebClientBLL bll        = new WebClientBLL();
                string       actual     = bll.UpdateOdds1x2Content(scheduleID);

                //获取赔率原始数据
                Regex reg = new Regex("game\\=Array\\(\"" + "\\w[^;" + "]*;");
                Match mat = reg.Match(actual);
                if (mat != null && !String.IsNullOrEmpty(mat.Value))
                {
                    //所有公司数据
                    string source = mat.Value.Substring(12, mat.Value.Length - 10 - 4);
                    //分解出每个公司数据
                    string[] compstrs = Regex.Split(source, "\",\"", RegexOptions.IgnoreCase);
                    foreach (string compstr in compstrs)
                    {
                        JObject  item    = new JObject();
                        string[] oddsArr = compstr.Replace("\"", "").Split('|');

                        #region 插入公司数据
                        if (!companyDAO.Exists(int.Parse(oddsArr[0])) && oddsArr.Length > 22)
                        {
                            SeoWebSite.Model.Company company = new SeoWebSite.Model.Company();
                            company.id         = int.Parse(oddsArr[0]);
                            company.fullname   = oddsArr[21];
                            company.name       = oddsArr[2];
                            company.isprimary  = Convert.ToBoolean(int.Parse(oddsArr[22]));
                            company.isexchange = Convert.ToBoolean(int.Parse(oddsArr[23]));
                            companyDAO.Add(company);
                        }
                        #endregion

                        #region 插入欧赔数据
                        if (!oddsDAO.Exists(int.Parse(oddsArr[1])))
                        {
                            Odds odds = new Odds();
                            odds.scheduleid = int.Parse(scheduleID);
                            odds.companyid  = int.Parse(oddsArr[0]);
                            odds.id         = int.Parse(oddsArr[1]);
                            odds.s_win      = decimal.Parse(oddsArr[3]);
                            odds.s_draw     = decimal.Parse(oddsArr[4]);
                            odds.s_lost     = decimal.Parse(oddsArr[5]);
                            odds.s_winper   = decimal.Parse(oddsArr[6]);
                            odds.s_drawper  = decimal.Parse(oddsArr[7]);
                            odds.s_lostper  = decimal.Parse(oddsArr[8]);
                            if (!String.IsNullOrEmpty(oddsArr[9]))
                            {
                                odds.s_return = decimal.Parse(oddsArr[9]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[10]))
                            {
                                odds.e_win = decimal.Parse(oddsArr[10]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[11]))
                            {
                                odds.e_draw = decimal.Parse(oddsArr[11]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[12]))
                            {
                                odds.e_lost = decimal.Parse(oddsArr[12]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[13]))
                            {
                                odds.e_winper = decimal.Parse(oddsArr[13]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[14]))
                            {
                                odds.e_drawper = decimal.Parse(oddsArr[14]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[15]))
                            {
                                odds.e_lostper = decimal.Parse(oddsArr[15]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[16]))
                            {
                                odds.e_return = decimal.Parse(oddsArr[16]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[17]))
                            {
                                odds.winkelly = decimal.Parse(oddsArr[17]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[18]))
                            {
                                odds.drawkelly = decimal.Parse(oddsArr[18]);
                            }
                            if (!String.IsNullOrEmpty(oddsArr[19]))
                            {
                                odds.lostkelly = decimal.Parse(oddsArr[19]);
                            }
                            string[] timeArr = oddsArr[20].Split(',');
                            odds.lastupdatetime = new DateTime(int.Parse(timeArr[0]), int.Parse(timeArr[1].Remove(2)), int.Parse(timeArr[2]), int.Parse(timeArr[3]), int.Parse(timeArr[4]), int.Parse(timeArr[5])).AddHours(8);
                            oddsDAO.Add(odds);
                        }
                        #endregion
                    }
                }
            }
            catch (WebException e)
            {
                HttpWebResponse response = (HttpWebResponse)e.Response;
                if (response != null)                                   //排除对象为空的错误
                {
                    if (response.StatusCode == HttpStatusCode.NotFound) //判断是否是404错误
                    {
                        sdal.Delete(Convert.ToInt32(scheduleID));
                    }
                }
            }
        }
Esempio n. 6
0
        public void updateOdds1x2Stat(string scheduleID)
        {
            try
            {
                ScheduleAnalysisBLL scheduleAnalysisBLL = new ScheduleAnalysisBLL();
                ScheduleBLL         scheduleBLL         = new ScheduleBLL();
                WebClientBLL        bll = new WebClientBLL();
                string actual           = bll.UpdateOdds1x2Content(scheduleID);

                //获取赔率原始数据
                Regex reg = new Regex("game\\=Array\\(\"" + "\\w[^;" + "]*;");
                Match mat = reg.Match(actual);
                if (mat != null && !String.IsNullOrEmpty(mat.Value))
                {
                    List <string>  swhereList = new List <string>();
                    List <string>  ewhereList = new List <string>();
                    List <decimal> swlist     = new List <decimal>();
                    List <decimal> sdlist     = new List <decimal>();
                    List <decimal> sllist     = new List <decimal>();
                    List <decimal> ewlist     = new List <decimal>();
                    List <decimal> edlist     = new List <decimal>();
                    List <decimal> ellist     = new List <decimal>();

                    //所有公司数据
                    string source = mat.Value.Substring(12, mat.Value.Length - 10 - 4);
                    //分解出每个公司数据
                    string[] oddsArr = Regex.Split(source, "\",\"", RegexOptions.IgnoreCase);
                    foreach (string oddsStr in oddsArr)
                    {
                        string[] oddsArray = oddsStr.Replace("\"", "").Split('|');
                        swhereList.Add("(companyid=" + oddsArray[0] + " and s_win=" + oddsArray[3] +
                                       " and s_draw=" + oddsArray[4] + " and s_lost=" + oddsArray[5] + ")");
                        swlist.Add(Convert.ToDecimal(oddsArray[6]));
                        sdlist.Add(Convert.ToDecimal(oddsArray[7]));
                        sllist.Add(Convert.ToDecimal(oddsArray[8]));
                        if (!string.IsNullOrEmpty(oddsArray[10]) && !string.IsNullOrEmpty(oddsArray[11]) && !string.IsNullOrEmpty(oddsArray[12]) && !string.IsNullOrEmpty(oddsArray[13]) && !string.IsNullOrEmpty(oddsArray[14]) && !string.IsNullOrEmpty(oddsArray[15]))
                        {
                            ewhereList.Add("(companyid=" + oddsArray[0] + " and e_win=" + oddsArray[10] +
                                           " and e_draw=" + oddsArray[11] + " and e_lost=" + oddsArray[12] + ")");
                            ewlist.Add(Convert.ToDecimal(oddsArray[13]));
                            edlist.Add(Convert.ToDecimal(oddsArray[14]));
                            ellist.Add(Convert.ToDecimal(oddsArray[15]));
                        }
                    }
                    DataSet sds = scheduleBLL.statOddsHistory("(" + String.Join(" or ", swhereList.ToArray()) + ")");
                    DataSet eds = scheduleBLL.statOddsHistory("(" + String.Join(" or ", ewhereList.ToArray()) + ")");
                    if (sds != null && eds != null)
                    {
                        ScheduleAnalysis model = new ScheduleAnalysis();
                        model.scheduleid = Convert.ToInt32(scheduleID);
                        model.oddswin    = ewlist.Average() - swlist.Average();
                        model.oddsdraw   = edlist.Average() - sdlist.Average();
                        model.oddslost   = ellist.Average() - sllist.Average();
                        model.perwin     = Convert.ToDecimal(eds.Tables[0].Rows[0][0]) - Convert.ToDecimal(sds.Tables[0].Rows[0][0]);
                        model.perdraw    = Convert.ToDecimal(eds.Tables[0].Rows[0][1]) - Convert.ToDecimal(sds.Tables[0].Rows[0][1]);
                        model.perlost    = Convert.ToDecimal(eds.Tables[0].Rows[0][2]) - Convert.ToDecimal(sds.Tables[0].Rows[0][2]);
                        model.time       = DateTime.Now;
                        if (!scheduleAnalysisBLL.Exists(model))
                        {
                            scheduleAnalysisBLL.Add(model);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }