日期:2014-05-18 浏览次数:20475 次
public int[] counts() { int[] zj; int y1= 0; int y2= 0; int y3= 0; int y4= 0; IList<tb_ssq> listSsq = (from ls in cpjc.tb_ssq where ls.tb_ssq_QiShu == 2011129 orderby ls.tb_ssq_JieZhiTime descending select ls).ToList(); if (listSsq.Count != 0) { ArrayList al = new ArrayList { 1, 2, 3, 4, 5, 6}; ArrayList alBlue = new ArrayList { 7}; for (int i = 0; i < listSsq.Count; i++) { int countH = 0; //统计红球中奖个数 int countL = 0; //统计篮球是否中奖 if (al.Contains(listSsq[i].tb_ssq_h1)) countH++; if (al.Contains(listSsq[i].tb_ssq_h2)) countH++; if (al.Contains(listSsq[i].tb_ssq_h3)) countH++; if (al.Contains(listSsq[i].tb_ssq_h4)) countH++; if (al.Contains(listSsq[i].tb_ssq_h5)) countH++; if (al.Contains(listSsq[i].tb_ssq_h6)) countH++; if (alBlue.Contains(listSsq[i].tb_ssq_l1)) countL++; if (countH == 6 && countL == 1) { y1++; listSsq[i].tb_ssq_state= 2; } else if (countH == 6 && countL == 0) { y2++; listSsq[i].tb_ssq_state = 2; } else if (countH == 5 && countL == 1) { y3++; listSsq[i].tb_ssq_state = 2; } else if ((countH == 5 && countL == 0) || (countH == 4 && countL == 1)) { y4++; listSsq[i].tb_ssq_state = 2; } else if ((countH == 4 && countL == 0) || (countH == 3 && countL == 1)) { listSsq[i].tb_ssq_state = 2; } else if (countL == 1) { listSsq[i].tb_ssq_state = 2; } else { listSsq[i].tb_ssq_state = 1; } } cpjc.SubmitChanges(); } zj = new int[] { y1, y2,y3, y4}; return zj; }