Exemplo n.º 1
0
        public void PubDltSecondTable(HtmlDocument htmlDoc, lotterydetail lotterydetail, string gameCode)
        {
            var dltList           = new List <dltList>();
            var SecondTableTrNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1].SelectNodes("tr").Skip(2);//第二个table

            int index = 0;

            foreach (var item in SecondTableTrNode)
            {
                if (item.SelectNodes("td")[0].InnerHtml == "派奖")
                {
                    continue;
                }
                index++;
                if (index % 2 != 0 && index < 12)
                {
                    int j     = 0;
                    var model = new dltList();
                    for (int i = 0; i < item.SelectNodes("td").Count; i++)
                    {
                        j++;

                        if (j == 1)
                        {
                            var hhh = item.SelectNodes("td")[i].InnerHtml;
                            model.openPrize = item.SelectNodes("td")[i].InnerHtml;
                            dltList.Add(model);
                        }
                        if (j == 2)
                        {
                            model.openPrizeType = openPrizeType.basic;
                        }
                        if (j == 3)
                        {
                            model.openWinNumber = item.SelectNodes("td")[i].InnerHtml;
                        }
                        if (j == 4)
                        {
                            model.openSingleBonus = item.SelectNodes("td")[i].InnerHtml;
                        }
                        if (j == 5)
                        {
                            model.openSumBonus = item.SelectNodes("td")[i].InnerHtml;
                            lotterydetail.dltLists.Add(model);
                        }
                    }
                }
                if (index % 2 == 0 && index < 12)
                {
                    int j          = 0;
                    int indexPrize = 0;
                    var model      = new dltList();
                    for (int i = 0; i < item.SelectNodes("td").Count; i++)
                    {
                        j++;

                        foreach (var itemPrize in lotterydetail.dltLists)
                        {
                            indexPrize++;
                            if (indexPrize == lotterydetail.dltLists.Count)
                            {
                                model.openPrize = itemPrize.openPrize;
                            }
                        }
                        if (j == 1)
                        {
                            model.openPrizeType = openPrizeType.Append;
                        }
                        if (j == 2)
                        {
                            model.openWinNumber = item.SelectNodes("td")[i].InnerHtml;
                        }
                        if (j == 3)
                        {
                            model.openSingleBonus = item.SelectNodes("td")[i].InnerHtml;
                        }
                        if (j == 4)
                        {
                            model.openSumBonus = item.SelectNodes("td")[i].InnerHtml;
                            lotterydetail.dltLists.Add(model);
                        }
                    }
                }
                if (index == 12)
                {
                    lotterydetail.TotalBonus = Convert.ToDecimal(item.SelectNodes("td")[3].InnerHtml);
                }
            }
        }
Exemplo n.º 2
0
        public List <dlt> GetDltByRule(string urlNumber)
        {
            if (Convert.ToInt32(urlNumber) > 18144)
            {
                HtmlWeb web = new HtmlWeb();
                CommonHelper.Gzip(web);
                var htmlDoc          = web.Load("http://kaijiang.500.com/shtml/dlt/" + urlNumber + ".shtml");
                var FirstTableTrNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr");
                int k   = 1;
                dlt dlt = new dlt();
                foreach (var item in FirstTableTrNode)//遍历第一个table下的tr
                {
                    switch (k)
                    {
                    case 1:
                        var    Date     = item.SelectSingleNode("//span[@class='span_right']").InnerHtml;
                        string openTime = Date.Split(':')[1].Split('兑')[0];
                        string EndTime  = Date.Split(':')[2];

                        dlt.expect   = urlNumber;
                        dlt.openTime = openTime;
                        dlt.endTime  = EndTime;
                        dltLists.Add(dlt);
                        break;

                    case 2:
                        int j = 1;
                        foreach (var item2 in item.SelectSingleNode("td").SelectSingleNode("table").SelectNodes("tr"))
                        {
                            switch (j)
                            {
                            case 1:
                                var lilist = item2.SelectNodes("td")[1].SelectSingleNode("div").SelectSingleNode("ul").SelectNodes("li");
                                foreach (var item3 in lilist)
                                {
                                    dlt.OpenCode += item3.InnerHtml + ",";
                                }
                                dlt.OpenCode.Trim(',');
                                break;

                            case 2:
                                dlt.OutOfOrder = item2.SelectNodes("td")[1].InnerHtml;
                                break;
                            }
                            j++;
                        }

                        break;

                    case 3:
                        dlt.SalesVolume = item.SelectSingleNode("td").SelectNodes("span")[0].InnerHtml;
                        dlt.PoolRolling = item.SelectSingleNode("td").SelectNodes("span")[1].InnerHtml;
                        break;
                    }
                    k = k + 1;
                }
                var dltList           = new List <dltList>();
                var SecondTableTrNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1].SelectNodes("tr").Skip(2);//第二个table

                int index = 0;
                foreach (var item in SecondTableTrNode)
                {
                    if (item.SelectNodes("td")[0].InnerHtml == "派奖")
                    {
                        continue;
                    }
                    index++;
                    if (index % 2 != 0 && index < 12)
                    {
                        int j     = 0;
                        var model = new dltList();
                        for (int i = 0; i < item.SelectNodes("td").Count; i++)
                        {
                            j++;

                            if (j == 1)
                            {
                                var hhh = item.SelectNodes("td")[i].InnerHtml;
                                model.openPrize = item.SelectNodes("td")[i].InnerHtml;
                                dltList.Add(model);
                            }
                            if (j == 2)
                            {
                                model.openPrizeType = openPrizeType.basic;
                            }
                            if (j == 3)
                            {
                                model.openWinNumber = item.SelectNodes("td")[i].InnerHtml;
                            }
                            if (j == 4)
                            {
                                model.openSingleBonus = item.SelectNodes("td")[i].InnerHtml;
                            }
                            if (j == 5)
                            {
                                model.openSumBonus = item.SelectNodes("td")[i].InnerHtml;
                                dlt.dltLists.Add(model);
                            }
                        }
                    }
                    if (index % 2 == 0 && index < 12)
                    {
                        int j          = 0;
                        int indexPrize = 0;
                        var model      = new dltList();
                        for (int i = 0; i < item.SelectNodes("td").Count; i++)
                        {
                            j++;

                            foreach (var itemPrize in dlt.dltLists)
                            {
                                indexPrize++;
                                if (indexPrize == dlt.dltLists.Count)
                                {
                                    model.openPrize = itemPrize.openPrize;
                                }
                            }
                            if (j == 1)
                            {
                                model.openPrizeType = openPrizeType.Append;
                            }
                            if (j == 2)
                            {
                                model.openWinNumber = item.SelectNodes("td")[i].InnerHtml;
                            }
                            if (j == 3)
                            {
                                model.openSingleBonus = item.SelectNodes("td")[i].InnerHtml;
                            }
                            if (j == 4)
                            {
                                model.openSumBonus = item.SelectNodes("td")[i].InnerHtml;
                                dlt.dltLists.Add(model);
                            }
                        }
                    }
                    if (index == 12)
                    {
                        dlt.TotalBonus = Convert.ToDecimal(item.SelectNodes("td")[3].InnerHtml);
                    }
                }
            }
            return(dltLists);
        }