Ejemplo n.º 1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                SoccerSingleDAL dal = new SoccerSingleDAL();
                DataSet ds = dal.SearchDanchang();
                List<SoccerSingleAnalysis> danChangAnalyses = new List<SoccerSingleAnalysis>();

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    SoccerSingleAnalysis analysis = new SoccerSingleAnalysis();

                    analysis.riqi = row["riqi"].ToString();
                    analysis.bianhao = row["bianhao"].ToString();
                    analysis.liansai = row["liansai"].ToString();
                    analysis.shengsp = row["shengsp"].ToString();
                    analysis.pingsp = row["pingsp"].ToString();
                    analysis.fusp = row["fusp"].ToString();
                    analysis.rqshengsp = row["rqshengsp"].ToString();
                    analysis.rqpingsp = row["rqpingsp"].ToString();
                    analysis.rqfusp = row["rqfusp"].ToString();
                    analysis.spfresult = row["spfresult"].ToString();
                    analysis.rqspfresult = row["rqspfresult"].ToString();

                    analysis.spfrank = GetSpfRank(analysis);
                    analysis.rqspfrank = GetRqSpfRank(analysis);

                    danChangAnalyses.Add(analysis);
                }

                dataGridView1.DataSource = danChangAnalyses;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }    
        }
Ejemplo n.º 2
0
        private void btnDoubleAnalysis_Click(object sender, EventArgs e)
        {

            //单场概率分析,分析连续多少天没有出现某个排名,以天为单位,同时分析两个

            Dictionary<int, int> maxTimes = new Dictionary<int, int>();
            maxTimes.Add(0, 0);
            maxTimes.Add(1, 0);
            maxTimes.Add(2, 0);
            maxTimes.Add(3, 0);


            DataTable dtData = new SoccerSingleDAL().GetAllSingle();
            int continueTimes = 0;
            //这里只搜索3的未出现最大天数
            int lastSpfPaiming = 1;
            int currentSpfPaiming = 0;
            int currentRqSpfPaiming = 0;
            string maxRiqi = "";
            string currentRiqi = "";
            foreach (DataRow row in dtData.Rows)
            {
                currentSpfPaiming = Convert.ToInt32(row["spfpaiming"]);
                currentRqSpfPaiming = Convert.ToInt32(row["rqspfpaiming"]);
                currentRiqi = row["riqi"].ToString();

                //如果这一天的排名都不是3
                if (currentSpfPaiming != lastSpfPaiming && currentRqSpfPaiming != lastSpfPaiming)
                {
                    continueTimes++;

                    int currentMaxTimes = maxTimes[lastSpfPaiming];
                    if (currentMaxTimes < continueTimes)
                    {
                        maxTimes[lastSpfPaiming] = continueTimes;
                        maxRiqi = currentRiqi;
                    }

                    //lastSpfPaiming = currentSpfPaiming;
                    //continueTimes = 1;
                }
                else
                {
                    continueTimes = 0;
                }
            }

            StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<int, int> kv in maxTimes)
            {
                sb.Append(kv.Key).Append(":").Append(kv.Value).AppendLine();
            }
            sb.AppendLine(maxRiqi);
            MessageBox.Show(sb.ToString());
        }
Ejemplo n.º 3
0
        private void btnGailvFenxiRq_Click(object sender, EventArgs e)
        {
            //单场概率分析

            Dictionary<int, int> maxTimes = new Dictionary<int, int>();
            maxTimes.Add(0, 0);
            maxTimes.Add(1, 0);
            maxTimes.Add(2, 0);
            maxTimes.Add(3, 0);


            DataTable dtData = new SoccerSingleDAL().GetAllSingle();
            int continueTimes = 1;
            int lastSpfPaiming = 0;
            int currentSpfPaiming = 0;
            foreach (DataRow row in dtData.Rows)
            {
                currentSpfPaiming = Convert.ToInt32(row["rqspfpaiming"]);
                if (currentSpfPaiming != lastSpfPaiming)
                {
                    int currentMaxTimes = maxTimes[lastSpfPaiming];
                    if (currentMaxTimes < continueTimes)
                    {
                        maxTimes[lastSpfPaiming] = continueTimes;
                    }

                    lastSpfPaiming = currentSpfPaiming;
                    continueTimes = 1;
                }
                else
                {
                    continueTimes++;
                }
            }

            StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<int, int> kv in maxTimes)
            {
                sb.Append(kv.Key).Append(":").Append(kv.Value).AppendLine();
            }
            MessageBox.Show(sb.ToString());
        }
Ejemplo n.º 4
0
        private void btnUpdateDanchangPaiming_Click(object sender, EventArgs e)
        {
            //1.先获得需要更新的数据

            DataTable dtHandle = new SoccerSingleDAL().GetNotHandledSingle();
            
            //2.循环更新数据
           
            foreach (DataRow row in dtHandle.Rows)
            {
                int spfpaiming = 1;
                int rqspfpaiming = 1;
                string rowriqi = Convert.ToString(row["riqi"]);
                string bianhao = Convert.ToString(row["bianhao"]);
                double shengsp = Convert.ToDouble(row["shengsp"]);
                double pingsp = Convert.ToDouble(row["pingsp"]);
                double fusp = Convert.ToDouble(row["fusp"]);

                double rqshengsp = Convert.ToDouble(row["rqshengsp"]);
                double rqpingsp = Convert.ToDouble(row["rqpingsp"]);
                double rqfusp = Convert.ToDouble(row["rqfusp"]);

                
                int spfresult = -1;
                if (!int.TryParse(row["spfresult"].ToString(), out spfresult))
                {
                    spfresult = -1;
                }
                int rqspfresult = -1;
                if (!int.TryParse(row["rqspfresult"].ToString(), out rqspfresult))
                {
                    rqspfresult = -1;
                }
                switch (spfresult)
                {
                    case 3:
                        if (shengsp >= pingsp)
                        {
                            spfpaiming++;
                        }
                        if (shengsp >= fusp)
                        {
                            spfpaiming++;
                        }
                        break;
                    case 1:
                        if (pingsp > shengsp)
                        {
                            spfpaiming++;
                        }
                        if (pingsp >= fusp)
                        {
                            spfpaiming++;
                        }
                        break;
                    case 0:
                        if (fusp > shengsp)
                        {
                            spfpaiming++;
                        }
                        if (fusp > pingsp)
                        {
                            spfpaiming++;
                        }
                        break;
                    case -1:
                        spfpaiming = 0;
                        break;

                }

                switch (rqspfresult)
                {
                    case 3:
                        if (rqshengsp >= rqpingsp)
                        {
                            rqspfpaiming++;
                        }
                        if (rqshengsp >= fusp)
                        {
                            rqspfpaiming++;
                        }
                        break;
                    case 1:
                        if (rqpingsp > rqshengsp)
                        {
                            rqspfpaiming++;
                        }
                        if (rqpingsp >= rqfusp)
                        {
                            rqspfpaiming++;
                        }
                        break;
                    case 0:
                        if (rqfusp > rqshengsp)
                        {
                            rqspfpaiming++;
                        }
                        if (rqfusp > rqpingsp)
                        {
                            rqspfpaiming++;
                        }
                        break;
                    case -1:
                        rqspfpaiming = 0;
                        break;
                }

                new SoccerSingleDAL().UpdateSoccer_Single(spfpaiming,rqspfpaiming,rowriqi,bianhao);
                Console.WriteLine("更新单场数据成功!");
            }





        }