private void Form1_Load(object sender, EventArgs e) { lastOpen = LotteryOpenInfoDAL.LastOpenNo(Lottery.Id); nextOpen = LotteryOpenInfoDAL.NextOpenNo(Lottery.Id); showOpenInfo(); timer1.Start(); }
private void tmOpen_Tick(object sender, EventArgs e) { //#region 线程开奖 //Thread t1 = new Thread(new ThreadStart()); //t1.IsBackground = true; //t1.Start(); //#endregion tmOpen.Stop(); //开始开奖 var info = new LotteryOpenInfo { Expect = openNext.Expect, LotteryId = openNext.LotteryId, OpenTime = DateTime.Now, OpenDate = DateTime.Now.Date, OpenCode = openNext.ScheduleOpenCode, }; if (rbtnXZ.Checked) { } else if (rbtnGD.Checked) { var o = info.OpenCode.Split(','); if (txtNo1.Text != "") { o[0] = txtNo1.Text; } if (txtNo2.Text != "") { o[1] = txtNo2.Text; } if (txtNo3.Text != "") { o[2] = txtNo3.Text; } if (txtNo4.Text != "") { o[3] = txtNo4.Text; } if (txtNo5.Text != "") { o[4] = txtNo5.Text; } info.OpenCode = string.Format("{0},{1},{2},{3},{4}", o[0], o[1], o[2], o[3], o[4]); } LotteryOpenInfoDAL.Add(info); LotteryOpenInfoDAL.BackWinMoney(Lottery.Id, info.Expect); }
private void Form1_Load(object sender, EventArgs e) { dtLoad = EntitiesTool.GetDateTimeNow(); tbc_3m_SelectedIndexChanged(null, null); cboDW.SelectedIndex = 0; dgvHistory.AutoGenerateColumns = false; dgvBet.AutoGenerateColumns = false; dgvHistory.DataSource = LotteryOpenInfoDAL.LastOpen_Count(20, lottery.Id).Select(n => new { OpenNo = n.Expect, OpenNum = n.OpenCode }).ToList(); lblMoney.Text = account.AccountBalance + "元"; lblName.Text = account.AccountName; nextOpen = LotteryOpenOffcialInfoDAL.NextOpenNo(lottery.Id); lastOpen = LotteryOpenInfoDAL.LastOpenNo(lottery.Id); showOpenInfo(); timer1.Start(); }
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); }
private void tm1s_Tick(object sender, EventArgs e) { lblRemainderTime.Text = getRemainderTime(); tsRemainderTime = tsRemainderTime.Add(-_1s); if (tsRemainderTime.TotalSeconds <= 0) { tmOpen.Start(); openNext = new LotteryOffcialSchedule { Expect = NextExcept.Expect, LotteryId = NextExcept.LotteryId, ScheduleOpenCode = NextExcept.ScheduleOpenCode, }; var next = LotteryOpenOffcialInfoDAL.NextOpenNo(Lottery.Id); if (next != null && next.Expect != NextExcept.Expect)//新一期 { NextExcept = next; tsRemainderTime = NextExcept.ScheduleOpenTime - EntitiesTool.GetDateTimeNow(); gbLotteryTime.Text = string.Format("距离{0}期开奖", NextExcept.Expect); lblYKJH.Text = "预开奖号:" + NextExcept.ScheduleOpenCode; beginGetLast = true; } } if (beginGetLast) { var last = LotteryOpenInfoDAL.LastOpenNo(Lottery.Id); if (last != null && (LastExcept == null || last.Expect != LastExcept.Expect)) { gbLotteryInfo.Text = string.Format("{0} 第{1}期 开奖号码", Lottery.LotteryName, last.Expect); lblLNo.Text = last.OpenCode; beginGetLast = false; LastExcept = last; } } if (DateTime.Now.Hour >= 6 && DateTime.Now.Hour <= 7 && DateTime.Now.Minute % 10 == 0 && DateTime.Now.Second == 0) { LotteryOpenOffcialInfoDAL.InitialTodayInfo(Lottery); } }
private void btnStart_Click(object sender, EventArgs e) { if (dgvLottery.SelectedRows.Count > 0) { lblLNo.Text = "*,*,*,*,*"; Lottery = EntitiesTool.GetLotteryDic()[dgvLottery.SelectedRows[0].Cells["LotteryCode"].Value.ToString()]; LotteryOpenOffcialInfoDAL.InitialTodayInfo(Lottery); NextExcept = LotteryOpenOffcialInfoDAL.NextOpenNo(Lottery.Id); gbLotteryInfo.Text = string.Format("{0} 第XXX期 开奖号码", Lottery.LotteryName); if (NextExcept != null) { tsRemainderTime = NextExcept.ScheduleOpenTime - EntitiesTool.GetDateTimeNow(); gbLotteryTime.Text = string.Format("距离{0}期开奖", NextExcept.Expect); lblYKJH.Text = "预开奖号:" + NextExcept.ScheduleOpenCode; LastExcept = LotteryOpenInfoDAL.LastOpenNo(Lottery.Id); if (LastExcept != null) { gbLotteryInfo.Text = string.Format("{0} 第{1}期 开奖号码", Lottery.LotteryName, LastExcept.Expect); lblLNo.Text = LastExcept.OpenCode; } btnStart.Enabled = false; } } }
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); }