/// <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; } }
/// <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); } }
private void btnStart_Click(object sender, EventArgs e) { var dt = EntitiesTool.GetDateTimeNow(); LotteryOpenPrivateInfoDAL.InitialTodayInfo(Lottery, dt); // LotteryOpenDAL.InitialTodayInfo(Lottery, dt.AddDays(1)); // LotteryOpenDAL.SetNextOpenNo(Lottery.Id); btnStart.Enabled = false; btnStop.Enabled = !btnStart.Enabled; showOpenInfo(); timer1.Start(); }
public string Json_GetLotteryNextInfo(string LotteryId) { var arr = LotteryId.Split(',').Select(n => Convert.ToInt32(n)).ToArray(); if (arr.Length == 0) { return(""); } var dt = EntitiesTool.GetDateTimeNow(); var list = LotteryOpenOffcialInfoDAL.NextOpenNo(arr).Select(n => new { n.LotteryId, RemainderSeconds = (n.ScheduleOpenTime - dt).TotalSeconds, n.Expect }).ToList(); return(ObjectToJson(list)); }
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(); }
BetInfo bet(long OpenId, Accounts account, int code) { var betInfo = new BetInfo() { AccountId = account.Id, LotteryOpenId = OpenId, ResultType = (int)Enum_ResultType.Wait, CreateTime = EntitiesTool.GetDateTimeNow(), BetNum = createNum(code), BetPlayTypeCode = code, BetTimes = 1, BetUnit = code == 12 ? 3 : 1, BetMoney = code == 12 ? 6 : 2, GetBackPercent = account.AgentPercent11X5, IsGetBackPercent = ckbFandian.Checked, MaxBackMoney = LotteryOpenTool_11x5.LpList()[code - 1].PrizeClass == null?LotteryOpenTool_11x5.LpList()[code - 1].PayBack : LotteryOpenTool_11x5.LpList()[code - 1].PrizeClass.Max(n => n.Value),//根据是否要返点产生中奖金额 }; return(betInfo); }
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); } }
/// <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; } }
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; } } }
/// <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; } }
public string SendBetInfo_ZH(string Guid, int LotteryId, bool isWinCancel, List <WS_ZHInfo> ZHInfo) { if (!isLogin(Guid)) { return(null); } var l = EntitiesTool.GetLotteryDic().Values.FirstOrDefault(n => n.Id == LotteryId); if (l == null) { return("无该彩种信息"); } try { var t = new List <WS_BetInfo>(); var accId = GetLoginId(Guid); var acc = AccountDAL.GetAccount(accId); var list = ZHInfo; #region 验证下注信息 var minDec = new decimal(0.2); if (list.Exists(n => n.BetMoney < minDec)) { return("每种玩法的下注金额不能少于" + minDec + "元"); } if (list.Sum(n => n.BetMoney) > acc.AccountBalance) { return("余额不足"); } var returnStr = LotteryOpenInfoDAL.IsExistsExpect(LotteryId, ZHInfo[0].Except, EntitiesTool.GetLotteryDic().Values.FirstOrDefault(n => n.Id == LotteryId).IsPrivate); if (returnStr != "") { return(returnStr); } var wBetList = new List <BetInfo>(); var addNumNo = "ZH" + DateTime.Now.Ticks + random.Next(1000, 10000); foreach (var item in list) { var betU = Tools.Calculate(l.LotteryType, item.BetPlayTypeCode, item.BetNum, item.ChoicePosition, item.BetUnit); if (betU != item.BetUnit) { return("下单注数验证失败"); } if (betU <= 0) { return("下单注数应大于0"); } decimal mm = 0; switch (item.BetMoneyMode) { case "元": mm = 2; break; case "角": mm = new decimal(0.2); break; case "分": mm = new decimal(0.02); break; case "厘": mm = new decimal(0.002); break; } if (betU * mm * item.BetTimes != item.BetMoney) { return("下单金额有误"); } var betInfo = new BetInfo { AccountId = acc.Id, ResultType = (int)Enum_ResultType.Wait, BetNum = item.BetNum, BetPlayTypeCode = item.BetPlayTypeCode, BetTimes = item.BetTimes, BetUnit = item.BetUnit, BetMoney = item.BetMoney, ChoicePosition = item.ChoicePosition, IsGetBackPercent = item.IsGetBackPercent, LotteryId = LotteryId, LotteryExcept = item.Except, IsWinCancel = isWinCancel,//中奖后停止追号 //追号单号 AddNumNo = addNumNo, }; switch (l.LotteryType) { case "ssc": betInfo.GetBackPercent = acc.AgentPercentSSC; betInfo.MaxBackMoney = (betInfo.IsGetBackPercent ? LotteryInfo_SSC.LpList()[item.BetPlayTypeCode - 1].PayBack : AgentCalculateTool.GetAgentBackMoney_SSC(LotteryInfo_SSC.LpList()[item.BetPlayTypeCode - 1].PayBack, betInfo.GetBackPercent)) * (betInfo.BetMoney / betInfo.BetUnit / 2); break; case "11x5": betInfo.GetBackPercent = acc.AgentPercent11X5; betInfo.MaxBackMoney = (betInfo.IsGetBackPercent ? LotteryOpenTool_11x5.LpList()[item.BetPlayTypeCode - 1].PayBack : AgentCalculateTool.GetAgentBackMoney_SSC(LotteryOpenTool_11x5.LpList()[item.BetPlayTypeCode - 1].PayBack, betInfo.GetBackPercent)) * (betInfo.BetMoney / betInfo.BetUnit / 2); break; case "dpc": betInfo.GetBackPercent = acc.AgentPercentDPC; betInfo.MaxBackMoney = (betInfo.IsGetBackPercent ? LotteryOpenTool_3D.LpList()[item.BetPlayTypeCode - 1].PayBack : AgentCalculateTool.GetAgentBackMoney_SSC(LotteryOpenTool_3D.LpList()[item.BetPlayTypeCode - 1].PayBack, betInfo.GetBackPercent)) * (betInfo.BetMoney / betInfo.BetUnit / 2); break; } wBetList.Add(betInfo); } #endregion if (wBetList.Count == 0) { return("无有效下注信息"); } var dt = EntitiesTool.GetDateTimeNow(new LotteryAPPEntities()); wBetList.ForEach(n => n.CreateTime = dt); var account = AccountDAL.BalanceChange(acc.Id, wBetList); return(account.AccountBalance + "(元)"); } catch (Exception ex) { return("错误的下注信息" + ex.Message); } }
public string SendBetInfo(string Guid, int LotteryId, string Except, List <WS_BetInfo> BetInfo) { if (!isLogin(Guid)) { return(null); } var l = EntitiesTool.GetLotteryDic().Values.FirstOrDefault(n => n.Id == LotteryId); if (l == null) { return("无该彩种信息"); } //if (l.LotteryType == "ssc") //{ // t.Add(new WS_BetInfo // { // BetMoney = 2, // BetMoneyMode = "元", // BetNum = "0|0|0|0|0", // BetPlayTypeCode = 2, // BetTimes = 1, // BetUnit = 1, // ChoicePosition = "", // IsGetBackPercent = true, // }); // t.Add(new WS_BetInfo // { // BetMoney = 6, // BetMoneyMode = "角", // BetNum = "0 1 2|0 1 2", // BetPlayTypeCode = 116, // BetTimes = 1, // BetUnit = 30, // ChoicePosition = "0,1,2,3,4", // IsGetBackPercent = true, // }); //} //if (l.LotteryType == "11x5") //{ // t.Add(new WS_BetInfo // { // BetMoney = 2, // BetMoneyMode = "元", // BetNum = "04|05|06", // BetPlayTypeCode = 1, // BetTimes = 1, // BetUnit = 1, // ChoicePosition = "", // IsGetBackPercent = false, // }); //} //BetInfo = ObjectToJson(t);//示例[{"BetNum":"0","BetPlayTypeCode":1,"BetUnit":1,"BetTimes":1,"BetMoneyMode":"元","BetMoney":0.0,"ChoicePosition":"","IsGetBackPercent":true}] try { var t = new List <WS_BetInfo>(); var accId = GetLoginId(Guid); var acc = AccountDAL.GetAccount(accId); //var acc = AccountDAL.GetAccount(2);//jix008 var list = BetInfo; //JsonToObject(BetInfo, new List<WS_BetInfo>()) as List<WS_BetInfo>; #region 验证下注信息 var returnStr = LotteryOpenInfoDAL.IsExistsExpect(LotteryId, Except, EntitiesTool.GetLotteryDic().Values.FirstOrDefault(n => n.Id == LotteryId).IsPrivate); if (returnStr != "") { return(returnStr); } var minDec = new decimal(0.2); if (list.Exists(n => n.BetMoney < minDec)) { return("每种玩法的下注金额不能少于" + minDec + "元"); } if (list.Sum(n => n.BetMoney) > acc.AccountBalance) { return("余额不足"); } var wBetList = new List <BetInfo>(); foreach (var item in list) { var betU = Tools.Calculate(l.LotteryType, item.BetPlayTypeCode, item.BetNum, item.ChoicePosition, item.BetUnit); if (betU != item.BetUnit) { return("下单注数验证失败"); } if (betU <= 0) { return("下单注数应大于0"); } decimal mm = 0; switch (item.BetMoneyMode) { case "元": mm = 2; break; case "角": mm = new decimal(0.2); break; case "分": mm = new decimal(0.02); break; case "厘": mm = new decimal(0.002); break; } if (betU * mm * item.BetTimes != item.BetMoney) { return("下单金额有误"); } var betInfo = new BetInfo { AccountId = acc.Id, ResultType = (int)Enum_ResultType.Wait, BetNum = item.BetNum, BetPlayTypeCode = item.BetPlayTypeCode, BetTimes = item.BetTimes, BetUnit = item.BetUnit, BetMoney = item.BetMoney, ChoicePosition = item.ChoicePosition, IsGetBackPercent = item.IsGetBackPercent, LotteryId = LotteryId, LotteryExcept = Except, }; switch (l.LotteryType) { case "ssc": betInfo.GetBackPercent = acc.AgentPercentSSC; betInfo.MaxBackMoney = (betInfo.IsGetBackPercent ? LotteryInfo_SSC.LpList()[item.BetPlayTypeCode - 1].PayBack : AgentCalculateTool.GetAgentBackMoney_SSC(LotteryInfo_SSC.LpList()[item.BetPlayTypeCode - 1].PayBack, betInfo.GetBackPercent)) * (betInfo.BetMoney / betInfo.BetUnit / 2); break; case "11x5": betInfo.GetBackPercent = acc.AgentPercent11X5; betInfo.MaxBackMoney = (betInfo.IsGetBackPercent ? LotteryOpenTool_11x5.LpList()[item.BetPlayTypeCode - 1].PayBack : AgentCalculateTool.GetAgentBackMoney_SSC(LotteryOpenTool_11x5.LpList()[item.BetPlayTypeCode - 1].PayBack, betInfo.GetBackPercent)) * (betInfo.BetMoney / betInfo.BetUnit / 2); break; case "dpc": betInfo.GetBackPercent = acc.AgentPercentDPC; betInfo.MaxBackMoney = (betInfo.IsGetBackPercent ? LotteryOpenTool_3D.LpList()[item.BetPlayTypeCode - 1].PayBack : AgentCalculateTool.GetAgentBackMoney_SSC(LotteryOpenTool_3D.LpList()[item.BetPlayTypeCode - 1].PayBack, betInfo.GetBackPercent)) * (betInfo.BetMoney / betInfo.BetUnit / 2); break; } wBetList.Add(betInfo); } #endregion if (wBetList.Count == 0) { return("无有效下注信息"); } var dt = EntitiesTool.GetDateTimeNow(new LotteryAPPEntities()); wBetList.ForEach(n => n.CreateTime = dt); var account = AccountDAL.BalanceChange(acc.Id, wBetList); return(account.AccountBalance + "(元)"); } catch (Exception ex) { return("错误的下注信息" + ex.Message); } }
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); }
/// <summary> /// 刷新注数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCalculate_Click(object sender, EventArgs e) { LotteryInptuNoControl tb = null; foreach (var item in ChoiceTabPage.Controls) { if (item.GetType() == typeof(LotteryInptuNoControl)) { tb = (LotteryInptuNoControl)item; break; } } if (tb != null) { var betStr = tb.GetBetNo(); var bet = betStr == "" ? 0 : betStr.Split('|').Length; lblTotal.Tag = bet + " " + ChoiceTabPage.Parent.Tag + ChoiceTabPage.Text; lblTotal.Text = BetCalculateTool.GetTotalMoney(bet, (int)nudBS.Value, cboDW.SelectedIndex); MessageBox.Show("自动剔除不符合规范号码"); } else { calculate(); } #region 注 if (lblTotal.Tag == null) { return; } var sp = lblTotal.Tag.ToString().Split(' '); if (sp[0] == "0") { return; } var lp = LotteryOpenTool_11x5.LpList().FirstOrDefault(n => n.LotteryPlayName == sp[1]); BetInfo b = new BetInfo { BetPlayTypeCode = lp.BetPlayTypeCode, BetTimes = Convert.ToInt32(nudBS.Value), BetUnit = Convert.ToInt32(sp[0]), BetMoney = Convert.ToDecimal(lblTotal.Text.Substring(lblTotal.Text.IndexOf("¥") + 1, lblTotal.Text.IndexOf("元") - lblTotal.Text.IndexOf("¥") - 1)), AccountId = account.Id, CreateTime = EntitiesTool.GetDateTimeNow(), //LotteryOpenId = nextOpen.Id, ResultType = (int)Enum_ResultType.Wait, GetBackPercent = account.AgentPercent11X5, IsGetBackPercent = cboFandian.SelectedIndex != 0, }; if (sp[1].Contains("趣味定_")) { StringBuilder sb = new StringBuilder(); foreach (var item in txtBetNo.Text.Split(' ')) { sb.Append(' ' + item[0].ToString()); } b.BetNum = sb.ToString().Trim(); } else { b.BetNum = txtBetNo.Text; } b.MaxBackMoney = (b.IsGetBackPercent?AgentCalculateTool.GetAgentBackMoney_11x5(lp.PayBack, account.AgentPercent11X5):lp.PayBack) * (b.BetMoney / b.BetUnit / 2); //根据是否要返点产生中奖金额 if (string.IsNullOrEmpty(b.BetNum)) { return; } wBetList.Add(b); #endregion var row = dgvwBet.Rows[dgvwBet.Rows.Add()]; row.Cells[0].Value = sp[1]; row.Cells[1].Value = b.BetNum; row.Cells[2].Value = b.BetUnit; row.Cells[3].Value = b.BetTimes; row.Cells[4].Value = b.BetMoney; row.Cells[5].Value = "X"; }