예제 #1
0
 private void GetRQList()
 {
     try
     {
         SeoWebSite.BLL.odds_rq oddsrqbll = new SeoWebSite.BLL.odds_rq();
         JObject result     = new JObject();
         int     start      = int.Parse(Request.Form["start"]);
         int     limit      = int.Parse(Request.Form["limit"]);
         int     totalCount = 0;
         string where = Request.Form["where"];
         DataSet ds = oddsrqbll.GetList(where, start + 1, start + limit, out totalCount);
         result.Add("success", true);
         result.Add("totalCount", totalCount);
         string javascriptJson = JsonConvert.SerializeObject(ds.Tables[0], new JavaScriptDateTimeConverter());
         responseText = "{success:true,totalCount:" + totalCount + ",data:" + javascriptJson + "}";
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
    private void GetRQList()
    {
        try
        {
            SeoWebSite.BLL.odds_rq oddsrqbll = new SeoWebSite.BLL.odds_rq();
            JObject result = new JObject();
            int start = int.Parse(Request.Form["start"]);
            int limit = int.Parse(Request.Form["limit"]);
            int totalCount = 0;
            string where = Request.Form["where"];
            DataSet ds = oddsrqbll.GetList(where, start + 1, start + limit, out totalCount);
            result.Add("success", true);
            result.Add("totalCount", totalCount);
            string javascriptJson = JsonConvert.SerializeObject(ds.Tables[0], new JavaScriptDateTimeConverter());
            responseText = "{success:true,totalCount:" + totalCount + ",data:" + javascriptJson + "}";
        }
        catch (Exception)
        {

            throw;
        }
    }
예제 #3
0
    private void getOdds3in1()
    {
        SeoWebSite.BLL.odds_rq odds_rqbll   = new SeoWebSite.BLL.odds_rq();
        WebClientBLL           webClientBLL = new WebClientBLL();

        try
        {
            if (Request["scheduleid"] != null && Request["companyid"] != null)
            {
                string    scheduleid      = Request.Form["scheduleid"];
                string[]  companyid_Array = Request.Form["companyid"].Split(',');
                DataTable dt = new DataTable();
                dt.Columns.Add("scheduleid", typeof(int));
                dt.Columns.Add("companyid", typeof(int));
                dt.Columns.Add("aaa", typeof(double));
                dt.Columns.Add("aab", typeof(double));
                dt.Columns.Add("aac", typeof(double));
                dt.Columns.Add("aba", typeof(double));
                dt.Columns.Add("abb", typeof(double));
                dt.Columns.Add("abc", typeof(double));
                dt.Columns.Add("baa", typeof(double));
                dt.Columns.Add("bab", typeof(double));
                dt.Columns.Add("bac", typeof(double));
                dt.Columns.Add("bba", typeof(double));
                dt.Columns.Add("bbb", typeof(double));
                dt.Columns.Add("bbc", typeof(double));
                dt.Columns.Add("caa", typeof(double));
                dt.Columns.Add("cab", typeof(double));
                dt.Columns.Add("cac", typeof(double));
                dt.Columns.Add("cba", typeof(double));
                dt.Columns.Add("cbb", typeof(double));
                dt.Columns.Add("cbc", typeof(double));

                dt.Columns.Add("aaa1", typeof(string));
                dt.Columns.Add("aab1", typeof(string));
                dt.Columns.Add("aac1", typeof(string));
                dt.Columns.Add("aba1", typeof(string));
                dt.Columns.Add("abb1", typeof(string));
                dt.Columns.Add("abc1", typeof(string));
                dt.Columns.Add("baa1", typeof(string));
                dt.Columns.Add("bab1", typeof(string));
                dt.Columns.Add("bac1", typeof(string));
                dt.Columns.Add("bba1", typeof(string));
                dt.Columns.Add("bbb1", typeof(string));
                dt.Columns.Add("bbc1", typeof(string));
                foreach (string companyid in companyid_Array)
                {
                    string[]  paramArr  = { companyid, scheduleid };
                    string    s         = webClientBLL.GetRemoteHtml("odds/detail.aspx?companyID={0}&scheduleid={1}", paramArr);
                    Parser    parser    = Parser.CreateParser(s, "utf-8");
                    AndFilter andFilter = new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("bgColor", "#bbbbbb"));
                    NodeList  tableList = parser.ExtractAllNodesThatMatch(andFilter);
                    parser = Parser.CreateParser(s, "utf-8");
                    //NodeList h3tag = parser.ExtractAllNodesThatMatch(new TagNameFilter("h3"));
                    //string year = h3tag[0].ToPlainTextString().Remove(5);
                    if (tableList.Count == 3)
                    {
                        DataRow dr = dt.NewRow();
                        dr["scheduleid"] = scheduleid;
                        dr["companyid"]  = companyid;
                        NodeList tdList;
                        string   pankou;
                        #region 让球盘
                        AndFilter andFilter1 = new AndFilter(new TagNameFilter("tr"), new HasAttributeFilter("class", "ts1"));
                        NodeList  list       = tableList[0].Children.ExtractAllNodesThatMatch(andFilter1);

                        if (list.Count > 0)
                        {
                            tdList = list[list.Count - 1].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));//初盘
                            pankou = CommonHelper.GoalCnToGoal(tdList[1].ToPlainTextString());
                            double per1 = 0, per2 = 0, per3 = 0;
                            double per4 = 0, per5 = 0, per6 = 0;
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["aaa"] = tdList[0].ToPlainTextString();
                                dr["aab"] = pankou;
                                dr["aac"] = tdList[2].ToPlainTextString();
                                DataSet ds = odds_rqbll.queryCompanyOddsCount(companyid, tdList[0].ToPlainTextString(), pankou, tdList[2].ToPlainTextString(), Convert.ToInt32(Request.Form["scheduleType"]), "Chupan");
                                if (Convert.ToDouble(ds.Tables[0].Rows[0][3]) > 0)
                                {
                                    per1       = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per2       = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per3       = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    dr["aaa1"] = ds.Tables[0].Rows[0][0].ToString() + "(" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%)";
                                    dr["aab1"] = ds.Tables[0].Rows[0][1].ToString() + "(" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%)";
                                    dr["aac1"] = ds.Tables[0].Rows[0][2].ToString() + "(" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%)";
                                }
                            }
                            tdList = list[0].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));//终盘
                            pankou = CommonHelper.GoalCnToGoal(tdList[1].ToPlainTextString());
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["aba"] = tdList[0].ToPlainTextString();
                                dr["abb"] = pankou;
                                dr["abc"] = tdList[2].ToPlainTextString();
                                DataSet ds = odds_rqbll.queryCompanyOddsCount(companyid, tdList[0].ToPlainTextString(), pankou, tdList[2].ToPlainTextString(), Convert.ToInt32(Request.Form["scheduleType"]), "Zhongpan");
                                if (Convert.ToDouble(ds.Tables[0].Rows[0][3]) > 0)
                                {
                                    per4       = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per5       = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per6       = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    dr["aba1"] = ds.Tables[0].Rows[0][0].ToString() + "(<font color=" + (per4 > per1 ? "red" : "green") + ">" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%</font>)";
                                    dr["abb1"] = ds.Tables[0].Rows[0][1].ToString() + "(<font color=" + (per5 > per2 ? "red" : "green") + ">" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%</font>)";
                                    dr["abc1"] = ds.Tables[0].Rows[0][2].ToString() + "(<font color=" + (per6 > per3 ? "red" : "green") + ">" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%</font>)";
                                }
                            }
                        }
                        #endregion
                        #region 标准盘
                        list = tableList[1].Children.ExtractAllNodesThatMatch(andFilter1);
                        if (list.Count > 0)
                        {
                            tdList    = list[list.Count - 1].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                            dr["baa"] = tdList[0].ToPlainTextString();
                            dr["bab"] = tdList[1].ToPlainTextString();
                            dr["bac"] = tdList[2].ToPlainTextString();
                            tdList    = list[0].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));//终盘
                            dr["bba"] = tdList[0].ToPlainTextString();
                            dr["bbb"] = tdList[1].ToPlainTextString();
                            dr["bbc"] = tdList[2].ToPlainTextString();
                        }
                        #endregion
                        #region 大小盘
                        list = tableList[2].Children.ExtractAllNodesThatMatch(andFilter1);
                        if (list.Count > 0)
                        {
                            tdList = list[list.Count - 1].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                            pankou = CommonHelper.BallSizeToBall(tdList[1].ToPlainTextString());
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["caa"] = tdList[0].ToPlainTextString();
                                dr["cab"] = pankou;
                                dr["cac"] = tdList[2].ToPlainTextString();
                            }
                            tdList = list[0].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                            pankou = CommonHelper.BallSizeToBall(tdList[1].ToPlainTextString());
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["cba"] = tdList[0].ToPlainTextString();
                                dr["cbb"] = pankou;
                                dr["cbc"] = tdList[2].ToPlainTextString();
                            }
                        }
                        #endregion
                        dt.Rows.Add(dr);
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    DataRow dr1 = dt.NewRow();


                    #region 亚洲盘统计
                    List <double> pankouList1 = new List <double>();
                    List <double> homefcList1 = new List <double>();
                    List <double> awayfcList1 = new List <double>();
                    List <double> pankouList2 = new List <double>();
                    List <double> homefcList2 = new List <double>();
                    List <double> awayfcList2 = new List <double>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["aab"] != DBNull.Value && !pankouList1.Contains(Convert.ToDouble(dr["aab"])))
                        {
                            pankouList1.Add(Convert.ToDouble(dr["aab"]));
                        }
                        if (dr["abb"] != DBNull.Value && !pankouList2.Contains(Convert.ToDouble(dr["abb"])))
                        {
                            pankouList2.Add(Convert.ToDouble(dr["abb"]));
                        }
                    }
                    foreach (decimal item in pankouList2)
                    {
                        if (dt.Select("aab=" + item).Count() > 1)
                        {
                            double fc = Convert.ToDouble(dt.Compute("Var(aaa)", "aab=" + item));
                            homefcList1.Add(fc);
                            fc = Convert.ToDouble(dt.Compute("Var(aac)", "aab=" + item));
                            awayfcList1.Add(fc);
                        }
                        if (dt.Select("abb=" + item).Count() > 1)
                        {
                            double fc = Convert.ToDouble(dt.Compute("Var(aba)", "abb=" + item));
                            homefcList2.Add(fc);
                            fc = Convert.ToDouble(dt.Compute("Var(abc)", "abb=" + item));
                            awayfcList2.Add(fc);
                        }
                    }
                    dr1["aaa"]  = Convert.ToDouble(dt.Compute("Avg(aaa)", "1=1"));
                    dr1["aac"]  = Convert.ToDouble(dt.Compute("Avg(aac)", "1=1"));
                    dr1["aaa1"] = homefcList1.Average();
                    dr1["aac1"] = awayfcList1.Average();
                    dr1["aba"]  = Convert.ToDouble(dt.Compute("Avg(aba)", "1=1"));
                    dr1["abc"]  = Convert.ToDouble(dt.Compute("Avg(abc)", "1=1"));
                    dr1["aba1"] = "<font color=" + (homefcList2.Average() > homefcList1.Average() ? "red" : "green") + ">" + homefcList2.Average() + "</font>";
                    dr1["abc1"] = "<font color=" + (awayfcList2.Average() > awayfcList1.Average() ? "red" : "green") + ">" + awayfcList2.Average() + "</font>";
                    #endregion

                    dr1["baa"]  = Convert.ToDouble(dt.Compute("Avg(baa)", "1=1"));
                    dr1["bab"]  = Convert.ToDouble(dt.Compute("Avg(bab)", "1=1"));
                    dr1["bac"]  = Convert.ToDouble(dt.Compute("Avg(bac)", "1=1"));
                    dr1["bba"]  = Convert.ToDouble(dt.Compute("Avg(bba)", "1=1"));
                    dr1["bbb"]  = Convert.ToDouble(dt.Compute("Avg(bbb)", "1=1"));
                    dr1["bbc"]  = Convert.ToDouble(dt.Compute("Avg(bbc)", "1=1"));
                    dr1["baa1"] = Convert.ToDouble(dt.Compute("Var(baa)", "1=1"));
                    dr1["bab1"] = Convert.ToDouble(dt.Compute("Var(bab)", "1=1"));
                    dr1["bac1"] = Convert.ToDouble(dt.Compute("Var(bac)", "1=1"));
                    dr1["bba1"] = "<font color=" + (Convert.ToDouble(dt.Compute("Var(bba)", "1=1")) > Convert.ToDouble(dr1["baa1"]) ? "red" : "green") + ">" + Convert.ToDouble(dt.Compute("Var(bba)", "1=1")) + "</font>";
                    dr1["bbb1"] = "<font color=" + (Convert.ToDouble(dt.Compute("Var(bbb)", "1=1")) > Convert.ToDouble(dr1["bab1"]) ? "red" : "green") + ">" + Convert.ToDouble(dt.Compute("Var(bbb)", "1=1")) + "</font>";
                    dr1["bbc1"] = "<font color=" + (Convert.ToDouble(dt.Compute("Var(bbc)", "1=1")) > Convert.ToDouble(dr1["bac1"]) ? "red" : "green") + ">" + Convert.ToDouble(dt.Compute("Var(bbc)", "1=1")) + "</font>";
                    dt.Rows.Add(dr1);
                }

                JObject result = new JObject();
                result.Add(new JProperty("success", true));
                result.Add(new JProperty("totlalCount", dt.Rows.Count));
                result.Add(new JProperty("data", JArray.FromObject(dt)));
                JsonStr = result.ToString();
            }
            else
            {
                JsonStr = "{success:false,message:'请求数据异常!'}";
            }
        }
        catch (Exception e)
        {
            JsonStr = "{success:false,message:'" + e.Message + "'}";
        }
    }
예제 #4
0
    private void queryCompanyCountRQ()
    {
        if (Request["rowData"] != null && Request["blur"] != null)
        {
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
            JArray rowData = JArray.Parse(Request.Form["rowData"]);
            List<string> oddsList = new List<string>();
            foreach (JObject item in rowData)
            {
                if (!string.IsNullOrEmpty((string)item["aaa"]) && !string.IsNullOrEmpty((string)item["aab"]) && !string.IsNullOrEmpty((string)item["aac"]) && !string.IsNullOrEmpty((string)item["aba"]) && !string.IsNullOrEmpty((string)item["abb"]) && !string.IsNullOrEmpty((string)item["abc"]))
                {
                    string[] sa = { (string)item["aaa"], (string)item["aab"], (string)item["aac"], (string)item["aba"], (string)item["abb"], (string)item["abc"], item["companyid"].ToString() };
                    oddsList.Add(string.Join(",", sa));
                }
            }
            JArray data1 = new JArray();
            JArray data2 = new JArray();

            JObject obj = JObject.Parse("{blur:" + Request.Form["blur"] + "}");
            DataSet ds = odds_rqbll.queryOddsCount(oddsList, float.Parse(Request.Form["blur"]), Convert.ToInt32(Request.Form["scheduleType"]));
            int totalCount = int.Parse(ds.Tables[0].Rows[0]["totalCount"].ToString());
            if (totalCount > 0)
            {
                obj.Add("rqycount1", ds.Tables[0].Rows[0][0].ToString());
                obj.Add("rqzcount1", ds.Tables[0].Rows[0][1].ToString());
                obj.Add("rqscount1", ds.Tables[0].Rows[0][2].ToString());
                obj.Add("totalCount1", totalCount);
                double diffPer = (Convert.ToDouble(ds.Tables[0].Rows[0][0]) / totalCount) - (Convert.ToDouble(ds.Tables[0].Rows[0][2]) / totalCount);
                if (totalCount >= 8)
                {
                    double rmb = 0;
                    if (Math.Abs(diffPer) < 0.33)
                    {
                        rmb = Math.Floor(Math.Abs(diffPer) * 100 * 5 / 3);
                    }
                    else if (Math.Abs(diffPer) >= 0.33 && Math.Abs(diffPer) <= 0.6)
                    {
                        rmb = Math.Floor(Math.Abs(diffPer) * 100 * 5 / 2);
                    }
                    else
                    {
                        rmb = Math.Floor(Math.Abs(diffPer) * 100 * 5);
                        if (totalCount > 12 && float.Parse(Request.Form["blur"]) < 0.1f)
                        {
                            rmb = rmb * 2;
                        }
                    }

                    if (diffPer > 0)
                    {
                        obj.Add("suggest", "<font color=red>" + rmb + "元</font>");
                    }
                    else if (diffPer < 0)
                    {
                        obj.Add("suggest", "<font color=blue>" + rmb + "元</font>");
                    }
                    else
                    {
                        obj.Add("suggest", "<font color=green>0元</font>");
                    }

                }

            }
            //ds = odds_rqbll.queryOddsCount(oddsList, 2, float.Parse(Request.Form["blur"]), Convert.ToInt32(Request.Form["scheduleType"]));
            //totalCount = int.Parse(ds.Tables[0].Rows[0]["totalCount"].ToString());
            //if (totalCount > 0)
            //{
            //    obj.Add("rqycount2", ds.Tables[0].Rows[0][0].ToString());
            //    obj.Add("rqzcount2", ds.Tables[0].Rows[0][1].ToString());
            //    obj.Add("rqscount2", ds.Tables[0].Rows[0][2].ToString());
            //    obj.Add("totalCount2", totalCount);
            //}
            JArray data = new JArray();
            data.Add(obj);
            responseText = "{success:true,data:" + data.ToString() + "}";
        }
    }
예제 #5
0
    private void queryOddsRQ()
    {
        if (Request["odds"] != null && Request["isTrue"] != null)
        {
            JObject result = new JObject();
            JArray oddsArray = JArray.Parse(Request.Form["odds"]);
            int totalCount = 0;
            DataSet ds = null;
            DataTable dt = null;
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();

            foreach (JObject item in oddsArray)
            {
                ds = odds_rqbll.GetList(item["companyid"].ToString().Replace("\"", ""), new string[] { (string)item["home1"], (string)item["pankou1"], (string)item["away1"], (string)item["home2"], (string)item["pankou2"], (string)item["away2"] });
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (dt == null)
                    {
                        dt = ds.Tables[0];
                    }
                    else
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                            dt.ImportRow(dr);
                    }
                }
            }
            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("victory");
                dt.Columns.Add("win1");
                dt.Columns.Add("win2");
                foreach (DataRow dr in dt.Rows)
                {
                    int score = (int)dr["home"] - (int)dr["away"];
                    if (score > 0)
                    {
                        dr["victory"] = 3;
                    }
                    else if (score == 0)
                    {
                        dr["victory"] = 1;
                    }
                    else
                    {
                        dr["victory"] = 0;
                    }
                    if (score > float.Parse(dr["pankou1"].ToString()))
                    {
                        dr["win1"] = 3;
                    }
                    else if (score == float.Parse(dr["pankou1"].ToString()))
                    {
                        dr["win1"] = 1;
                    }
                    else
                    {
                        dr["win1"] = 0;
                    }
                    if (score > float.Parse(dr["pankou2"].ToString()))
                    {
                        dr["win2"] = 3;
                    }
                    else if (score == float.Parse(dr["pankou2"].ToString()))
                    {
                        dr["win2"] = 1;
                    }
                    else
                    {
                        dr["win2"] = 0;
                    }
                }
            }
            result.Add("success", true);
            result.Add("totalCount", totalCount);
            string javascriptJson = JsonConvert.SerializeObject(dt, new JavaScriptDateTimeConverter());
            responseText = "{success:true,totalCount:" + totalCount + ",data:" + javascriptJson + "}";
        }
    }
예제 #6
0
    private void queryOddsPerRQ1()
    {
        if (Request["scheduletypeid"] != null && Request["scheduleid"] != null && Request["companyids"] != null)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("rqy", typeof(double));
            dt.Columns.Add("rqz", typeof(double));
            dt.Columns.Add("rqs", typeof(double));
            dt.Columns.Add("totalCount", typeof(int));
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
            string[] companyidarray = Request.Form["companyids"].Split(',');
            string scheduleid = Request.Form["scheduleid"];
            List<int> companyidList = new List<int>();
            foreach (string companyid in companyidarray)
            {
                companyidList.Add(Convert.ToInt32(companyid));
                List<string> whereStrList = new List<string>();
                string[] paramArr = { companyid, scheduleid };
                string s = webClientBLL.GetRemoteHtml("odds/detail.aspx?companyID={0}&scheduleid={1}", paramArr);
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                Parser parser = Parser.CreateParser(s, "utf-8");
                AndFilter andFilter = new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("bgColor", "#bbbbbb"));
                NodeList tableList = parser.ExtractAllNodesThatMatch(andFilter);
                parser = Parser.CreateParser(s, "utf-8");
                NodeList h3tag = parser.ExtractAllNodesThatMatch(new TagNameFilter("h3"));
                string year = h3tag[0].ToPlainTextString().Remove(5);
                if (tableList.Count == 3)
                {
                    AndFilter andFilter1 = new AndFilter(new TagNameFilter("tr"), new HasAttributeFilter("class", "ts1"));

                    NodeList list = tableList[0].Children.ExtractAllNodesThatMatch(andFilter1);
                    for (int i = 0; i < list.Count; i++)
                    {
                        NodeList tdList = list[i].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                        string pankou = CommonHelper.GoalCnToGoal(tdList[1].ToPlainTextString());
                        if (!string.IsNullOrEmpty(pankou))
                        {
                            whereStrList.Add("e.home=" + tdList[0].ToPlainTextString() + " and e.pankou=" + pankou + " and e.away=" + tdList[2].ToPlainTextString());
                        }
                    }
                }

                if (whereStrList.Count > 0)
                {
                    DataTable dt1 = odds_rqbll.queryCompanyOddsPer1(Convert.ToInt32(Request.Form["scheduletypeid"]), Convert.ToInt32(Request.Form["scheduleid"]), Convert.ToInt32(companyid),whereStrList);
                    if (dt1 != null && dt1.Rows.Count > 0 && Convert.ToInt32(dt1.Rows[0]["totalCount"]) > 0)
                    {
                        dt.ImportRow(dt1.Rows[0]);
                    }
                }
            }

            DataTable data = new DataTable();
            data.Columns.Add("id", typeof(int));
            data.Columns.Add("name", typeof(string));
            data.Columns.Add("rqyper", typeof(float));
            data.Columns.Add("rqzper", typeof(float));
            data.Columns.Add("rqsper", typeof(float));
            data.Columns.Add("diffper", typeof(float));
            data.Columns.Add("suggest", typeof(int));

            DataRow dr = data.NewRow();
            dr["id"] = 1;
            dr["name"] = "赔率支持平均";
            dr["rqyper"] = dt.Compute("avg(rqy)", "1=1");
            dr["rqzper"] = dt.Compute("avg(rqz)", "1=1");
            dr["rqsper"] = dt.Compute("avg(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1"));
            dr["suggest"] = 25;
            data.Rows.Add(dr);

            dr = data.NewRow();
            dr["id"] = 2;
            dr["name"] = "赔率支持最大";
            dr["rqyper"] = dt.Compute("max(rqy)", "1=1");
            dr["rqzper"] = dt.Compute("avg(rqz)", "1=1");
            dr["rqsper"] = dt.Compute("max(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            double ycount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy > rqs"));
            double scount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy < rqs"));
            dr = data.NewRow();
            dr["id"] = 3;
            dr["name"] = "公司支持数量";
            dr["rqyper"] = ycount / (ycount + scount) * 100;
            dr["rqzper"] = 0;
            dr["rqsper"] = scount / (ycount + scount) * 100;
            dr["diffper"] = ycount / (ycount + scount) * 100 - scount / (ycount + scount) * 100;
            dr["suggest"] = 80;
            data.Rows.Add(dr);
            responseText = "{success:true,data:" + JArray.FromObject(data) + "}";
        }
    }
예제 #7
0
    private void queryOddsPerRQ()
    {
        if (Request["rowData"] != null)
        {
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
            SeoWebSite.BLL.odds_bz odds_bzbll = new SeoWebSite.BLL.odds_bz();
            JArray rowData = JArray.Parse(Request.Form["rowData"]);
            List<string> oddsList = new List<string>();
            List<string> oddsList1 = new List<string>();
            foreach (JObject item in rowData)
            {
                if (!string.IsNullOrEmpty((string)item["aaa"]) && !string.IsNullOrEmpty((string)item["aab"]) && !string.IsNullOrEmpty((string)item["aac"]) && !string.IsNullOrEmpty((string)item["aba"]) && !string.IsNullOrEmpty((string)item["abb"]) && !string.IsNullOrEmpty((string)item["abc"]))
                {
                    string[] sa = { (string)item["aaa"], (string)item["aab"], (string)item["aac"], (string)item["aba"], (string)item["abb"], (string)item["abc"], item["companyid"].ToString() };
                    oddsList.Add(string.Join(",", sa));
                }
                if (!string.IsNullOrEmpty((string)item["baa"]) && !string.IsNullOrEmpty((string)item["bab"]) && !string.IsNullOrEmpty((string)item["bac"]) && !string.IsNullOrEmpty((string)item["bba"]) && !string.IsNullOrEmpty((string)item["bbb"]) && !string.IsNullOrEmpty((string)item["bbc"]))
                {
                    string[] sa = { (string)item["baa"], (string)item["bab"], (string)item["bac"], (string)item["bba"], (string)item["bbb"], (string)item["bbc"], item["companyid"].ToString() };
                    oddsList1.Add(string.Join(",", sa));
                }
            }
            DataTable dt = odds_rqbll.queryCompanyOddsPer(oddsList, 0,0);
            DataTable dt1 = odds_bzbll.queryCompanyOddsPer(oddsList1, 0, 0);
            DataTable data = new DataTable();
            data.Columns.Add("id", typeof(int));
            data.Columns.Add("name", typeof(string));
            data.Columns.Add("rqyper", typeof(float));
            data.Columns.Add("rqzper", typeof(float));
            data.Columns.Add("rqsper", typeof(float));
            data.Columns.Add("diffper", typeof(float));
            data.Columns.Add("suggest", typeof(int));

            DataRow dr = data.NewRow();
            dr["id"] = 1;
            dr["name"] = "亚赔支持平均";
            dr["rqyper"] = dt.Compute("avg(rqy)", "1=1");
            dr["rqzper"] = dt.Compute("avg(rqz)", "1=1");
            dr["rqsper"] = dt.Compute("avg(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1"));
            dr["suggest"] = 25;
            data.Rows.Add(dr);

            dr = data.NewRow();
            dr["id"] = 2;
            dr["name"] = "亚赔支持最大";
            dr["rqyper"] = dt.Compute("max(rqy)", "1=1");
            dr["rqzper"] = dt.Compute("max(rqz)", "1=1");
            dr["rqsper"] = dt.Compute("max(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            double ycount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy > rqs"));
            double scount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy < rqs"));
            dr = data.NewRow();
            dr["id"] = 3;
            dr["name"] = "亚赔支持数量";
            dr["rqyper"] = ycount / (ycount + scount) * 100;
            dr["rqzper"] = 0;
            dr["rqsper"] = scount / (ycount + scount) * 100;
            dr["diffper"] = ycount / (ycount + scount) * 100 - scount / (ycount + scount) * 100;
            dr["suggest"] = 80;
            data.Rows.Add(dr);

            dr = data.NewRow();
            dr["id"] = 4;
            dr["name"] = "欧赔支持平均";
            dr["rqyper"] = dt1.Compute("avg(rqy)", "1=1");
            dr["rqzper"] = dt1.Compute("avg(rqz)", "1=1");
            dr["rqsper"] = dt1.Compute("avg(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt1.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt1.Compute("avg(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            dr = data.NewRow();
            dr["id"] = 5;
            dr["name"] = "欧赔支持最大";
            dr["rqyper"] = dt1.Compute("max(rqy)", "1=1");
            dr["rqzper"] = dt1.Compute("max(rqz)", "1=1");
            dr["rqsper"] = dt1.Compute("max(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt1.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt1.Compute("max(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            double ycount1 = Convert.ToDouble(dt1.Compute("count(rqy)", "rqy > rqs"));
            double scount1 = Convert.ToDouble(dt1.Compute("count(rqy)", "rqy < rqs"));
            dr = data.NewRow();
            dr["id"] = 6;
            dr["name"] = "欧赔支持数量";
            dr["rqyper"] = ycount1 / (ycount1 + scount1) * 100;
            dr["rqzper"] = 0;
            dr["rqsper"] = scount1 / (ycount1 + scount1) * 100;
            dr["diffper"] = ycount1 / (ycount1 + scount1) * 100 - scount1 / (ycount1 + scount1) * 100;
            dr["suggest"] = 80;
            data.Rows.Add(dr);
            responseText = "{success:true,data:" + JArray.FromObject(data) + "}";
        }
    }
예제 #8
0
    private void getOdds3in1()
    {
        SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
        WebClientBLL webClientBLL = new WebClientBLL();
        try
        {
            if (Request["scheduleid"] != null && Request["companyid"] != null)
            {
                string scheduleid = Request.Form["scheduleid"];
                string[] companyid_Array = Request.Form["companyid"].Split(',');
                DataTable dt = new DataTable();
                dt.Columns.Add("scheduleid", typeof(int));
                dt.Columns.Add("companyid", typeof(int));
                dt.Columns.Add("aaa", typeof(double));
                dt.Columns.Add("aab", typeof(double));
                dt.Columns.Add("aac", typeof(double));
                dt.Columns.Add("aba", typeof(double));
                dt.Columns.Add("abb", typeof(double));
                dt.Columns.Add("abc", typeof(double));
                dt.Columns.Add("baa", typeof(double));
                dt.Columns.Add("bab", typeof(double));
                dt.Columns.Add("bac", typeof(double));
                dt.Columns.Add("bba", typeof(double));
                dt.Columns.Add("bbb", typeof(double));
                dt.Columns.Add("bbc", typeof(double));
                dt.Columns.Add("caa", typeof(double));
                dt.Columns.Add("cab", typeof(double));
                dt.Columns.Add("cac", typeof(double));
                dt.Columns.Add("cba", typeof(double));
                dt.Columns.Add("cbb", typeof(double));
                dt.Columns.Add("cbc", typeof(double));

                dt.Columns.Add("aaa1", typeof(string));
                dt.Columns.Add("aab1", typeof(string));
                dt.Columns.Add("aac1", typeof(string));
                dt.Columns.Add("aba1", typeof(string));
                dt.Columns.Add("abb1", typeof(string));
                dt.Columns.Add("abc1", typeof(string));
                dt.Columns.Add("baa1", typeof(string));
                dt.Columns.Add("bab1", typeof(string));
                dt.Columns.Add("bac1", typeof(string));
                dt.Columns.Add("bba1", typeof(string));
                dt.Columns.Add("bbb1", typeof(string));
                dt.Columns.Add("bbc1", typeof(string));
                foreach (string companyid in companyid_Array)
                {
                    string[] paramArr = { companyid, scheduleid };
                    string s = webClientBLL.GetRemoteHtml("odds/detail.aspx?companyID={0}&scheduleid={1}", paramArr);
                    Parser parser = Parser.CreateParser(s, "utf-8");
                    AndFilter andFilter = new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("bgColor", "#bbbbbb"));
                    NodeList tableList = parser.ExtractAllNodesThatMatch(andFilter);
                    parser = Parser.CreateParser(s, "utf-8");
                    //NodeList h3tag = parser.ExtractAllNodesThatMatch(new TagNameFilter("h3"));
                    //string year = h3tag[0].ToPlainTextString().Remove(5);
                    if (tableList.Count == 3)
                    {
                        DataRow dr = dt.NewRow();
                        dr["scheduleid"] = scheduleid;
                        dr["companyid"] = companyid;
                        NodeList tdList;
                        string pankou;
                        #region 让球盘
                        AndFilter andFilter1 = new AndFilter(new TagNameFilter("tr"), new HasAttributeFilter("class", "ts1"));
                        NodeList list = tableList[0].Children.ExtractAllNodesThatMatch(andFilter1);

                        if (list.Count > 0)
                        {
                            tdList = list[list.Count - 1].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));//初盘
                            pankou = CommonHelper.GoalCnToGoal(tdList[1].ToPlainTextString());
                            double per1 = 0, per2 = 0, per3 = 0;
                            double per4 = 0, per5 = 0, per6 = 0;
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["aaa"] = tdList[0].ToPlainTextString();
                                dr["aab"] = pankou;
                                dr["aac"] = tdList[2].ToPlainTextString();
                                DataSet ds = odds_rqbll.queryCompanyOddsCount(companyid, tdList[0].ToPlainTextString(), pankou, tdList[2].ToPlainTextString(), Convert.ToInt32(Request.Form["scheduleType"]), "Chupan");
                                if (Convert.ToDouble(ds.Tables[0].Rows[0][3]) > 0)
                                {
                                    per1 = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per2 = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per3 = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    dr["aaa1"] = ds.Tables[0].Rows[0][0].ToString() + "(" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%)";
                                    dr["aab1"] = ds.Tables[0].Rows[0][1].ToString() + "(" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%)";
                                    dr["aac1"] = ds.Tables[0].Rows[0][2].ToString() + "(" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%)";
                                }
                            }
                            tdList = list[0].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));//终盘
                            pankou = CommonHelper.GoalCnToGoal(tdList[1].ToPlainTextString());
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["aba"] = tdList[0].ToPlainTextString();
                                dr["abb"] = pankou;
                                dr["abc"] = tdList[2].ToPlainTextString();
                                DataSet ds = odds_rqbll.queryCompanyOddsCount(companyid, tdList[0].ToPlainTextString(), pankou, tdList[2].ToPlainTextString(), Convert.ToInt32(Request.Form["scheduleType"]), "Zhongpan");
                                if (Convert.ToDouble(ds.Tables[0].Rows[0][3]) > 0)
                                {
                                    per4 = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per5 = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    per6 = Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100);
                                    dr["aba1"] = ds.Tables[0].Rows[0][0].ToString() + "(<font color=" + (per4 > per1 ? "red" : "green") + ">" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][0]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%</font>)";
                                    dr["abb1"] = ds.Tables[0].Rows[0][1].ToString() + "(<font color=" + (per5 > per2 ? "red" : "green") + ">" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][1]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%</font>)";
                                    dr["abc1"] = ds.Tables[0].Rows[0][2].ToString() + "(<font color=" + (per6 > per3 ? "red" : "green") + ">" + Math.Round(Convert.ToDouble(ds.Tables[0].Rows[0][2]) / Convert.ToDouble(ds.Tables[0].Rows[0][3]) * 100) + "%</font>)";
                                }
                            }
                        }
                        #endregion
                        #region 标准盘
                        list = tableList[1].Children.ExtractAllNodesThatMatch(andFilter1);
                        if (list.Count > 0)
                        {
                            tdList = list[list.Count - 1].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                            dr["baa"] = tdList[0].ToPlainTextString();
                            dr["bab"] = tdList[1].ToPlainTextString();
                            dr["bac"] = tdList[2].ToPlainTextString();
                            tdList = list[0].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));//终盘
                            dr["bba"] = tdList[0].ToPlainTextString();
                            dr["bbb"] = tdList[1].ToPlainTextString();
                            dr["bbc"] = tdList[2].ToPlainTextString();
                        }
                        #endregion
                        #region 大小盘
                        list = tableList[2].Children.ExtractAllNodesThatMatch(andFilter1);
                        if (list.Count > 0)
                        {
                            tdList = list[list.Count - 1].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                            pankou = CommonHelper.BallSizeToBall(tdList[1].ToPlainTextString());
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["caa"] = tdList[0].ToPlainTextString();
                                dr["cab"] = pankou;
                                dr["cac"] = tdList[2].ToPlainTextString();
                            }
                            tdList = list[0].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                            pankou = CommonHelper.BallSizeToBall(tdList[1].ToPlainTextString());
                            if (!string.IsNullOrEmpty(pankou))
                            {
                                dr["cba"] = tdList[0].ToPlainTextString();
                                dr["cbb"] = pankou;
                                dr["cbc"] = tdList[2].ToPlainTextString();
                            }
                        }
                        #endregion
                        dt.Rows.Add(dr);
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    DataRow dr1 = dt.NewRow();

                    #region 亚洲盘统计
                    List<double> pankouList1 = new List<double>();
                    List<double> homefcList1 = new List<double>();
                    List<double> awayfcList1 = new List<double>();
                    List<double> pankouList2 = new List<double>();
                    List<double> homefcList2 = new List<double>();
                    List<double> awayfcList2 = new List<double>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["aab"] != DBNull.Value && !pankouList1.Contains(Convert.ToDouble(dr["aab"])))
                        {
                            pankouList1.Add(Convert.ToDouble(dr["aab"]));
                        }
                        if (dr["abb"] != DBNull.Value && !pankouList2.Contains(Convert.ToDouble(dr["abb"])))
                        {
                            pankouList2.Add(Convert.ToDouble(dr["abb"]));
                        }
                    }
                    foreach (decimal item in pankouList2)
                    {
                        if (dt.Select("aab=" + item).Count() > 1)
                        {
                            double fc = Convert.ToDouble(dt.Compute("Var(aaa)", "aab=" + item));
                            homefcList1.Add(fc);
                            fc = Convert.ToDouble(dt.Compute("Var(aac)", "aab=" + item));
                            awayfcList1.Add(fc);
                        }
                        if (dt.Select("abb=" + item).Count() > 1)
                        {
                            double fc = Convert.ToDouble(dt.Compute("Var(aba)", "abb=" + item));
                            homefcList2.Add(fc);
                            fc = Convert.ToDouble(dt.Compute("Var(abc)", "abb=" + item));
                            awayfcList2.Add(fc);
                        }
                    }
                    dr1["aaa"] = Convert.ToDouble(dt.Compute("Avg(aaa)", "1=1"));
                    dr1["aac"] = Convert.ToDouble(dt.Compute("Avg(aac)", "1=1"));
                    dr1["aaa1"] = homefcList1.Average();
                    dr1["aac1"] = awayfcList1.Average();
                    dr1["aba"] = Convert.ToDouble(dt.Compute("Avg(aba)", "1=1"));
                    dr1["abc"] = Convert.ToDouble(dt.Compute("Avg(abc)", "1=1"));
                    dr1["aba1"] = "<font color=" + (homefcList2.Average() > homefcList1.Average() ? "red" : "green") + ">" + homefcList2.Average() + "</font>";
                    dr1["abc1"] = "<font color=" + (awayfcList2.Average() > awayfcList1.Average() ? "red" : "green") + ">" + awayfcList2.Average() + "</font>";
                    #endregion

                    dr1["baa"] = Convert.ToDouble(dt.Compute("Avg(baa)", "1=1"));
                    dr1["bab"] = Convert.ToDouble(dt.Compute("Avg(bab)", "1=1"));
                    dr1["bac"] = Convert.ToDouble(dt.Compute("Avg(bac)", "1=1"));
                    dr1["bba"] = Convert.ToDouble(dt.Compute("Avg(bba)", "1=1"));
                    dr1["bbb"] = Convert.ToDouble(dt.Compute("Avg(bbb)", "1=1"));
                    dr1["bbc"] = Convert.ToDouble(dt.Compute("Avg(bbc)", "1=1"));
                    dr1["baa1"] = Convert.ToDouble(dt.Compute("Var(baa)", "1=1"));
                    dr1["bab1"] = Convert.ToDouble(dt.Compute("Var(bab)", "1=1"));
                    dr1["bac1"] = Convert.ToDouble(dt.Compute("Var(bac)", "1=1"));
                    dr1["bba1"] = "<font color=" + (Convert.ToDouble(dt.Compute("Var(bba)", "1=1")) > Convert.ToDouble(dr1["baa1"]) ? "red" : "green") + ">" + Convert.ToDouble(dt.Compute("Var(bba)", "1=1")) + "</font>";
                    dr1["bbb1"] = "<font color=" + (Convert.ToDouble(dt.Compute("Var(bbb)", "1=1")) > Convert.ToDouble(dr1["bab1"]) ? "red" : "green") + ">" + Convert.ToDouble(dt.Compute("Var(bbb)", "1=1")) + "</font>";
                    dr1["bbc1"] = "<font color=" + (Convert.ToDouble(dt.Compute("Var(bbc)", "1=1")) > Convert.ToDouble(dr1["bac1"]) ? "red" : "green") + ">" + Convert.ToDouble(dt.Compute("Var(bbc)", "1=1")) + "</font>";
                    dt.Rows.Add(dr1);
                }

                JObject result = new JObject();
                result.Add(new JProperty("success", true));
                result.Add(new JProperty("totlalCount", dt.Rows.Count));
                result.Add(new JProperty("data", JArray.FromObject(dt)));
                JsonStr = result.ToString();
            }
            else
            {
                JsonStr = "{success:false,message:'请求数据异常!'}";
            }
        }
        catch (Exception e)
        {
            JsonStr = "{success:false,message:'" + e.Message + "'}";
        }
    }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ScheduleBLL schedulebll = new ScheduleBLL();
            odds_rq rqbll = new odds_rq();
            odds_bz bzbll = new odds_bz();

            DataSet schedule = DbHelperSQL.Query("select top 200 id,scheduletypeid,Data,Date,home,away FROM Schedule where updated=1 order by id desc");
            List<int> companyidList = new List<int>();
            foreach (DataRow dr in schedule.Tables[0].Rows)
            {
                DataSet odds = DbHelperSQL.Query("select a.companyid, a.home aaa,a.pankou aab,a.away aac,b.home aba,b.pankou abb,b.away abc from tempdb..TempTable_Companys_Chupan_RQ a join tempdb..TempTable_Companys_Zhongpan_RQ b on a.scheduleid=b.scheduleid and a.companyid=b.companyid where a.scheduleid=" + dr["id"]);
                List<string> oddsList = new List<string>();
                foreach (DataRow item in odds.Tables[0].Rows)
                {
                    string[] sa = { item["aaa"].ToString(), item["aab"].ToString(), item["aac"].ToString(), item["aba"].ToString(), item["abb"].ToString(), item["abc"].ToString(), item["companyid"].ToString() };
                    oddsList.Add(string.Join(",", sa));
                    companyidList.Add(Convert.ToInt32(item["companyid"]));
                }

                if (oddsList.Count > 0)
                {
                    //DataTable dt = rqbll.queryOddsPer(oddsList, 0.02f, 0, Convert.ToInt32(dr["id"]));
                    //DataTable dt = rqbll.queryCompanyOddsPer(oddsList, 0, Convert.ToInt32(dr["id"]));
                    DataTable dt = bzbll.queryCompanyOddsPer(oddsList, 0, Convert.ToInt32(dr["id"]));
                    //DataTable dt = rqbll.queryCompanyOddsPer1(Convert.ToInt32(dr["scheduletypeid"]), Convert.ToInt32(dr["id"]), companyidList);
                    try
                    {

                        double pankou = Convert.ToDouble(odds.Tables[0].Rows[0]["aab"]);
                        if (dt.Rows.Count > 0)
                        {
                            if (Math.Abs(Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1"))) > 10)
                            {
                                if (Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1")) > 10 && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) > pankou)
                                {
                                    winCount++;
                                }
                                else if (Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1")) < 10 && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) < pankou)
                                {
                                    winCount++;
                                }
                                totalCount++;
                            }
                            if (Math.Abs(Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1"))) > 0)
                            {
                                if (Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1")) > 0 && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) > pankou)
                                {
                                    winCount1++;
                                }
                                else if (Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1")) < 0 && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) < pankou)
                                {
                                    winCount1++;
                                }
                                totalCount1++;
                            }
                            double ycount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy > rqs"));
                            double scount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy < rqs"));
                            if (ycount + scount > 0)
                            {
                                if (ycount / (ycount + scount) > 0.7d || scount / (ycount + scount) > 0.7d)
                                {
                                    if (ycount / (ycount + scount) > 0.7d && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) > pankou)
                                    {
                                        winCount2++;
                                    }
                                    else if (scount / (ycount + scount) > 0.7d && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) < pankou)
                                    {
                                        winCount2++;
                                    }
                                    totalCount2++;
                                }
                            }

                            if (Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1")) < 0 && Convert.ToInt32(dt.Compute("count(rqy)", "rqy > rqs")) - Convert.ToInt32(dt.Compute("count(rqy)", "rqy < rqs")) >= 10)
                            {
                                if (Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) > pankou)
                                {
                                    winCount3++;
                                }
                                totalCount3++;
                            }
                            else if (Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1")) >0 && Convert.ToInt32(dt.Compute("count(rqy)", "rqy > rqs")) - Convert.ToInt32(dt.Compute("count(rqy)", "rqy < rqs")) <= 10)
                            {
                                if (Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) < pankou)
                                {
                                    winCount3++;
                                }
                                totalCount3++;
                            }

                        }

                        //DataSet ds = rqbll.queryOddsCount(oddsList, 0.05f, 0, Convert.ToInt32(dr["id"]));//Convert.ToInt32(dr["scheduleTypeid"])
                        //if (ds != null && Convert.ToInt32(ds.Tables[0].Rows[0]["totalCount"]) > 0)
                        //{
                        //    int diff = Convert.ToInt32(ds.Tables[0].Rows[0][0]) - Convert.ToInt32(ds.Tables[0].Rows[0][2]);
                        //    //if (Math.Abs(diff) >= 5 && Math.Min(Convert.ToInt32(ds.Tables[0].Rows[0][0]), Convert.ToInt32(ds.Tables[0].Rows[0][2])) == 0)
                        //    //{
                        //    if (diff > 0 && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) > pankou)
                        //    {
                        //        winCount3++;
                        //    }
                        //    else if (diff < 0 && Convert.ToInt32(dr["home"]) - Convert.ToInt32(dr["away"]) < pankou)
                        //    {
                        //        winCount3++;
                        //    }
                        //    totalCount3++;
                        //    //}
                        //}
                    }
                    catch (Exception)
                    {

                        throw;
                    }
                }

            }
        }
    }
예제 #10
0
    private void queryOddsPerRQ1()
    {
        if (Request["scheduletypeid"] != null && Request["scheduleid"] != null && Request["companyids"] != null)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("rqy", typeof(double));
            dt.Columns.Add("rqz", typeof(double));
            dt.Columns.Add("rqs", typeof(double));
            dt.Columns.Add("totalCount", typeof(int));
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
            string[]   companyidarray         = Request.Form["companyids"].Split(',');
            string     scheduleid             = Request.Form["scheduleid"];
            List <int> companyidList          = new List <int>();
            foreach (string companyid in companyidarray)
            {
                companyidList.Add(Convert.ToInt32(companyid));
                List <string> whereStrList = new List <string>();
                string[]      paramArr     = { companyid, scheduleid };
                string        s            = webClientBLL.GetRemoteHtml("odds/detail.aspx?companyID={0}&scheduleid={1}", paramArr);
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                Parser    parser    = Parser.CreateParser(s, "utf-8");
                AndFilter andFilter = new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("bgColor", "#bbbbbb"));
                NodeList  tableList = parser.ExtractAllNodesThatMatch(andFilter);
                parser = Parser.CreateParser(s, "utf-8");
                NodeList h3tag = parser.ExtractAllNodesThatMatch(new TagNameFilter("h3"));
                string   year  = h3tag[0].ToPlainTextString().Remove(5);
                if (tableList.Count == 3)
                {
                    AndFilter andFilter1 = new AndFilter(new TagNameFilter("tr"), new HasAttributeFilter("class", "ts1"));

                    NodeList list = tableList[0].Children.ExtractAllNodesThatMatch(andFilter1);
                    for (int i = 0; i < list.Count; i++)
                    {
                        NodeList tdList = list[i].Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.TableColumn));
                        string   pankou = CommonHelper.GoalCnToGoal(tdList[1].ToPlainTextString());
                        if (!string.IsNullOrEmpty(pankou))
                        {
                            whereStrList.Add("e.home=" + tdList[0].ToPlainTextString() + " and e.pankou=" + pankou + " and e.away=" + tdList[2].ToPlainTextString());
                        }
                    }
                }

                if (whereStrList.Count > 0)
                {
                    DataTable dt1 = odds_rqbll.queryCompanyOddsPer1(Convert.ToInt32(Request.Form["scheduletypeid"]), Convert.ToInt32(Request.Form["scheduleid"]), Convert.ToInt32(companyid), whereStrList);
                    if (dt1 != null && dt1.Rows.Count > 0 && Convert.ToInt32(dt1.Rows[0]["totalCount"]) > 0)
                    {
                        dt.ImportRow(dt1.Rows[0]);
                    }
                }
            }

            DataTable data = new DataTable();
            data.Columns.Add("id", typeof(int));
            data.Columns.Add("name", typeof(string));
            data.Columns.Add("rqyper", typeof(float));
            data.Columns.Add("rqzper", typeof(float));
            data.Columns.Add("rqsper", typeof(float));
            data.Columns.Add("diffper", typeof(float));
            data.Columns.Add("suggest", typeof(int));

            DataRow dr = data.NewRow();
            dr["id"]      = 1;
            dr["name"]    = "赔率支持平均";
            dr["rqyper"]  = dt.Compute("avg(rqy)", "1=1");
            dr["rqzper"]  = dt.Compute("avg(rqz)", "1=1");
            dr["rqsper"]  = dt.Compute("avg(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1"));
            dr["suggest"] = 25;
            data.Rows.Add(dr);

            dr            = data.NewRow();
            dr["id"]      = 2;
            dr["name"]    = "赔率支持最大";
            dr["rqyper"]  = dt.Compute("max(rqy)", "1=1");
            dr["rqzper"]  = dt.Compute("avg(rqz)", "1=1");
            dr["rqsper"]  = dt.Compute("max(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            double ycount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy > rqs"));
            double scount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy < rqs"));
            dr            = data.NewRow();
            dr["id"]      = 3;
            dr["name"]    = "公司支持数量";
            dr["rqyper"]  = ycount / (ycount + scount) * 100;
            dr["rqzper"]  = 0;
            dr["rqsper"]  = scount / (ycount + scount) * 100;
            dr["diffper"] = ycount / (ycount + scount) * 100 - scount / (ycount + scount) * 100;
            dr["suggest"] = 80;
            data.Rows.Add(dr);
            responseText = "{success:true,data:" + JArray.FromObject(data) + "}";
        }
    }
예제 #11
0
    private void queryOddsRQ()
    {
        if (Request["odds"] != null && Request["isTrue"] != null)
        {
            JObject   result     = new JObject();
            JArray    oddsArray  = JArray.Parse(Request.Form["odds"]);
            int       totalCount = 0;
            DataSet   ds         = null;
            DataTable dt         = null;
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();

            foreach (JObject item in oddsArray)
            {
                ds = odds_rqbll.GetList(item["companyid"].ToString().Replace("\"", ""), new string[] { (string)item["home1"], (string)item["pankou1"], (string)item["away1"], (string)item["home2"], (string)item["pankou2"], (string)item["away2"] });
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (dt == null)
                    {
                        dt = ds.Tables[0];
                    }
                    else
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            dt.ImportRow(dr);
                        }
                    }
                }
            }
            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("victory");
                dt.Columns.Add("win1");
                dt.Columns.Add("win2");
                foreach (DataRow dr in dt.Rows)
                {
                    int score = (int)dr["home"] - (int)dr["away"];
                    if (score > 0)
                    {
                        dr["victory"] = 3;
                    }
                    else if (score == 0)
                    {
                        dr["victory"] = 1;
                    }
                    else
                    {
                        dr["victory"] = 0;
                    }
                    if (score > float.Parse(dr["pankou1"].ToString()))
                    {
                        dr["win1"] = 3;
                    }
                    else if (score == float.Parse(dr["pankou1"].ToString()))
                    {
                        dr["win1"] = 1;
                    }
                    else
                    {
                        dr["win1"] = 0;
                    }
                    if (score > float.Parse(dr["pankou2"].ToString()))
                    {
                        dr["win2"] = 3;
                    }
                    else if (score == float.Parse(dr["pankou2"].ToString()))
                    {
                        dr["win2"] = 1;
                    }
                    else
                    {
                        dr["win2"] = 0;
                    }
                }
            }
            result.Add("success", true);
            result.Add("totalCount", totalCount);
            string javascriptJson = JsonConvert.SerializeObject(dt, new JavaScriptDateTimeConverter());
            responseText = "{success:true,totalCount:" + totalCount + ",data:" + javascriptJson + "}";
        }
    }
예제 #12
0
    private void queryOddsCountRQ()
    {
        if (Request["rowData"] != null && Request["blur"] != null)
        {
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
            JArray        rowData             = JArray.Parse(Request.Form["rowData"]);
            List <string> oddsList            = new List <string>();
            foreach (JObject item in rowData)
            {
                if (!string.IsNullOrEmpty((string)item["aaa"]) && !string.IsNullOrEmpty((string)item["aab"]) && !string.IsNullOrEmpty((string)item["aac"]) && !string.IsNullOrEmpty((string)item["aba"]) && !string.IsNullOrEmpty((string)item["abb"]) && !string.IsNullOrEmpty((string)item["abc"]))
                {
                    string[] sa = { (string)item["aaa"], (string)item["aab"], (string)item["aac"], (string)item["aba"], (string)item["abb"], (string)item["abc"], item["companyid"].ToString() };
                    oddsList.Add(string.Join(",", sa));
                }
            }
            JArray data1 = new JArray();
            JArray data2 = new JArray();

            JObject obj        = JObject.Parse("{blur:" + Request.Form["blur"] + "}");
            DataSet ds         = odds_rqbll.queryOddsCount(oddsList, float.Parse(Request.Form["blur"]), Convert.ToInt32(Request.Form["scheduleType"]));
            int     totalCount = int.Parse(ds.Tables[0].Rows[0]["totalCount"].ToString());
            if (totalCount > 0)
            {
                obj.Add("rqycount1", ds.Tables[0].Rows[0][0].ToString());
                obj.Add("rqzcount1", ds.Tables[0].Rows[0][1].ToString());
                obj.Add("rqscount1", ds.Tables[0].Rows[0][2].ToString());
                obj.Add("totalCount1", totalCount);
                double diffPer = (Convert.ToDouble(ds.Tables[0].Rows[0][0]) / totalCount) - (Convert.ToDouble(ds.Tables[0].Rows[0][2]) / totalCount);
                if (totalCount >= 5)
                {
                    double rmb = 0;
                    rmb = Math.Floor(Math.Abs(diffPer) * 100);
                    if (Math.Abs(diffPer) == 1)
                    {
                        rmb *= 2;
                    }
                    if (diffPer > 0)
                    {
                        obj.Add("suggest", "<font color=red>" + rmb + "元</font>");
                    }
                    else if (diffPer < 0)
                    {
                        obj.Add("suggest", "<font color=blue>" + rmb + "元</font>");
                    }
                    else
                    {
                        obj.Add("suggest", "<font color=green>0元</font>");
                    }
                }
            }
            //ds = odds_rqbll.queryOddsCount(oddsList, 2, float.Parse(Request.Form["blur"]), Convert.ToInt32(Request.Form["scheduleType"]));
            //totalCount = int.Parse(ds.Tables[0].Rows[0]["totalCount"].ToString());
            //if (totalCount > 0)
            //{
            //    obj.Add("rqycount2", ds.Tables[0].Rows[0][0].ToString());
            //    obj.Add("rqzcount2", ds.Tables[0].Rows[0][1].ToString());
            //    obj.Add("rqscount2", ds.Tables[0].Rows[0][2].ToString());
            //    obj.Add("totalCount2", totalCount);
            //}
            JArray data = new JArray();
            data.Add(obj);
            responseText = "{success:true,data:" + data.ToString() + "}";
        }
    }
예제 #13
0
    private void queryOddsPerRQ()
    {
        if (Request["rowData"] != null)
        {
            SeoWebSite.BLL.odds_rq odds_rqbll = new SeoWebSite.BLL.odds_rq();
            SeoWebSite.BLL.odds_bz odds_bzbll = new SeoWebSite.BLL.odds_bz();
            JArray        rowData             = JArray.Parse(Request.Form["rowData"]);
            List <string> oddsList            = new List <string>();
            List <string> oddsList1           = new List <string>();
            foreach (JObject item in rowData)
            {
                if (!string.IsNullOrEmpty((string)item["aaa"]) && !string.IsNullOrEmpty((string)item["aab"]) && !string.IsNullOrEmpty((string)item["aac"]) && !string.IsNullOrEmpty((string)item["aba"]) && !string.IsNullOrEmpty((string)item["abb"]) && !string.IsNullOrEmpty((string)item["abc"]))
                {
                    string[] sa = { (string)item["aaa"], (string)item["aab"], (string)item["aac"], (string)item["aba"], (string)item["abb"], (string)item["abc"], item["companyid"].ToString() };
                    oddsList.Add(string.Join(",", sa));
                }
                if (!string.IsNullOrEmpty((string)item["baa"]) && !string.IsNullOrEmpty((string)item["bab"]) && !string.IsNullOrEmpty((string)item["bac"]) && !string.IsNullOrEmpty((string)item["bba"]) && !string.IsNullOrEmpty((string)item["bbb"]) && !string.IsNullOrEmpty((string)item["bbc"]))
                {
                    string[] sa = { (string)item["baa"], (string)item["bab"], (string)item["bac"], (string)item["bba"], (string)item["bbb"], (string)item["bbc"], item["companyid"].ToString() };
                    oddsList1.Add(string.Join(",", sa));
                }
            }
            DataTable dt   = odds_rqbll.queryCompanyOddsPer(oddsList, 0, 0);
            DataTable dt1  = odds_bzbll.queryCompanyOddsPer(oddsList1, 0, 0);
            DataTable data = new DataTable();
            data.Columns.Add("id", typeof(int));
            data.Columns.Add("name", typeof(string));
            data.Columns.Add("rqyper", typeof(float));
            data.Columns.Add("rqzper", typeof(float));
            data.Columns.Add("rqsper", typeof(float));
            data.Columns.Add("diffper", typeof(float));
            data.Columns.Add("suggest", typeof(int));

            DataRow dr = data.NewRow();
            dr["id"]      = 1;
            dr["name"]    = "亚赔支持平均";
            dr["rqyper"]  = dt.Compute("avg(rqy)", "1=1");
            dr["rqzper"]  = dt.Compute("avg(rqz)", "1=1");
            dr["rqsper"]  = dt.Compute("avg(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("avg(rqs)", "1=1"));
            dr["suggest"] = 25;
            data.Rows.Add(dr);

            dr            = data.NewRow();
            dr["id"]      = 2;
            dr["name"]    = "亚赔支持最大";
            dr["rqyper"]  = dt.Compute("max(rqy)", "1=1");
            dr["rqzper"]  = dt.Compute("max(rqz)", "1=1");
            dr["rqsper"]  = dt.Compute("max(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt.Compute("max(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            double ycount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy > rqs"));
            double scount = Convert.ToDouble(dt.Compute("count(rqy)", "rqy < rqs"));
            dr            = data.NewRow();
            dr["id"]      = 3;
            dr["name"]    = "亚赔支持数量";
            dr["rqyper"]  = ycount / (ycount + scount) * 100;
            dr["rqzper"]  = 0;
            dr["rqsper"]  = scount / (ycount + scount) * 100;
            dr["diffper"] = ycount / (ycount + scount) * 100 - scount / (ycount + scount) * 100;
            dr["suggest"] = 80;
            data.Rows.Add(dr);

            dr            = data.NewRow();
            dr["id"]      = 4;
            dr["name"]    = "欧赔支持平均";
            dr["rqyper"]  = dt1.Compute("avg(rqy)", "1=1");
            dr["rqzper"]  = dt1.Compute("avg(rqz)", "1=1");
            dr["rqsper"]  = dt1.Compute("avg(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt1.Compute("avg(rqy)", "1=1")) - Convert.ToInt32(dt1.Compute("avg(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            dr            = data.NewRow();
            dr["id"]      = 5;
            dr["name"]    = "欧赔支持最大";
            dr["rqyper"]  = dt1.Compute("max(rqy)", "1=1");
            dr["rqzper"]  = dt1.Compute("max(rqz)", "1=1");
            dr["rqsper"]  = dt1.Compute("max(rqs)", "1=1");
            dr["diffper"] = Convert.ToInt32(dt1.Compute("max(rqy)", "1=1")) - Convert.ToInt32(dt1.Compute("max(rqs)", "1=1"));
            dr["suggest"] = 40;
            data.Rows.Add(dr);

            double ycount1 = Convert.ToDouble(dt1.Compute("count(rqy)", "rqy > rqs"));
            double scount1 = Convert.ToDouble(dt1.Compute("count(rqy)", "rqy < rqs"));
            dr            = data.NewRow();
            dr["id"]      = 6;
            dr["name"]    = "欧赔支持数量";
            dr["rqyper"]  = ycount1 / (ycount1 + scount1) * 100;
            dr["rqzper"]  = 0;
            dr["rqsper"]  = scount1 / (ycount1 + scount1) * 100;
            dr["diffper"] = ycount1 / (ycount1 + scount1) * 100 - scount1 / (ycount1 + scount1) * 100;
            dr["suggest"] = 80;
            data.Rows.Add(dr);
            responseText = "{success:true,data:" + JArray.FromObject(data) + "}";
        }
    }