コード例 #1
0
ファイル: MatchSuggestForm.cs プロジェクト: xiaobeixin50/test
        private void button2_Click(object sender, EventArgs e)
        {
            string riqi = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            //获取数据
            DataTable dtYuce = new KaijiangDAL().GetKaijiangDateYuce2(riqi);
            //绑定datagrid
            dataGridView1.DataSource = dtYuce;

            //设置grid颜色
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {

                string spfresult = "-1";
                if (row.Cells["spfresult"].Value != null)
                {
                    spfresult = row.Cells["spfresult"].Value.ToString();
                }

                switch (spfresult)
                {
                    case "3":
                        row.Cells[5].Style.BackColor = Color.Red;
                        break;
                    case "1":
                        row.Cells[6].Style.BackColor = Color.Yellow;
                        break;
                    case "0":
                        row.Cells[7].Style.BackColor = Color.Blue;
                        break;

                }

                string rqspfresult = "-1";
                if (row.Cells["rqspfresult"].Value != null)
                {
                    rqspfresult = row.Cells["rqspfresult"].Value.ToString();
                }

                switch (rqspfresult)
                {
                    case "3":
                        row.Cells[8].Style.BackColor = Color.Red;
                        break;
                    case "1":
                        row.Cells[9].Style.BackColor = Color.Yellow;
                        break;
                    case "0":
                        row.Cells[10].Style.BackColor = Color.Green;
                        break;
                }
            }


        }
コード例 #2
0
ファイル: MainControlForm.cs プロジェクト: xiaobeixin50/test
        private void btnUpdate310Yuce_Click(object sender, EventArgs e)
        {
            //1.取得所有没有更新lucky数据的记录

            DataSet dsNullLucky = new AppYuceDAL().GetYuce310NullLuckyData();

            //2.通过日期和编号获取开奖表中的记录,qcbfresult, bqcresult
            foreach (DataRow row in dsNullLucky.Tables[0].Rows)
            {
                string id = row["id"].ToString();
                string bianhao = row["bianhao"].ToString();
                string riqi = row["riqi"].ToString();

                //如果是当前时间,不进行更新操作
                string curDate = DateTime.Now.ToString("yyyy-MM-dd");
                if (riqi == curDate)
                {
                    continue;
                }
                Kaijiang kaijiang = new KaijiangDAL().GetKaijiangByRiqiAndBianhao(riqi, bianhao);
                //这里有可能预测的比赛还没有开始
                if (kaijiang == null)
                {
                    continue;
                }
                string bqctuijian = row["bqctuijian"].ToString();
                string bifentuijian = row["bifentuijian"].ToString();
                string spfresult = row["spfresult"].ToString();
                string rqspf = row["rqspf"].ToString();

                string lucky = "0";
                string rqlucky = "0";
                string bifenlucky = "0";
                string bqclucky = "0";

                //3.对比获得四个lucky数据
                if (spfresult.IndexOf(kaijiang.SpfResult) != -1)
                {
                    lucky = "1";
                }
                else
                {
                    lucky = "2";
                }
                if(rqspf.IndexOf(kaijiang.RqspfResult)  != -1)
                {
                    rqlucky = "1";
                }
                else
                {
                    rqlucky = "2";
                }
                if (bifentuijian.IndexOf(kaijiang.QcbfResult) != -1)
                {
                    bifenlucky = "1";
                }
                else
                {
                    bifenlucky = "2";
                }
                //string bqctuijianHandle = bqctuijian.Replace("/", "").Replace("胜", "3").Replace("平", "1").Replace("负", "0");
                if (bqctuijian.Replace("/","").Replace("胜","3").Replace("平","1").Replace("负","0").IndexOf(kaijiang.BqcResult) != -1)
                {
                    bqclucky = "1";
                }
                else
                {
                    bqclucky = "2";
                }
                //4.更新lucky数据
                new AppYuceDAL().UpdateYuce310Lucky(id, lucky, rqlucky, bifenlucky, bqclucky,kaijiang);


                Console.WriteLine("更新数据成功");

            }
            MessageBox.Show("操作成功");
        }
コード例 #3
0
ファイル: MainControlForm.cs プロジェクト: xiaobeixin50/test
        private void btnCalcYDN_Click(object sender, EventArgs e)
        {
            double minShouyi = double.MaxValue;
            double maxShouyi = double.MinValue;
            string mindate = "";
            string maxdate = "";
            DataSet yuce = new AppYuceDAL().GetAllYuce();
            DataSet kaijiang = new KaijiangDAL().GetAllKaijiang();

            double totalshouyi = 0.0;
            double defaultTouru = 200;
            foreach (DataRow yuceRow in yuce.Tables[0].Rows)
            {
                string yuceriqi = yuceRow["riqi"].ToString();
                string yucebianhao = yuceRow["bianhao"].ToString();
                string yucerangqiushu = yuceRow["rangqiushu"].ToString();
                string yucespfresult = yuceRow["spfresult"].ToString();

                DataRow matchedRow = null;
                foreach (DataRow kaijiangrow in kaijiang.Tables[0].Rows)
                {
                    if (kaijiangrow["riqi"].ToString() == yuceriqi && kaijiangrow["bianhao"].ToString() == yucebianhao)
                    {
                        matchedRow = kaijiangrow;
                        break;
                    }
                }
                if (matchedRow != null)
                {
                    totalshouyi = totalshouyi - defaultTouru;
                    double shengsp = 0.0;
                    double pingsp = 0.0;
                    double fusp = 0.0;
                    int spfresult = 0;
                    double spfresultsp = 0.0;
                    if (yucerangqiushu == "0")
                    {
                        shengsp = Convert.ToDouble(matchedRow["shengsp"]);
                        pingsp = Convert.ToDouble(matchedRow["pingsp"]);
                        fusp = Convert.ToDouble(matchedRow["fusp"]);
                        spfresult = Convert.ToInt32(matchedRow["spfresult"]);
                        spfresultsp = Convert.ToDouble(matchedRow["spfsp"]);

                    }else
                    {
                        shengsp = Convert.ToDouble(matchedRow["rqshengsp"]);
                        pingsp = Convert.ToDouble(matchedRow["rqpingsp"]);
                        fusp = Convert.ToDouble(matchedRow["rqfusp"]);
                        spfresult = Convert.ToInt32(matchedRow["rqspfresult"]);
                        spfresultsp = Convert.ToDouble(matchedRow["rqspfsp"]);
                    }
                    //首先要判断是否中奖
                    if(yucespfresult.Trim().IndexOf(spfresult.ToString()) != -1)
                    {
                        if (yucespfresult.Trim().Length == 1)
                        {
                            if (yucespfresult == spfresult.ToString())
                            {

                                totalshouyi = totalshouyi + defaultTouru * spfresultsp;
                            }
                        }
                        else
                        {
                            //第一个预测结果中奖的情况
                            string firstString = yucespfresult.Substring(0, 1);
                            double firstsp = GetMatchedSp(firstString, shengsp, pingsp, fusp);

                            string secondString = yucespfresult.Substring(1, 1);
                            double secondsp = GetMatchedSp(secondString, shengsp, pingsp, fusp);
                            if (secondsp == 0)
                            {
                                MessageBox.Show("数据不完整");
                            }
                            if (firstString == spfresult.ToString())
                            {
                                totalshouyi = totalshouyi + firstsp * (defaultTouru - defaultTouru / secondsp);

                            }else
                            {
                                totalshouyi = totalshouyi + 200;
                            }
                           

                        }
                    }
                    if (totalshouyi > maxShouyi)
                    {
                        maxShouyi = totalshouyi;
                        maxdate = yuceriqi;
                    }
                    if (totalshouyi < minShouyi)
                    {
                        minShouyi = totalshouyi;
                        mindate = yuceriqi;
                    }
                }


            }

            MessageBox.Show("总收益为" + totalshouyi + ",过程最大收益为" + maxShouyi  + "日期为" + maxdate + ",过程最小收益为" + minShouyi + "日期为" + mindate);

        }
コード例 #4
0
ファイル: MainControlForm.cs プロジェクト: xiaobeixin50/test
        private void ImportBifa(DateTime importDate)
        {
            string bifaUrl = "http://live.aicai.com/jsbf/timelyscore!dynamicBfDataFromPage.htm?lotteryType=zc&issue=" + importDate.ToString("yyyyMMdd");
            //string bifaUrl = "http://live.aicai.com/jsbf/timelyscore!dynamicBfDataFromPage.htm?lotteryType=zc&issue=20150628";
            string result = GetHtmlFromUrl(bifaUrl);

            BifaJsonEntity bifaJsonEntity = JsonConvert.DeserializeObject<BifaJsonEntity>(result);
            //MessageBox.Show(bifaJsonEntity.result.bf_page);

            HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
            document.LoadHtml(bifaJsonEntity.result.bf_page);

            HtmlNode rootNode = document.DocumentNode;

            SuperBifa bifa = new SuperBifa();
            bifa.riqi = importDate.ToString("yyyy-MM-dd");
            //HtmlNode parentNode = rootNode.SelectSingleNode(@"//div[@id='jq_bf_refresh_time_div']");
            HtmlNodeCollection bifaNodes = rootNode.SelectNodes("./div[@class='md_data_box css_league']");

            foreach (HtmlNode bifaNode in bifaNodes)
            {
                //HtmlNode div = bifaNode.SelectSingleNode("./div[@class='md_data_box css_league']");
                //HtmlNode div2 = bifaNode.SelectSingleNode("./div/div");
                //HtmlNode div3 = bifaNode.SelectSingleNode("./div/div/span");
                //HtmlNode div4 = bifaNode.SelectSingleNode("./div/div/span/span[@class='c_yellow']");

                string xingqiandbianhao = bifaNode.SelectSingleNode(@"./div/span/span[@class='c_yellow']").InnerText;
                string liansai = bifaNode.SelectSingleNode(@"./div/span[@class='c_dgreen']").InnerText;
                //这里得增加一个判断,比分是否有值,没有的话以 -1:-1为默认值
                string zhudui = "";
                string bifen = "";
                string kedui = "";
                if (bifaNode.SelectNodes(@"./div/span[@class='c_yellow']/span").Count == 3)
                {
                    zhudui = bifaNode.SelectNodes(@"./div/span[@class='c_yellow']/span")[0].InnerText;
                    bifen = bifaNode.SelectNodes(@"./div/span[@class='c_yellow']/span")[1].InnerText;
                    kedui = bifaNode.SelectNodes(@"./div/span[@class='c_yellow']/span")[2].InnerText;
                }
                else
                {
                    zhudui = bifaNode.SelectNodes(@"./div/span[@class='c_yellow']/span")[0].InnerText;
                    bifen = "-1:-1";
                    kedui = bifaNode.SelectNodes(@"./div/span[@class='c_yellow']/span")[1].InnerText;
                }
              

                string bisaishijian = bifaNode.SelectSingleNode("./div/span[@class='md_ks_time']/span").InnerText;

                HtmlNode tbody = bifaNode.SelectSingleNode("./div/div/table/tbody");
                HtmlNode tr1 = tbody.SelectNodes("./tr")[0];
                HtmlNodeCollection tds1 = tr1.SelectNodes("./td");
                string bifajiawei_sheng = tds1[1].InnerText;
                string bifazhishu_sheng = tds1[2].InnerText;
                string baijiaoupei_sheng = tds1[3].InnerText;

                HtmlNode tr2 = tbody.SelectNodes("./tr")[1];
                HtmlNodeCollection tds2 = tr2.SelectNodes("./td");
                string bifajiawei_ping = tds2[1].InnerText;
                string bifazhishu_ping = tds2[2].InnerText;
                string baijiaoupei_ping = tds2[3].InnerText;

                HtmlNode tr3 = tbody.SelectNodes("./tr")[2];
                HtmlNodeCollection tds3 = tr3.SelectNodes("./td");
                string bifajiawei_fu = tds3[1].InnerText;
                string bifazhishu_fu = tds3[2].InnerText;
                string baijiaoupei_fu = tds3[3].InnerText;

                string chengjiaoliang = bifaNode.SelectSingleNode("./div/div/div[@class='proba_total']/p/strong[@class='c_orange']").InnerText;

                string sheng = bifaNode.SelectNodes("./div/div/div[@class='proba_data']/p/span[@class='c_orange']")[0].InnerText;
                string ping = bifaNode.SelectNodes("./div/div/div[@class='proba_data']/p/span[@class='c_green']")[0].InnerText;
                string fu = bifaNode.SelectNodes("./div/div/div[@class='proba_data']/p/span[@class='c_blue']")[0].InnerText;

                string dae_sheng = bifaNode.SelectNodes("./div/div/div[@class='proba_data']/p/span[@class='c_orange']")[1].InnerText;
                string dae_ping = bifaNode.SelectNodes("./div/div/div[@class='proba_data']/p/span[@class='c_green']")[1].InnerText;
                string dae_fu = bifaNode.SelectNodes("./div/div/div[@class='proba_data']/p/span[@class='c_blue']")[1].InnerText;


                bifa.xingqi = GetXingqiFromData(xingqiandbianhao);
                bifa.bianhao = GetBianhaoFromData(xingqiandbianhao);

                bifa.liansai = liansai;
                bifa.zhudui = zhudui;
                bifa.kedui = kedui;
                bifa.bifen = bifen;
                bifa.kaisaishijian = bisaishijian;
                bifa.bifajiawei_sheng = Convert.ToDouble(bifajiawei_sheng);
                bifa.bifajiawei_ping = Convert.ToDouble(bifajiawei_ping);
                bifa.bifajiawei_fu = Convert.ToDouble(bifajiawei_fu);

                bifa.bifazhishu_sheng = Convert.ToDouble(bifazhishu_sheng);
                bifa.bifazhishu_ping = Convert.ToDouble(bifazhishu_ping);
                bifa.bifazhishu_fu = Convert.ToDouble(bifazhishu_fu);

                bifa.baijiaoupei_sheng = Convert.ToDouble(baijiaoupei_sheng);
                bifa.baijiaoupei_ping = Convert.ToDouble(baijiaoupei_ping);
                bifa.baijiaoupei_fu = Convert.ToDouble(baijiaoupei_fu);

                bifa.chengjiaoe = Convert.ToInt32(chengjiaoliang);

                bifa.sheng = Convert.ToDouble(sheng.Substring(0, sheng.Length - 1));
                bifa.ping = Convert.ToDouble(ping.Substring(0, ping.Length - 1));
                bifa.fu = Convert.ToDouble(fu.Substring(0, fu.Length - 1));

                bifa.dae_sheng = Convert.ToDouble(dae_sheng.Substring(0, dae_sheng.Length - 1));
                bifa.dae_ping = Convert.ToDouble(dae_ping.Substring(0, dae_ping.Length - 1));
                bifa.dae_fu = Convert.ToDouble(dae_fu.Substring(0, dae_fu.Length - 1));

                bifa.inserttime = DateTime.Now;

                string[] bifens = bifa.bifen.Split(':');
                int zhuScore = Convert.ToInt32(bifens[0]);
                int keScore = Convert.ToInt32(bifens[1]);

                if (zhuScore > keScore)
                {
                    //int prize_rank = GetRank(bifa.sheng, bifa.ping, bifa.fu);
                    //int dae_prize_rank = GetRank(bifa.dae_sheng, bifa.dae_ping, bifa.dae_fu);
                    int prize_rank = GetRank(3, bifa.sheng, bifa.sheng, bifa.ping, bifa.fu);
                    int dae_prize_rank = GetRank(3, bifa.dae_sheng, bifa.dae_sheng,bifa.dae_ping, bifa.dae_fu);
                    bifa.prize_rank = prize_rank;
                    bifa.dae_prize_rank = dae_prize_rank;
                }
                else if(zhuScore == keScore)
                {
                    //int prize_rank = GetRank(bifa.ping, bifa.sheng, bifa.fu);
                    //int dae_prize_rank = GetRank(bifa.dae_ping, bifa.dae_sheng, bifa.dae_fu);
                    int prize_rank = GetRank(1, bifa.ping, bifa.sheng, bifa.ping, bifa.fu);
                    int dae_prize_rank = GetRank(1, bifa.dae_ping, bifa.dae_sheng, bifa.dae_ping, bifa.dae_fu);
                    bifa.prize_rank = prize_rank;
                    bifa.dae_prize_rank = dae_prize_rank;
                }
                else
                {
                    //int prize_rank = GetRank(bifa.fu, bifa.ping, bifa.sheng);
                    //int dae_prize_rank = GetRank(bifa.dae_fu, bifa.dae_ping, bifa.dae_sheng);
                    int prize_rank = GetRank(0, bifa.fu, bifa.sheng, bifa.ping, bifa.fu);
                    int dae_prize_rank = GetRank(0, bifa.dae_fu, bifa.dae_sheng, bifa.dae_ping, bifa.dae_fu);
                    bifa.prize_rank = prize_rank;
                    bifa.dae_prize_rank = dae_prize_rank;
                }
                //获取赔率

                Kaijiang kaijiang = new KaijiangDAL().GetKaijiangByRiqiAndBianhao(bifa.riqi, bifa.bianhao);

                if (kaijiang != null)
                {
                    //MessageBox.Show("数据有错!");
                    bifa.first_sp = GetFirstSp(kaijiang, bifa.dae_sheng, bifa.dae_ping, bifa.dae_fu);
                    bifa.second_sp = GetSecondSp(kaijiang, bifa.dae_sheng, bifa.dae_ping, bifa.dae_fu);
                    bifa.third_sp = GetThirdSp(kaijiang, bifa.dae_sheng, bifa.dae_ping, bifa.dae_fu);
                }
                else
                {
                    bifa.first_sp = 0.0;
                    bifa.second_sp = 0.0;
                    bifa.third_sp = 0.0;
                }
                
                new SuperBifaDAL().InsertSuperBifa(bifa);

            }
        }
コード例 #5
0
ファイル: MainControlForm.cs プロジェクト: xiaobeixin50/test
        private void btnUpdate310Bianhao_Click(object sender, EventArgs e)
        {
            //1.取得所有没有编号的行记录

            DataSet dsNullBianhao = new AppYuceDAL().GetNullBianhaoData();

            //2.通过主队或者客队名称和日期从kaijiang表里取得数据
            foreach (DataRow row in dsNullBianhao.Tables[0].Rows)
            {
                string id =row["id"].ToString();
                string riqi = row["riqi"].ToString();
                string zhudui = row["zhudui"].ToString();
                string kedui = row["kedui"].ToString();

                string bianhao = new KaijiangDAL().GetKaijiangBianhao(riqi,zhudui,kedui);

                //3.更新编号数据
                new AppYuceDAL().UpdateYuce310Bianhao(id, bianhao);
                Console.WriteLine("更新编号成功!");
            }
            MessageBox.Show("操作成功!");
            
        }
コード例 #6
0
        public void UpdateZhongjiangResult(DateTime touzhushijian)
        {
            string conStr = "server=localhost;User Id=root;database=aicai;" +
                            "Password=root;Character Set=utf8;";
            DataSet ds = new DataSet();

            using (MySqlConnection mySqlCon = new MySqlConnection(conStr))
            {
                mySqlCon.Open();
                using (MySqlCommand mySqlCom = mySqlCon.CreateCommand())
                {
                    MySqlDataAdapter da  = new MySqlDataAdapter();
                    string           sql = @"
SELECT
	y.*,
	ifnull(m1.TargetName, y.Zhudui) AS zhuduireal,
	ifnull(m2.TargetName, y.Kedui) AS keduireal
FROM
	yuce_rawdata_analysis y
LEFT JOIN qiuduimapping m1 ON y.Zhudui = m1.OriginName
LEFT JOIN qiuduimapping m2 ON y.Kedui = m2.OriginName

where y.Touzhushijian = ?touzhushijian
 ";

                    //--and y.Yucetype = '[竞彩足球]'

                    mySqlCom.CommandText = sql;
                    mySqlCom.Parameters.AddWithValue("?touzhushijian", touzhushijian);
                    da.SelectCommand = mySqlCom;
                    da.Fill(ds);
                }
            }
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                string id             = row["id"].ToString();
                string zhudui         = row["zhuduireal"].ToString();
                string kedui          = row["keduireal"].ToString();
                string yucespf        = row["yucespf"].ToString();
                string hasrangqiu     = row["hasrangqiu"].ToString();
                string rangqiushu     = row["rangqiushu"].ToString();
                string touzhushijian2 = row["touzhushijian"].ToString();

                Kaijiang kaijiang = new KaijiangDAL().GetKaijiang(touzhushijian2, zhudui, kedui);
                if (kaijiang != null)
                {
                    int lucky = 0;
                    if (hasrangqiu.Equals("0"))
                    {
                        if (yucespf.IndexOf(kaijiang.SpfResult) != -1)
                        {
                            lucky = 1;
                        }
                    }
                    else
                    {
                        if (yucespf.IndexOf(kaijiang.RqspfResult) != -1)
                        {
                            lucky = 1;
                        }
                    }

                    UpdateYuceDetail(id, lucky, kaijiang);
                }
            }
        }
コード例 #7
0
ファイル: YucerawdataDAL.cs プロジェクト: xiaobeixin50/test
         public  void UpdateZhongjiangResult(DateTime touzhushijian)
         {
             string conStr = "server=localhost;User Id=root;database=aicai;" +
                          "Password=root;Character Set=utf8;";
             DataSet ds = new DataSet();
             using (MySqlConnection mySqlCon = new MySqlConnection(conStr))
             {
                 mySqlCon.Open();
                 using (MySqlCommand mySqlCom = mySqlCon.CreateCommand())
                 {
                     MySqlDataAdapter da = new MySqlDataAdapter();
                     string sql = @"
SELECT
	y.*,
	ifnull(m1.TargetName, y.Zhudui) AS zhuduireal,
	ifnull(m2.TargetName, y.Kedui) AS keduireal
FROM
	yuce_rawdata_analysis y
LEFT JOIN qiuduimapping m1 ON y.Zhudui = m1.OriginName
LEFT JOIN qiuduimapping m2 ON y.Kedui = m2.OriginName

where y.Touzhushijian = ?touzhushijian
 ";

                     //--and y.Yucetype = '[竞彩足球]'
                    
                     mySqlCom.CommandText = sql;
                     mySqlCom.Parameters.AddWithValue("?touzhushijian", touzhushijian);
                     da.SelectCommand = mySqlCom;
                     da.Fill(ds);
                 }
             }
             foreach (DataRow row in ds.Tables[0].Rows)
             {
                 string id = row["id"].ToString();
                 string zhudui = row["zhuduireal"].ToString();
                 string kedui = row["keduireal"].ToString();
                 string yucespf = row["yucespf"].ToString();
                 string hasrangqiu = row["hasrangqiu"].ToString();
                 string rangqiushu = row["rangqiushu"].ToString();
                 string touzhushijian2 = row["touzhushijian"].ToString();

                 Kaijiang kaijiang = new KaijiangDAL().GetKaijiang(touzhushijian2, zhudui, kedui);
                 if (kaijiang != null)
                 {
                     int lucky = 0;
                     if (hasrangqiu.Equals("0"))
                     {
                        
                         if (yucespf.IndexOf(kaijiang.SpfResult)!= -1)
                         {
                             lucky = 1;
                         }
                     }
                     else
                     {
                         if (yucespf.IndexOf(kaijiang.RqspfResult) != -1)
                         {
                             lucky = 1;
                         }
                     }

                     UpdateYuceDetail(id,lucky,kaijiang);
                
                 }


             }

         }
コード例 #8
0
ファイル: DataStaticsForm.cs プロジェクト: xiaobeixin50/test
        private void btnCalcShouyiDaily_Click(object sender, EventArgs e)
        {
            double minShouyi = double.MaxValue;
            double maxShouyi = double.MinValue;
            string mindate = "";
            string maxdate = "";
            DataSet yuce = new AppYuceDAL().GetAllYuce();
            DataSet kaijiang = new KaijiangDAL().GetAllKaijiang();

            double totalshouyi = 0.0;
            double defaultTouru = 200;

            string currentRiqi = "";
            List<DailyShouyi> dailyShouyis = new List<DailyShouyi>();

            DailyShouyi dailyshouyi = null;
            foreach (DataRow yuceRow in yuce.Tables[0].Rows)
            {
                

                string yuceriqi = yuceRow["riqi"].ToString();

                if (currentRiqi != yuceriqi)
                {
                    if (dailyshouyi != null)
                    {
                        dailyshouyi.shouyi = dailyshouyi.totalprize - dailyshouyi.totaltouru;
                    }
                    dailyshouyi = new DailyShouyi();
                    dailyshouyi.riqi = yuceriqi;

                    dailyShouyis.Add(dailyshouyi);
                    currentRiqi = yuceriqi;
                }
                string yucebianhao = yuceRow["bianhao"].ToString();
                string yucerangqiushu = yuceRow["rangqiushu"].ToString();
                string yucespfresult = yuceRow["spfresult"].ToString();

                DataRow matchedRow = null;
                foreach (DataRow kaijiangrow in kaijiang.Tables[0].Rows)
                {
                    if (kaijiangrow["riqi"].ToString() == yuceriqi && kaijiangrow["bianhao"].ToString() == yucebianhao)
                    {
                        matchedRow = kaijiangrow;
                        break;
                    }
                }
                if (matchedRow != null)
                {
                    dailyshouyi.totaltouru += defaultTouru;


                    totalshouyi = totalshouyi - defaultTouru;
                    double shengsp = 0.0;
                    double pingsp = 0.0;
                    double fusp = 0.0;
                    int spfresult = 0;
                    double spfresultsp = 0.0;
                    if (yucerangqiushu == "0")
                    {
                        shengsp = Convert.ToDouble(matchedRow["shengsp"]);
                        pingsp = Convert.ToDouble(matchedRow["pingsp"]);
                        fusp = Convert.ToDouble(matchedRow["fusp"]);
                        spfresult = Convert.ToInt32(matchedRow["spfresult"]);
                        spfresultsp = Convert.ToDouble(matchedRow["spfsp"]);

                    }
                    else
                    {
                        shengsp = Convert.ToDouble(matchedRow["rqshengsp"]);
                        pingsp = Convert.ToDouble(matchedRow["rqpingsp"]);
                        fusp = Convert.ToDouble(matchedRow["rqfusp"]);
                        spfresult = Convert.ToInt32(matchedRow["rqspfresult"]);
                        spfresultsp = Convert.ToDouble(matchedRow["rqspfsp"]);
                    }
                    //首先要判断是否中奖
                    if (yucespfresult.Trim().IndexOf(spfresult.ToString()) != -1)
                    {
                        if (yucespfresult.Trim().Length == 1)
                        {
                            if (yucespfresult == spfresult.ToString())
                            {

                                totalshouyi = totalshouyi + defaultTouru * spfresultsp;

                                dailyshouyi.totalprize += defaultTouru * spfresultsp; 
                            }
                        }
                        else
                        {
                            //第一个预测结果中奖的情况
                            string firstString = yucespfresult.Substring(0, 1);
                            double firstsp = GetMatchedSp(firstString, shengsp, pingsp, fusp);

                            string secondString = yucespfresult.Substring(1, 1);
                            double secondsp = GetMatchedSp(secondString, shengsp, pingsp, fusp);
                            if (secondsp == 0)
                            {
                                MessageBox.Show("数据不完整");
                            }
                            if (firstString == spfresult.ToString())
                            {
                                totalshouyi = totalshouyi + firstsp * (defaultTouru - defaultTouru / secondsp);

                                dailyshouyi.totalprize += firstsp * (defaultTouru - defaultTouru / secondsp);

                            }
                            else
                            {
                                totalshouyi = totalshouyi + defaultTouru;

                                dailyshouyi.totalprize += defaultTouru;
                            }


                        }
                        
                    }
                    if (totalshouyi > maxShouyi)
                    {
                        maxShouyi = totalshouyi;
                        maxdate = yuceriqi;
                    }
                    if (totalshouyi < minShouyi)
                    {
                        minShouyi = totalshouyi;
                        mindate = yuceriqi;
                    }
                }
            }
            dataGridView1.DataSource = dailyShouyis;
        }
コード例 #9
0
ファイル: AppYuceDAL.cs プロジェクト: xiaobeixin50/test
        public void UpdateZhongjiangResult(DateTime touzhushijian)
        {
            string conStr = "server=localhost;User Id=root;database=aicai;" +
                            "Password=root;Character Set=utf8;";
            DataSet ds = new DataSet();
            using (MySqlConnection mySqlCon = new MySqlConnection(conStr))
            {
                mySqlCon.Open();
                using (MySqlCommand mySqlCom = mySqlCon.CreateCommand())
                {
                    MySqlDataAdapter da = new MySqlDataAdapter();
                    string sql = @"
SELECT
	*
FROM
	yuce_app

where riqi = ?touzhushijian
 ";

                    //--and y.Yucetype = '[竞彩足球]'

                    mySqlCom.CommandText = sql;
                    mySqlCom.Parameters.AddWithValue("?touzhushijian", touzhushijian.ToString("yyyy-MM-dd"));
                    da.SelectCommand = mySqlCom;
                    da.Fill(ds);
                }

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    string id = row["id"].ToString();
                    string riqi = row["riqi"].ToString();
                    string bianhao = row["bianhao"].ToString();
                    string yucespf = row["spfresult"].ToString();
                    string rangqiushu = row["rangqiushu"].ToString();
                    Kaijiang kaijiang = new KaijiangDAL().GetKaijangSpfResult(riqi, bianhao);
                    if (kaijiang != null)
                    {
                        int lucky = 0;
                        if (String.IsNullOrEmpty(yucespf))
                        {
                            continue;
                            
                        }

                        if (!string.IsNullOrEmpty(kaijiang.SpfResult))
                        {

                            if (rangqiushu == "0")
                            {
                                if (yucespf.IndexOf(kaijiang.SpfResult) != -1)
                                {
                                    lucky = 1;
                                }
                                else
                                {
                                    lucky = 2; //不中奖
                                }
                            }
                            else
                            {
                                if (yucespf.IndexOf(kaijiang.RqspfResult) != -1)
                                {
                                    lucky = 1;
                                }
                                else
                                {
                                    lucky = 2; //不中奖
                                }
                            }    
                            UpdateYuceDetail(id, lucky, kaijiang,rangqiushu);
                        }
                    }
                }
            }
        }
コード例 #10
0
        public void UpdateZhongjiangResult(DateTime touzhushijian)
        {
            string conStr = "server=localhost;User Id=root;database=aicai;" +
                            "Password=root;Character Set=utf8;";
            DataSet ds = new DataSet();

            using (MySqlConnection mySqlCon = new MySqlConnection(conStr))
            {
                mySqlCon.Open();
                using (MySqlCommand mySqlCom = mySqlCon.CreateCommand())
                {
                    MySqlDataAdapter da  = new MySqlDataAdapter();
                    string           sql = @"
SELECT
	*
FROM
	yuce_app

where riqi = ?touzhushijian
 ";

                    //--and y.Yucetype = '[竞彩足球]'

                    mySqlCom.CommandText = sql;
                    mySqlCom.Parameters.AddWithValue("?touzhushijian", touzhushijian.ToString("yyyy-MM-dd"));
                    da.SelectCommand = mySqlCom;
                    da.Fill(ds);
                }

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    string   id         = row["id"].ToString();
                    string   riqi       = row["riqi"].ToString();
                    string   bianhao    = row["bianhao"].ToString();
                    string   yucespf    = row["spfresult"].ToString();
                    string   rangqiushu = row["rangqiushu"].ToString();
                    Kaijiang kaijiang   = new KaijiangDAL().GetKaijangSpfResult(riqi, bianhao);
                    if (kaijiang != null)
                    {
                        int lucky = 0;
                        if (String.IsNullOrEmpty(yucespf))
                        {
                            continue;
                        }

                        if (!string.IsNullOrEmpty(kaijiang.SpfResult))
                        {
                            if (rangqiushu == "0")
                            {
                                if (yucespf.IndexOf(kaijiang.SpfResult) != -1)
                                {
                                    lucky = 1;
                                }
                                else
                                {
                                    lucky = 2; //不中奖
                                }
                            }
                            else
                            {
                                if (yucespf.IndexOf(kaijiang.RqspfResult) != -1)
                                {
                                    lucky = 1;
                                }
                                else
                                {
                                    lucky = 2; //不中奖
                                }
                            }
                            UpdateYuceDetail(id, lucky, kaijiang, rangqiushu);
                        }
                    }
                }
            }
        }