Esempio n. 1
0
        private void BindGrid(DateTime touzhushijian)
        {
            DataSet ds = new YucerawdataDAL().GetYucerawdataAnalysis(touzhushijian);
            dgvResult.DataSource = ds.Tables[0];

            SetGridColor();
        }
Esempio n. 2
0
        private void TouzhuByMingren()
        {
            //重新绑定 
            DateTime date = dtpTouzhushijian.Value.Date;
            DataSet dsYuce = new YucerawdataDAL().GetYucerawdataAnalysisHasMingRen(date);

            PeilvDAL dal = new PeilvDAL();
            string riqi = dtpTouzhushijian.Value.Date.ToString("yyyy-MM-dd");
            string liansai = "全部";
            DataSet ds = dal.SearchPeilv(riqi, liansai);
            dgvTuijian.DataSource = ds.Tables[0];

            foreach (DataRow row in dsYuce.Tables[0].Rows)
            {
                //string kedui = row["kedui"].ToString();
                //string zhudui = row["zhudui"].ToString();
                string kedui = row["keduireal"].ToString();
                string zhudui = row["zhuduireal"].ToString();
                string yucespf = row["yucespf"].ToString();
                string hasrangqiu = row["hasrangqiu"].ToString();
                string rangqiushu = row["rangqiushu"].ToString();

                foreach (DataGridViewRow gridRow in dgvTuijian.Rows)
                {
                    if (gridRow.Index == dgvTuijian.Rows.Count - 1)
                    {
                        continue;
                    }
                    if (gridRow.Cells[2].Value.ToString().Equals(zhudui) || gridRow.Cells[3].Value.ToString().Equals(kedui))
                    {
                        if (hasrangqiu.Equals("0") && gridRow.Cells[4].Value.ToString().Equals("0"))
                        {
                            char[] chars = yucespf.ToCharArray();
                            foreach (char ch in chars)
                            {
                                if (ch <= '9' && ch >= '0')
                                {
                                    switch (ch)
                                    {
                                        case '0': SetCellColor(gridRow.Cells[7]); break;
                                        case '1': SetCellColor(gridRow.Cells[6]); break;
                                        case '3': SetCellColor(gridRow.Cells[5]); break;

                                    }
                                }
                            }
                        }
                        else if (hasrangqiu.Equals("1") && !gridRow.Cells[4].Value.ToString().Equals("0"))
                        {
                            char[] chars = yucespf.ToCharArray();
                            foreach (char ch in chars)
                            {
                                if (ch <= '9' && ch >= '0')
                                {
                                    switch (ch)
                                    {
                                        case '0': SetCellColor(gridRow.Cells[7]); break;
                                        case '1': SetCellColor(gridRow.Cells[6]); break;
                                        case '3': SetCellColor(gridRow.Cells[5]); break;

                                    }
                                }
                            }
                        }

                    }
                }

            }
            TouzhuByNatureForMingren(); 
        }
Esempio n. 3
0
        private void btnAnalysisCaike_Click(object sender, EventArgs e)
        {
            //获取最新预测数据
            YucerawdataDAL dal = new YucerawdataDAL();
            DataSet ds = dal.GetYucerawdata();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                string url = row["url"].ToString();
                string caizhongtype = row["caizhongtype"].ToString();
                string title = row["title"].ToString();
                string p2 = row["p2"].ToString();
                string p3 = row["p3"].ToString();
                string p8 = row["p8"].ToString();
                //分析数据
                int zhongkuohaoIndex = title.IndexOf("[");
                int zhongkuohaoIndex2 = title.IndexOf("]");
                string yuceren = "";
                if (zhongkuohaoIndex != -1)
                {
                    yuceren = title.Substring(zhongkuohaoIndex + 1, zhongkuohaoIndex2 - zhongkuohaoIndex - 1);
                }

                string zhudui = "";
                string kedui = "";
                if (p2.IndexOf(":") != -1)
                {
                    p2 = PreHandleData2(p2);
                    string[] splitP2 = p2.Split(' ');
                    kedui = splitP2[splitP2.Length - 1];
                    zhudui = splitP2[splitP2.Length - 3];
                    //去除主队和客队中包含的括号
                    kedui = DeleteKuohao(kedui);
                    zhudui = DeleteKuohao(zhudui);
                }
                else
                {
                    int vsIndex = p2.ToUpper().IndexOf("VS");
                    string preVs = p2.Substring(0, vsIndex).Replace("&nbsp;", "");
                    string postVs = p2.Substring(vsIndex + 2);
                    kedui = postVs.Replace("&nbsp;", "").Replace(" ", "");
                    int lastKonggeIndex = preVs.Trim().LastIndexOf(" ");
                    if (lastKonggeIndex != -1)
                    {
                        zhudui = preVs.Substring(lastKonggeIndex).Trim();
                    }
                    else
                    {
                        zhudui = preVs.Trim();
                    }

                    //去除主队和客队中包含的括号
                    kedui = DeleteKuohao(kedui);
                    zhudui = DeleteKuohao(zhudui);
                }

                //获取比赛时间
                string bisaishijian = "";
                p3 = PreHandleData3(p3);
                int bisaiIndex = p3.IndexOf("比赛时间:");
                bisaishijian = p3.Substring(bisaiIndex + 5);

                //获取推荐及让球数
                string spf = "";
                string rangqiushu = "0";
                int hasrangqiu = 0;
                p8 = PreHandleData8(p8);

                int maohaoIndex = p8.IndexOf(":");

                if (maohaoIndex == -1)
                {
                    maohaoIndex = p8.IndexOf("推荐") + 1;
                }
                int qiankuohaoIndex = p8.IndexOf("(");
                int houkuohaoIndex = p8.IndexOf(")");

                //这个分支适用于模式: 竞彩足球让球胜平负推荐:0(维冈竞技让1球)
                if (qiankuohaoIndex != -1 && qiankuohaoIndex > maohaoIndex && houkuohaoIndex == p8.Length - 1)
                {
                    spf = p8.Substring(maohaoIndex + 1, qiankuohaoIndex - maohaoIndex - 1);
                }
                else if (qiankuohaoIndex != -1 && qiankuohaoIndex > maohaoIndex && houkuohaoIndex != p8.Length - 1)
                {
                    spf = p8.Substring(houkuohaoIndex + 1);
                }
                else
                {
                    spf = p8.Substring(maohaoIndex + 1);
                }

                if (p8.IndexOf("无让球") != -1 || p8.IndexOf("没有让球") != -1 || p8.IndexOf("不让球") != -1)
                {
                }
                else
                {
                    if (p8.IndexOf("让球") != -1 || p8.IndexOf(")球") != -1)
                    {
                        //让球(-1)和让(-1)球模式
                        int rangIndex = p8.LastIndexOf("让");
                        int qiuIndex = p8.LastIndexOf("球");
                        if (rangIndex != -1 && qiuIndex > rangIndex + 1)
                        {
                            rangqiushu = p8.Substring(rangIndex + 1, qiuIndex - rangIndex - 1);
                            switch (rangqiushu)
                            {
                                case "一":
                                    rangqiushu = "1";
                                    break;
                                case "二":
                                    rangqiushu = "2";
                                    break;
                                case "三":
                                    rangqiushu = "3";
                                    break;
                                case "四":
                                    rangqiushu = "4";
                                    break;
                                case "五":
                                    rangqiushu = "5";
                                    break;
                                case "六":
                                    rangqiushu = "6";
                                    break;
                                case "七":
                                    rangqiushu = "7";
                                    break;
                                case "八":
                                    rangqiushu = "8";
                                    break;
                                case "九":
                                    rangqiushu = "9";
                                    break;
                                case "十":
                                    rangqiushu = "10";
                                    break;
                            }
                        }
                        else
                        {
                            rangqiushu = p8.Substring(qiankuohaoIndex + 1, houkuohaoIndex - qiankuohaoIndex - 1);
                        }
                    }
                    else
                    {
                        int rangIndex = p8.LastIndexOf("让");
                        int qiuIndex = p8.LastIndexOf("球");
                        if (rangIndex != -1)
                        {
                            rangqiushu = p8.Substring(rangIndex + 1, qiuIndex - rangIndex - 1);
                        }
                        else if (qiankuohaoIndex != -1)
                        {
                            rangqiushu = p8.Substring(qiankuohaoIndex + 1, houkuohaoIndex - qiankuohaoIndex - 1);
                        }
                    }
                }
                if (rangqiushu == "0")
                {
                    hasrangqiu = 0;
                }
                else
                {
                    hasrangqiu = 1;
                }


                //保存分析数据
                Yuceanalysis analy = new Yuceanalysis();
                analy.Url = url;
                analy.Zhudui = zhudui;
                analy.Kedui = kedui;
                analy.Yucetype = caizhongtype;
                analy.Bisaishijian = Convert.ToDateTime(bisaishijian);
                analy.Touzhushijian = Convert.ToDateTime(bisaishijian).AddHours(-11).Date;
                analy.Rangqiushu = rangqiushu;
                analy.Hasrangqiu = hasrangqiu;
                analy.OperateTime = DateTime.Now;
                analy.Operator = "吴林";
                analy.Yucespf = spf;
                analy.Yuceren = yuceren;
                dal.InsertYuceanalysis(analy);
            }

            MessageBox.Show("分析成功!");
        }
Esempio n. 4
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DateTime touzhushijian = dateTimePicker1.Value.Date;
            YucerawdataDAL dal = new YucerawdataDAL();
            DataSet ds = dal.GetYucePeilv(touzhushijian);

            
            DataTable dt = new DataTable();
            dt.Columns.Add("主队", typeof(string));
            dt.Columns.Add("客队", typeof(string));
            dt.Columns.Add("时间", typeof(string));
            dt.Columns.Add("预测结果", typeof(string));
            dt.Columns.Add("赔率", typeof(string));
            dt.Columns.Add("让球数", typeof(string));
            dt.Columns.Add("是否中奖", typeof(string));

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                string zhudui = row["zhuduireal"].ToString();
                string kedui = row["keduireal"].ToString();
                string riqi = row["riqi"].ToString();
                string rangqiu = row["rangqiu"].ToString();
                string yucespf = row["yucespf"].ToString();
                string lucky = row["lucky"].ToString();
                foreach (char ch in yucespf.ToCharArray())
                {
                    if (ch <= '9' && ch >= '0')
                    {
                        DataRow newrow = dt.NewRow();
                        newrow["主队"] = zhudui;
                        newrow["客队"] = kedui;
                        newrow["时间"] = riqi;
                        newrow["让球数"] = rangqiu;
                        string spfresult = row["spfresult1"].ToString();
                        if (rangqiu == "0")
                        {
                            spfresult = row["spfresult1"].ToString();
                        }
                        else 
                        {
                            spfresult = row["rqspfresult1"].ToString();
                        }
                        //if (lucky == "0")
                        //{
                        //    newrow["是否中奖"] = "未中奖";
                        //}
                        //else if (lucky == "1")
                        //{
                        //    newrow["是否中奖"] = "已中奖";
                        //}

                        switch (ch)
                        {
                            case '3':
                                if (!string.IsNullOrEmpty(spfresult))
                                {
                                    if (spfresult == "3")
                                    {
                                        newrow["是否中奖"] = "已中奖";
                                    }
                                    else
                                    {
                                        newrow["是否中奖"] = "未中奖";
                                    }
                                }
                                newrow["预测结果"] = "胜";
                                newrow["赔率"] = row["shengsp"].ToString();
                                break;
                            case '1':
                                if (!string.IsNullOrEmpty(spfresult))
                                {
                                    if (spfresult == "1")
                                    {
                                        newrow["是否中奖"] = "已中奖";
                                    }
                                    else
                                    {
                                        newrow["是否中奖"] = "未中奖";
                                    }
                                }
                                newrow["赔率"] = row["pingsp"].ToString();
                                newrow["预测结果"] = "平";
                                break;
                            case '0':
                                if (!string.IsNullOrEmpty(spfresult))
                                {
                                    if (spfresult == "0")
                                    {
                                        newrow["是否中奖"] = "已中奖";
                                    }
                                    else
                                    {
                                        newrow["是否中奖"] = "未中奖";
                                    }
                                }
                                newrow["预测结果"] = "负";
                                newrow["赔率"] = row["fusp"].ToString();
                                break;
                        }
                        dt.Rows.Add(newrow);
                    }
                    
                }
            }
            DataView dv = dt.DefaultView;
            dv.Sort = "赔率 Asc ,主队 Asc ";
            DataTable dt2 = dv.ToTable();

            dataGridView1.DataSource = dt2;
            
            //修改grid样式用于看清
            foreach (DataGridViewRow gridRow in dataGridView1.Rows)
            {

                if (gridRow.Cells["是否中奖"].Value != null && gridRow.Cells["是否中奖"].Value.ToString() == "已中奖")
                {
                    gridRow.DefaultCellStyle.BackColor = Color.Red;
                }
            }
        }
Esempio n. 5
0
 private void BindGrid()
 {
     DataSet ds = new YucerawdataDAL().GetAllYuceAnalysis();
     dgvResult.DataSource = ds.Tables[0];
     SetGridColor();
 }