public void ResetState() { Status = ZombieGameStatus.NotStarted; MaxRounds = 0; RoundInProgress = false; RoundStart = DateTime.MinValue; RoundEnd = DateTime.MinValue; Player[] online = PlayerInfo.Online.Items; Alive.Clear(); Infected.Clear(); Lottery.Clear(); Bounties.Clear(); RecentMaps.Clear(); foreach (Player pl in online) { pl.Game.Referee = false; pl.Game.RatedMap = false; pl.Game.ResetZombieState(); ResetInvisibility(pl); pl.SetPrefix(); if (pl.level == null || !pl.level.name.CaselessEq(CurLevelName)) { continue; } HUD.Reset(pl); } LastLevelName = ""; CurLevelName = ""; CurLevel = null; }
public ActionResult BackRule() { try { NameValueCollection parmas = WorkContext.postparms; if (parmas.Keys.Count != 2) { return(APIResult("error", "缺少请求参数")); } string mobile = parmas["account"]; //List<BaseInfo> list = BSPConfig.BaseConfig.BaseList.Where(x => x.Name == parmas["name"].ToString()).ToList() List <MD_UserBackRate> list = Lottery.GetUserBackRuleList(1, int.MaxValue, ""); if (list.Count > 0) { JsonSerializerSettings jsetting = new JsonSerializerSettings(); jsetting.DateFormatString = "yyyy-MM-dd HH:mm:ss"; string data = JsonConvert.SerializeObject(list, jsetting).ToLower(); return(APIResult("success", data, true)); } else { return(APIResult("success", "暂无信息")); } } catch (Exception ex) { return(APIResult("error", "获取失败")); } }
/// <summary> /// 赔率 分类型显示 /// </summary> /// <returns></returns> private ActionResult LotterySet(string type) { try { NameValueCollection parmas = WorkContext.postparms; if (parmas.Keys.Count != 3) { return(APIResult("error", "缺少请求参数")); } DataSet list = Lottery.GetLotterySetList("where a.roomtype=" + parmas["type"]); DataTable dt = list.Tables[0]; StringBuilder strb = new StringBuilder(); strb.Append("{\"first\":"); strb.Append(JsonConvert.SerializeObject(list.Tables[1])); strb.Append(",\"sec\":"); strb.Append(JsonConvert.SerializeObject(list.Tables[2])); strb.Append(",\"three\":"); strb.Append(JsonConvert.SerializeObject(list.Tables[3]) + "}"); //JsonSerializerSettings jsetting = new JsonSerializerSettings(); //jsetting.ContractResolver = new JsonLimitOutPut(new string[] { "lotterytype", "lottery", "settype", "type", "item", "odds","nums" }, true); //string data = JsonConvert.SerializeObject(list.Tables[0], jsetting).ToLower(); return(APIResult("success", strb.ToString(), true)); } catch (Exception ex) { return(APIResult("error", "获取失败")); } }
public void LotterySimpleEnterTest() { Lottery <int> lottery = new Lottery <int>(); lottery.Enter(1); Assert.That(lottery.GetTickets(1) == 1); }
public void Lottery10000EnterTest() { Lottery <int> lottery = new Lottery <int>(1000000); Random rng = new Random(); Dictionary <int, int> tickets = new Dictionary <int, int>(10000); for (int i = 0; i < 10000; i++) { int entrant = rng.Next(); int n = rng.Next(100) + 1; lottery.Enter(entrant, n); if (tickets.ContainsKey(entrant)) { tickets[entrant] += n; } else { tickets.Add(entrant, n); } } foreach (var entrant in tickets.Keys) { Assert.That(tickets[entrant] == lottery.GetTickets(entrant)); } }
private static void ShowExistingLotteryNumbersPerPattern(Lottery lottery, string patternLevel) { System.Console.WriteLine("*********************************************"); System.Console.WriteLine("Lottery Numbers Per Pattern {0} from {1} - {2}", patternLevel, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()); System.Console.WriteLine("*********************************************"); foreach (var drawing in lottery.Drawings) { var sortedNumbers = drawing.Numbers.OrderBy(a => a).ToList(); var patternLevels = string.Join(",", drawing.PatternLevels); if (patternLevels.Equals(patternLevel)) { System.Console.WriteLine("{0} - {1},{2},{3},{4},{5}", drawing.DateTime.ToString("MM/dd/yyyy"), sortedNumbers[0].ToString(), sortedNumbers[1].ToString(), sortedNumbers[2].ToString(), sortedNumbers[3].ToString(), sortedNumbers[4].ToString()); } } System.Console.WriteLine("*********************************************"); }
private Lottery GetLottery(Roulette roulette) { List <int> participants = roulette.Bets.Select(u => u.Number).Distinct().ToList(); Random r = new Random(); int rInt = r.Next(0, participants.Count()); Lottery lottery = new Lottery(); lottery.RegisterDate = DateTime.Now; lottery.Close = roulette.OpenDate; lottery.Close = roulette.CloseDate; lottery.RouletteId = roulette.RouletteId; lottery.TotalBet = roulette.Bets.Sum(u => u.MoneyBet); lottery.WinningNumber = participants[rInt]; lottery.WinnersQuantityNumber = roulette.Bets.Where(u => u.Number == lottery.WinningNumber).Count(); lottery.WinnersNumber = GetWinners(roulette.Bets.Where(u => u.Number == lottery.WinningNumber).ToList(), 5); if (lottery.WinningNumber % 2 == 0) { lottery.TotalMoneyBetColor = roulette.Bets.Where(u => u.Number % 2 == 0).Sum(u => u.MoneyBet); lottery.WinnersQuantityColor = roulette.Bets.Where(u => u.Number % 2 == 0).Count(); lottery.WinnersColor = GetWinners(roulette.Bets.Where(u => u.Number % 2 == 0).ToList(), 1.8); } else { lottery.WinnersQuantityColor = roulette.Bets.Where(u => u.Number % 2 != 0).Count(); lottery.TotalMoneyBetNumber = roulette.Bets.Where(u => u.Number % 2 != 0).Sum(u => u.MoneyBet); lottery.WinnersColor = GetWinners(roulette.Bets.Where(u => u.Number % 2 != 0).ToList(), 1.8); } return(lottery); }
/// <summary> /// 创建聊天室 /// </summary> /// <returns></returns> public ActionResult ChatRoom() { string hxurl = root + "/chatrooms"; MD_AccessTokenResult token = Lottery.GetAccessToken(); string[] chat = new string[] { "bj-fir-vip1", "bj-fir-vip2", "bj-fir-vip3", "bj-fir-vip4", "bj-sec-vip1", "bj-sec-vip2", "bj-sec-vip3", "bj-sec-vip4", "bj-thr-vip1", "bj-thr-vip2", "bj-thr-vip3", "bj-thr-vip4", "cakeno-fir-vip1", "cakeno-fir-vip2", "cakeno-fir-vip3", "cakeno-fir-vip4", "cakeno-sec-vip1", "cakeno-sec-vip2", "cakeno-sec-vip3", "cakeno-sec-vip4", "cakeno-thr-vip1", "cakeno-thr-vip2", "cakeno-thr-vip3", "cakeno-thr-vip4" }; StringBuilder strb = new StringBuilder(); foreach (string str in chat) { strb.Append("{\"name\": \"" + str + "\",\"description\": \"" + str + "\",\"maxusers\": 500,\"owner\": \"8001\"}"); string result = WebHelper.GetHXRequestData(hxurl, "post", token.SuccessResult.access_token, true, strb.ToString()); if (result.Contains("error")) { return(APIResult("error", "聊天室创建失败,返回信息 :" + result)); } strb = new StringBuilder(); } //获取聊天室信息 hxurl += "?pagenum=1&pagesize=24"; string chats = WebHelper.GetHXRequestData(hxurl, "get", token.SuccessResult.access_token, true, ""); if (!chats.Contains("error")) { return(APIResult("success", "创建成功", true)); } return(APIResult("success", "创建失败", true)); }
private ActionResult DealBettHigh(NameValueCollection parmas) { lock (lkbthigh) { int typeid = int.Parse(parmas["bttypeid"]); int money = int.Parse(parmas["money"]); string valres = Lottery.ValidateBetMoney(parmas["expect"], typeid, money, parmas["room"]); if (!valres.Contains("验证通过")) { return(APIResult("error", valres)); } MD_Bett bet = new MD_Bett { Account = parmas["account"], Room = parmas["room"], Vip = parmas["vip"], Lotterynum = parmas["expect"], Money = int.Parse(parmas["money"]), Bttypeid = int.Parse(parmas["bttypeid"]) }; bool betres = Lottery.AddBett(bet); if (betres) { return(APIResult("success", "投注成功")); } else { return(APIResult("error", "投注失败")); } } }
/// <summary> /// 删除聊天室成员 /// </summary> /// <returns></returns> public ActionResult DelChatRoomUser() { try { NameValueCollection parmas = WorkContext.postparms; string hxurl = root + "/chatrooms/" + parmas["chatroomid"] + "/users/" + parmas["mobile"]; MD_AccessTokenResult token = Lottery.GetAccessToken(); string chats = WebHelper.GetHXRequestData(hxurl, "delete", token.SuccessResult.access_token, true, ""); if (chats.Contains("error")) { ErrorMsg errm = JsonConvert.DeserializeObject <ErrorMsg>(chats); return(APIResult("error", errm.error_description)); } else { MD_HXRoomData room = JsonConvert.DeserializeObject <MD_HXRoomData>(chats); if (room.data[0].result) { return(APIResult("success", "删除成功")); } } return(APIResult("error", "删除失败")); } catch (Exception ex) { return(APIResult("error", "删除失败")); } }
/// <summary> /// 删除聊天室(MVC 不支持Delete) /// </summary> /// <returns></returns> public ActionResult DelChatRoom() { try { string hxurl = root + "/chatrooms"; MD_AccessTokenResult token = Lottery.GetAccessToken(); //获取聊天室信息 hxurl += "?pagenum=1&pagesize=24"; string chats = WebHelper.GetHXRequestData(hxurl, "get", token.SuccessResult.access_token, true, ""); MD_HXRoomData room = JsonConvert.DeserializeObject <MD_HXRoomData>(chats); foreach (MD_RoomData rd in room.data) { hxurl = root + "/chatrooms/" + rd.id.ToString(); chats = WebHelper.GetHXRequestData(hxurl, "delete", token.SuccessResult.access_token, true, ""); room = JsonConvert.DeserializeObject <MD_HXRoomData>(chats); } return(APIResult("success", "删除成功", true)); } catch (Exception ex) { return(APIResult("error", "删除失败", true)); } }
/// <summary> /// 开奖趋势分析 /// </summary> private void analyzeTendency(Lottery lottery, Tendency tendency, int index1, int index2) { tendency.ClearTendencys();//清空记录 TendencyModel tm; AnalyzeTendency at = new AnalyzeTendency(); for (int i = lottery.Lt_Lotterys.Count - 1; i >= 0; i--) { tm = new TendencyModel(); tm.ID = i + 1; tm.Lottery = lottery.Lt_Lotterys[i].Lottery; tm.Big = at.BigNum(lottery.Lt_Lotterys, i, index1, index2); //大大 tm.BigSmall = at.BigSmallNum(lottery.Lt_Lotterys, i, index1, index2); //大小 tm.SmallBig = at.SmallBigNum(lottery.Lt_Lotterys, i, index1, index2); //小大 tm.Small = at.SmallNum(lottery.Lt_Lotterys, i, index1, index2); //小小 tm.Odd = at.OddPairNum(lottery.Lt_Lotterys, i, index1, index2, 1, 1); //奇奇 tm.OddPair = at.OddPairNum(lottery.Lt_Lotterys, i, index1, index2, 1, 0); //奇偶 tm.PairOdd = at.OddPairNum(lottery.Lt_Lotterys, i, index1, index2, 0, 1); //偶奇 tm.Pair = at.OddPairNum(lottery.Lt_Lotterys, i, index1, index2, 0, 0); //偶偶 tm.Dbl = at.DblNum(lottery.Lt_Lotterys, i, index1, index2); //重数 tm.SNO = (lottery.Lt_Lotterys[i].Sno.ToString() + "期").PadLeft(5, '0'); tm.Dtime = lottery.Lt_Lotterys[i].Dtime; tendency.AddTendency(tm);//添加趋势记录 } }
public static void StartShutdown() { if (Lottery.OpenLotto) { Lottery.StartLotto(); } Lottery.ShuttingDown = true; if (AutoShutdown.Kick_Login) { NoEntry = true; } if (Timers.Stop_Server_Time < 1) { Timers.Stop_Server_Time = 1; } Timers._sSC = Timers.Stop_Server_Time; stopServerCountingDown = true; string _phrase450; if (!Phrases.Dict.TryGetValue(450, out _phrase450)) { _phrase450 = "Server Shutdown In {Minutes} Minutes."; } _phrase450 = _phrase450.Replace("{Minutes}", Timers.Stop_Server_Time.ToString()); string _message = _phrase450; Alert(_message, Alert_Count); }
public JsonResult SaveLottery(string entity) { JavaScriptSerializer serializer = new JavaScriptSerializer(); Lottery model = serializer.Deserialize <Lottery>(entity); string errmsg = ""; if (model.AutoID < 1) { model.AutoID = WebSetBusiness.CreateLottery(model.CPName, model.CPCode, model.IconType, model.ResultUrl, CurrentUser.UserID, model.OpenTimes, model.CloseTime, model.OnSaleTime, model.SealTimes, model.PeriodsNum, ref errmsg); } else { bool bl = WebSetBusiness.UpdateLottery(model.CPName, model.CPCode, model.IconType, model.ResultUrl, model.OpenTimes, model.CloseTime, model.OnSaleTime, model.SealTimes, model.PeriodsNum, model.AutoID); if (!bl) { model.AutoID = 0; } } JsonDictionary.Add("model", model); JsonDictionary.Add("ErrMsg", errmsg); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public static void StartShutdown() { if (Lottery.OpenLotto) { Lottery.StartLotto(); } Lottery.ShuttingDown = true; if (AutoShutdown.Kick_Login) { NoEntry = true; } if (Timers.Stop_Server_Time < 1) { Timers.Stop_Server_Time = 1; } Timers._sSC = Timers.Stop_Server_Time; stopServerCountingDown = true; string _phrase450; if (!Phrases.Dict.TryGetValue(450, out _phrase450)) { _phrase450 = "Server Shutdown In {Minutes} Minutes."; } _phrase450 = _phrase450.Replace("{Minutes}", Timers.Stop_Server_Time.ToString()); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("[FF0000]{0}[-]", _phrase450), Config.Server_Response_Name, false, "", false); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("[FF0000]{0}[-]", _phrase450), Config.Server_Response_Name, false, "", false); }
private int SaveLottery(Lottery lottery) { lock (Connection) { return(Connection.Update(lottery)); } }
/// <summary> /// 游戏记录 /// </summary> /// <returns></returns> public ActionResult GameList() { bool isref = WebHelper.GetQueryInt("isref", 0) == 0 ? false : true; int lotterytype = WebHelper.GetQueryInt("lotterytype", 0); string start = WebHelper.GetQueryString("start", ""); string end = WebHelper.GetQueryString("end", ""); int page = WebHelper.GetQueryInt("page", 1); StringBuilder strb = new StringBuilder(); strb.Append(" where 1=1 "); if (lotterytype != 0) { strb.Append(" and a.lotteryid=" + lotterytype.ToString()); } if (start != "") { strb.Append(" and convert(varchar(25),a.addtime,120)>='" + start + "'"); } if (end != "") { strb.Append(" and convert(varchar(25),a.addtime,120)<='" + end + "'"); } List <MD_Bett> list = Lottery.GetBettList(page, 50, strb.ToString()); BettListModel bett = new BettListModel { BettList = list, PageModel = new PageModel(15, 1, list.Count > 0 ? list[0].TotalCount : 0) }; if (isref) { return(Content(JsonConvert.SerializeObject(list))); } return(View(bett)); }
public int itemsAmount = 1; // Amount of rewards given public void PickRewards(bool onlyUnique, Action <List <LootBoxReward> > callback) { // Contruction de la lottery Lottery <LootBoxReward> lot = new Lottery <LootBoxReward>(); foreach (var reward in possibleItems) { // Conditions to adding an item in rewards here : // example : this items in the ref is not yet available by the player so it needs to not appear in lootbox reward // If player already has item and we want only unique reward if (reward.Key.PlayerAlreadyHasIt() && onlyUnique) { continue; } lot.Add(reward.Key, reward.Value); } List <LootBoxReward> pickedItems = new List <LootBoxReward>(); //On pick for (int i = 0; i < itemsAmount; i++) { if (lot.Count <= 0) { break; // No rewards } int pickedIndex = -1; pickedItems.Add(lot.Pick(out pickedIndex)); lot.RemoveAt(pickedIndex); } callback(pickedItems); }
private async Task <IList <AddKudosLogDto> > CreateKudosLogsAsync(Lottery lottery, UserAndOrganizationDto userOrg) { var kudosTypeId = await _kudosService.GetKudosTypeIdAsync(KudosTypeEnum.Refund); var usersToRefund = await _participantService.GetParticipantsCountedAsync(lottery.Id); var usersToSendKudos = new List <AddKudosLogDto>(); foreach (var user in usersToRefund) { var totalReturn = user.Tickets * lottery.EntryFee; var kudosLog = new AddKudosLogDto { ReceivingUserIds = new List <string> { user.UserId }, PointsTypeId = kudosTypeId, MultiplyBy = totalReturn, Comment = CreateComment(lottery, totalReturn), UserId = userOrg.UserId, OrganizationId = userOrg.OrganizationId }; usersToSendKudos.Add(kudosLog); } return(usersToSendKudos); }
private void btnLAWPASaveChanges_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show(ResourcesUtils.GetMessage("lott_lwpa_msg3"), ResourcesUtils.GetMessage("lott_lwpa_msg2"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.No) { return; } Lottery lottery = (Lottery)cmbLWPAGameMode.SelectedItem; LotteryWinningCombination originalCombination = this.lotteryDataServices.GetLotteryWinningCombinations(lottery.GetGameMode()); LotteryWinningCombinationSetup lotteryUpdated = (LotteryWinningCombinationSetup)originalCombination.Clone(); lotteryUpdated.Match1 = int.Parse(txtbLWPABet1.Value.ToString()); lotteryUpdated.Match2 = int.Parse(txtbLWPABet2.Value.ToString()); lotteryUpdated.Match3 = int.Parse(txtbLWPABet3.Value.ToString()); lotteryUpdated.Match4 = int.Parse(txtbLWPABet4.Value.ToString()); lotteryUpdated.Match5 = int.Parse(txtbLWPABet5.Value.ToString()); lotteryUpdated.Match6 = int.Parse(txtbLWPABet6.Value.ToString()); this.lotteryDataServices.SaveWinningCombination(lotteryUpdated); MessageBox.Show(ResourcesUtils.GetMessage("lott_lwpa_msg1")); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public IHttpActionResult Lottery([FromBody] Lottery drawnPrize) { int userId = TokenHelper.GetUserId(User.Identity); _quizService.RecordLottery(userId, drawnPrize); return(Ok(_eduAlgorithmService.GetScore(userId))); }
private void btnLotSchedSave_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show(ResourcesUtils.GetMessage("lott_sched_msg4"), ResourcesUtils.GetMessage("lott_sched_msg3"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.No) { return; } Lottery lottery = (Lottery)cmbLotSchedLotteries.SelectedItem; LotteryScheduleSetup lotSchedNew = (LotteryScheduleSetup)this.lotteryDataServices.GetLotterySchedule(lottery.GetGameMode()); lotSchedNew.Monday = chkbLotSchedMon.Checked; lotSchedNew.Tuesday = chkbLotSchedTue.Checked; lotSchedNew.Wednesday = chkbLotSchedWed.Checked; lotSchedNew.Thursday = chkbLotSchedThurs.Checked; lotSchedNew.Friday = chkbLotSchedFri.Checked; lotSchedNew.Saturday = chkbLotSchedSat.Checked; lotSchedNew.Sunday = chkbLotSchedSun.Checked; this.lotteryDataServices.AddNewLotterySchedule(lotSchedNew); MessageBox.Show(ResourcesUtils.GetMessage("lott_sched_msg2")); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void TestLotteryPerformance() { Stopwatch timer = new Stopwatch(); // setup Lottery <int> lottery = new Lottery <int>(1000000); HashSet <int> blacklist = new HashSet <int>(); for (int i = 0; i < 10000; i++) { lottery.Enter(i % 100, 100); if (i != 69) { blacklist.Add(i); } } lottery.StartBatchDraw(); timer.Start(); // actual test lottery.Draw(100); timer.Stop(); Debug.Log($"Test took {timer.Elapsed.ToString("fffffff").Insert(3, ".").TrimStart('0')} ms"); }
public ActionResult ProfitList(int lottery = -1, string type = "每日盈亏", string start = "", string end = "", int pageSize = 15, int pageNumber = 1) { Load(); StringBuilder strb = new StringBuilder(); strb.Append(" where 1=1"); if (lottery > 0) { strb.Append(" and type=" + lottery); } DataTable dt = Lottery.GetProfitListNoLottery(type, pageSize, pageNumber, start == "" ? DateTime.Now.ToString("yyyy-MM-dd") : start, end == "" ? DateTime.Now.ToString("yyyy-MM-dd") : end); ProfitStatList list = new ProfitStatList { Lottery = lottery, Type = type, Start = start == "" ? DateTime.Now.ToString("yyyy-MM-dd") : start, End = end == "" ? DateTime.Now.ToString("yyyy-MM-dd") : end, ProfitList = dt, PageModel = new PageModel(pageSize, pageNumber, dt.Rows.Count > 0 ? int.Parse(dt.Rows[0]["TotalCount"].ToString()) : 0) }; return(View(list)); }
public static LotteryNumber DecodeNumbers(Lottery l) { for (int tries = 0; tries < 3; tries++) { try { l.LoadHtml(l.url); IStateDecodable decode = l.state as IStateDecodable; LotteryNumber num = decode.GetLatestNumbers(l); return(num); } catch (Exception ex) { if (ex.InnerException != null) { if (ex.InnerException.Message.Contains("closed.")) { AddToConsole(" ...The host closed the connection."); AddToConsole(" ...Retrying (" + (tries + 1) + " of 3)"); Thread.Sleep(1000); continue; } } AddToConsole("Unknown exception while running " + l.lotteryName); AddToConsole(" ..." + ex.Message); if (ex.InnerException != null) { AddToConsole(" ..." + ex.InnerException.Message); } AddToConsole("Stack trace: \n" + ex.StackTrace); } } throw new NumbersUnavailableExcpetion(); }
public static int[] ValidateBet(int countLimit, int maxLimit, string input) { var lottery = new Lottery(countLimit, maxLimit); lottery.Parse(input); return(lottery.GetSortedNumbers()); }
public void GetSingleLottery(string lotteryId) { // We can add default request headers for all requests LoadingData.Invoke(); var entireUrl = BASE_PATH + "/" + lotteryId; RequestHelper requestOptions = new RequestHelper { Uri = entireUrl, Method = "GET", Headers = new Dictionary <string, string> { { "Authorization", "Bearer " + FirebaseSettings.idToken } } }; RestClient.Request(requestOptions).Then(response => { LotteryDeserializer l = new LotteryDeserializer(); lottery = l.GenerateLottery(response.Text); return(lottery); }).Then(lott => {; if (lott != null) { onLotteryLoadFinished.Invoke(lott); } }).Catch(err => this.LogMessage("Error", err.Message)); }
public void Initialize() { RandomGeneratorMock = new Mock <IRandomGenerator>(MockBehavior.Strict); RandomWrapperMock = new Mock <IRandomWrapper>(MockBehavior.Strict); Lottery = new Lottery(RandomGeneratorMock.Object, RandomWrapperMock.Object); }
public DateTime GetLatestDate(Lottery lottery) { try { if (String.IsNullOrWhiteSpace((lottery.html))) { throw new MissingFieldException("Georgia.cs", lottery.html); } HtmlDocument Georgia = new HtmlDocument(); Georgia.LoadHtml(lottery.html); if (lottery.lotteryName.Equals("georgia_jumbobucks")) { //File.WriteAllText(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Autoclave\\Save\\" + lottery.lotteryName + ".html", lottery.html); HtmlNode node = Georgia.DocumentNode.SelectNodes("//div[contains(@class,'winning-numbers')]")[0]; HtmlNode node2 = node.SelectSingleNode(".//time"); string dateText = node2.InnerHtml; DateTime dt = DateTime.ParseExact(dateText, "MM/dd/yyyy", CultureInfo.InvariantCulture); return(dt); } } catch { throw; } throw new Exception(); }
public Lottery AddOrUpdateLottery(Lottery lottery) { int primaryKey = default(int); int countRecordsAffected = default(int); if (lottery != null) { if (lottery.LotteryID > 0) { //it exists so update countRecordsAffected = SaveLottery(lottery); primaryKey = lottery.LotteryID; } else { //probably new AddLottery(lottery); primaryKey = lottery.LotteryID; } if (primaryKey <= 0 && countRecordsAffected <= 0) { //throw an error } else { return(GetLottery(primaryKey)); } } return(null); }
// END CUT HERE // BEGIN CUT HERE public static void Main() { try { Lottery ___test = new Lottery(); ___test.run_test(-1); } catch(Exception e) { //Console.WriteLine(e.StackTrace); Console.WriteLine(e.ToString()); } }
public string GenerateLuckLotteryNumber(int LotteryID, string Type, string Name) { string key = "Home_Room_Buy_GenerateLuckLotteryNumber" + LotteryID.ToString(); Type = Shove._Web.Utility.FilteSqlInfusion(Type); Name = Shove._Web.Utility.FilteSqlInfusion(Name); if (Type == "3") { try { DateTime time = Convert.ToDateTime(Name); Name = time.ToString("yyyy-MM-dd"); if (time > DateTime.Now) { return "出生日期不能超过当前日期!"; } } catch { return "日期格式不正确!"; } } DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key); if ((cacheAsDataTable == null) || (cacheAsDataTable.Rows.Count == 0)) { cacheAsDataTable = new Tables.T_LuckNumber().Open("", "datediff(d,getdate(),DateTime)=0 and LotteryID=" + LotteryID.ToString(), ""); Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0xe10); } string lotteryNumber = ""; DataRow[] rowArray = cacheAsDataTable.Select("Type=" + Type + " and Name='" + Name + "'"); if ((rowArray != null) && (rowArray.Length > 0)) { lotteryNumber = rowArray[0]["LotteryNumber"].ToString(); } else { lotteryNumber = new Lottery()[LotteryID].BuildNumber(1); Tables.T_LuckNumber number = new Tables.T_LuckNumber { LotteryID = { Value = LotteryID }, LotteryNumber = { Value = lotteryNumber }, Name = { Value = Name }, Type = { Value = Type } }; number.Insert(); number.Delete("datediff(d,DateTime,getdate())>0"); Shove._Web.Cache.ClearCache(key); } return (lotteryNumber + "|" + this.FormatLuckLotteryNumber(lotteryNumber)); }
protected void btnGO_Click(object sender, EventArgs e) { this.tbWinNumber.Text = _Convert.ToDBC(this.tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(this.tbWinNumber.Text)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); } else { double[] winMoneyList = new double[this.g.Rows.Count * 2]; for (int i = 0; i < this.g.Rows.Count; i++) { winMoneyList[i * 2] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0.0); winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0.0); if (winMoneyList[i * 2] < 0.0) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项奖金输入错误!"); return; } } Tables.T_Schemes schemes = new Tables.T_Schemes(); DataTable table = schemes.Open("", "IsuseID = " + this.ddlIsuse.SelectedValue + " and isOpened = 1", ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { for (int j = 0; j < table.Rows.Count; j++) { string number = table.Rows[j]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double num5 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(number, this.tbWinNumber.Text.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table.Rows[j]["PlayTypeID"].ToString()), winMoneyList); int num6 = _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1); schemes.PreWinMoney.Value = num5 * num6; schemes.PreWinMoneyNoWithTax.Value = num5 * num6; schemes.WinDescription.Value = description; schemes.Update("[ID] = " + table.Rows[j]["ID"].ToString()); } JavaScript.Alert(this.Page, "重构中奖描述成功。"); } } }
public static DataTable GetDataTable(DataTable dt, int Type2) { DataRow[] rowArray; DataColumn column = new DataColumn("Order", Type.GetType("System.String")); DataColumn column2 = new DataColumn("LotteryID", Type.GetType("System.String")); DataColumn column3 = new DataColumn("LotteryName", Type.GetType("System.String")); DataColumn column4 = new DataColumn("IsuseName", Type.GetType("System.String")); DataColumn column5 = new DataColumn("WinLotteryNumber", Type.GetType("System.String")); DataColumn column6 = new DataColumn("LotteryTypeID", Type.GetType("System.String")); DataColumn column7 = new DataColumn("LotteryType2", Type.GetType("System.String")); DataColumn column8 = new DataColumn("LotteryType2Name", Type.GetType("System.String")); DataTable table = new DataTable(); table.Columns.Add(column); table.Columns.Add(column2); table.Columns.Add(column3); table.Columns.Add(column4); table.Columns.Add(column5); table.Columns.Add(column6); table.Columns.Add(column7); table.Columns.Add(column8); if (Type2 == 3) { object[] objArray = new object[] { "LotteryType2 = ", Type2, "and LotteryID <> ", 0x2d.ToString() }; rowArray = dt.Select(string.Concat(objArray), "EndTime desc"); } else { rowArray = dt.Select("LotteryType2 = " + Type2, "EndTime desc"); } foreach (DataRow row in rowArray) { DataRow row2 = table.NewRow(); row2[0] = row[0].ToString(); row2[1] = row[1].ToString(); row2[2] = row[2].ToString(); row2[3] = row[3].ToString(); row2[4] = new Lottery()[int.Parse(row[1].ToString())].ShowNumber(row[4].ToString()); row2[5] = row[5].ToString(); row2[6] = row[6].ToString(); row2[7] = row[7].ToString(); table.Rows.Add(row2); } return table; }
private void BindDataForAliBuy(long BuyID) { DataTable table = new Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), ""); if ((table != null) && (table.Rows.Count != 0)) { DataRow row = table.Rows[0]; string s = row["IsuseID"].ToString(); string str2 = row["PlayTypeID"].ToString(); bool flag = _Convert.StrToBool(row["IsChase"].ToString(), false); bool flag2 = _Convert.StrToBool(row["IsCoBuy"].ToString(), false); string str3 = row["Share"].ToString(); string str4 = row["BuyShare"].ToString(); string str5 = row["AssureShare"].ToString(); string str6 = row["OpenUsers"].ToString(); string str7 = row["Title"].ToString(); string str8 = row["Description"].ToString(); string str9 = row["StopwhenwinMoney"].ToString(); string str10 = row["SecrecyLevel"].ToString(); string str11 = row["LotteryNumber"].ToString(); string str12 = row["SumMoney"].ToString(); string str13 = row["AssureMoney"].ToString(); string str14 = row["LotteryID"].ToString(); string str15 = row["Multiple"].ToString(); string xml = row["AdditionasXml"].ToString(); if (str15 == "") { str15 = "1"; } double num = 0.0; int num2 = 0; int num3 = 0; double num4 = 0.0; int num5 = 0; short num6 = 0; int playType = 0; int num8 = 0; try { num = double.Parse(str12); num2 = int.Parse(str3); num3 = int.Parse(str4); num4 = double.Parse(str13); num5 = int.Parse(str15); num6 = short.Parse(str10); playType = int.Parse(str2); num8 = int.Parse(str14); long.Parse(s); double.Parse(str9); } catch { } if ((num3 == num2) && (num4 == 0.0)) { num2 = 1; num3 = 1; } double num1 = num / ((double)num2); if (flag) { double.Parse(str12); } string str17 = str11; if (str17[str17.Length - 1] == '\n') { str17 = str17.Substring(0, str17.Length - 1); } StringBuilder builder = new StringBuilder(); builder.AppendLine("<script type='text/javascript' defer='defer'>"); if (num8 == 0x3f) { builder.AppendLine("function clickPlayClass(i,obj)").AppendLine("{").AppendLine("var tds = obj.offsetParent.rows[0].cells;").AppendLine("for(var a=0; a<tds.length-1; a++)").AppendLine("{").AppendLine("if(a%2==1)").AppendLine("{").AppendLine("tds[a].className = 'nsplay';").AppendLine("}").AppendLine("if($Id('playTypes' + String(a))!=null)").AppendLine("{").AppendLine("$Id('playTypes' + String(a)).style.display = 'none';").AppendLine("}").AppendLine("}").AppendLine("var pt = $Id('playTypes' + String(i));").AppendLine("pt.style.display = '';"); builder.AppendLine("$Id('playTypes').style.display = ((i == 1 || i == 2 || i == 3) ? 'none':'');"); builder.AppendLine("obj.className = 'msplay';").AppendLine("}"); builder.Append("var playclass =").Append("$Id('playType").Append(playType.ToString()).AppendLine("').parentNode.id.substr(9,1);"); builder.Append("clickPlayClass(playclass,").Append("$Id('tbPlayTypeMenu").Append(num8.ToString()).AppendLine("').rows[0].cells[playclass*2+1]);"); } builder.Append("$Id('playType").Append(playType.ToString()).AppendLine("').checked = true;"); builder.AppendLine("clickPlayType('" + playType.ToString() + "');"); builder.AppendLine("function BindDataForFromAli(){"); if (flag) { XmlDocument document = new XmlDocument(); document.LoadXml(xml); foreach (XmlNode node in document.ChildNodes[0].ChildNodes) { builder.Append("$Id('times").Append(node.Attributes["IsuseID"].Value).Append("').value = '").Append(node.Attributes["Multiple"].Value).AppendLine("';"); builder.Append("$Id('money").Append(node.Attributes["IsuseID"].Value).Append("').value = '").Append(node.Attributes["Money"].Value).AppendLine("';"); builder.Append("$Id('check").Append(node.Attributes["IsuseID"].Value).AppendLine("').checked = true;"); builder.Append("$Id('times").Append(node.Attributes["IsuseID"].Value).AppendLine("').disabled = '';"); } } str17 = str17.Replace("\r", ""); int num9 = 0; string canonicalNumber = ""; foreach (string str19 in str17.Split(new char[] { '\n' })) { num9 += new Lottery()[num8].ToSingle(str19, ref canonicalNumber, playType).Length; builder.AppendLine("var option = document.createElement('option');"); builder.AppendLine("$Id('list_LotteryNumber').options.add(option);"); builder.Append("option.innerText = '").Append(str19).AppendLine("';"); builder.Append("option.value = '").Append(str19).AppendLine("';"); } if (flag) { builder.AppendLine("$Id('Chase').checked = true;"); builder.AppendLine("oncbInitiateTypeClick($Id('Chase'));"); } if (flag2) { builder.AppendLine("$Id('CoBuy').checked = true;"); builder.AppendLine("oncbInitiateTypeClick($Id('CoBuy'));"); } builder.Append("$Id('tb_LotteryNumber').value = '").Append(str11.Replace("\r", @"\r").Replace("\n", @"\n")).AppendLine("';"); builder.Append("$Id('tb_Share').value = '").Append(str3).AppendLine("';"); builder.Append("$Id('tb_BuyShare').value = '").Append(str4).AppendLine("';"); builder.Append("$Id('tb_AssureShare').value = '").Append(str5).AppendLine("';"); builder.Append("$Id('tb_OpenUserList').value = '").Append(str6).AppendLine("';"); builder.Append("$Id('tb_Title').value = '").Append(str7).AppendLine("';"); builder.Append("$Id('tb_Description').value = '").Append(str8.Replace("\r", @"\r").Replace("\n", @"\n")).AppendLine("';"); builder.Append("$Id('tbAutoStopAtWinMoney').value = '").Append(str9).AppendLine("';"); builder.Append("$Id('SecrecyLevel").Append(num6.ToString()).AppendLine("').checked = true;"); builder.Append("$Id('tb_hide_SumMoney').value = '").Append(str12).AppendLine("';"); builder.Append("$Id('tb_hide_AssureMoney').value = '").Append(num4.ToString("N0")).AppendLine("';"); builder.Append("$Id('tb_Multiple').value = '").Append(num5.ToString()).AppendLine("';"); builder.Append("$Id('lab_AssureMoney').innerText = '").Append(num4.ToString("N0")).AppendLine("';"); builder.Append("$Id('lab_SumMoney').innerText = '").Append(num.ToString("N0")).AppendLine("';"); builder.Append("$Id('LbSumMoney').innerText = '").Append(num.ToString("N0")).AppendLine("';"); builder.Append("$Id('lab_Num').innerText = '").Append(num9.ToString()).AppendLine("';"); builder.AppendLine("CalcResult();"); builder.AppendLine("}"); builder.AppendLine("</script>"); this.script = builder.ToString(); } }
//返回Flash中奖奖品的序列号 public string GetAwardOrder(int awardid) { XmlDocument xml = new XmlDocument(); string xmlPath = Server.MapPath("/Upload/xml/Lotter.xml"); if (!File.Exists(xmlPath)) { return ""; } xml.Load(xmlPath); List<Lottery> list = new List<Lottery>(); int j = 1; int orderid = 0; XmlNodeList topM = xml.DocumentElement.ChildNodes; foreach (XmlElement element in topM) { Lottery lo = new Lottery(); // lo.ID = Convert.ToInt32(element.Attributes["id"].Value); lo.ID = Convert.ToInt32(element.Attributes["id"].Value); lo.OrderID = j; j++; if (lo.ID == awardid) { orderid = lo.OrderID; } if (lo.Min != lo.Max) { list.Add(lo); } } if (orderid == 0) { return "12"; } else return orderid.ToString(); }
private void BindDataForAliBuy(long BuyID) { DataTable table = new Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), ""); if ((table != null) && (table.Rows.Count != 0)) { DataRow row = table.Rows[0]; string s = row["IsuseID"].ToString(); string str2 = row["PlayTypeID"].ToString(); bool flag = _Convert.StrToBool(row["IsCoBuy"].ToString(), false); string str3 = row["Share"].ToString(); string str4 = row["BuyShare"].ToString(); string str5 = row["AssureShare"].ToString(); string str6 = row["OpenUsers"].ToString(); string str7 = row["Title"].ToString(); string str8 = row["Description"].ToString(); string str9 = row["SecrecyLevel"].ToString(); string str10 = row["LotteryNumber"].ToString(); string str11 = row["SumMoney"].ToString(); string str12 = row["AssureMoney"].ToString(); string str13 = row["LotteryID"].ToString(); string str14 = row["Multiple"].ToString(); if (str14 == "") { str14 = "1"; } double num = 0.0; int num2 = 0; int num3 = 0; double num4 = 0.0; int num5 = 0; short num6 = 0; int playType = 0; int num8 = 0; try { num = double.Parse(str11); num2 = int.Parse(str3); num3 = int.Parse(str4); num4 = double.Parse(str12); num5 = int.Parse(str14); num6 = short.Parse(str9); playType = int.Parse(str2); num8 = int.Parse(str13); long.Parse(s); } catch { } if ((num3 == num2) && (num4 == 0.0)) { num2 = 1; num3 = 1; } double num1 = num / ((double)num2); string str15 = str10; if (!string.IsNullOrEmpty(str15) && (str15[str15.Length - 1] == '\n')) { str15 = str15.Substring(0, str15.Length - 1); } StringBuilder builder = new StringBuilder(); builder.AppendLine("<script type='text/javascript' defer='defer'>"); builder.Append("$Id('playType").Append(playType.ToString()).AppendLine("').checked = true;"); builder.AppendLine("clickPlayType('" + playType.ToString() + "');"); builder.AppendLine("function BindDataForFromAli(){"); str15 = str15.Replace("\r", ""); int num9 = 0; string canonicalNumber = ""; foreach (string str17 in str15.Split(new char[] { '\n' })) { if (!string.IsNullOrEmpty(str17)) { num9 += new Lottery()[num8].ToSingle(str17, ref canonicalNumber, playType).Length; builder.AppendLine("var option = document.createElement('option');"); builder.AppendLine("$Id('list_LotteryNumber').options.add(option);"); builder.Append("option.innerText = '").Append(str17).AppendLine("';"); builder.Append("option.value = '").Append(str17).AppendLine("';"); } } if (flag) { builder.AppendLine("$Id('CoBuy').checked = true;"); builder.AppendLine("oncbInitiateTypeClick();"); } builder.Append("$Id('tb_LotteryNumber').value = '").Append(str10.Replace("\r", @"\r").Replace("\n", @"\n")).AppendLine("';"); builder.Append("$Id('tb_Share').value = '").Append(str3).AppendLine("';"); builder.Append("$Id('tb_BuyShare').value = '").Append(str4).AppendLine("';"); builder.Append("$Id('tb_AssureShare').value = '").Append(str5).AppendLine("';"); builder.Append("$Id('tb_OpenUserList').value = '").Append(str6).AppendLine("';"); builder.Append("$Id('tb_Title').value = '").Append(str7).AppendLine("';"); builder.Append("$Id('tb_Description').value = '").Append(str8.Replace("\r", @"\r").Replace("\n", @"\n")).AppendLine("';"); builder.Append("$Id('SecrecyLevel").Append(num6.ToString()).AppendLine("').checked = true;"); builder.Append("$Id('tb_hide_SumMoney').value = '").Append(str11).AppendLine("';"); builder.Append("$Id('tb_hide_AssureMoney').value = '").Append(num4.ToString("N0")).AppendLine("';"); builder.Append("$Id('tb_Multiple').value = '").Append(num5.ToString()).AppendLine("';"); builder.Append("$Id('lab_AssureMoney').innerText = '").Append(num4.ToString("N0")).AppendLine("';"); builder.Append("$Id('lab_SumMoney').innerText = '").Append(num.ToString("N0")).AppendLine("';"); builder.Append("$Id('lab_Num').innerText = '").Append(num9.ToString()).AppendLine("';"); builder.Append("$Id('tb_SchemeMoney').value = '").Append(num.ToString()).AppendLine("';"); builder.AppendLine("CalcResult();"); builder.AppendLine("}"); if (str2.Length != (num8.ToString().Length + 2)) { builder.AppendLine("BindDataForFromAli()"); } builder.AppendLine("</script>"); this.script = builder.ToString(); } }
private void IsuseOpenNotice(string Transmessage) { XmlDocument document = new XmlDocument(); XmlNodeList elementsByTagName = null; XmlNodeList list2 = null; XmlNodeList list3 = null; try { document.Load(new StringReader(Transmessage)); elementsByTagName = document.GetElementsByTagName("*"); list2 = document.GetElementsByTagName("bonusItem"); list3 = document.GetElementsByTagName("issue"); } catch { } if (elementsByTagName != null) { string winNumber = ""; for (int i = 0; i < elementsByTagName.Count; i++) { if ((elementsByTagName[i].Name.ToUpper() == "BODY") && (elementsByTagName[i].FirstChild.Name.ToUpper() == "BONUSNOTIFY")) { winNumber = elementsByTagName[i].FirstChild.Attributes["bonusNumber"].InnerText; } } if (list3 == null) { base.Response.End(); } else { string messageID = elementsByTagName[0].Attributes["id"].Value; string input = list3[0].Attributes["number"].Value; string lotteryName = list3[0].Attributes["gameName"].Value; int LotteryID = this.GetLotteryID(lotteryName); string str5 = this.GetWinNumber(LotteryID, winNumber); DataTable table = new Tables.T_Isuses().Open("", " [Name] = '" + Utility.FilteSqlInfusion(input) + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0", ""); if ((table == null) || (table.Rows.Count < 1)) { base.Response.End(); } else { string str = table.Rows[0]["ID"].ToString(); new Tables.T_Isuses { WinLotteryNumber = { Value = str5 }, OpenOperatorID = { Value = 1 } }.Update(" ID = " + str); int returnValue = 0; string returnDescription = ""; if (LotteryID == 0x3e) { DataTable table2 = new Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), ""); if ((table2 != null) && (table2.Rows.Count > 0)) { double[] winMoneyList = new double[table2.Rows.Count * 2]; double num3 = 0.0; double num4 = 0.0; for (int j = 0; j < table2.Rows.Count; j++) { num3 = _Convert.StrToDouble(table2.Rows[j]["DefaultMoney"].ToString(), 0.0); num4 = _Convert.StrToDouble(table2.Rows[j]["DefaultMoneyNoWithTax"].ToString(), 0.0); winMoneyList[j * 2] = (num3 == 0.0) ? 1.0 : num4; winMoneyList[(j * 2) + 1] = (num4 == 0.0) ? 1.0 : num4; } DataTable table3 = new Tables.T_Schemes().Open("", "IsuseID = " + str + " and WinMoney = 0 and Buyed = 1 and BuyOperatorID = 132011", ""); string number = ""; Lottery.LotteryBase base2 = new Lottery()[LotteryID]; string description = ""; double winMoneyNoWithTax = 0.0; for (int k = 0; k < table3.Rows.Count; k++) { number = table3.Rows[k]["LotteryNumber"].ToString(); description = ""; winMoneyNoWithTax = 0.0; double num8 = base2.ComputeWin(number, str5.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table3.Rows[k]["PlayTypeID"].ToString()), winMoneyList); if (num8 > 0.0) { MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, WinMoney = @p3, WinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + table3.Rows[k]["ID"].ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, num8 * _Convert.StrToInt(table3.Rows[k]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, winMoneyNoWithTax * _Convert.StrToInt(table3.Rows[k]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, num8 * _Convert.StrToInt(table3.Rows[k]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, winMoneyNoWithTax * _Convert.StrToInt(table3.Rows[k]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, description) }); } } } } string bonusXML = "<Schemes>"; string agentBonusXML = "<Schemes>"; if ((list2 != null) && (list2.Count > 0)) { string s = Transmessage.Substring(Transmessage.IndexOf("<bonusNotify"), Transmessage.LastIndexOf("</body>") - Transmessage.IndexOf("<bonusNotify")); DataSet set = new DataSet(); try { set.ReadXml(new StringReader(s)); } catch (Exception exception) { new Log(@"ElectronTicket\HPSD").Write("电子票开奖,第 " + input + " 期解析开奖数据错误:" + exception.Message); base.Response.End(); return; } if ((set == null) || (set.Tables.Count < 3)) { new Log(@"ElectronTicket\HPSD").Write("电子票开奖,第 " + input + " 期开奖数据格式不符合要求。"); base.Response.End(); return; } DataTable source = set.Tables[2]; DataTable table5 = MSSQL.Select("SELECT SchemeID, AgentID, SchemesMultiple as Multiple, Identifiers FROM V_ElectronTicketAgentSchemesSendToCenter WHERE (IsuseID = " + str + ") UNION ALL SELECT SchemeID, 0 AS AgentID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + str + ")", new MSSQL.Parameter[0]); if (table5 == null) { new Log(@"ElectronTicket\HPSD").Write("电子票开奖,第 " + input + " 期,读取本地方案错误。"); base.Response.End(); return; } try { foreach (var type in from NewDt in (from NewDt in (from NewDtTickets in source.AsEnumerable() join NewdtScheme in table5.AsEnumerable() on NewDtTickets.Field<string>("ticketID") equals NewdtScheme.Field<string>("Identifiers") //Sum<Package>((Func<Package, double>) (pkg => pkg.Weight)); select new { ID = NewdtScheme.Field<long>("SchemeID"), AgentID = NewdtScheme.Field<long>("AgentID"), Multiple = NewdtScheme.Field<int>("Multiple"), Bonus = _Convert.StrToDouble(NewDtTickets.Field<string>("money"), 0.0), BonusLevel = NewDtTickets.Field<string>("bonusLevel") }).AsQueryable() group NewDt by new { ID = NewDt.ID, BonusLevel = NewDt.BonusLevel, AgentID = NewDt.AgentID, Multiple = NewDt.Multiple } into gg select new { ID = gg.Key.ID, AgentID = gg.Key.AgentID, Multiple = gg.Key.Multiple, Bonus = gg.Sum(NewDt => NewDt.Bonus), BonusLevel = this.GetWinDescription(LotteryID, gg.Key.BonusLevel) }).AsQueryable() group NewDt by new { ID = NewDt.ID, Multiple = NewDt.Multiple, AgentID = NewDt.AgentID } into t_dtSchemes select new { SchemeID = t_dtSchemes.Key.ID, AgentID = t_dtSchemes.Key.AgentID, Multiple = t_dtSchemes.Key.Multiple, Bonus = t_dtSchemes.Sum(NewDt => NewDt.Bonus), BonusLevel = "中奖金额:" + t_dtSchemes.Sum(NewDt => NewDt.Bonus).ToString() + ((t_dtSchemes.Key.Multiple != 1) ? ("(" + t_dtSchemes.Key.Multiple.ToString() + "倍)") : "") }) { string str13; if (type.AgentID == 0L) { str13 = bonusXML; bonusXML = str13 + "<Scheme SchemeID=\"" + type.SchemeID.ToString() + "\" WinMoney=\"" + type.Bonus.ToString() + "\" WinDescription=\"" + type.BonusLevel + "\" />"; } else { str13 = agentBonusXML; agentBonusXML = str13 + "<Scheme SchemeID=\"" + type.SchemeID.ToString() + "\" WinMoney=\"" + type.Bonus.ToString() + "\" WinDescription=\"" + type.BonusLevel + "\" />"; } } } catch (Exception exception2) { new Log(@"ElectronTicket\HPSD").Write("电子票开奖,第 " + input + " 期详细中奖数据解析错误:" + exception2.Message); base.Response.End(); return; } } bonusXML = bonusXML + "</Schemes>"; agentBonusXML = agentBonusXML + "</Schemes>"; table = new Tables.T_Isuses().Open("", "[ID] = " + str + " and IsOpened = 0", ""); if ((table == null) || (table.Rows.Count < 1)) { base.Response.End(); } else { DataSet ds = null; int num11 = 0; int num12 = -1; while ((num12 < 0) && (num11 < 5)) { returnValue = 0; returnDescription = ""; num12 = Procedures.P_ElectronTicketWin(ref ds, _Convert.StrToLong(str, 0L), bonusXML, agentBonusXML, ref returnValue, ref returnDescription); if (num12 < 0) { string[] strArray = new string[] { "电子票第 ", (num11 + 1).ToString(), " 次派奖出现错误(IsuseOpenNotice) 期号为: ", input, ",彩种为: ", LotteryID.ToString() }; new Log(@"ElectronTicket\HPSD").Write(string.Concat(strArray)); num11++; if (num11 < 5) { Thread.Sleep(0x2710); } } } if (returnValue < 0) { new Log(@"ElectronTicket\HPSD").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + input + ",彩种为: " + LotteryID.ToString() + ",错误:" + returnDescription); base.Response.End(); } else { DataTable table6 = new Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), ""); if ((table6 != null) && (table6.Rows.Count > 0)) { double[] numArray2 = new double[table6.Rows.Count * 2]; double num14 = 0.0; double num15 = 0.0; for (int m = 0; m < table6.Rows.Count; m++) { num14 = _Convert.StrToDouble(table6.Rows[m]["DefaultMoney"].ToString(), 0.0); num15 = _Convert.StrToDouble(table6.Rows[m]["DefaultMoneyNoWithTax"].ToString(), 0.0); numArray2[m * 2] = (num14 == 0.0) ? 1.0 : num15; numArray2[(m * 2) + 1] = (num15 == 0.0) ? 1.0 : num15; } DataTable table7 = new Views.V_Schemes().Open("LotteryNumber, PlayTypeID, SiteID, ID, Multiple", " IsuseID = " + str + " and WinMoney = 0 and Buyed = 0", ""); string str14 = ""; Lottery.LotteryBase base3 = new Lottery()[LotteryID]; string str15 = ""; double num17 = 0.0; for (int n = 0; n < table7.Rows.Count; n++) { str14 = table7.Rows[n]["LotteryNumber"].ToString(); str15 = ""; num17 = 0.0; double winMoney = base3.ComputeWin(str14, str5.Trim(), ref str15, ref num17, int.Parse(table7.Rows[n]["PlayTypeID"].ToString()), numArray2); if ((winMoney > 0.0) && (Procedures.P_ChaseTaskStopWhenWin(_Convert.StrToLong(table7.Rows[n]["SiteID"].ToString(), 0L), _Convert.StrToLong(table7.Rows[n]["ID"].ToString(), 0L), winMoney, ref returnValue, ref returnDescription) < 0)) { new Log(@"ElectronTicket\HPSD").Write("执行电子票--判断是否停止追号的时候出现错误"); } } } PF.SendWinNotification(ds); messageID = elementsByTagName[0].Attributes["id"].Value; this.ReNotice(messageID, "508"); } } } } } }
protected void btn_ok_Click(object sender, EventArgs e) { DataTable table = new Views.V_ElectronTicketAgentSchemesElectronTickets().Open("LotteryID, IsuseID, PlayTypeID, Ticket, SchemeNumber, WinLotteryNumber, DateTime, Money, Multiple", "Identifiers='" + this.tbTicket.Text.Trim() + "'", ""); if (table == null) { JavaScript.Alert(this.Page, "数据库读写错误!"); } else if (table.Rows.Count < 1) { JavaScript.Alert(this.Page, "没有找到此票标识!"); } else { DataTable table2 = new Tables.T_WinTypes().Open("", "LotteryID=" + table.Rows[0]["LotteryID"].ToString(), ""); if ((table2 == null) || (table2.Rows.Count < 1)) { JavaScript.Alert(this.Page, "数据库读写错误!"); } else { double[] winMoneyList = new double[table2.Rows.Count * 2]; for (int i = 0; i < table2.Rows.Count; i++) { winMoneyList[i * 2] = _Convert.StrToDouble(table2.Rows[i]["defaultMoney"].ToString(), 0.0); winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(table2.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0.0); if (winMoneyList[i * 2] < 0.0) { JavaScript.Alert(this.Page, "数据库读写错误!"); return; } if (winMoneyList[i * 2] < winMoneyList[(i * 2) + 1]) { JavaScript.Alert(this.Page, "数据库读写错误!"); return; } } string number = table.Rows[0]["Ticket"].ToString(); string ticketNumber = ""; int num2 = _Convert.StrToInt(table.Rows[0]["LotteryID"].ToString(), 0); int playTypeID = _Convert.StrToInt(table.Rows[0]["PlayTypeID"].ToString(), 0); string winNumber = table.Rows[0]["WinLotteryNumber"].ToString(); try { new Lottery()[num2].HPSH_ToElectronicTicket(playTypeID, number, ref ticketNumber, ref playTypeID); } catch { } string description = ""; double winMoneyNoWithTax = 0.0; double num5 = 0.0; try { num5 = new Lottery()[num2].ComputeWin(ticketNumber, winNumber, ref description, ref winMoneyNoWithTax, playTypeID, winMoneyList); } catch { } this.lbDescription.Text = ""; if (!string.IsNullOrEmpty(description.Trim())) { this.lbDescription.Text = description; } this.lbSchemeNumber.Text = table.Rows[0]["SchemeNumber"].ToString(); this.lbDateTime.Text = table.Rows[0]["DateTime"].ToString(); this.lbAmount.Text = table.Rows[0]["Money"].ToString(); this.lbMultiple.Text = table.Rows[0]["Multiple"].ToString(); if (num5 > 0.0) { this.lbWinMoney.Text = num5.ToString(); } else { this.lbWinMoney.Text = "<color='red'>" + num5 + "</color>"; } } } }
protected void btnGO_Step1_Click(object sender, EventArgs e) { this.btnGO_Step1.AlertText = ""; if (this.ddlLottery.SelectedValue == "45") { JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。"); } else { this.tbWinNumber.Text = _Convert.ToDBC(this.tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(this.tbWinNumber.Text)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); } else { SystemOptions options = new SystemOptions(); bool flag = options["isCompareWinMoneyNoWithFax"].ToBoolean(true); string winListXML = "<WinLists>"; double[] winMoneyList = new double[this.g.Rows.Count * 2]; for (int i = 0; i < this.g.Rows.Count; i++) { winMoneyList[i * 2] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0.0); winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0.0); if (winMoneyList[i * 2] < 0.0) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项奖金输入错误!"); return; } if ((winMoneyList[i * 2] < winMoneyList[(i * 2) + 1]) && flag) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!"); return; } string str2 = winListXML; winListXML = str2 + "<WinList defaultMoney=\"" + winMoneyList[i * 2].ToString() + "\" DefaultMoneyNoWithTax=\"" + winMoneyList[(i * 2) + 1].ToString() + "\"/>"; } winListXML = winListXML + "</WinLists>"; DataTable table = new Tables.T_IsuseBonuses().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue), ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else if (table.Rows.Count < 1) { int returnValue = -1; string returnDescription = ""; if (Procedures.P_IsuseBonusesAdd(_Convert.StrToLong(this.ddlIsuse.SelectedValue, 0L), base._User.ID, winListXML, ref returnValue, ref returnDescription) < 0) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else if (returnValue < 0) { JavaScript.Alert(this.Page, returnDescription); } else { JavaScript.Alert(this.Page, "请让下一位开奖操作员继续下一步开奖操作!"); } } else if (table.Rows[0]["UserID"].ToString() == base._User.ID.ToString()) { JavaScript.Alert(this.Page, "请让下一位开奖操作员继续下一步开奖操作!"); } else { for (int j = 0; j < table.Rows.Count; j++) { if ((winMoneyList[j * 2] != _Convert.StrToDouble(table.Rows[j]["defaultMoney"].ToString(), 0.0)) || (winMoneyList[(j * 2) + 1] != _Convert.StrToDouble(table.Rows[j]["DefaultMoneyNoWithTax"].ToString(), 0.0))) { new Tables.T_IsuseBonuses().Delete("IsuseID = " + this.ddlIsuse.SelectedValue); JavaScript.Alert(this.Page, "两次奖项输入不一致,请联系上一次开奖操作员!"); return; } } DataTable table2 = new Tables.T_Schemes().Open("top 500 * ", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and isOpened = 0 and ID > " + Utility.FilteSqlInfusion(this.h_SchemeID.Value) + " and Buyed = 1", "[ID]"); if (table2 == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { StringBuilder builder = new StringBuilder(); for (int k = 0; k < table2.Rows.Count; k++) { string number = table2.Rows[k]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double num10 = 0.0; try { num10 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(number, this.tbWinNumber.Text.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table2.Rows[k]["PlayTypeID"].ToString()), winMoneyList); } catch { num10 = 0.0; new Log("System").Write("方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!"); PF.SendEmail(base._Site, "*****@*****.**", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!"); PF.SendEmail(base._Site, "*****@*****.**", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!"); } builder.Append("update T_Schemes set PreWinMoney = ").Append((double)(num10 * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", PreWinMoneyNoWithTax = ").Append((double)(winMoneyNoWithTax * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", EditWinMoney = ").Append((double)(num10 * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", EditWinMoneyNoWithTax = ").Append((double)(winMoneyNoWithTax * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", WinDescription = '").Append(description).Append("'").Append(" where [ID] = ").AppendLine(table2.Rows[k]["ID"].ToString()); } MSSQL.ExecuteNonQuery(builder.ToString(), new MSSQL.Parameter[0]); if (table2.Rows.Count > 1) { this.h_SchemeID.Value = table2.Rows[table2.Rows.Count - 1]["ID"].ToString(); } this.Step1IsOpen = table2.Rows.Count == 500; if (!this.Step1IsOpen) { table2 = new Tables.T_Schemes().Open("top 1 * ", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1 and WinMoney is null", "[ID]"); if (table2 == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } this.Step1IsOpen = table2.Rows.Count > 0; } this.btnGO_Step1.Enabled = this.Step1IsOpen; this.btnGO_Step2.Enabled = !this.Step1IsOpen; this.btnGO_Step3.Enabled = !this.Step1IsOpen && !this.Step2IsOpen; string msg = "请再次执行第一步"; if (!this.Step1IsOpen) { msg = "开奖步骤一已经完成,请执行第二步."; } JavaScript.Alert(this.Page, msg); } } } } }
private void GetID() { this.LotteryID = _Convert.StrToInt(this.tbLotteryID.Value, -1); this.PlayTypeID = _Convert.StrToInt(this.tbPlayTypeID.Value, -1); this.UserID = _Convert.StrToInt(this.tbUserID.Value, -1); Lottery lottery = new Lottery(); if (!lottery.ValidID(this.LotteryID)) { PF.GoError(1, "参数错误,系统异常。", base.GetType().FullName); } else if (!lottery[this.LotteryID].CheckPlayType(this.PlayTypeID)) { PF.GoError(1, "参数错误,系统异常。", base.GetType().FullName); } else { this.LotteryName = lottery[this.LotteryID].name; this.PlayTypeName = lottery.GetPlayTypeName(this.PlayTypeID); this.Name = new Users(1L)[1L, this.UserID].Name; } }
private void IsuseNotice(string TransMessage) { XmlDocument document = new XmlDocument(); XmlNodeList elementsByTagName = null; XmlNodeList list2 = null; try { document.Load(new StringReader(TransMessage)); elementsByTagName = document.GetElementsByTagName("*"); list2 = document.GetElementsByTagName("issue"); } catch { } if (elementsByTagName == null) { base.Response.End(); } else { Tables.T_Isuses isuses = new Tables.T_Isuses(); for (int i = 0; i < elementsByTagName.Count; i++) { if ((elementsByTagName[i].Name.ToUpper() == "BODY") && (elementsByTagName[i].FirstChild.Name.ToUpper() == "ISSUENOTIFY")) { for (int j = 0; j < list2.Count; j++) { string str = list2[j].Attributes["number"].Value; string lotteryName = list2[j].Attributes["gameName"].Value; string str3 = list2[j].Attributes["status"].Value; string s = list2[j].Attributes["startTime"].Value; string str5 = list2[j].Attributes["stopTime"].Value; int lotteryID = this.GetLotteryID(lotteryName); string winNumber = ""; try { winNumber = this.GetWinNumber(lotteryID, list2[j].Attributes["bonusCode"].Value); } catch { } if ((lotteryID >= 0) && !string.IsNullOrEmpty(str)) { if (isuses.GetCount("LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(str) + "'") < 1L) { DateTime now = DateTime.Now; DateTime endTime = DateTime.Now; try { now = DateTime.Parse(s); endTime = DateTime.Parse(str5); } catch { goto Label_0611; } long isuseID = -1L; string returnDescription = ""; if ((Procedures.P_IsuseAdd(lotteryID, str, now, endTime, "", ref isuseID, ref returnDescription) < 0) || (isuseID < 0L)) { goto Label_0611; } } DataTable table = isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(str) + "'", ""); if ((table != null) && (table.Rows.Count >= 1)) { if (str3 == "4") { int returnValue = 0; string returnDescptrion = ""; if (Procedures.P_ElectronTicketAgentSchemeQuash(_Convert.StrToLong(table.Rows[0]["ID"].ToString(), 0L), ref returnValue, ref returnDescptrion) < 0) { new Log(@"ElectronTicket\HPSH").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash"); goto Label_0611; } } bool flag = false; if (table.Rows[0]["State"].ToString() != str3) { isuses.State.Value = str3; isuses.StateUpdateTime.Value = DateTime.Now; flag = true; } if (!string.IsNullOrEmpty(winNumber) && (table.Rows[0]["WinLotteryNumber"].ToString() != winNumber)) { isuses.WinLotteryNumber.Value = winNumber; flag = true; if (lotteryID == 0x1d) { DataTable table2 = new Tables.T_WinTypes().Open("", "LotteryID =" + lotteryID.ToString(), ""); double[] winMoneyList = new double[table2.Rows.Count * 2]; for (int k = 0; k < table2.Rows.Count; k++) { winMoneyList[k * 2] = _Convert.StrToDouble(table2.Rows[k]["DefaultMoney"].ToString(), 1.0); winMoneyList[(k * 2) + 1] = _Convert.StrToDouble(table2.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1.0); } DataTable table3 = new Tables.T_ChaseTaskDetails().Open("", "IsuseID=" + table.Rows[0]["ID"].ToString() + " and SchemeID IS NOT NULL", ""); for (int m = 0; m < table3.Rows.Count; m++) { string number = table3.Rows[m]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double winMoney = new Lottery()[lotteryID].ComputeWin(number, winNumber, ref description, ref winMoneyNoWithTax, int.Parse(table3.Rows[m]["PlayTypeID"].ToString()), winMoneyList); if (winMoney >= 1.0) { int num10 = 0; string str11 = ""; if (Procedures.P_ChaseTaskStopWhenWin(_Convert.StrToLong(table3.Rows[m]["SiteID"].ToString(), 1L), _Convert.StrToLong(table3.Rows[m]["SchemeID"].ToString(), 0L), winMoney, ref num10, ref str11) < 0) { new Log(@"ElectronTicket\HPSH").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。"); } } } } } if (flag) { isuses.Update("LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(str) + "'"); } } Label_0611: ; } } } } string messageID = elementsByTagName[0].Attributes["id"].Value; this.ReNotice(messageID, "501"); } }
private void IsuseOpenNotice(string Transmessage) { XmlDocument document = new XmlDocument(); XmlNodeList elementsByTagName = null; XmlNodeList list2 = null; XmlNodeList list3 = null; try { document.Load(new StringReader(Transmessage)); elementsByTagName = document.GetElementsByTagName("*"); list2 = document.GetElementsByTagName("bonusItem"); list3 = document.GetElementsByTagName("issue"); } catch { } if (elementsByTagName != null) { string winNumber = ""; for (int i = 0; i < elementsByTagName.Count; i++) { if ((elementsByTagName[i].Name.ToUpper() == "BODY") && (elementsByTagName[i].FirstChild.Name.ToUpper() == "BONUSNOTIFY")) { winNumber = elementsByTagName[i].FirstChild.Attributes["bonusNumber"].InnerText; } } if (list3 == null) { base.Response.End(); } else { string messageID = elementsByTagName[0].Attributes["id"].Value; string input = list3[0].Attributes["number"].Value; string lotteryName = list3[0].Attributes["gameName"].Value; int LotteryID = this.GetLotteryID(lotteryName); string str5 = this.GetWinNumber(LotteryID, winNumber); DataTable table = new Tables.T_Isuses().Open("", " [Name] = '" + Utility.FilteSqlInfusion(input) + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0", ""); if ((table == null) || (table.Rows.Count < 1)) { base.Response.End(); } else { string str = table.Rows[0]["ID"].ToString(); new Tables.T_Isuses { WinLotteryNumber = { Value = str5 }, OpenOperatorID = { Value = 1 } }.Update(" ID = " + str); string bonusXML = "<Schemes>"; string agentBonusXML = "<Schemes>"; if ((list2 != null) && (list2.Count > 0)) { string s = Transmessage.Substring(Transmessage.IndexOf("<bonusNotify"), Transmessage.LastIndexOf("</body>") - Transmessage.IndexOf("<bonusNotify")); DataSet set = new DataSet(); try { set.ReadXml(new StringReader(s)); } catch (Exception exception) { new Log(@"ElectronTicket\HPSH").Write("电子票开奖,第 " + input + " 期解析开奖数据错误:" + exception.Message); base.Response.End(); return; } if ((set == null) || (set.Tables.Count < 3)) { new Log(@"ElectronTicket\HPSH").Write("电子票开奖,第 " + input + " 期开奖数据格式不符合要求。"); base.Response.End(); return; } DataTable source = set.Tables[2]; DataTable table3 = MSSQL.Select("SELECT SchemeID, AgentID, SchemesMultiple as Multiple, Identifiers FROM V_ElectronTicketAgentSchemesSendToCenter WHERE (IsuseID = " + str + ") UNION ALL SELECT SchemeID, 0 AS AgentID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + str + ")", new MSSQL.Parameter[0]); if (table3 == null) { new Log(@"ElectronTicket\HPSH").Write("电子票开奖,第 " + input + " 期,读取本地方案错误。"); base.Response.End(); return; } try { foreach (var type in from NewDt in (from NewDt in (from NewDtTickets in source.AsEnumerable() join NewdtScheme in table3.AsEnumerable() on NewDtTickets.Field<string>("ticketID") equals NewdtScheme.Field<string>("Identifiers") select new { ID = NewdtScheme.Field<long>("SchemeID"), AgentID = NewdtScheme.Field<long>("AgentID"), Multiple = NewdtScheme.Field<int>("Multiple"), Bonus = _Convert.StrToDouble(NewDtTickets.Field<string>("money"), 0.0), BonusLevel = NewDtTickets.Field<string>("bonusLevel"), Size = _Convert.StrToInt(NewDtTickets.Field<string>("size"), 1) }).AsQueryable() group NewDt by new { NewDt.ID, NewDt.BonusLevel, NewDt.AgentID, NewDt.Multiple } into gg select new { ID = gg.Key.ID, AgentID = gg.Key.AgentID, Multiple = gg.Key.Multiple, Bonus = gg.Sum(NewDt => NewDt.Bonus), BonusLevel = this.GetSchemeWinDescription(gg.Key.BonusLevel, LotteryID, gg.Sum(NewDt => NewDt.Size) / gg.Key.Multiple) }).AsQueryable() group NewDt by new { ID = NewDt.ID, Multiple = NewDt.Multiple, AgentID = NewDt.AgentID } into t_dtSchemes select new { SchemeID = t_dtSchemes.Key.ID, AgentID = t_dtSchemes.Key.AgentID, Multiple = t_dtSchemes.Key.Multiple, Bonus = t_dtSchemes.Sum(NewDt => NewDt.Bonus), BonusLevel = t_dtSchemes.Merge(NewDt => NewDt.BonusLevel) + ((t_dtSchemes.Key.Multiple != 1) ? ("(" + t_dtSchemes.Key.Multiple.ToString() + "倍)") : "") }) { string str10; if (type.AgentID == 0L) { str10 = bonusXML; bonusXML = str10 + "<Scheme SchemeID=\"" + type.SchemeID.ToString() + "\" WinMoney=\"" + type.Bonus.ToString() + "\" WinDescription=\"" + type.BonusLevel + "\" />"; } else { str10 = agentBonusXML; agentBonusXML = str10 + "<Scheme SchemeID=\"" + type.SchemeID.ToString() + "\" WinMoney=\"" + type.Bonus.ToString() + "\" WinDescription=\"" + type.BonusLevel + "\" />"; } } } catch (Exception exception2) { new Log(@"ElectronTicket\HPSH").Write("电子票开奖,第 " + input + " 期详细中奖数据解析错误:" + exception2.Message); base.Response.End(); return; } } bonusXML = bonusXML + "</Schemes>"; agentBonusXML = agentBonusXML + "</Schemes>"; table = new Tables.T_Isuses().Open("", "[ID] = " + str + " and IsOpened = 0", ""); if ((table == null) || (table.Rows.Count < 1)) { base.Response.End(); } else { int returnValue = 0; string returnDescription = ""; DataSet ds = null; int num5 = 0; int num6 = -1; string appSettingsString = WebConfig.GetAppSettingsString("ConnectionString"); if (appSettingsString.StartsWith("0x78AD")) { appSettingsString = Encrypt.Decrypt3DES(PF.GetCallCert(), appSettingsString.Substring(6), PF.DesKey); } SqlConnection conn = MSSQL.CreateDataConnection(appSettingsString + ";Connect Timeout=150;"); if (conn != null) { while ((num6 < 0) && (num5 < 5)) { returnValue = 0; returnDescription = ""; num6 = this.P_ElectronTicketWin(conn, ref ds, _Convert.StrToLong(str, 0L), bonusXML, agentBonusXML, ref returnValue, ref returnDescription); if (num6 < 0) { string[] strArray = new string[] { "电子票第 ", (num5 + 1).ToString(), " 次派奖出现错误(IsuseOpenNotice) 期号为: ", input, ",彩种为: ", LotteryID.ToString() }; new Log(@"ElectronTicket\HPSH").Write(string.Concat(strArray)); num5++; if (num5 < 5) { Thread.Sleep(0x2710); } } } if (returnValue < 0) { new Log(@"ElectronTicket\HPSH").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + input + ",彩种为: " + LotteryID.ToString() + ",错误:" + returnDescription); base.Response.End(); } else { PF.SendWinNotification(ds); DataTable table4 = new Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), ""); if ((table4 != null) && (table4.Rows.Count > 0)) { double[] winMoneyList = new double[table4.Rows.Count * 2]; double num8 = 0.0; double num9 = 0.0; for (int j = 0; j < table4.Rows.Count; j++) { num8 = _Convert.StrToDouble(table4.Rows[j]["DefaultMoney"].ToString(), 0.0); num9 = _Convert.StrToDouble(table4.Rows[j]["DefaultMoneyNoWithTax"].ToString(), 0.0); winMoneyList[j * 2] = (num8 == 0.0) ? 1.0 : num9; winMoneyList[(j * 2) + 1] = (num9 == 0.0) ? 1.0 : num9; } DataTable table5 = new Views.V_Schemes().Open("", " IsuseName = '" + Utility.FilteSqlInfusion(input) + "' and LotteryID = " + LotteryID.ToString() + " and WinMoney = 0 and Buyed = 0 and ID in ( select ID from V_ChaseTaskDetails where IsuseName = '" + Utility.FilteSqlInfusion(input) + "' and LotteryID = " + LotteryID.ToString() + ")", ""); string number = ""; Lottery.LotteryBase base2 = new Lottery()[LotteryID]; string description = ""; double winMoneyNoWithTax = 0.0; for (int k = 0; k < table5.Rows.Count; k++) { number = table5.Rows[k]["LotteryNumber"].ToString(); description = ""; winMoneyNoWithTax = 0.0; double winMoney = base2.ComputeWin(number, str5.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table5.Rows[k]["PlayTypeID"].ToString()), winMoneyList); if ((winMoney > 0.0) && (Procedures.P_ChaseTaskStopWhenWin(_Convert.StrToLong(table5.Rows[k]["SiteID"].ToString(), 0L), _Convert.StrToLong(table5.Rows[k]["ID"].ToString(), 0L), winMoney, ref returnValue, ref returnDescription) < 0)) { new Log(@"ElectronTicket\HPSH").Write("执行电子票--判断是否停止追号的时候出现错误"); } } } messageID = elementsByTagName[0].Attributes["id"].Value; this.ReNotice(messageID, "508"); } } else { base.Response.End(); } } } } } }
private string GetLotteryNumber(int LotteryID, int PlayTypeID, string BettingNumber, ref int Num) { Num = 0; if (string.IsNullOrEmpty(BettingNumber)) { return ""; } Lottery.LotteryBase base2 = new Lottery()[LotteryID]; if (base2 == null) { return ""; } string str = base2.AnalyseScheme(BettingNumber, PlayTypeID); if (string.IsNullOrEmpty(str)) { return ""; } string[] strArray = str.Split(new char[] { '\n' }); if ((strArray == null) || (strArray.Length < 1)) { return ""; } string str2 = ""; foreach (string str3 in strArray) { string str4 = str3.Trim(); if (!string.IsNullOrEmpty(str4)) { string[] strArray3 = str4.Split(new char[] { '|' }); if ((strArray3 != null) && (strArray3.Length == 2)) { int num2 = _Convert.StrToInt(strArray3[1], -1); if (!string.IsNullOrEmpty(strArray3[0]) && (num2 >= 1)) { str2 = str2 + strArray3[0] + "\n"; Num += num2; } } } } if (str2.EndsWith("\n")) { str2 = str2.Substring(0, str2.Length - 1); } return str2; }
public void Setup() { _luckyBuyer = new Mock<IPerson>(); _mockedDrawing = new Mock<ILotteryDrawing>(); _lottery = new Lottery(); _lottery.AppendFunds(Funding); _mockedDrawing .Setup(x => x.SoldTickets) .Returns(() => new List<LotteryTicket>()); _mockedDrawing .Setup(x => x.Winner) .Returns(() => _luckyBuyer.Object); _mockedDrawing .Setup(x => x.Jackpot) .Returns(() => 500m); _mockedDrawing .Setup(x => x.LotteryType) .Returns(() => LotteryType.Normal); }
private void BindData() { DataTable table = new Views.V_SchemeSchedulesWithQuashed().Open("", "SiteID = " + base._Site.ID.ToString() + " and [id] = " + Shove._Web.Utility.FilteSqlInfusion(this.tbSchemeID.Text), ""); if ((table == null) || (table.Rows.Count < 1)) { PF.GoError(4, "数据库繁忙,请重试(-141)", base.GetType().BaseType.FullName); } else { DataTable table4; DataRow row = table.Rows[0]; long num = _Convert.StrToLong(row["InitiateUserID"].ToString(), 0L); this.hfID.Value = num.ToString(); this.LotteryName = row["LotteryName"].ToString(); if (this.LotteryName == "江西时时彩") { this.LotteryName = this.LotteryName.Replace("江西", ""); } this.Label3.Text = this.LotteryName + "<font class='red14'>" + row["IsuseName"].ToString() + "</font>期" + row["PlayTypeName"].ToString() + "认购方案"; this.labTitle.Text = row["IsuseName"].ToString(); this.labStartTime.Text = row["StartTime"].ToString(); this.tbIsuseID.Text = row["IsuseID"].ToString(); this.tbLotteryID.Text = row["LotteryID"].ToString(); this.LotteryID = this.tbLotteryID.Text; this.PlayTypeID = _Convert.StrToInt(row["PlayTypeID"].ToString(), 0); this.labEndTime.Text = row["SystemEndTime"].ToString(); if (_Convert.StrToInt(row["LotteryID"].ToString(), 0) == 0x2d) { string scheme = row["LotteryNumber"].ToString(); string buyContent = ""; string cnLocateWaysAndMultiples = ""; Lottery lottery = new Lottery(); if (lottery["45"].GetSchemeSplit(scheme, ref buyContent, ref cnLocateWaysAndMultiples)) { string str4 = buyContent.Split(new char[] { '|' })[0].ToString(); DataTable table2 = new Views.V_IsuseForZCDC().Open("DateTime", "[IsuseID]=" + this.tbIsuseID.Text + " and [No]=" + str4.Split(new char[] { '(' })[0], ""); if ((table2 == null) || (table2.Rows.Count == 0)) { PF.GoError(4, "数据库繁忙,请重试(-184)", base.GetType().FullName); return; } DataTable table3 = new Tables.T_PlayTypes().Open("SystemEndAheadMinute", "[ID] = " + row["PlayTypeID"], ""); this.labEndTime.Text = _Convert.StrToDateTime(table2.Rows[0][0].ToString(), DateTime.Now.ToString()).AddMinutes(_Convert.StrToDouble(table3.Rows[0][0].ToString(), 0.0)).ToString(); } } this.labInitiateUser.Text = row["InitiateName"].ToString() + " 【<A class=li3 href='../Web/Score.aspx?id=" + row["InitiateUserID"].ToString() + "&LotteryID=" + this.tbLotteryID.Text + "' target='_blank'>发起人历史战绩</A>】"; short num2 = _Convert.StrToShort(row["QuashStatus"].ToString(), 0); Shove._Web.Cache.SetCache("All_QuashStatus" + this.SchemeID, num2, 0xe10); bool flag = _Convert.StrToBool(row["Buyed"].ToString(), false); int num3 = _Convert.StrToInt(row["Share"].ToString(), 0); int num4 = _Convert.StrToInt(row["BuyedShare"].ToString(), 0); double num5 = _Convert.StrToDouble(row["Money"].ToString(), 0.0); double num6 = _Convert.StrToDouble(row["AssureMoney"].ToString(), 0.0); double num7 = _Convert.StrToDouble(row["WinMoney"].ToString(), 0.0); short num8 = _Convert.StrToShort(row["SecrecyLevel"].ToString(), 0); bool flag2 = false; _Convert.StrToBool(row["isCanChat"].ToString(), false); if (num3 > 1) { this.trBonusScale.Visible = true; this.lbSchemeBonus.Text = ((_Convert.StrToDouble(row["SchemeBonusScale"].ToString(), 0.04) * 100.0)).ToString() + "%"; } this.HidSchedule.Value = row["Schedule"].ToString(); table4 = table4 = new Views.V_Isuses().Open("IsOpened, WinLotteryNumber,Code", "[id] = " + row["IsuseID"].ToString(), ""); if (table4 == null) { PF.GoError(4, "数据库繁忙,请重试(-213)", base.GetType().FullName); } else if (table4.Rows.Count < 1) { PF.GoError(1, "系统错误(-220)", base.GetType().FullName); } else { flag2 = _Convert.StrToBool(table4.Rows[0]["IsOpened"].ToString(), true); this.lbWinNumber.Text = table4.Rows[0]["WinLotteryNumber"].ToString(); this.ImageLogo.ImageUrl = "images/lottery/" + table4.Rows[0]["Code"].ToString().ToLower() + ".jpg"; if (!base._Site.SiteOptions["Opt_FullSchemeCanQuash"].ToBoolean(false)) { this.btnQuashScheme.Visible = (((num2 == 0) && !flag) && ((num3 > num4) && (base._User != null))) && (num == base._User.ID); } else { this.btnQuashScheme.Visible = (((num2 == 0) && !flag) && (base._User != null)) && (num == base._User.ID); } short num10 = _Convert.StrToShort(row["AtTopStatus"].ToString(), 0); bool flag4 = num10 != 0; if (num10 == 0) { this.cbAtTopApplication.Visible = (((num2 == 0) && !flag) && ((num3 > num4) && (base._User != null))) && (num == base._User.ID); this.cbAtTopApplication.Checked = flag4; } else { this.labAtTop.Visible = true; } bool flag5 = false; bool flag6 = false; DateTime time5 = _Convert.StrToDateTime(this.labEndTime.Text, DateTime.Now.ToString()); if (DateTime.Now >= time5) { flag6 = true; this.tbStop.Text = flag6.ToString(); } if (num2 > 0) { if (num2 == 2) { this.labState.Text = "已撤单(系统撤单)"; } else { this.labState.Text = "已撤单"; } } else if (flag6) { this.labState.Text = "已截止"; } else if (flag) { this.labState.Text = "<FONT color='red'>已成功</font>"; } else if (num3 <= num4) { this.labState.Text = "<FONT color='red'>已满员</font>"; } else { this.labState.Text = "<font color='red'>抢购中...</font>"; flag5 = true; } this.labMultiple.Text = row["Multiple"].ToString(); if (((num8 == 1) && !flag6) && ((base._User == null) || (((base._User != null) && (num != base._User.ID)) && !base._User.isOwnedViewSchemeCompetence()))) { this.labLotteryNumber.Text = "投注内容已经被保密,将在本期投注截止后公开。"; } else if (((num8 == 2) && !flag2) && ((base._User == null) || (((base._User != null) && (num != base._User.ID)) && !base._User.isOwnedViewSchemeCompetence()))) { this.labLotteryNumber.Text = "投注内容已经被保密,将在本期开奖后公开。"; } else if ((num8 == 3) && ((base._User == null) || (((base._User != null) && (num != base._User.ID)) && !base._User.isOwnedViewSchemeCompetence()))) { this.labLotteryNumber.Text = "投注内容已经被保密。"; } else { int num11 = base._Site.SiteOptions["Opt_MaxShowLotteryNumberRows"].ToShort(0); string str = ""; try { str = row["LotteryNumber"].ToString(); } catch { } if (_String.StringAt(str, '\n') < num11) { if (new Lottery.ZCDC().CheckPlayType(_Convert.StrToInt(row["PlayTypeID"].ToString(), -1))) { string vote = ""; DataTable table5 = PF.GetZCDCBuyContent(str, this.SchemeID, ref vote); if (table5 == null) { PF.GoError(4, "数据访问错误(-358)", base.GetType().FullName); return; } this.labMultiple.Text = vote; this.rptScheme.DataSource = table5; this.rptScheme.DataBind(); this.rptScheme.Visible = true; } else { this.labLotteryNumber.Text = _Convert.ToHtmlCode(str) + " "; if (flag2) { this.NumberDuiBi(this.labLotteryNumber.Text, this.lbWinNumber.Text, this.PlayTypeID); } } } else { this.linkDownloadScheme.Visible = true; this.linkDownloadLotteryIdentifiers.Visible = (base._User == null) || ((base._User != null) && ((base._User.ID.ToString() == row["InitiateUserID"].ToString()) || base._User.Competences["Administrator"])); this.linkDownloadLotteryIdentifiers.NavigateUrl = "../Web/DownLotteryIdentifiers.aspx?id=" + this.tbSchemeID.Text; this.linkDownloadScheme.NavigateUrl = "../Web/DownloadSchemeFile.aspx?id=" + this.tbSchemeID.Text; } } this.labSchemeNumber.Text = row["SchemeNumber"].ToString(); this.labSchemeDateTime.Text = row["DateTime"].ToString(); this.labSchemeMoney.Text = _Convert.StrToDouble(row["Money"].ToString(), 0.0).ToString("N"); this.labSchemeTitle.Text = row["Title"].ToString() + " "; this.labSchemeDescription.Text = row["Description"].ToString() + " "; this.labSchemeADUrl.Text = Shove._Web.Utility.GetUrl() + "/Home/Room/Scheme.aspx?id=" + this.tbSchemeID.Text; object[] args = new object[] { this.labSchemeMoney.Text, num3, (num5 / ((double)num3)).ToString("N"), num4, ((num5 / ((double)num3)) * num4).ToString("N") }; this.labSchemeDetail.Text = string.Format("此方案总金额 <FONT color='red'>{0}</font> 元,共 <FONT color='red'>{1}</font> 份,每份 <FONT color='red'>{2}</font> 元。<br />已认购 <FONT color='red'>{3}</font> 份(金额 <FONT color='red'>{4}</font> 元)", args) + (flag5 ? string.Format(",还有 <FONT color='red'>{0}</font> 份(金额 <FONT color='red'>{1}</font> 元)可以认购!", num3 - num4, ((num5 / ((double)num3)) * (num3 - num4)).ToString("N")) : ""); if ((string.IsNullOrEmpty(row["LotteryNumber"].ToString()) && (((this.LotteryID == "1") || (this.LotteryID == "2")) || (this.LotteryID == "15"))) && (((num2 == 0) && !flag6) && !flag)) { this.labLotteryNumber.Text = "未上传"; if ((base._User != null) && (row["InitiateUserID"].ToString() == base._User.ID.ToString())) { this.lbUploadScheme.Visible = true; } } if (flag) { this.labLotteryCode.Text = "已出票,彩票标识:"; this.linkDownloadLotteryIdentifiers.Visible = true; this.linkDownloadLotteryIdentifiers.NavigateUrl = "../Web/DownLotteryIdentifiers.aspx?id=" + this.tbSchemeID.Text; } else { this.labLotteryCode.Text = "暂未出票"; this.linkDownloadLotteryIdentifiers.Visible = false; } this.labAssureMoney.Text = (num6 > 0.0) ? string.Format("发起人保底 <FONT color='red'>{0}</font> 份,<FONT color='red'>{1}</font> 元", Math.Round((double)(num6 / (num5 / ((double)num3))), 0).ToString(), num6.ToString("N")) : "未保底"; if (num2 > 0) { if (num2 == 2) { this.labWin.Text = "已撤单(系统撤单)"; } else { this.labWin.Text = "已撤单"; } } else if (flag6) { this.labWin.Text = string.Format("<FONT color='red'>{0}</font> 元", num7.ToString("N")); string str7 = row["WinDescription"].ToString(); if (str7 != "") { this.labWin.Text = this.labWin.Text + "<br />" + str7; } else if (flag2) { this.labWin.Text = this.labWin.Text + " 未中奖"; } else { this.labWin.Text = this.labWin.Text + " <font color='red'>【注】</font>中奖结果在开奖后需要一段时间才能显示。"; } } else { this.labWin.Text = "尚未截止"; } if (flag2 && (((this.LotteryID == "1") || (this.LotteryID == "2")) || (this.LotteryID == "15"))) { this.labWin.Text = this.labWin.Text + "(命中<font color='red'>" + this.CompareLotteryNumberToWinNumber(row["LotteryNumber"].ToString(), row["WinLotteryNumber"].ToString()).ToString() + "</font>场)"; } if (flag6) { this.labCannotBuyTip.Text = "方案已截止,不能认购"; this.labCannotBuyTip.Visible = true; this.pBuy.Visible = false; this.btnOK.Enabled = false; } else if (num2 > 0) { this.labCannotBuyTip.Text = "方案已撤单,不能认购"; this.labCannotBuyTip.Visible = true; this.pBuy.Visible = false; this.btnOK.Enabled = false; } else if (num4 >= num3) { this.labCannotBuyTip.Text = "方案已满员,不能认购"; this.labCannotBuyTip.Visible = true; this.pBuy.Visible = false; this.btnOK.Enabled = false; } else { this.labCannotBuyTip.Visible = false; this.pBuy.Visible = true; this.btnOK.Enabled = true; } this.labShare.Text = (num3 - num4).ToString(); this.labShareMoney.Text = (num5 / ((double)num3)).ToString("N"); this.BindDataForUserList(); if (base._User != null) { DataTable dt = new Views.V_BuyDetailsWithQuashedAll().Open("[id],[DateTime],[Money],Share,SchemeShare,BuyedShare,QuashStatus,Buyed,IsuseID,Code,Schedule,DetailMoney,isWhenInitiate, WinMoneyNoWIthTax", "SiteID = " + base._Site.ID.ToString() + " and SchemeID = " + Shove._Web.Utility.FilteSqlInfusion(this.tbSchemeID.Text) + " and [UserID] = " + base._User.ID.ToString(), "[id]"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试(-518)", base.GetType().FullName); } else { if (dt.Rows.Count == 0) { this.labMyBuy.Text = "此方案还没有我的认购记录。"; this.labMyBuy.Visible = true; this.g.Visible = false; } else { this.labMyBuy.Visible = false; this.g.Visible = true; PF.DataGridBindData(this.g, dt); if (flag2) { double num23 = 0.0; for (int i = 0; i < dt.Rows.Count; i++) { num23 += double.Parse(dt.Rows[i]["WinMoneyNoWIthTax"].ToString()); } this.lbReward.Text = num23.ToString("N"); } } if (base._User.UserType < 2) { this.btnOK.Enabled = false; this.btnQuashScheme.Enabled = false; } } } } } }
private void Buy(Users _User) { string request = Shove._Web.Utility.GetRequest("HidIsuseID"); string str2 = Shove._Web.Utility.GetRequest("HidIsuseEndTime"); string s = Shove._Web.Utility.GetRequest("tbPlayTypeID"); string str4 = Shove._Web.Utility.GetRequest("Chase"); Shove._Web.Utility.GetRequest("CoBuy"); string str5 = Shove._Web.Utility.GetRequest("tb_Share"); string str6 = Shove._Web.Utility.GetRequest("tb_BuyShare"); Shove._Web.Utility.GetRequest("tb_AssureShare"); string str7 = Shove._Web.Utility.GetRequest("tb_OpenUserList"); string str8 = Shove._Web.Utility.GetRequest("tb_Title"); string str9 = Shove._Web.Utility.GetRequest("tb_Description"); string str10 = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney"); string str11 = Shove._Web.Utility.GetRequest("SecrecyLevel"); string str12 = Shove._Web.Utility.FilteSqlInfusion(base.Request["tb_LotteryNumber"]); string str13 = Shove._Web.Utility.GetRequest("tb_hide_SumMoney"); string str14 = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney"); string str15 = Shove._Web.Utility.GetRequest("tb_hide_SumNum"); Shove._Web.Utility.GetRequest("HidIsuseCount"); string str16 = Shove._Web.Utility.GetRequest("HidLotteryID"); Shove._Web.Utility.GetRequest("HidIsAlipay"); string str17 = Shove._Web.Utility.GetRequest("tb_Multiple"); Shove._Web.Utility.GetRequest("HidIsuseName"); Shove._Web.Utility.GetRequest("tbPlayTypeName"); string str18 = Shove._Web.Utility.GetRequest("tb_hide_ChaseBuyedMoney"); string str19 = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale"); string str20 = Shove._Web.Utility.GetRequest("tb_SchemeBonusScalec"); int num = 2; if ((s == "3903") || (s == "3904")) { num = 3; } else { num = 2; } if (str17 == "") { str17 = "1"; } double money = 0.0; int share = 0; int buyShare = 0; double assureMoney = 0.0; int multiple = 0; int num7 = 0; short num8 = 0; int playType = 0; int lotteryID = 0; long isuseID = 0L; double stopWhenWinMoney = 0.0; double schemeBonusScale = 0.0; double schemeBonusScalec = 0.0; try { money = double.Parse(str13); share = int.Parse(str5); buyShare = int.Parse(str6); assureMoney = double.Parse(str14); multiple = int.Parse(str17); num7 = int.Parse(str15); num8 = short.Parse(str11); playType = int.Parse(s); lotteryID = int.Parse(str16); isuseID = long.Parse(request); stopWhenWinMoney = double.Parse(str10); schemeBonusScale = double.Parse(str19); schemeBonusScalec = double.Parse(str20); } catch { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); return; } if ((money > 0.0) && (num7 >= 1)) { if (assureMoney < 0.0) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } else if (share < 1) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } else { if ((buyShare == share) && (assureMoney == 0.0)) { share = 1; buyShare = 1; } if ((money / ((double)share)) < 1.0) { JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。"); } else { double num15 = (buyShare * (money / ((double)share))) + assureMoney; if (str4 != "") { num15 = double.Parse(str18); } if (num15 > _User.Balance) { this.SaveDataForAliBuy(); } else if (num15 > 10000000.0) { JavaScript.Alert(this.Page, "投注金额不能大于" + 0x989680.ToString() + ",谢谢。"); } else if (multiple > 0x3e7) { JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。"); } else if ((schemeBonusScale < 0.0) && (schemeBonusScale > 10.0)) { JavaScript.Alert(this.Page, "佣金比例只能在0~10之间"); } else if ((schemeBonusScale.ToString().IndexOf("-") > -1) || (schemeBonusScale.ToString().IndexOf(".") > -1)) { JavaScript.Alert(this.Page, "佣金比例输入有误"); } else if ((schemeBonusScalec < 0.0) && (schemeBonusScalec > 10.0)) { JavaScript.Alert(this.Page, "佣金比例只能在0~10之间"); } else if ((schemeBonusScalec.ToString().IndexOf("-") > -1) || (schemeBonusScalec.ToString().IndexOf(".") > -1)) { JavaScript.Alert(this.Page, "佣金比例输入有误"); } else { schemeBonusScale /= 100.0; schemeBonusScalec /= 100.0; string number = str12; if (number[number.Length - 1] == '\n') { number = number.Substring(0, number.Length - 1); } Lottery lottery = new Lottery(); string[] strArray = this.SplitLotteryNumber(number); if ((strArray == null) || (strArray.Length < 1)) { JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)"); } else { int num17 = 0; foreach (string str22 in strArray) { string str23 = lottery[lotteryID].AnalyseScheme(str22, playType); if (!string.IsNullOrEmpty(str23)) { string[] strArray3 = str23.Split(new char[] { '|' }); if ((strArray3 != null) && (strArray3.Length >= 1)) { num17 += _Convert.StrToInt(strArray3[strArray3.Length - 1], 0); } } } if (num17 != num7) { JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。"); } else { StringBuilder builder = new StringBuilder(); int num19 = 0; string detailXML = ""; string returnDescription = ""; if (str4 == "1") { foreach (string str26 in base.Request.Form.AllKeys) { if (str26.IndexOf("check") > -1) { int num20 = _Convert.StrToInt(str26.Replace("check", ""), -1); if (num20 > 0) { num19++; int num21 = (_Convert.StrToInt(base.Request.Form["tb_hide_SumNum"], -1) * num) * _Convert.StrToInt(base.Request.Form["times" + num20.ToString()], -1); builder.Append(base.Request.Form[str26]).Append(",").Append(base.Request.Form["times" + num20.ToString()]).Append(",").Append(num21.ToString()).Append(";"); } } } if (builder.Length > 0) { builder.Remove(builder.Length - 1, 1); } if (number[number.Length - 1] == '\n') { number = number.Substring(0, number.Length - 1); } try { money = double.Parse(str13); } catch { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1325)"); return; } if (money < 2.0) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1332)"); } else { string[] strArray5 = builder.ToString().Split(new char[] { ';' }); int length = strArray5.Length; string[] str = new string[length * 6]; DateTime time2 = DateTime.Parse(Functions.F_GetIsuseSystemEndTime(long.Parse(strArray5[0].Split(new char[] { ',' })[0]), playType).ToString()); if (DateTime.Now >= time2) { JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。"); } else { for (int i = 0; i < length; i++) { str[i * 6] = strArray5[i].Split(new char[] { ',' })[0]; str[(i * 6) + 1] = playType.ToString(); str[(i * 6) + 2] = number; str[(i * 6) + 3] = strArray5[i].Split(new char[] { ',' })[1]; str[(i * 6) + 4] = strArray5[i].Split(new char[] { ',' })[2]; str[(i * 6) + 5] = num8.ToString(); if ((_Convert.StrToDouble(str[(i * 6) + 3], 0.0) * money) != _Convert.StrToDouble(str[(i * 6) + 4], 1.0)) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); return; } if (_Convert.StrToDouble(str[(i * 6) + 3], 0.0) < multiple) { JavaScript.Alert(this.Page, "追号倍数有错误,请仔细检查!"); return; } if (((double.Parse(str[(i * 6) + 3]) * num7) * num) != double.Parse(str[(i * 6) + 4])) { JavaScript.Alert(this.Page, "追号金额有错误,请仔细检查!可能原因:浏览器不兼容,建议使用IE 7.0"); return; } } detailXML = PF.BuildIsuseAdditionasXmlForChase(str); if (detailXML == "") { JavaScript.Alert(this.Page, "追号发生错误。"); } else if (_User.InitiateChaseTask(str8.Trim(), str9.Trim(), lotteryID, stopWhenWinMoney, detailXML, number, schemeBonusScalec, ref returnDescription) < 0) { PF.GoError(1, returnDescription, base.GetType().FullName + "(-754)"); } else { Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + isuseID.ToString()); Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + isuseID.ToString()); Shove._Web.Cache.ClearCache(base._Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString()); base.Response.Redirect("UserBuySuccess.aspx?LotteryID=" + lotteryID.ToString() + "&Type=2&Money=" + num15.ToString()); } } } } else if (DateTime.Now >= _Convert.StrToDateTime(str2.Replace("/", "-"), DateTime.Now.AddDays(-1.0).ToString())) { JavaScript.Alert(this.Page, "本期投注已截止,谢谢。"); } else if (((num * num7) * multiple) != money) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } else { long num25 = _User.InitiateScheme(isuseID, playType, (str8.Trim() == "") ? "(无标题)" : str8.Trim(), str9.Trim(), number, "", multiple, money, assureMoney, share, buyShare, str7.Trim(), short.Parse(num8.ToString()), schemeBonusScale, ref returnDescription); if (num25 < 0L) { PF.GoError(1, returnDescription, base.GetType().FullName + "(-755)"); } else { Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + isuseID.ToString()); Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + isuseID.ToString()); if ((money > 50.0) && (share > 1)) { Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData"); } base.Response.Redirect("UserBuySuccess.aspx?LotteryID=" + lotteryID.ToString() + "&&Money=" + num15.ToString() + "&SchemeID=" + num25.ToString()); } } } } } } } } else { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } }
protected void DataListZCDC_ItemCommand(object source, DataListCommandEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { if (e.CommandName == "btEdit") { this.DataListZCDC.EditItemIndex = e.Item.ItemIndex; } if (e.CommandName == "btUpdate") { if (e.Item.ItemType == ListItemType.EditItem) { string result = ""; string halftimeResult = ""; string str3 = ""; string str4 = ""; string str5 = ""; string letBall = "0"; string sPFResult = ""; string zJQResult = ""; string sXDSResult = ""; string zQBFResult = ""; string bQCSPFResult = ""; double num = 0.0; double num2 = 0.0; double num3 = 0.0; double num4 = 0.0; double num5 = 0.0; int num6 = 0; CheckBox box = (CheckBox)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("cbResultDelay"); HiddenField field = (HiddenField)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("hfId"); if (box.Checked) { result = "*"; halftimeResult = "*"; sPFResult = "*"; zJQResult = "*"; sXDSResult = "*"; zQBFResult = "*"; bQCSPFResult = "*"; num = 1.0; num2 = 1.0; num3 = 1.0; num4 = 1.0; num5 = 1.0; } else { DropDownList list = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlLetBall"); DropDownList list2 = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlGame1"); DropDownList list3 = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlGame2"); DropDownList list4 = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlHalftime1"); DropDownList list5 = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlHalftime2"); DropDownList list6 = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlZQBF"); DropDownList list7 = (DropDownList)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlBQCSPF"); TextBox box2 = (TextBox)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("tbSPF_SP"); TextBox box3 = (TextBox)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("tbZJQ_SP"); TextBox box4 = (TextBox)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("tbSXDS_SP"); TextBox box5 = (TextBox)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("tbZQBF_SP"); TextBox box6 = (TextBox)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("tbBQCSPF_SP"); result = list2.SelectedValue + ":" + list3.SelectedValue; halftimeResult = list4.SelectedValue + ":" + list5.SelectedValue; letBall = list.SelectedValue; if ((int.Parse(list2.SelectedValue) + int.Parse(list.SelectedValue)) > int.Parse(list3.SelectedValue)) { sPFResult = "3"; } else if ((int.Parse(list2.SelectedValue) + int.Parse(list.SelectedValue)) == int.Parse(list3.SelectedValue)) { sPFResult = "1"; } else { sPFResult = "0"; } num6 = int.Parse(list2.SelectedValue) + int.Parse(list3.SelectedValue); if (num6 >= 7) { zJQResult = "7"; } else { zJQResult = num6.ToString(); } if (num6 >= 3) { if ((num6 % 2) != 0) { sXDSResult = "1"; } else { sXDSResult = "2"; } } else if ((num6 % 2) != 0) { sXDSResult = "3"; } else { sXDSResult = "4"; } if (int.Parse(list2.SelectedValue) > int.Parse(list3.SelectedValue)) { if (int.Parse(list2.SelectedValue) > 4) { if (_Convert.StrToInt(list6.SelectedValue, -1) != 10) { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } zQBFResult = list6.SelectedValue; } else { if ((int.Parse(list2.SelectedValue) == 4) && (int.Parse(list3.SelectedValue) == 3)) { if (list6.SelectedItem.Text.Trim() != "胜其他") { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } } else if (list6.SelectedItem.Text != result) { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } zQBFResult = list6.SelectedValue; } } else if (int.Parse(list2.SelectedValue) == int.Parse(list3.SelectedValue)) { if (int.Parse(list2.SelectedValue) > 3) { if (_Convert.StrToInt(list6.SelectedValue, -1) != 15) { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } zQBFResult = list6.SelectedValue; } else { if (list6.SelectedItem.Text != result) { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } zQBFResult = list6.SelectedValue; } } else if (int.Parse(list3.SelectedValue) > 4) { if (_Convert.StrToInt(list6.SelectedValue, -1) != 0x19) { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } zQBFResult = list6.SelectedValue; } else { if ((int.Parse(list2.SelectedValue) == 3) && (int.Parse(list3.SelectedValue) == 4)) { if (list6.SelectedItem.Text != "负其他") { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } } else if (list6.SelectedItem.Text != result) { JavaScript.Alert(this.Page, "请正确选择本场比赛的正确比分结果!"); return; } zQBFResult = list6.SelectedValue; } if (int.Parse(list4.SelectedValue) > int.Parse(list5.SelectedValue)) { str4 = "胜"; } else if (int.Parse(list4.SelectedValue) == int.Parse(list5.SelectedValue)) { str4 = "平"; } else { str4 = "负"; } if (int.Parse(list2.SelectedValue) > int.Parse(list3.SelectedValue)) { str3 = "胜"; } else if (int.Parse(list2.SelectedValue) == int.Parse(list3.SelectedValue)) { str3 = "平"; } else { str3 = "负"; } str5 = str4 + "-" + str3; if (list7.SelectedItem.Text != str5) { JavaScript.Alert(this.Page, "请正确选择本场比赛半全场胜平负的结果!"); return; } bQCSPFResult = list7.SelectedValue; if (_Convert.StrToDouble(box2.Text.Trim(), -1.0) < 0.0) { JavaScript.Alert(this.Page, "请正确输入全场比赛胜平负的SP结果值!"); return; } if (_Convert.StrToDouble(box3.Text.Trim(), -1.0) < 0.0) { JavaScript.Alert(this.Page, "请正确输入全场比赛总进球的SP结果值!"); return; } if (_Convert.StrToDouble(box4.Text.Trim(), -1.0) < 0.0) { JavaScript.Alert(this.Page, "请正确输入全场比赛上下单双的SP结果值!"); return; } if (_Convert.StrToDouble(box5.Text.Trim(), -1.0) < 0.0) { JavaScript.Alert(this.Page, "请正确输入全场比赛正确比分的SP结果值!"); return; } if (_Convert.StrToDouble(box6.Text.Trim(), -1.0) < 0.0) { JavaScript.Alert(this.Page, "请正确输入本场比赛半全场胜平负的SP结果值!"); return; } num = _Convert.StrToDouble(box2.Text.Trim(), 0.0); num2 = _Convert.StrToDouble(box3.Text.Trim(), 0.0); num3 = _Convert.StrToDouble(box4.Text.Trim(), 0.0); num4 = _Convert.StrToDouble(box5.Text.Trim(), 0.0); num5 = _Convert.StrToDouble(box6.Text.Trim(), 0.0); } long iD = int.Parse(field.Value); int returnValue = 0; string returnDescription = ""; Procedures.P_IsuseInsertOneResultForZCDC(iD, halftimeResult, result, letBall, sPFResult, num, zJQResult, num2, sXDSResult, num3, zQBFResult, num4, bQCSPFResult, num5, ref returnValue, ref returnDescription); if (returnValue < 0) { JavaScript.Alert(this.Page, returnDescription); return; } JavaScript.Alert(this.Page, "更新成功!"); } this.DataListZCDC.EditItemIndex = -1; } if (e.CommandName == "btOpenWin") { if (e.Item.ItemType == ListItemType.EditItem) { Label label = (Label)this.DataListZCDC.Items[e.Item.ItemIndex].FindControl("lbZCDC"); DataTable table = MSSQL.Select("select * from T_IsuseForZCDC where IsuseID = " + this.ddlIsuse.SelectedValue + " order by [NO]", new MSSQL.Parameter[0]); if ((table == null) || (table.Rows.Count < 1)) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } int count = table.Rows.Count; DataTable table2 = MSSQL.Select("select * from T_IsuseForZCDC where IsuseID = " + this.ddlIsuse.SelectedValue + " and [NO] <= " + label.Text + " order by [NO]", new MSSQL.Parameter[0]); if ((table2 == null) || (table2.Rows.Count < 1)) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } int competitionCount = table2.Rows.Count; string number = ""; string str14 = ""; string str15 = ""; string str16 = ""; string str17 = ""; string str18 = ""; for (int i = 0; i < competitionCount; i++) { if (((table2.Rows[i]["Result"].ToString() == "") || (table2.Rows[i]["SPFResult"].ToString() == "")) || (table2.Rows[i]["SPF_SP"].ToString() == "")) { JavaScript.Alert(this.Page, "第" + table2.Rows[i]["No"].ToString() + "场比赛的彩果没有输入!请先输入!!"); return; } string str19 = str14; str14 = str19 + table2.Rows[i]["No"].ToString() + "(" + table2.Rows[i]["SPFResult"].ToString() + "," + table2.Rows[i]["SPF_SP"].ToString() + ")|"; str19 = str15; str15 = str19 + table2.Rows[i]["No"].ToString() + "(" + table2.Rows[i]["ZJQResult"].ToString() + "," + table2.Rows[i]["ZJQ_SP"].ToString() + ")|"; str19 = str16; str16 = str19 + table2.Rows[i]["No"].ToString() + "(" + table2.Rows[i]["SXDSResult"].ToString() + "," + table2.Rows[i]["SXDS_SP"].ToString() + ")|"; str19 = str17; str17 = str19 + table2.Rows[i]["No"].ToString() + "(" + table2.Rows[i]["ZQBFResult"].ToString() + "," + table2.Rows[i]["ZQBF_SP"].ToString() + ")|"; str19 = str18; str18 = str19 + table2.Rows[i]["No"].ToString() + "(" + table2.Rows[i]["BQCSPFResult"].ToString() + "," + table2.Rows[i]["BQCSPF_SP"].ToString() + ")|"; } str14 = str14.Substring(0, str14.Length - 1); str15 = str15.Substring(0, str15.Length - 1); str16 = str16.Substring(0, str16.Length - 1); str17 = str17.Substring(0, str17.Length - 1); str18 = str18.Substring(0, str18.Length - 1); number = str14 + ";" + str15 + ";" + str16 + ";" + str17 + ";" + str18; if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(number, table2.Rows.Count)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); return; } DataTable table3 = new Tables.T_Schemes().Open("", "IsuseID = " + this.ddlIsuse.SelectedValue + " and isOpened = 0", ""); if (table3 == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } int num12 = 0; int num13 = 0; int num14 = 0; for (int j = 0; j < table3.Rows.Count; j++) { string scheme = table3.Rows[j]["LotteryNumber"].ToString(); int playType = _Convert.StrToInt(scheme.Trim().Split(new char[] { ';' })[0].ToString(), 0); string str22 = scheme.Trim().Split(new char[] { ';' })[1].ToString(); string[] strArray2 = str22.Substring(1, str22.Length - 1).Substring(0, str22.Length - 2).ToString().Trim().Split(new char[] { '|' }); string str = strArray2[strArray2.Length - 1].Substring(0, strArray2[strArray2.Length - 1].IndexOf('(')); if (competitionCount >= _Convert.StrToInt(str, 0)) { num12++; string description = ""; double winMoneyNoWithTax = 0.0; double winMoney = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(scheme, number, ref description, ref winMoneyNoWithTax, playType, competitionCount, ""); if (winMoney > 0.0) { num14++; } int num19 = 0; string str26 = ""; DataSet ds = null; Procedures.P_WinByOpenManual(ref ds, base._Site.ID, _Convert.StrToLong(table3.Rows[j]["ID"].ToString(), 0L), winMoney, winMoneyNoWithTax, description, base._User.ID, ref num19, ref str26); if ((ds == null) || (str26 != "")) { num13++; new Log("System").Write(table3.Rows[j]["ID"].ToString() + "方案派奖错误!"); } PF.SendWinNotification(ds); } } if (count == competitionCount) { MSSQL.ExecuteNonQuery("update T_Isuses set isOpened = 1, OpenAffiche = @p2 where [ID] = " + this.ddlIsuse.SelectedValue, new MSSQL.Parameter[] { new MSSQL.Parameter("p1", SqlDbType.VarChar, 0, ParameterDirection.Input, number), new MSSQL.Parameter("p2", SqlDbType.VarChar, 0, ParameterDirection.Input, "无开奖模板") }); } this.BindDataForIsuse(); JavaScript.Alert(this.Page, string.Format("开奖成功,总方案 {0} 个,失败方案 {1} 个,有效中奖方案 {2} 个。", num12, num13, num14)); } this.DataListZCDC.EditItemIndex = -1; } this.BindDataForZCDC(); } }
protected void btnOK_Click(object sender, EventArgs e) { if (!PF.IsSystemRegister()) { PF.GoError(4, "请联系网站管理员输入软件序列号", base.GetType().BaseType.FullName); } else { int isuseCount = _Convert.StrToInt(this.HidIsuseCount.Value, -1); int lotteryID = _Convert.StrToInt(this.HidLotteryID.Value, -1); short type = _Convert.StrToShort(this.HidType.Value, -1); int multiple = _Convert.StrToInt(this.HidMultiple.Value, -1); int nums = _Convert.StrToInt(this.HidNums.Value, -1); short betType = _Convert.StrToShort(this.HidBetType.Value, -1); double money = _Convert.StrToDouble(this.HidMoney.Value, -1.0); string request = Shove._Web.Utility.GetRequest("tbTitle1"); int playType = _Convert.StrToInt(this.HidPlayTypeID.Value, -1); if (string.IsNullOrEmpty(request)) { request = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } if ((((isuseCount < 0) || (lotteryID < 0)) || ((type < 0) || (multiple < 0))) || (((nums < 0) || (betType < 0)) || ((money < 0.0) || (playType < 0)))) { JavaScript.Alert(this.Page, "投注信息有误!"); } else if (base._User.Balance < money) { JavaScript.Alert(this.Page, "您的余额不足,请充值!"); } else { int price = 2; if (playType == 0xf3f) { price = 3; } if ((((isuseCount * multiple) * nums) * price) != money) { JavaScript.Alert(this.Page, "投注总金额与投注倍数、注数、期数不相符!"); } else { DateTime now = DateTime.Now; switch (type) { case 1: now = now.AddMonths(1); break; case 2: now = now.AddMonths(3); break; case 3: now = now.AddMonths(6); break; case 4: now = now.AddYears(1); break; } string chaseXML = ""; if (betType != 1) { if (string.IsNullOrEmpty(this.HidLotteryNumber.Value)) { JavaScript.Alert(this.Page, "发起追号套餐有异常!"); return; } if (multiple != _Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0)) { JavaScript.Alert(this.Page, "投注倍数出现异常!"); return; } Lottery lottery2 = new Lottery(); string[] strArray6 = this.SplitLotteryNumber(this.HidLotteryNumber.Value); if ((strArray6 == null) || (strArray6.Length < 1)) { JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。"); return; } int num15 = 0; foreach (string str5 in strArray6) { string str6 = lottery2[lotteryID].AnalyseScheme(str5, playType); if (!string.IsNullOrEmpty(str6)) { string[] strArray8 = str6.Split(new char[] { '|' }); if ((strArray8 != null) && (strArray8.Length >= 1)) { num15 += _Convert.StrToInt(strArray8[strArray8.Length - 1], 0); } } } if (num15 != nums) { JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。"); return; } } else { string[] strArray2; if (nums != _Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0)) { JavaScript.Alert(this.Page, "投注注数出现异常!"); return; } if (multiple != 1) { JavaScript.Alert(this.Page, "投注倍数出现异常!"); return; } this.HidLotteryNumber.Value = ""; chaseXML = "<ChaseDetails>"; Lottery lottery = new Lottery(); switch (lotteryID) { case 5: strArray2 = lottery[5].BuildNumber(6, 1, nums * isuseCount).Split(new string[] { "\n" }, StringSplitOptions.None); break; case 0x27: strArray2 = lottery[0x27].BuildNumber(5, 2, nums * isuseCount).Split(new string[] { "\n" }, StringSplitOptions.None); break; default: strArray2 = lottery[lotteryID].BuildNumber(nums * isuseCount).Split(new string[] { "\n" }, StringSplitOptions.None); break; } if (strArray2.Length != (nums * isuseCount)) { JavaScript.Alert(this.Page, "随机生成号码时出现异常!"); return; } int num12 = 1; int num13 = 0; string str3 = ""; foreach (string str4 in strArray2) { str3 = str3 + str4 + "\n"; if ((num12 % nums) == 0) { chaseXML = chaseXML + "<Chase ChaseLotteryNumber=\"" + str3 + "\"/>"; num13++; str3 = ""; } num12++; } if (num13 != isuseCount) { JavaScript.Alert(this.Page, "随机生成号码时出现异常!"); return; } chaseXML = chaseXML + "</ChaseDetails>"; } string returnDescription = ""; if (base._User.InitiateCustomChase(lotteryID, playType, price, type, now, isuseCount, multiple, nums, betType, this.HidLotteryNumber.Value, 1, 0.0, money, request, chaseXML, ref returnDescription) < 0) { JavaScript.Alert(this.Page, returnDescription); } else { Shove._Web.Cache.ClearCache("LotteryPackage_BindUsers"); Shove._Web.Cache.ClearCache(base._Site.ID.ToString() + "AccountFreezeDetail_" + base._User.ID.ToString()); Shove._Web.Cache.ClearCache("Home_Room_ViewChaseCombo_BindData" + base._User.ID.ToString()); JavaScript.Alert(this.Page, "定制追号套餐成功!", "LotteryPackage.aspx"); } } } } }
protected void btnGO_Click(object sender, EventArgs e) { if (this.ddlLottery.SelectedValue == "45") { this.btnGO_ClickForZCDC(); } else { this.tbWinNumber.Text = _Convert.ToDBC(this.tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(this.tbWinNumber.Text)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); } else { SystemOptions options = new SystemOptions(); bool flag = options["isCompareWinMoneyNoWithFax"].ToBoolean(true); double[] winMoneyList = new double[this.g.Rows.Count * 2]; for (int i = 0; i < this.g.Rows.Count; i++) { winMoneyList[i * 2] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0.0); winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0.0); if (winMoneyList[i * 2] < 0.0) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项奖金输入错误!"); return; } if ((winMoneyList[i * 2] < winMoneyList[(i * 2) + 1]) && flag) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!"); return; } } if (_Convert.ToTextCode(this.tbOpenAffiche.Text.Trim()) == "") { JavaScript.Alert(this.Page, "请输入开奖公告!"); } else { DataTable table = new Tables.T_Schemes().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and isOpened = 0", "[ID]"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { for (int j = 0; j < table.Rows.Count; j++) { string number = table.Rows[j]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double num6 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(number, this.tbWinNumber.Text.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table.Rows[j]["PlayTypeID"].ToString()), winMoneyList); MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + table.Rows[j]["ID"].ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, num6 * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, winMoneyNoWithTax * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, num6 * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, winMoneyNoWithTax * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, description) }); } JavaScript.Alert(this.Page, "奖金已经计算完成,请执行第三步进行派奖!。"); this.BindDataForIsuse(); } } } } }
public string SplitScheme(string LotteryNumber, int LotteryID) { Lottery lottery = new Lottery(); string canonicalNumber = ""; string[] strArray = lottery[LotteryID].ToSingle(LotteryNumber, ref canonicalNumber, (LotteryID * 100) + 1); if ((strArray == null) || (strArray.Length < 1)) { return ""; } LotteryNumber = ""; foreach (string str2 in strArray) { LotteryNumber = LotteryNumber + str2 + ","; } int length = strArray.Length; return (LotteryNumber + length.ToString()); }
protected void btnGO_Step2_Click(object sender, EventArgs e) { this.btnGO_Step1.AlertText = ""; if (this.ddlLottery.SelectedValue == "45") { JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。"); } else { this.tbWinNumber.Text = _Convert.ToDBC(this.tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(this.tbWinNumber.Text)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); } else { SystemOptions options = new SystemOptions(); bool flag = options["isCompareWinMoneyNoWithFax"].ToBoolean(true); double[] winMoneyList = new double[this.g.Rows.Count * 2]; for (int i = 0; i < this.g.Rows.Count; i++) { winMoneyList[i * 2] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0.0); winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0.0); if (winMoneyList[i * 2] < 0.0) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项奖金输入错误!"); return; } if ((winMoneyList[i * 2] < winMoneyList[(i * 2) + 1]) && flag) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!"); return; } } if (_Convert.ToTextCode(this.tbOpenAffiche.Text.Trim()) == "") { JavaScript.Alert(this.Page, "请输入开奖公告!"); } else { DataTable table = new Tables.T_ElectronTicketAgentSchemes().Open("top 500 *", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and WinMoney is null and state = 1", "[ID]"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { Tables.T_ElectronTicketAgentSchemes schemes = new Tables.T_ElectronTicketAgentSchemes(); for (int j = 0; j < table.Rows.Count; j++) { string number = table.Rows[j]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double num6 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(number, this.tbWinNumber.Text.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table.Rows[j]["PlayTypeID"].ToString()), winMoneyList); schemes.WinMoney.Value = num6 * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1); schemes.WinMoneyWithoutTax.Value = winMoneyNoWithTax * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1); schemes.WinDescription.Value = description; schemes.Update("[ID] =" + table.Rows[j]["ID"].ToString()); } this.Step2IsOpen = table.Rows.Count == 500; if (!this.Step2IsOpen) { table = new Tables.T_ElectronTicketAgentSchemes().Open("top 1 * ", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and state = 1 and WinMoney is null", "[ID]"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } this.Step2IsOpen = table.Rows.Count > 0; } this.btnGO_Step2.Enabled = this.Step2IsOpen; this.btnGO_Step3.Enabled = !this.Step2IsOpen; string msg = "请再次执行第二步"; if (!this.Step2IsOpen) { msg = "开奖步骤二已经完成,请执行第三步."; } JavaScript.Alert(this.Page, msg); } } } } }
protected void btnOK_Click(object sender, System.EventArgs e) { int IsuseCount = Shove._Convert.StrToInt(HidIsuseCount.Value, -1); int LotteryID = Shove._Convert.StrToInt(HidLotteryID.Value, -1); short Type = Shove._Convert.StrToShort(HidType.Value, -1); int Multiple = Shove._Convert.StrToInt(HidMultiple.Value, -1); int Nums = Shove._Convert.StrToInt(HidNums.Value, -1); short BetType = Shove._Convert.StrToShort(HidBetType.Value, -1); double Money = Shove._Convert.StrToDouble(HidMoney.Value, -1); string Title = Shove._Web.Utility.GetRequest("tbTitle1"); int PlayTypeID = Shove._Convert.StrToInt(HidPlayTypeID.Value, -1); if (string.IsNullOrEmpty(Title)) { Title = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } if (IsuseCount < 0 || LotteryID < 0 || Type < 0 || Multiple < 0 || Nums < 0 || BetType < 0 || Money < 0 || PlayTypeID < 0) { Shove._Web.JavaScript.Alert(this.Page, "投注信息有误!"); return; } if (_User.Balance < Money) { Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值!"); return; } int Price = 2; if (PlayTypeID == 3903) { Price = 3; } if (IsuseCount * Multiple * Nums * Price != Money) { Shove._Web.JavaScript.Alert(this.Page, "投注总金额与投注倍数、注数、期数不相符!"); return; } int Result = -1; DateTime EndTime = DateTime.Now; switch (Type) { case 1: { EndTime = EndTime.AddMonths(1); } break; case 2: { EndTime = EndTime.AddMonths(3); } break; case 3: { EndTime = EndTime.AddMonths(6); } break; case 4: { EndTime = EndTime.AddYears(1); } break; } string ChaseXML = ""; if (BetType == 1) { if (Nums != Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0)) { Shove._Web.JavaScript.Alert(this.Page, "投注注数出现异常!"); return; } if (Multiple != 1) { Shove._Web.JavaScript.Alert(this.Page, "投注倍数出现异常!"); return; } HidLotteryNumber.Value = ""; string[] lotteryNumber; ChaseXML = "<ChaseDetails>"; Lottery l = new Lottery(); if (LotteryID == 5) { lotteryNumber = l[5].BuildNumber(6, 1, Nums*IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None); } else if (LotteryID == 39) { lotteryNumber = l[39].BuildNumber(5, 2, Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None); } else { lotteryNumber = l[LotteryID].BuildNumber(Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None); } if (lotteryNumber.Length != Nums * IsuseCount) { Shove._Web.JavaScript.Alert(this.Page, "随机生成号码时出现异常!"); return; } int i = 1; int j = 0; string LotteryNumber = ""; foreach (string s in lotteryNumber) { LotteryNumber += s + "\n"; if (i % Nums == 0) { ChaseXML += "<Chase ChaseLotteryNumber=\"" + LotteryNumber + "\"/>"; j++; LotteryNumber = ""; } i++; } if (j != IsuseCount) { Shove._Web.JavaScript.Alert(this.Page, "随机生成号码时出现异常!"); return; } ChaseXML += "</ChaseDetails>"; } else { if (string.IsNullOrEmpty(HidLotteryNumber.Value)) { Shove._Web.JavaScript.Alert(this.Page, "发起追号套餐有异常!"); return; } if (Multiple != Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0)) { Shove._Web.JavaScript.Alert(this.Page, "投注倍数出现异常!"); return; } SLS.Lottery slsLottery = new SLS.Lottery(); string[] t_lotterys = SplitLotteryNumber(HidLotteryNumber.Value); if ((t_lotterys == null) || (t_lotterys.Length < 1)) { Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。"); return; } int ValidNum = 0; foreach (string str in t_lotterys) { string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID); if (string.IsNullOrEmpty(Number)) { continue; } string[] str_s = Number.Split('|'); if (str_s == null || str_s.Length < 1) { continue; } ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0); } if (ValidNum != Nums) { Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。"); return; } } string Description = ""; Result = _User.InitiateCustomChase(LotteryID,PlayTypeID,Price, Type, EndTime, IsuseCount, Multiple, Nums, BetType, HidLotteryNumber.Value, 1, 0, Money, Title, ChaseXML, ref Description); if (Result < 0) { Shove._Web.JavaScript.Alert(this.Page, Description); return; } Shove._Web.Cache.ClearCache("LotteryPackage_BindUsers"); Shove._Web.Cache.ClearCache(_Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString()); Shove._Web.Cache.ClearCache("Home_Room_ViewChaseCombo_BindData" + _User.ID.ToString()); Shove._Web.JavaScript.Alert(this.Page, "定制追号套餐成功!", "LotteryPackage.aspx"); }
private void btnGO_ClickForZCDC() { if (_Convert.ToTextCode(this.tbOpenAffiche.Text.Trim()) == "") { JavaScript.Alert(this.Page, "请输入开奖公告!"); } else { DataTable table = MSSQL.Select("select * from T_IsuseForZCDC where IsuseID = " + this.ddlIsuse.SelectedValue + " order by [NO]", new MSSQL.Parameter[0]); if ((table == null) || (table.Rows.Count < 1)) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { int count = table.Rows.Count; string number = ""; string str2 = ""; string str3 = ""; string str4 = ""; string str5 = ""; string str6 = ""; for (int i = 0; i < count; i++) { if (((table.Rows[i]["Result"].ToString() == "") || (table.Rows[i]["SPFResult"].ToString() == "")) || (table.Rows[i]["SPF_SP"].ToString() == "")) { JavaScript.Alert(this.Page, "第" + table.Rows[i]["No"].ToString() + "场比赛的彩果没有输入!请先输入!!"); return; } string str7 = str2; str2 = str7 + table.Rows[i]["No"].ToString() + "(" + _Convert.ToDBC(table.Rows[i]["SPFResult"].ToString()).Trim() + "," + _Convert.ToDBC(table.Rows[i]["SPF_SP"].ToString()).Trim() + ")|"; string str8 = str3; str3 = str8 + table.Rows[i]["No"].ToString() + "(" + _Convert.ToDBC(table.Rows[i]["ZJQResult"].ToString()).Trim() + "," + _Convert.ToDBC(table.Rows[i]["ZJQ_SP"].ToString()).Trim() + ")|"; string str9 = str4; str4 = str9 + table.Rows[i]["No"].ToString() + "(" + _Convert.ToDBC(table.Rows[i]["SXDSResult"].ToString()).Trim() + "," + _Convert.ToDBC(table.Rows[i]["SXDS_SP"].ToString()).Trim() + ")|"; string str10 = str5; str5 = str10 + table.Rows[i]["No"].ToString() + "(" + _Convert.ToDBC(table.Rows[i]["ZQBFResult"].ToString()).Trim() + "," + _Convert.ToDBC(table.Rows[i]["ZQBF_SP"].ToString()).Trim() + ")|"; string str11 = str6; str6 = str11 + table.Rows[i]["No"].ToString() + "(" + _Convert.ToDBC(table.Rows[i]["BQCSPFResult"].ToString()).Trim() + "," + _Convert.ToDBC(table.Rows[i]["BQCSPF_SP"].ToString()).Trim() + ")|"; } str2 = str2.Substring(0, str2.Length - 1); str3 = str3.Substring(0, str3.Length - 1); str4 = str4.Substring(0, str4.Length - 1); str5 = str5.Substring(0, str5.Length - 1); str6 = str6.Substring(0, str6.Length - 1); number = str2 + ";" + str3 + ";" + str4 + ";" + str5 + ";" + str6; if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(number, table.Rows.Count)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); } else { DataTable table2 = new Tables.T_Schemes().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and isOpened = 0", ""); if (table2 == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { for (int j = 0; j < table2.Rows.Count; j++) { string scheme = table2.Rows[j]["LotteryNumber"].ToString(); int playType = _Convert.StrToInt(scheme.Trim().Split(new char[] { ';' })[0].ToString(), 0); string description = ""; double winMoneyNoWithTax = 0.0; double num6 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(scheme, number, ref description, ref winMoneyNoWithTax, playType, count, ""); MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + table2.Rows[j]["ID"].ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, num6 * _Convert.StrToInt(table2.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, winMoneyNoWithTax * _Convert.StrToInt(table2.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, num6 * _Convert.StrToInt(table2.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, winMoneyNoWithTax * _Convert.StrToInt(table2.Rows[j]["Multiple"].ToString(), 1)), new MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, description) }); } int num7 = 0; int num8 = 0; int num9 = 0; int num10 = 0; this.BindDataForIsuse(); this.tbWinNumber.Text = ""; JavaScript.Alert(this.Page, string.Format("开奖成功,总方案 {0} 个,撤单未满员或未出票方案 {1} 个,有效中奖方案 {2} 个,中奖但未成功方案 {3} 个。", new object[] { num7, num8, num9, num10 })); } } } } }
//开始抽奖 public string Lottery1() { string type = Common.FilterString(Common.GetStringOfUrl("method")); Lottery lo = new Lottery(); //判断玩家是否被指定中奖 int speAwardid = lo.GetAwardSpecial(UiCommon.UserLoginInfo.UserID); // int speAwardid = lo.GetAwardSpecial("207"); int result = 0; if (speAwardid != 0) { //玩家指定中奖 result = lo.AddAwardLog(UiCommon.UserLoginInfo.UserID, speAwardid.ToString(), type, "0"); // lo.AddAwardLog("207", speAwardid.ToString(), type); } else { //抽取随机奖品id int awradid = Convert.ToInt32(GetAwardId(type)); //获得奖品 //if (awradid > 0) //{ //抽中奖品 result = lo.AddAwardLog(UiCommon.UserLoginInfo.UserID, awradid.ToString(), type, "1"); if (result == -2 || result == 1) speAwardid = 0; if (result == 0) speAwardid = awradid; } //返回奖品的排序号 return GetAwardOrder(speAwardid); }
public string SplitScheme(string LotteryNumber, int PlayTypeID) { Lottery lottery = new Lottery(); string canonicalNumber = ""; string[] strArray = lottery[0x3e].ToSingle(LotteryNumber, ref canonicalNumber, PlayTypeID); if ((strArray == null) || (strArray.Length < 1)) { return ""; } LotteryNumber = ""; foreach (string str2 in strArray) { LotteryNumber = LotteryNumber + str2.Replace(" ", "|") + ","; } int length = strArray.Length; return (LotteryNumber + length.ToString()); }
//获得中奖的id public string GetAwardId(string type) { XmlDocument xml = new XmlDocument(); string xmlPath = Server.MapPath("/Upload/xml/Lotter.xml"); if (!File.Exists(xmlPath)) { return ""; } xml.Load(xmlPath); string strRateType = string.Empty; if (type == "0") strRateType = "GoldRate"; if (type == "1") strRateType = "JadeRate"; if (type == "2") strRateType = "SilverRate"; List<Lottery> list = new List<Lottery>(); int num = 0; int j = 1; XmlNodeList topM = xml.DocumentElement.ChildNodes; string str = ""; foreach (XmlElement element in topM) { Lottery lo = new Lottery(); lo.ID = Convert.ToInt32(element.Attributes["id"].Value); int m = 0; foreach (XmlElement xn in element.ChildNodes) { if (xn.Name == strRateType && xn.InnerText != "0") { lo.Min = num + 1; num += Convert.ToInt32(xn.InnerText) * 100; str += ":" + num; m = 1; } else { } } lo.Max = num; lo.OrderID = j; j++; if (m == 1) { list.Add(lo); } } Random ran = new Random(); int i = ran.Next(1, 10001); //如果第一次随机没有选中,则在可中选项中随机选取一个 foreach (Lottery lo1 in list) { str += ":" + lo1.Max; if (lo1.Min != lo1.Max) { if (i >= lo1.Min && i <= lo1.Max) { return lo1.ID.ToString(); ; } else { } } } return "0"; }
public void RunTests() { var lottery = new Lottery(); Assert.AreEqual(new[] { "PICK TWO LIMITED", "PICK TWO IN ORDER", "PICK TWO DIFFERENT", "PICK ANY TWO" }, lottery.sortByOdds(new[] { "PICK ANY TWO: 10 2 F F", "PICK TWO IN ORDER: 10 2 T F", "PICK TWO DIFFERENT: 10 2 F T", "PICK TWO LIMITED: 10 2 T T" })); Assert.AreEqual(new[] { "RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "INDIGO", "VIOLET" }, lottery.sortByOdds(new[] { "INDIGO: 93 8 T F", "ORANGE: 29 8 F T", "VIOLET: 76 6 F F", "BLUE: 100 8 T T", "RED: 99 8 T T", "GREEN: 78 6 F T", "YELLOW: 75 6 F F" })); }
private void Buy(Users _User) { string request = Shove._Web.Utility.GetRequest("HidIsuseID"); string str2 = Shove._Web.Utility.GetRequest("HidIsuseEndTime"); string str3 = Shove._Web.Utility.GetRequest("playType"); Shove._Web.Utility.GetRequest("CoBuy"); string s = Shove._Web.Utility.GetRequest("tb_Share"); string str5 = Shove._Web.Utility.GetRequest("tb_BuyShare"); Shove._Web.Utility.GetRequest("tb_AssureShare"); string str6 = Shove._Web.Utility.GetRequest("tb_OpenUserList"); string str7 = Shove._Web.Utility.GetRequest("tb_Title"); string str8 = Shove._Web.Utility.GetRequest("tb_Description"); string str9 = Shove._Web.Utility.GetRequest("SecrecyLevel"); string str10 = Shove._Web.Utility.FilteSqlInfusion(base.Request["tb_LotteryNumber"]); string str11 = Shove._Web.Utility.GetRequest("tb_hide_SumMoney"); string str12 = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney"); string str13 = Shove._Web.Utility.GetRequest("tb_hide_SumNum"); string str14 = Shove._Web.Utility.GetRequest("HidLotteryID"); string str15 = Shove._Web.Utility.GetRequest("tb_Multiple"); string str16 = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale"); string str17 = Shove._Web.Utility.GetRequest("tbPlayTypeID"); string str18 = Shove._Web.Utility.GetRequest("tb_SchemeMoney"); int num = 2; if (str15 == "") { str15 = "1"; } double money = 0.0; int share = 0; int buyShare = 0; double assureMoney = 0.0; int multiple = 0; int num7 = 0; short num8 = 0; int playType = 0; int num10 = 0; long isuseID = 0L; double schemeBonusScale = 0.0; try { money = double.Parse(str11); share = int.Parse(s); buyShare = int.Parse(str5); assureMoney = double.Parse(str12); multiple = int.Parse(str15); num7 = int.Parse(str13); num8 = short.Parse(str9); playType = int.Parse(str17); num10 = int.Parse(str14); isuseID = long.Parse(request); schemeBonusScale = double.Parse(str16); } catch { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); return; } if (str17 != str3) { money = double.Parse(str18); } if ((money > 0.0) && ((num7 >= 1) || !(str17 == str3))) { if (assureMoney < 0.0) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } else if (share < 1) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } else { if ((buyShare == share) && (assureMoney == 0.0)) { share = 1; buyShare = 1; } if ((money / ((double)share)) < 1.0) { JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。"); } else { double num13 = (buyShare * (money / ((double)share))) + assureMoney; if (num13 > _User.Balance) { this.SaveDataForAliBuy(); } else if (num13 > 10000000.0) { JavaScript.Alert(this.Page, "投注金额不能大于" + 0x989680.ToString() + ",谢谢。"); } else if (multiple > 0x3e7) { JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。"); } else if ((schemeBonusScale < 0.0) && (schemeBonusScale > 10.0)) { JavaScript.Alert(this.Page, "佣金比例只能在0~10之间"); } else if ((schemeBonusScale.ToString().IndexOf("-") > -1) || (schemeBonusScale.ToString().IndexOf(".") > -1)) { JavaScript.Alert(this.Page, "佣金比例输入有误"); } else { schemeBonusScale /= 100.0; string number = str10; if (str17 == str3) { if (number[number.Length - 1] == '\n') { number = number.Substring(0, number.Length - 1); } Lottery lottery = new Lottery(); string[] strArray = this.SplitLotteryNumber(number); if ((strArray == null) || (strArray.Length < 1)) { JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)"); return; } int num15 = 0; foreach (string str20 in strArray) { string str21 = lottery[num10].AnalyseScheme(str20, playType); if (!string.IsNullOrEmpty(str21)) { string[] strArray3 = str21.Split(new char[] { '|' }); if ((strArray3 != null) && (strArray3.Length >= 1)) { num15 += _Convert.StrToInt(strArray3[strArray3.Length - 1], 0); } } } if (num15 != num7) { JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。"); return; } } string returnDescription = ""; if (DateTime.Now >= _Convert.StrToDateTime(str2.Replace("/", "-"), DateTime.Now.AddDays(-1.0).ToString())) { JavaScript.Alert(this.Page, "本期投注已截止,谢谢。"); } else if ((str3 == str17) && (((num * num7) * multiple) != money)) { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } else { long num17 = _User.InitiateScheme(isuseID, playType, (str7.Trim() == "") ? "(无标题)" : str7.Trim(), str8.Trim(), number, "", multiple, money, assureMoney, share, buyShare, str6.Trim(), short.Parse(num8.ToString()), schemeBonusScale, ref returnDescription); if (num17 < 0L) { PF.GoError(1, returnDescription, base.GetType().FullName + "(-755)"); } else { Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + isuseID.ToString()); Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + isuseID.ToString()); if ((money > 50.0) && (share > 1)) { Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData"); } base.Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + num10.ToString() + "&&Money=" + num13.ToString() + "&SchemeID=" + num17.ToString()); } } } } } } else { JavaScript.Alert(this.Page, "输入有错误,请仔细检查。"); } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { Lottery lottery = new Lottery(); int lotteryID = _Convert.StrToInt(Utility.GetRequest("id"), -1); if (lottery.ValidID(lotteryID)) { this.tbLotteryID.Value = lotteryID.ToString(); this.strLotteryID = lotteryID.ToString(); this.strIsuse = ""; try { this.strIsuse = Utility.GetRequest("Isuse"); } catch { } this.tbIsuse.Value = this.strIsuse; int num2 = _Convert.StrToInt(Utility.GetRequest("PlayType"), -1); if (num2 >= 0) { this.strLotteryName = lottery[lotteryID].name; if (lottery[lotteryID].CheckPlayType(num2)) { this.tbPlayType.Value = num2.ToString(); this.strPlayType = num2.ToString(); this.tbSchemeFileName.Value = "null"; this.tbLotteryNumber.Value = "null"; this.strSchemeFileName = "null"; this.strLotteryNumber = "null"; } } } } }