示例#1
0
 private void BindGrid(String riqi)
 {
     DataSet ds = new AppYuceDAL().GetYuceByRiqi(riqi);
     dataGridView1.DataSource = ds.Tables[0];
     foreach (DataGridViewRow row in dataGridView1.Rows)
     {
         if (row.Index == dataGridView1.Rows.Count - 1)
         {
             continue;
         }
         if (row.Cells["lucky"].Value.ToString() == "1")
         {
             row.DefaultCellStyle.BackColor = Color.Red;
         }
     }
 }
示例#2
0
        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);

        }
示例#3
0
        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("操作成功!");
            
        }
示例#4
0
        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("操作成功");
        }
示例#5
0
        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;
        }