Example #1
0
    private void DemoPage()
    {
        string txt = new TPR2.Collec.BasketWap().GetBasketWap(216682);

        //builder.Append(txt);

        string   p_title   = "";
        string   p_one     = "";
        string   p_two     = "";
        DateTime p_TPRtime = DateTime.Now;

        string strpattern = @"[\s\S]+<strong\sstyle=[\s\S]+>([\s\S]+)</strong>[\s\S]+<strong\sstyle=[\s\S]+>([\s\S]+)</strong>[\s\S]+<b>开赛时间:</b>([\s\S]+)</font>&nbsp;&nbsp;场地:[\s\S]+target=_blank><u>([\s\S]+)";

        Match mtitle = Regex.Match(txt, strpattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);

        if (mtitle.Success)
        {
            p_title = mtitle.Groups[4].Value;
            p_title = Regex.Replace(p_title, @"[\s\r\n]+", "");
            //builder.Append(p_title + "");

            p_one = mtitle.Groups[1].Value;
            p_one = Regex.Replace(p_one, @"[\s\r\n]+", "");
            //builder.Append(p_one + "");

            p_two = mtitle.Groups[2].Value;
            p_two = Regex.Replace(p_two, @"[\s\r\n]+", "");
            //builder.Append(p_two + "");


            string p_time = mtitle.Groups[3].Value;
            p_time    = Regex.Replace(p_time, @"[\s\r\n]+", "");
            p_time    = Regex.Replace(p_time, @"&nbsp;星期[^\^]&nbsp;", " ");
            p_TPRtime = Convert.ToDateTime(p_time);
            //builder.Append(p_TPRtime + "");



            builder.Append(p_title + "<br />");
            builder.Append(p_one + "<br />");
            builder.Append(p_two + "<br />");
            builder.Append(p_TPRtime + "<br />");
        }
    }
Example #2
0
    /// <summary>
    /// 写入数据库
    /// </summary>
    /// <param name="p_id"></param>
    /// <param name="p_pk"></param>
    /// <param name="p_dx_pk"></param>
    /// <param name="p_one_lu"></param>
    /// <param name="p_two_lu"></param>
    /// <param name="p_big_lu"></param>
    /// <param name="p_small_lu"></param>
    public void AccessData(int Types, int p_id, decimal p_pk, decimal p_dx_pk, decimal p_one_lu, decimal p_two_lu, decimal p_big_lu, decimal p_small_lu)
    {
        #region 定义Model
        TPR2.Model.guess.BaList model = new TPR2.Model.guess.BaList();
        model.p_id   = p_id;
        model.p_type = 2;

        if (p_pk < 0)
        {
            model.p_pn = 2;
        }
        else
        {
            model.p_pn = 1;
        }

        model.p_pk       = p_pk;
        model.p_dx_pk    = p_dx_pk;
        model.p_one_lu   = p_one_lu + 1;
        model.p_two_lu   = p_two_lu + 1;
        model.p_big_lu   = p_big_lu + 1;
        model.p_small_lu = p_small_lu + 1;
        model.p_bzs_lu   = 0;
        model.p_bzp_lu   = 0;
        model.p_bzx_lu   = 0;
        model.p_basketve = Types;
        #endregion

        #region 操作类 BLL
        TPR2.BLL.guess.BaList bll = new TPR2.BLL.guess.BaList();
        //检查是否存在记录
        if (!bll.ExistsByp_id(p_id, Types))
        {
            #region 是否先隐藏
            //是否先隐藏
            if (ub.GetSub("SiteIsyc", xmlPath) == "1")
            {
                model.p_del = 1;
            }
            else
            {
                model.p_del = 0;
            }
            #endregion

            #region 根据ID抓取数据 txt  http://nba.win007.com/analysis/" + p_id + ".htm
            //根据ID抓取数据
            string   txt       = new TPR2.Collec.BasketWap().GetBasketWap(p_id);
            string   p_title   = "";
            string   p_one     = "";
            string   p_two     = "";
            DateTime p_TPRtime = DateTime.Now;
            #endregion

            #region 获取队名,主队副队,时间
            string strpattern = @"[\s\S]+<strong\sstyle=[\s\S]+>([\s\S]+)</strong>[\s\S]+<strong\sstyle=[\s\S]+>([\s\S]+)</strong>[\s\S]+<b>开赛时间:</b>([\s\S]+)</font>&nbsp;&nbsp;场地:[\s\S]+target=_blank><u>([\s\S]+)";
            Match  mtitle     = Regex.Match(txt, strpattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            if (mtitle.Success)
            {
                p_title = mtitle.Groups[4].Value;
                p_title = Regex.Replace(p_title, @"[\s\r\n]+", "");
                //builder.Append(p_title + "");

                p_one = mtitle.Groups[1].Value;
                p_one = Regex.Replace(p_one, @"[\s\r\n]+", "");
                //builder.Append(p_one + "");

                p_two = mtitle.Groups[2].Value;
                p_two = Regex.Replace(p_two, @"[\s\r\n]+", "");
                //builder.Append(p_two + "");


                string p_time = mtitle.Groups[3].Value;
                p_time    = Regex.Replace(p_time, @"[\s\r\n]+", "");
                p_time    = Regex.Replace(p_time, @"&nbsp;星期[^\^]&nbsp;", " ");
                p_TPRtime = Convert.ToDateTime(p_time);
                //builder.Append(p_TPRtime + "");
            }
            #endregion

            #region 一节 二节 上半场 三节更新
            if (Convert.ToDateTime(p_TPRtime) <= DateTime.Now.AddHours(30))
            {
                //if (ub.GetSub("Sitelqhalf", xmlPath).IndexOf(p_title) != -1 || ub.GetSub("Sitelqhalf", xmlPath) == "")
                //{
                model.p_title = p_title;
                model.p_two   = p_two;
                if (Types == 1)
                {
                    model.p_one = "(一节)" + p_one;
                }
                else if (Types == 2)
                {
                    model.p_one = "(二节)" + p_one;
                }
                else if (Types == 3)
                {
                    model.p_one = "(上半场)" + p_one;
                }
                else if (Types == 4)
                {
                    model.p_one = "(三节)" + p_one;
                }


                model.p_addtime = DateTime.Now;
                model.p_TPRtime = p_TPRtime;
                model.p_ison    = 0;
                bll.Add(model);
                //}
            }
            #endregion
        }
        else
        {
            bll.BasketUpdateOdds(model);
        }
        #endregion
    }