/// <summary> /// 显示开奖相关信息 /// </summary> void showOpenInfo() { if (lastOpen != null) { gbLotteryInfo.Text = string.Format("十一选五 第{0}期 开奖号码", MyTool.AddZeroStr(lastOpen.Expect, 3)); } if (nextOpen != null) { gbLotteryTime.Text = string.Format("距离{0}期开奖:", MyTool.AddZeroStr(nextOpen.Expect, 3)); var dtNow = EntitiesTool.GetDateTimeNow(); if (dtNow > nextOpen.OpenTime) { // nextOpen = LotteryOpenDAL.NextOpenNo(); } dtOne = new TimeSpan(TimeSpan.TicksPerSecond * Convert.ToInt32((nextOpen.ScheduleOpenTime - dtNow).TotalSeconds)); } if (lastOpen != null && nextOpen != null && lastOpen.Id != nextOpen.Id) { var nList = lastOpen.OpenCode.Split(','); lblLNo1.Text = MyTool.AddZeroStr(nList[0], 2); lblLNo2.Text = MyTool.AddZeroStr(nList[1], 2); lblLNo3.Text = MyTool.AddZeroStr(nList[2], 2); lblLNo4.Text = MyTool.AddZeroStr(nList[3], 2); lblLNo5.Text = MyTool.AddZeroStr(nList[4], 2); } }
/// <summary> /// 显示开奖相关信息 /// </summary> void showOpenInfo() { if (lastOpen != null && !string.IsNullOrEmpty(lastOpen.OpenCode)) { var nList = lastOpen.OpenCode.Split(','); lblLNo1.Text = MyTool.AddZeroStr(nList[0], 2); lblLNo2.Text = MyTool.AddZeroStr(nList[1], 2); lblLNo3.Text = MyTool.AddZeroStr(nList[2], 2); lblLNo4.Text = MyTool.AddZeroStr(nList[3], 2); lblLNo5.Text = MyTool.AddZeroStr(nList[4], 2); gbLotteryInfo.Text = string.Format("十一选五 第{0}期 开奖号码", MyTool.AddZeroStr(lastOpen.Expect, 3)); lblKJ.Visible = false; } if (nextOpen != null) { gbLotteryTime.Text = string.Format("距离{0}期开奖:", MyTool.AddZeroStr(nextOpen.Expect, 3)); var s = (nextOpen.OpenTime - EntitiesTool.GetDateTimeNow()).TotalSeconds; dtOne = new TimeSpan(TimeSpan.TicksPerSecond * Convert.ToInt32(s)); } if (!string.IsNullOrEmpty(txtUser.Text)) { aList = AccountDAL.LoginOnTest(txtUser.Text); dgvHistory.DataSource = aList; } }
private void timer1_Tick(object sender, EventArgs e) { dtOne = dtOne.Add(-_1s); lblHours.Text = MyTool.AddZeroStr(dtOne.Hours, 2); lblMin.Text = MyTool.AddZeroStr(dtOne.Minutes, 2); lblSec.Text = MyTool.AddZeroStr(dtOne.Seconds, 2); if (openflag)//若开奖则进行返奖计算 { openflag = false; //LotteryOpenDAL.BackWinMoney(lastOpen.Id);//返奖(考虑新进程?) idList.Add(lastOpen.Id); //var bList=LotteryOpenDAL.GetBetInfoById(idList); //var loList = LotteryOpenDAL.GetLotteryOpenById(idList); //var query = (from a in loList // join b in bList on a.Id equals b.LotteryOpenId into t // from tt in t.DefaultIfEmpty() // group tt by new { a.Id, a.Expect, a.OpenNum, a.OpenTime } into g // select new // { // g.Key.Id, // g.Key.Expect, // g.Key.OpenNum, // g.Key.OpenTime, // TotalBackMoney =g.Sum(n =>n==null?0:n.TotalBackMoney), // TotalBetMoney = g.Sum(n => n == null ? 0 : n.TotalBetMoney), // WinMoney = g.Sum(n => n == null ? 0 : n.WinMoney) // }).ToList(); //var query = loList.Select(n => new // { // n.Id,n.Expect,n.OpenNum,n.OpenTime, // TotalBackMoney=bList.Where(w=>w.LotteryOpenId==n.Id).Sum(w=>w.TotalBackMoney), // TotalBetMoney = bList.Where(w => w.LotteryOpenId == n.Id).Sum(w => w.TotalBetMoney), // WinMoney = bList.Where(w => w.LotteryOpenId == n.Id).Sum(w => w.WinMoney), // }).ToList(); //dgvInfo.DataSource = LotteryOpenDAL.GetBetInfoById(idList); } if (dtOne.TotalSeconds == 0) { // LotteryOpenDAL.OpeningNo(nextOpen.Id, cbFixed.Checked, txtNo1.Text.Trim(), txtNo2.Text.Trim(), txtNo3.Text.Trim(), txtNo4.Text.Trim(), txtNo5.Text.Trim());//开奖 //重置计时器 //nextOpen = LotteryOpenDAL.NextOpenNo(); //if (nextOpen != null) //{ // lastOpen = LotteryOpenDAL.LastOpenNo(nextOpen.Id); //} showOpenInfo(); openflag = true; } }
private void timer1_Tick(object sender, EventArgs e) { dtOne = dtOne.Add(-_1s); if (dtOne.TotalSeconds <= 2) { lblKJ.Text = "截止投注,准备开奖"; lblKJ.Visible = true; } if (dtOne.TotalSeconds <= 0) { nextOpen = LotteryOpenInfoDAL.NextOpenNo(Lottery.Id); if (nextOpen == null) { dtOne = _1s; return; } var last = LotteryOpenInfoDAL.LastOpenNo(Lottery.Id); if (last.Id == lastOpen.Id)//每秒获取开奖信息 { dtOne = _1s; return; } //重置计时器 lastOpen = last; showOpenInfo(); flag = true; } if (checkBox1.Checked && flag && dtOne.TotalSeconds == 55)//模拟投注 { flag = false; try { Thread t = new Thread(new ThreadStart(betStart)); t.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } lblHours.Text = MyTool.AddZeroStr(dtOne.Hours, 2); lblMin.Text = MyTool.AddZeroStr(dtOne.Minutes, 2); lblSec.Text = MyTool.AddZeroStr(dtOne.Seconds, 2); }
/// <summary> /// 生成投注号码 /// </summary> /// <param name="count">至少选号个数</param> /// <param name="sp"></param> /// <returns></returns> static string createNum(int count, char?sp) { var list = NumList11x5_Normal.ToList(); StringBuilder betNum = new StringBuilder(); if (!sp.HasValue) { var r = random.Next(0, list.Count); betNum.Append(MyTool.AddZeroStr(list[r], 2) + '|'); list.RemoveAt(r); } while (list.Count != 11 - count) { var r = random.Next(0, list.Count); betNum.Append(MyTool.AddZeroStr(list[r], 2) + (sp.HasValue ? sp : ' ')); list.RemoveAt(r); } return(betNum.Remove(betNum.Length - 1, 1).ToString()); }
/// <summary> /// 显示开奖相关信息 /// </summary> void showOpenInfo() { if (lastOpen != null && !string.IsNullOrEmpty(lastOpen.OpenCode)) { var nList = lastOpen.OpenCode.Split(','); lblLNo1.Text = MyTool.AddZeroStr(nList[0], 2); lblLNo2.Text = MyTool.AddZeroStr(nList[1], 2); lblLNo3.Text = MyTool.AddZeroStr(nList[2], 2); lblLNo4.Text = MyTool.AddZeroStr(nList[3], 2); lblLNo5.Text = MyTool.AddZeroStr(nList[4], 2); gbLotteryInfo.Text = string.Format("第{0}期 开奖号码", lastOpen.Expect); lblKJ.Visible = false; dgvHistory.DataSource = LotteryOpenInfoDAL.LastOpen_Count(20, lottery.Id).Select(n => new { OpenNo = n.Expect, OpenNum = n.OpenCode }).ToList(); } if (nextOpen != null) { gbLotteryTime.Text = string.Format("距离{0}期开奖:", nextOpen.Expect); var s = (nextOpen.ScheduleOpenTime - EntitiesTool.GetDateTimeNow()).TotalSeconds; dtOne = new TimeSpan(TimeSpan.TicksPerSecond * Convert.ToInt32(s)); btnAddBet.Enabled = true; } }
/// <summary> /// 显示开奖相关信息 /// </summary> void showOpenInfo() { lastOpen = LotteryOpenDAL.LastOpenNo(Lottery.Id); if (lastOpen != null) { gbLotteryInfo.Text = string.Format("{0} 第{1}期 开奖号码", this.Text.Substring(0, this.Text.IndexOf("开奖器")), lastOpen.Expect); var nList = (lastOpen.OpenCode == null?lastOpen.ScheduleOpenCode:lastOpen.OpenCode).Split(','); lblLNo1.Text = MyTool.AddZeroStr(nList[0], 2); lblLNo2.Text = MyTool.AddZeroStr(nList[1], 2); lblLNo3.Text = MyTool.AddZeroStr(nList[2], 2); lblLNo4.Text = MyTool.AddZeroStr(nList[3], 2); lblLNo5.Text = MyTool.AddZeroStr(nList[4], 2); var pm = LotteryOpenDAL.GetPrizePoolMoney(Lottery.Id); if (pm != null) { lblPool.Text = pm.PoolMoney + "元"; } } nextOpen = LotteryOpenDAL.NextOpenNo(Lottery.Id); if (nextOpen != null) { var dtNow = EntitiesTool.GetDateTimeNow(); while (dtNow > nextOpen.OpenTime) { nextOpen = LotteryOpenDAL.NextOpenNo(Lottery.Id); } gbLotteryTime.Text = string.Format("距离{0}期开奖:", nextOpen.Expect); dtOne = new TimeSpan(TimeSpan.TicksPerSecond * Convert.ToInt32((nextOpen.ScheduleOpenTime - dtNow).TotalSeconds)); dgvInfo.Rows.Insert(0, new DataGridViewRow()); var row = dgvInfo.Rows[0]; row.Cells[0].Value = nextOpen.Id; row.Cells[1].Value = nextOpen.Expect; row.Cells[2].Value = nextOpen.ScheduleOpenTime; row.Cells[3].Value = nextOpen.ScheduleOpenCode; } }
private void timer1_Tick(object sender, EventArgs e) { dtOne = dtOne.Add(-_1s); lblHours.Text = MyTool.AddZeroStr(dtOne.Hours, 2); lblMin.Text = MyTool.AddZeroStr(dtOne.Minutes, 2); lblSec.Text = MyTool.AddZeroStr(dtOne.Seconds, 2); if (flag && dtOne.TotalSeconds % 3 == 0) { lastOpen = LotteryOpenDAL.LastOpenNo(Lottery.Id); if (lastOpen != null && lastOpen.OpenCode != null) { gbLotteryInfo.Text = string.Format("{0} 第{1}期 开奖号码", this.Text.Substring(0, this.Text.IndexOf("开奖器")), lastOpen.Expect); var nList = lastOpen.OpenCode.Split(','); lblLNo1.Text = MyTool.AddZeroStr(nList[0], 2); lblLNo2.Text = MyTool.AddZeroStr(nList[1], 2); lblLNo3.Text = MyTool.AddZeroStr(nList[2], 2); lblLNo4.Text = MyTool.AddZeroStr(nList[3], 2); lblLNo5.Text = MyTool.AddZeroStr(nList[4], 2); var pm = LotteryOpenDAL.GetPrizePoolMoney(Lottery.Id); var pi = LotteryOpenDAL.GetPrizePoolInfo(lastOpen.Id); for (int i = 0; i < dgvInfo.RowCount; i++) { if ((long)dgvInfo.Rows[i].Cells[0].Value == lastOpen.Id) { dgvInfo.Rows[i].Cells[4].Value = lastOpen.OpenTime; dgvInfo.Rows[i].Cells[5].Value = lastOpen.OpenCode; if (pi != null) { dgvInfo.Rows[i].Cells[6].Value = pi.TotalBet; dgvInfo.Rows[i].Cells[7].Value = pi.TotalAgenBack; dgvInfo.Rows[i].Cells[8].Value = pi.TotalBack; dgvInfo.Rows[i].Cells[9].Value = pi.TotalBet - pi.TotalAgenBack - pi.TotalBack; if (pi.TotalBet > 0) { dgvInfo.Rows[i].Cells[10].Value = Math.Round((pi.TotalAgenBack + pi.TotalBack) * 100 / pi.TotalBet, 2) + "%"; } } } } if (pm != null) { lblPool.Text = pm.PoolMoney + "元"; } flag = false; } } if (dtOne.TotalSeconds == 1) { //LotteryOpenDAL.SetNextOpenNo(Lottery.Id); //开奖 try { Thread t = new Thread(new ThreadStart(open)); t.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } if (dtOne.TotalSeconds == 0) { nextOpen = LotteryOpenDAL.NextOpenNo(Lottery.Id); if (nextOpen != null) { var dtNow = EntitiesTool.GetDateTimeNow(); while (dtNow > nextOpen.OpenTime) { nextOpen = LotteryOpenDAL.NextOpenNo(Lottery.Id); } gbLotteryTime.Text = string.Format("距离{0}期开奖:", nextOpen.Expect); dtOne = new TimeSpan(TimeSpan.TicksPerSecond * Convert.ToInt32((nextOpen.ScheduleOpenTime - dtNow).TotalSeconds)); dgvInfo.Rows.Insert(0, new DataGridViewRow()); var row = dgvInfo.Rows[0]; row.Cells[0].Value = nextOpen.Id; row.Cells[1].Value = nextOpen.Expect; row.Cells[2].Value = nextOpen.ScheduleOpenTime; row.Cells[3].Value = nextOpen.ScheduleOpenCode; } flag = true; } if (DateTime.Now.Hour == 6 && DateTime.Now.Minute == 0 && DateTime.Now.Second == 0) { var dt = EntitiesTool.GetDateTimeNow(); LotteryOpenPrivateInfoDAL.InitialTodayInfo(Lottery, dt.AddDays(1)); } if (dtOne.TotalSeconds < 0) { btnStop_Click(null, null); } }
private void timer1_Tick(object sender, EventArgs e) { dtOne = dtOne.Add(-_1s); if (dtOne.TotalSeconds <= (lottery.IsPrivate ? 2 : 60)) { lblKJ.Text = "截止投注,准备开奖"; lblKJ.Visible = true; btnAddBet.Enabled = false; } if (dtOne.TotalSeconds <= 0) { lblKJ.Text = "正在开奖,请稍等"; nextOpen = LotteryOpenOffcialInfoDAL.NextOpenNo(lottery.Id); if (nextOpen == null) { dtOne = _1s; return; } else { gbLotteryTime.Text = string.Format("距离{0}期开奖:", nextOpen.Expect); var s = (nextOpen.ScheduleOpenTime - EntitiesTool.GetDateTimeNow()).TotalSeconds; dtOne = new TimeSpan(TimeSpan.TicksPerSecond * Convert.ToInt32(s)); btnAddBet.Enabled = true; } var last = LotteryOpenInfoDAL.LastOpenNo(lottery.Id); //如果下一期有了,上期才会刷新 if (last.Id == lastOpen.Id) //每秒获取开奖信息 { dtOne = _1s; return; } else { lastOpen = last; showOpenInfo(); } //重置计时器 //nextOpen = LotteryOpenDAL.NextOpenNo(); //if (jix_test) //{ // btnAddBet_Click(null, null); //} } #region 获取返奖结果 if (dtOne.TotalSeconds % 5 == 0 && account != null) { if (lblKJ.Visible == true && btnAddBet.Enabled == true) { lastOpen = LotteryOpenInfoDAL.LastOpenNo(lottery.Id); if (lastOpen != null && !string.IsNullOrEmpty(lastOpen.OpenCode)) { var nList = lastOpen.OpenCode.Split(','); lblLNo1.Text = MyTool.AddZeroStr(nList[0], 2); lblLNo2.Text = MyTool.AddZeroStr(nList[1], 2); lblLNo3.Text = MyTool.AddZeroStr(nList[2], 2); lblLNo4.Text = MyTool.AddZeroStr(nList[3], 2); lblLNo5.Text = MyTool.AddZeroStr(nList[4], 2); gbLotteryInfo.Text = string.Format("第{0}期 开奖号码", lastOpen.Expect); lblKJ.Visible = false; dgvHistory.DataSource = LotteryOpenInfoDAL.LastOpen_Count(20, lottery.Id).Select(n => new { OpenNo = n.Expect, OpenNum = n.OpenCode }).ToList(); } } dgvBet.DataSource = AccountDAL.GetBetHistory(account.Id, lottery, dtLoad); account = AccountDAL.GetAccount(account.Id); lblMoney.Text = account.AccountBalance + "元"; } #endregion lblHours.Text = MyTool.AddZeroStr(dtOne.Hours, 2); lblMin.Text = MyTool.AddZeroStr(dtOne.Minutes, 2); lblSec.Text = MyTool.AddZeroStr(dtOne.Seconds, 2); }