private void BindData() { long schemeID = _Convert.StrToLong(Utility.GetRequest("id"), -1L); if (schemeID < 0L) { PF.GoError(1, "参数错误", base.GetType().FullName); } else { DataTable table = new Tables.T_Schemes().Open("InitiateUserID,LotteryNumber", "SiteID = " + base._Site.ID.ToString() + " and [ID] = " + schemeID.ToString(), ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().FullName); } else if (table.Rows.Count < 1) { PF.GoError(1, "参数错误", base.GetType().FullName); } else { _Convert.StrToLong(table.Rows[0]["InitiateUserID"].ToString(), -1L); if ((base._User != null) && !base._User.isCanViewSchemeContent(schemeID)) { PF.GoError(1, "对不起,您不在此方案的招股对象之内。", base.GetType().FullName); } else { string sourceStr = table.Rows[0]["LotteryNumber"].ToString(); base.Response.Write((sourceStr == "") ? "未找到相关数据。" : (_Convert.ToHtmlCode(sourceStr) + " ")); base.Response.End(); } } } }
protected void btnGO_Click(object sender, EventArgs e) { string str = Utility.FilteSqlInfusion(this.tbSchemeNumber.Text.Trim()); if (str == "") { JavaScript.Alert(this.Page, "请输入方案号。"); } else { DataTable table = new Tables.T_Schemes().Open("", "SchemeNumber='" + str + "'", ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_UploadWinLotteryImage"); } else if (table.Rows.Count < 1) { JavaScript.Alert(this.Page, "方案号不存在。"); } else { DataRow row = table.Rows[0]; if (!_Convert.StrToBool(row["Buyed"].ToString(), false)) { JavaScript.Alert(this.Page, "该方案号没有出票。"); } else if (Shove._IO.File.UploadFile(this.Page, this.fileImage, "../Temp/", "SchemeWinImage" + str + ".jpg", true, "image") < 0) { JavaScript.Alert(this.Page, "文件上传错误。"); } else { string path = base.Server.MapPath("../Temp/SchemeWinImage" + str + ".jpg"); byte[] buffer = System.IO.File.ReadAllBytes(path); System.IO.File.Delete(path); if (buffer == null) { JavaScript.Alert(this.Page, "文件格式错误。"); } else { MSSQL.ExecuteNonQuery("update T_Schemes set WinImage = @p1 where [SchemeNumber] = @p2", new MSSQL.Parameter[] { new MSSQL.Parameter("p1", SqlDbType.VarChar, 0, ParameterDirection.Input, buffer), new MSSQL.Parameter("p2", SqlDbType.VarChar, 0, ParameterDirection.Input, str) }); JavaScript.Alert(this.Page, "文件上传成功!"); } } } } }
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, "重构中奖描述成功。"); } } }
private void BindData() { long SchemeID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), -1); if (SchemeID < 0) { PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName); return; } DataTable dt = new DAL.Tables.T_Schemes().Open("InitiateUserID,LotteryNumber, PlayTypeID", "SiteID = " + _Site.ID.ToString() + " and [ID] = " + SchemeID.ToString(), ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().FullName); return; } if (dt.Rows.Count < 1) { PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName); return; } long InitiateUserID = Shove._Convert.StrToLong(dt.Rows[0]["InitiateUserID"].ToString(), -1); //既不是发起人,也不在招股对象之内 if (_User != null && !_User.isCanViewSchemeContent(SchemeID)) { PF.GoError(ErrorNumber.Unknow, "对不起,您不在此方案的招股对象之内。", this.GetType().FullName); return; } string LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString(); if (Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) > 7200 && Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) < 7300) { string CacheKey = "JCZC_Scheme_Bind"; DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey); if (dtMatch == null) { dtMatch = new DAL.Tables.T_Match().Open("ID, MatchNumber, StopSellingTime", "", ""); if(dtMatch == null) { return; } if (dtMatch.Rows.Count < 1) { return; } Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600); } string CanonicalNumber = ""; int PlayTypeID = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201); ArrayList al = new ArrayList(); string[] strs = LotteryNumber.Split('\n'); if (strs == null) return; if (strs.Length == 0) return; string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString(); string[] LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n'); string[] strNumbers = null; if (LotteryNumbers.Length < 2) { for (int i = 0; i < strs.Length; i++) { if (string.IsNullOrEmpty(strs[i])) { continue; } strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID); if (strNumbers == null) { continue; } for (int j = 0; j < strNumbers.Length; j++) { al.Add(strNumbers[j]); } } LotteryNumbers = new string[al.Count]; StringBuilder sbLotteryNumbers = new StringBuilder(); for (int i = 0; i < al.Count; i++) { if (i == al.Count) { sbLotteryNumbers.Append(al[i].ToString()); } else { sbLotteryNumbers.Append(al[i].ToString() + "\n"); } LotteryNumbers[i] = al[i].ToString(); } Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600); } StringBuilder sb = new StringBuilder(); sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">"); sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">"); sb.Append("<td width=\"8%\"><strong>序号</strong></td>"); sb.Append("<td><strong>过关场次</strong></td>"); sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>"); sb.Append("<td width=\"10%\"><strong>注数</strong></td>"); sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>"); string Number = ""; int No = 0; string BuyWays = ""; int Multiple = 0; int LotID = 0; int PlayID = 0; PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201); LotID = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72); DateTime EndTime = DateTime.Now; int pageindex = 1; if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p"))) { pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1); } int perPageRowCount = 30; if (pageindex < 1) { pageindex = 1; } foreach (string str in LotteryNumbers) { if (string.IsNullOrEmpty(str)) { continue; } No++; if (str.Split(';').Length < 3) { continue; } try { Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1); } catch { } if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount) { continue; } sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">"); sb.Append("<td>" + No.ToString() + "</td>"); Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2); string[] Numbers = Number.Split('|'); //if (Numbers.Length < 2) //{ // continue; //} sb.Append("<td height=\"20\">"); if (Numbers.Length == 1) { BuyWays = "单关"; } else { BuyWays = Numbers.Length.ToString() + "串1"; } long MatchID = 0; for (int i = 0; i < Numbers.Length; i++) { if (Numbers[i].IndexOf("(") < 0) { continue; } MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1); DataRow[] dr = dtMatch.Select("ID=" + MatchID.ToString()); if (dr.Length < 1) { continue; } sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";"); } sb.Append("</td>"); sb.Append("<td height=\"20\">" + BuyWays + "</td>"); sb.Append("<td>1</td>"); sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>"); } sb.Append("</table>"); labLotteryNumber.Text = sb.ToString(); StringBuilder sbpage = new StringBuilder(); int rowCount = No; int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1; if (SchemeID < 0) { sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"DownloadSchemeFile.aspx\">首页</a></span>"); if (pageindex == 1) { sbpage.Append("<span class=\"disabled\">« 上一页</span>"); } else { sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>"); } for (int i = 0; i < pageCount; i++) { if (i == pageindex - 1) { sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>"); continue; } if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10)) { sbpage.Append("<a href=\"DownloadSchemeFile.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>"); } } if (pageindex == pageCount) { sbpage.Append("<span class=\"disabled\">下一页 »</span>"); } else { sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>"); } sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>"); } else { sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "\">首页</a></span>"); if (pageindex == 1) { sbpage.Append("<span class=\"disabled\">« 上一页</span>"); } else { sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>"); } for (int i = 0; i < pageCount; i++) { if (i == pageindex - 1) { sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>"); continue; } if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10)) { sbpage.Append("<a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>"); } } if (pageindex == pageCount) { sbpage.Append("<span class=\"disabled\">下一页 »</span>"); } else { sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>"); } sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>"); } labLotteryNumber.Text += sbpage.ToString(); } else { LotteryNumber = PF.GetScriptResTable(LotteryNumber); if (LotteryNumber.IndexOf("table") < 0) { LotteryNumber = Shove._Convert.ToHtmlCode(LotteryNumber); } labLotteryNumber.Text = (LotteryNumber == "") ? "未找到相关数据。" : (LotteryNumber + " "); } }
//对返回的开奖号码,进行程序自动派奖 private void BonusQuery(string TransMessage) { System.Xml.XmlDocument XmlDoc = new XmlDocument(); XmlDoc.Load(new StringReader(TransMessage)); System.Xml.XmlNodeList nodes = XmlDoc.GetElementsByTagName("*"); string WinNumber = ""; string Issue = ""; string LotteryName = ""; if (nodes == null) { return; } for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Name.ToUpper() == "BONUSQUERYRESULT") { WinNumber = nodes[i].Attributes["bonusNumber"].Value.Replace(",", ""); } if (nodes[i].Name.ToUpper() == "ISSUE") { Issue = nodes[i].Attributes["number"].Value; LotteryName = nodes[i].Attributes["gameName"].Value; } } int LotteryID = GetLotteryID(LotteryName); if (LotteryID < 0) { return; } DataTable dtIssue = new DAL.Tables.T_Isuses().Open("top 1 *", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(Issue) + "' and isOpened = 0 and EndTime < GetDate()", ""); if (dtIssue == null) { new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue); return; } if (dtIssue.Rows.Count < 1) { return; } // 准备开奖,开奖之前,对出票不完整的方案进行处理(按系统的设定:当作已出票,或者撤单处理) //int ReturnValue = 0; //string ReturnDescription = ""; //DAL.Procedures.P_PrintOutNotFullHandle(LotteryID, "请电询", ref ReturnValue, ref ReturnDescription); DataTable dtWinMoneyList = new DAL.Tables.T_WinTypes().Open("DefaultMoney, DefaultMoneyNoWithTax", "LotteryID = " + LotteryID.ToString(), "[Order]"); if (dtWinMoneyList == null) { new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue); return; } double[] WinMoneyList = new double[dtWinMoneyList.Rows.Count * 2]; for (int i = 0; i < dtWinMoneyList.Rows.Count; i++) { WinMoneyList[i * 2] = Shove._Convert.StrToDouble(dtWinMoneyList.Rows[i][0].ToString(), 0); WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(dtWinMoneyList.Rows[i][1].ToString(), 0); } DataTable dtScheme = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + dtIssue.Rows[0]["ID"].ToString() + " and isOpened = 0", ""); if (dtScheme == null) { new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue); return; } if (dtScheme.Rows.Count > 0) { for (int i = 0; i < dtScheme.Rows.Count; i++) { string LotteryNumber = dtScheme.Rows[i]["LotteryNumber"].ToString(); string Description = ""; double WinMoneyNoWithTax = 0; double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtScheme.Rows[i]["PlayTypeID"].ToString()), WinMoneyList); Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtScheme.Rows[i]["ID"].ToString(), new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description)); } } //int SchemeCount = 0, QuashCount = 0, WinCount = 0, WinNoBuyCount = 0; // 总方案数,处理时撤单数,中奖数,中奖但未成功数 //ReturnValue = 0; //ReturnDescription = ""; DataSet ds = null; //DAL.Procedures.P_Win(ref ds, // long.Parse(dtIssue.Rows[0]["ID"].ToString()), // WinNumber, // "暂无", // 1, // true, // ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount, // ref ReturnValue, ref ReturnDescription); //if ((ds == null) || (ReturnDescription != "")) //{ // PF.GoError(ErrorNumber.DataReadWrite, ReturnDescription, this.GetType().BaseType.FullName); // return; //} PF.SendWinNotification(ds); }
// 接收开奖通知 private void IsuseOpenNotice(string Transmessage) { System.Xml.XmlDocument XmlDoc = new XmlDocument(); System.Xml.XmlNodeList nodes = null; System.Xml.XmlNodeList nodesBonusItem = null; System.Xml.XmlNodeList nodesIssue = null; try { XmlDoc.Load(new StringReader(Transmessage)); nodes = XmlDoc.GetElementsByTagName("*"); nodesBonusItem = XmlDoc.GetElementsByTagName("bonusItem"); nodesIssue = XmlDoc.GetElementsByTagName("issue"); } catch { } if (nodes == null) { return; } string BonusNumber = ""; for (int j = 0; j < nodes.Count; j++) { if (!(nodes[j].Name.ToUpper() == "BODY" && nodes[j].FirstChild.Name.ToUpper() == "BONUSNOTIFY")) { continue; } BonusNumber = nodes[j].FirstChild.Attributes["bonusNumber"].InnerText; } if (nodesIssue == null) { this.Response.End(); return; } string MessageID = nodes[0].Attributes["id"].Value; string number = nodesIssue[0].Attributes["number"].Value; string LotteryName = nodesIssue[0].Attributes["gameName"].Value; int LotteryID = GetLotteryID(LotteryName); string WinNumber = GetWinNumber(LotteryID, BonusNumber); DataTable dtIsuse = new DAL.Tables.T_Isuses().Open("", " [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0 and LotteryID in (select id from T_Lotteries where PrintOutType = 103)", ""); if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1)) { this.Response.End(); return; } string IsuseID = dtIsuse.Rows[0]["ID"].ToString(); DAL.Tables.T_Isuses T_Isuses = new DAL.Tables.T_Isuses(); T_Isuses.WinLotteryNumber.Value = WinNumber; T_Isuses.OpenOperatorID.Value = 1; T_Isuses.Update(" ID = " + IsuseID); DataTable dtWinTypesSSL = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), ""); if ((dtWinTypesSSL != null) && dtWinTypesSSL.Rows.Count > 0) { double[] WinMoneyList = new double[dtWinTypesSSL.Rows.Count * 2]; double DefaultMoney = 0; double DefaultMoneyNoWithTax = 0; for (int i = 0; i < dtWinTypesSSL.Rows.Count; i++) { DefaultMoney = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoney"].ToString(), 0); DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0); WinMoneyList[i * 2] = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax; WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax; } DataTable dtSchemesWithTaskDetails = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + IsuseID + " and WinMoney = 0 and Buyed = 1 and isnull(Identifiers, '') = ''", ""); string LotteryNumber = ""; SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID]; string Description = ""; double WinMoneyNoWithTax = 0; for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++) { LotteryNumber = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString(); Description = ""; WinMoneyNoWithTax = 0; double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList); if (WinMoney > 0) { Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, WinMoney = @p3, WinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(), new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description)); continue; } } } string BonusXML = "<Schemes>"; string AgentBonusXML = "<Schemes>"; if ((nodesBonusItem != null) && (nodesBonusItem.Count > 0)) { string bonusItemXML = Transmessage.Substring(Transmessage.IndexOf("<bonusNotify"), Transmessage.LastIndexOf("</body>") - Transmessage.IndexOf("<bonusNotify")); DataSet dsXML = new DataSet(); try { dsXML.ReadXml(new StringReader(bonusItemXML)); } catch (Exception e) { new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期解析开奖数据错误:" + e.Message); this.Response.End(); return; } if ((dsXML == null) || (dsXML.Tables.Count < 3)) { new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期开奖数据格式不符合要求。"); this.Response.End(); return; } DataTable dtTickets = dsXML.Tables[2]; DataTable dtSchemes = MSSQL.Select("SELECT SchemeID, 0 AS AgentID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + IsuseID + ")"); if (dtSchemes == null) { new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期,读取本地方案错误。"); this.Response.End(); return; } try { var query1 = from NewDtTickets in dtTickets.AsEnumerable() join NewdtScheme in dtSchemes.AsEnumerable() on NewDtTickets.Field<string>("ticketID") equals NewdtScheme.Field<string>("Identifiers") select new { ID = NewdtScheme.Field<long>("SchemeID"), AgentID = 0,//NewdtScheme.Field<long>("AgentID"), Multiple = NewdtScheme.Field<int>("Multiple"), Bonus = Shove._Convert.StrToDouble(NewDtTickets.Field<string>("money"), 0), BonusLevel = NewDtTickets.Field<string>("bonusLevel"), Size = Shove._Convert.StrToInt(NewDtTickets.Field<string>("size"), 1) }; var query2 = from NewDt in query1.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 = GetSchemeWinDescription(gg.Key.BonusLevel, LotteryID, (gg.Sum(NewDt => NewDt.Size) / gg.Key.Multiple)) }; var query3 = from NewDt in query2.AsQueryable() group NewDt by new { NewDt.ID, NewDt.Multiple, 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() + "倍)" : "") }; foreach (var Scheme in query3) { if (Scheme.AgentID == 0) { BonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />"; } else { AgentBonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />"; } } } catch (Exception e) { new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期详细中奖数据解析错误:" + e.Message); this.Response.End(); return; } } BonusXML += "</Schemes>"; AgentBonusXML += "</Schemes>"; dtIsuse = new DAL.Tables.T_Isuses().Open("", "[ID] = " + IsuseID + " and IsOpened = 0", ""); if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1)) { this.Response.End(); return; } int ReturnValue = 0; string ReturnDescription = ""; DataSet ds = null; int Times = 0; int Result = -1; while ((Result < 0) && (Times < 5)) { ReturnValue = 0; ReturnDescription = ""; Result = DAL.Procedures.P_ElectronTicketWin(ref ds, Shove._Convert.StrToLong(IsuseID, 0), BonusXML, AgentBonusXML, ref ReturnValue, ref ReturnDescription); if (Result < 0) { new Log("ElectronTicket\\HPJX").Write("电子票第 " + (Times + 1).ToString() + " 次派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString()); Times++; if (Times < 5) { System.Threading.Thread.Sleep(10000); } continue; } } if (ReturnValue < 0) { new Log("ElectronTicket\\HPJX").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString() + ",错误:" + ReturnDescription); this.Response.End(); return; } PF.SendWinNotification(ds); DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), ""); if ((dtWinTypes != null) && dtWinTypes.Rows.Count > 0) { double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2]; double DefaultMoney = 0; double DefaultMoneyNoWithTax = 0; for (int i = 0; i < dtWinTypes.Rows.Count; i++) { DefaultMoney = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoney"].ToString(), 0); DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0); WinMoneyList[i * 2] = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax; WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax; } DataTable dtSchemesWithTaskDetails = new DAL.Views.V_Schemes().Open("", "IsuseID = " + IsuseID + " and IsuseName = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + " and WinMoney = 0 and Buyed = 0 and ID in ( select ID from V_ChaseTaskDetails where IsuseName = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + ")", ""); string LotteryNumber = ""; SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID]; string Description = ""; double WinMoneyNoWithTax = 0; for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++) { LotteryNumber = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString(); Description = ""; WinMoneyNoWithTax = 0; double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList); if (WinMoney > 0) { if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["SiteID"].ToString(), 0), Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescription) < 0) { new Log("ElectronTicket\\HPJX").Write("执行电子票--判断是否停止追号的时候出现错误"); } continue; } } } MessageID = nodes[0].Attributes["id"].Value; ReNotice(MessageID, "508"); }
private void Bind(long SchemeID) { string LotteryNumber = ""; string[] LotteryNumbers = null; string CacheKey = "JCZC_Scheme_Bind"; DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey); if (SchemeID < 0) { string FileName = Request.Cookies["ASP.NET_SessionId"].Value; try { LotteryNumber = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + FileName + ".txt"); } catch { } if (string.IsNullOrEmpty(LotteryNumber)) { Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!"); return; } LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n'); if (dtMatch == null) { dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", ""); } } if (string.IsNullOrEmpty(LotteryNumber)) { string SchemeInfo = ""; try { SchemeInfo = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "SchemeInfo\\" + SchemeID.ToString() + ".txt"); } catch { } if (string.IsNullOrEmpty(SchemeInfo)) { DataTable dt = new DAL.Tables.T_Schemes().Open("", "ID=" + SchemeID.ToString(), ""); if (dt == null) { Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!"); return; } if (dt.Rows.Count < 1) { Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!"); return; } LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString(); ArrayList al = new ArrayList(); string[] strs = LotteryNumber.Split('\n'); if (strs == null) return; if (strs.Length == 0) return; string CanonicalNumber = ""; int PlayTypeID = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201); string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString(); LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n'); string[] strNumbers = null; if (LotteryNumbers.Length < 2) { for (int i = 0; i < strs.Length; i++) { if (string.IsNullOrEmpty(strs[i])) { continue; } strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID); if (strNumbers == null) { continue; } for (int j = 0; j < strNumbers.Length; j++) { al.Add(strNumbers[j]); } } LotteryNumbers = new string[al.Count]; StringBuilder sbLotteryNumbers = new StringBuilder(); for (int i = 0; i < al.Count; i++) { if (i == al.Count) { sbLotteryNumbers.Append(al[i].ToString()); } else { sbLotteryNumbers.Append(al[i].ToString() + "\n"); } LotteryNumbers[i] = al[i].ToString(); } Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600); } if (dtMatch == null) { dtMatch = new DAL.Tables.T_Match().Open("ID as MatchID, MatchNumber, StopSellingTime as StopSellTime", "", ""); } } else { LotteryNumber = SchemeInfo.Substring(0, SchemeInfo.LastIndexOf('$') - 1); LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n'); if (dtMatch == null) { dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "MatchID in (" + SchemeInfo.Substring(SchemeInfo.LastIndexOf('$')) + ")", ""); } } } if (dtMatch == null) { Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!"); return; } if (dtMatch.Rows.Count < 1) { return; } Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600); StringBuilder sb = new StringBuilder(); sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">"); sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">"); sb.Append("<td width=\"8%\"><strong>序号</strong></td>"); sb.Append("<td><strong>过关场次</strong></td>"); sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>"); sb.Append("<td width=\"10%\"><strong>注数</strong></td>"); sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>"); string Number = ""; int No = 0; string BuyWays = ""; int Multiple = 0; int LotID = 0; int PlayID = 0; PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201); LotID = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72); DateTime EndTime = DateTime.Now; int pageindex = 1; if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p"))) { pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1); } int perPageRowCount = 30; if (pageindex < 1) { pageindex = 1; } foreach (string str in LotteryNumbers) { if (string.IsNullOrEmpty(str)) { continue; } No++; if (str.Split(';').Length < 3) { continue; } try { Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1); } catch { } if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount) { continue; } sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">"); sb.Append("<td>" + No.ToString() + "</td>"); Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2); string[] Numbers = Number.Split('|'); if (Numbers.Length < 2) { continue; } sb.Append("<td height=\"20\">"); BuyWays = Numbers.Length.ToString() + "串1"; long MatchID = 0; for (int i = 0; i < Numbers.Length; i++) { if (Numbers[i].IndexOf("(") < 0) { continue; } MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1); DataRow[] dr = dtMatch.Select("MatchID=" + MatchID.ToString()); if (dr.Length < 1) { continue; } sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";"); } sb.Append("</td>"); sb.Append("<td height=\"20\">" + BuyWays + "</td>"); sb.Append("<td>1</td>"); sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>"); } sb.Append("</table>"); labLotteryNumber.Text = sb.ToString(); StringBuilder sbpage = new StringBuilder(); int rowCount = No; int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1; if (SchemeID < 0) { sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx\">首页</a></span>"); if (pageindex == 1) { sbpage.Append("<span class=\"disabled\">« 上一页</span>"); } else { sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>"); } for (int i = 0; i < pageCount; i++) { if (i == pageindex - 1) { sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>"); continue; } if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10)) { sbpage.Append("<a href=\"Scheme.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>"); } } if (pageindex == pageCount) { sbpage.Append("<span class=\"disabled\">下一页 »</span>"); } else { sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>"); } sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>"); } else { sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx?id="+ SchemeID.ToString() +"\">首页</a></span>"); if (pageindex == 1) { sbpage.Append("<span class=\"disabled\">« 上一页</span>"); } else { sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>"); } for (int i = 0; i < pageCount; i++) { if (i == pageindex - 1) { sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>"); continue; } if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10)) { sbpage.Append("<a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>"); } } if (pageindex == pageCount) { sbpage.Append("<span class=\"disabled\">下一页 »</span>"); } else { sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>"); } sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>"); } labLotteryNumber.Text += sbpage.ToString(); }
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); } } } } }
public string UpdateLotteryNumber(string id, string content, int Money) { DataTable dt = new DAL.Tables.T_Schemes().Open("","id=" + id,""); if (dt == null) { return ""; } if (dt.Rows.Count != 1) { return ""; } string Share = dt.Rows[0]["Share"].ToString(); string Schedule = dt.Rows[0]["Schedule"].ToString(); DAL.Tables.T_Schemes s = new DAL.Tables.T_Schemes(); s.LotteryNumber.Value = content; s.Money.Value = Money; s.Share.Value = Money; if (s.Update("ID=" + id) < 0) { return "修改方案号码失败!"; } return "上传成功!"; }
protected void btnGO_Step1_Click(object sender, EventArgs e) { btnGO_Step1.AlertText = ""; if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID) { Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。"); return; } tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text)) { Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!"); return; } SystemOptions so = new SystemOptions(); bool isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true); string WinListXML = "<WinLists>"; double[] WinMoneyList = new double[g.Rows.Count * 2]; for (int i = 0; i < g.Rows.Count; i++) { WinMoneyList[i * 2] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0); WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0); if (WinMoneyList[i * 2] < 0) { Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!"); return; } if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1]) { if (isCompareWinMoneyNoWithFax) { Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!"); return; } } WinListXML += "<WinList defaultMoney=\"" + WinMoneyList[i * 2].ToString() + "\" DefaultMoneyNoWithTax=\"" + WinMoneyList[i * 2 + 1].ToString() + "\"/>"; } WinListXML += "</WinLists>"; DataTable dtIsuseBonuses = new DAL.Tables.T_IsuseBonuses().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue), ""); if (dtIsuseBonuses == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if (dtIsuseBonuses.Rows.Count < 1) { int ReturnValue = -1; string ReturnDescription = ""; int Result = DAL.Procedures.P_IsuseBonusesAdd(Shove._Convert.StrToLong(ddlIsuse.SelectedValue, 0), _User.ID, WinListXML, ref ReturnValue, ref ReturnDescription); if (Result < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if (ReturnValue < 0) { Shove._Web.JavaScript.Alert(this.Page, ReturnDescription); return; } Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!"); return; } if (dtIsuseBonuses.Rows[0]["UserID"].ToString() == _User.ID.ToString()) { Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!"); return; } for (int i = 0; i < dtIsuseBonuses.Rows.Count; i++) { if ((WinMoneyList[i * 2] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["defaultMoney"].ToString(), 0)) || (WinMoneyList[i * 2 + 1] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0))) { DAL.Tables.T_IsuseBonuses T_IsuseBonuses = new DAL.Tables.T_IsuseBonuses(); T_IsuseBonuses.Delete("IsuseID = " + ddlIsuse.SelectedValue); Shove._Web.JavaScript.Alert(this.Page, "两次奖项输入不一致,请联系上一次开奖操作员!"); return; } } DataTable dt = new DAL.Tables.T_Schemes().Open("* ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1", "[ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } StringBuilder sb = new StringBuilder(); string NoWinSchemeID = ""; for (int i = 0; i < dt.Rows.Count; i++) { string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString(); string Description = ""; double WinMoneyNoWithTax = 0; double WinMoney = 0; try { WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList); } catch { WinMoney = 0; new Log("System").Write("方案 ID:" + dt.Rows[i]["ID"].ToString() + " 算奖出现错误!"); } if (WinMoney == 0) { NoWinSchemeID += dt.Rows[i]["ID"].ToString() + ","; continue; } sb.Append("update T_Schemes set EditWinMoney = ").Append(WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1)) .Append(", EditWinMoneyNoWithTax = ").Append(WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1)) .Append(", WinDescription = '").Append(Description).Append("'") .Append(" where [ID] = ").AppendLine(dt.Rows[i]["ID"].ToString()); } Shove.Database.MSSQL.ExecuteNonQuery(sb.ToString(), new Shove.Database.MSSQL.Parameter[0]); if (NoWinSchemeID.EndsWith(",")) { NoWinSchemeID = NoWinSchemeID.Substring(0, NoWinSchemeID.Length - 1); } if (!string.IsNullOrEmpty(NoWinSchemeID)) { StringBuilder sb1 = new StringBuilder(); sb1.Append("update T_Schemes set EditWinMoney = 0") .Append(", EditWinMoneyNoWithTax = 0, isOpened = 1 , OpenOperatorID=" + _User.ID.ToString()) .Append(", WinDescription = ''") .Append(" where [ID] in (" + NoWinSchemeID + ")"); Shove.Database.MSSQL.ExecuteNonQuery(sb1.ToString(), new Shove.Database.MSSQL.Parameter[0]); } dt = new DAL.Tables.T_Schemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1 and WinDescription is null", "[ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } Step1IsOpen = (dt.Rows.Count > 0); btnGO_Step1.Enabled = Step1IsOpen; btnGO_Step2.Enabled = (!Step1IsOpen); btnGO_Step3.Enabled = ((!Step1IsOpen) && (!Step2IsOpen)); string Message = "请再次执行第一步"; if (!Step1IsOpen) { Message = "开奖步骤一已经完成,请执行第二步."; } Shove._Web.JavaScript.Alert(this.Page, Message); }
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 })); } } } } }
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"); } } } } } }
public int JoinScheme(long SchemeID, int Share, ref string ReturnDescription) { if (this.ID < 0L) { throw new Exception("Users 尚未初始化到具体的数据实例上,请先使用 GetUserInformation 等获取数据信息"); } int returnValue = -1; ReturnDescription = ""; if (Procedures.P_JoinScheme(this.Site.ID, this.ID, SchemeID, Share, false, ref returnValue, ref ReturnDescription) < 0) { ReturnDescription = "数据库读写错误"; return -1; } if (returnValue < 0) { return returnValue; } string returnDescription = ""; this.GetUserInformationByID(ref returnDescription); if ((this.Email != "") && Functions.F_GetIsSendNotification(this.SiteID, 2, "JoinScheme", this.ID)) { string subject = ""; string body = ""; this.Site.SiteNotificationTemplates.SplitEmailTemplate(this.Site.SiteNotificationTemplates[2, "JoinScheme"], ref subject, ref body); if ((subject != "") && (body != "")) { DataTable table = new Tables.T_Schemes().Open("", "[id] = " + SchemeID.ToString(), ""); string str4 = ""; int num3 = 0; double num4 = 0.0; int num5 = 0; if ((table != null) && (table.Rows.Count > 0)) { str4 = table.Rows[0]["LotteryNumber"].ToString(); num3 = _Convert.StrToInt(table.Rows[0]["Multiple"].ToString(), 0); num4 = _Convert.StrToDouble(table.Rows[0]["Money"].ToString(), 0.0); num5 = _Convert.StrToInt(table.Rows[0]["Share"].ToString(), 0); } if (((str4 != "") && (num3 > 0)) && ((num4 > 0.0) && (num5 > 0))) { subject = subject.Replace("[UserName]", this.Name); body = body.Replace("[UserName]", this.Name).Replace("[SchemeID]", SchemeID.ToString()).Replace("[LotteryNumber]", str4.Replace("\n", "<BR />")).Replace("[Multiple]", num3.ToString()).Replace("[Money]", num4.ToString("N")).Replace("[Share]", num5.ToString()).Replace("[BuyShare]", Share.ToString()); PF.SendEmail(this.Site, this.Email, subject, body); } } } if (((this.Mobile != "") && this.isMobileValided) && Functions.F_GetIsSendNotification(this.SiteID, 1, "JoinScheme", this.ID)) { string content = this.Site.SiteNotificationTemplates[1, "JoinScheme"]; if (content != "") { content = content.Replace("[UserName]", this.Name).Replace("[SchemeID]", SchemeID.ToString()); PF.SendSMS(this.Site, this.ID, this.Mobile, content); } } if (Functions.F_GetIsSendNotification(this.SiteID, 3, "JoinScheme", this.ID)) { string str6 = this.Site.SiteNotificationTemplates[3, "JoinScheme"]; if (str6 != "") { str6 = str6.Replace("[UserName]", this.Name).Replace("[SchemeID]", SchemeID.ToString()); PF.SendStationSMS(this.Site, this.Site.AdministratorID, this.ID, 2, str6); } } return 0; }
private void BonusQuery(string TransMessage) { XmlDocument document = new XmlDocument(); document.Load(new StringReader(TransMessage)); XmlNodeList elementsByTagName = document.GetElementsByTagName("*"); string winNumber = ""; string input = ""; string gameName = ""; if (elementsByTagName != null) { for (int i = 0; i < elementsByTagName.Count; i++) { if (elementsByTagName[i].Name.ToUpper() == "BONUSQUERYRESULT") { winNumber = elementsByTagName[i].Attributes["bonusNumber"].Value.Replace(",", ""); } if (elementsByTagName[i].Name.ToUpper() == "ISSUE") { input = elementsByTagName[i].Attributes["number"].Value; gameName = elementsByTagName[i].Attributes["gameName"].Value; } } int lotteryID = this.GetLotteryID(gameName); if (lotteryID >= 0) { DataTable table = new Tables.T_Isuses().Open("top 1 *", "LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(input) + "' and isOpened = 0 and EndTime < GetDate()", ""); if (table == null) { new Log(@"ElectronTicket\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + gameName + ",期号:" + input); } else if (table.Rows.Count >= 1) { DataTable table2 = new Tables.T_WinTypes().Open("DefaultMoney, DefaultMoneyNoWithTax", "LotteryID = " + lotteryID.ToString(), "[Order]"); if (table2 == null) { new Log(@"ElectronTicket\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + gameName + ",期号:" + input); } else { double[] winMoneyList = new double[table2.Rows.Count * 2]; for (int j = 0; j < table2.Rows.Count; j++) { winMoneyList[j * 2] = _Convert.StrToDouble(table2.Rows[j][0].ToString(), 0.0); winMoneyList[(j * 2) + 1] = _Convert.StrToDouble(table2.Rows[j][1].ToString(), 0.0); } DataTable table3 = new Tables.T_Schemes().Open("", "IsuseID = " + table.Rows[0]["ID"].ToString() + " and isOpened = 0", ""); if (table3 == null) { new Log(@"ElectronTicket\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + gameName + ",期号:" + input); } else { if (table3.Rows.Count > 0) { for (int k = 0; k < table3.Rows.Count; k++) { string number = table3.Rows[k]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double num6 = new Lottery()[lotteryID].ComputeWin(number, winNumber, ref description, ref winMoneyNoWithTax, int.Parse(table3.Rows[k]["PlayTypeID"].ToString()), winMoneyList); MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + table3.Rows[k]["ID"].ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, num6 * _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, num6 * _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) }); } } DataSet ds = null; PF.SendWinNotification(ds); } } } } } }
public int JoinScheme(long SchemeID, int Share, ref string ReturnDescription) { if (ID < 0) { throw new Exception("Users 尚未初始化到具体的数据实例上,请先使用 GetUserInformation 等获取数据信息"); } int ReturnValue = -1; ReturnDescription = ""; int Result = DAL.Procedures.P_JoinScheme(Site.ID, ID, SchemeID, Share, false, ref ReturnValue, ref ReturnDescription); if (Result < 0) { ReturnDescription = "数据库读写错误"; return -1; } if (ReturnValue < 0) { return ReturnValue; } string ReturnDescription_2 = ""; GetUserInformationByID(ref ReturnDescription_2); //Send Email if ((Email != "") && (DAL.Functions.F_GetIsSendNotification(SiteID, NotificationManners.Email, NotificationTypes.JoinScheme, ID))) { string EmailSubject = "", EmailBody = ""; Site.SiteNotificationTemplates.SplitEmailTemplate(Site.SiteNotificationTemplates[NotificationManners.Email, NotificationTypes.JoinScheme], ref EmailSubject, ref EmailBody); if ((EmailSubject != "") && (EmailBody != "")) { DataTable dt = new DAL.Tables.T_Schemes().Open("", "[id] = " + SchemeID.ToString(), ""); string LotteryNumber = ""; int Multiple = 0; double Money = 0; int SumShare = 0; if ((dt != null) && (dt.Rows.Count > 0)) { LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString(); Multiple = Shove._Convert.StrToInt(dt.Rows[0]["Multiple"].ToString(), 0); Money = Shove._Convert.StrToDouble(dt.Rows[0]["Money"].ToString(), 0); SumShare = Shove._Convert.StrToInt(dt.Rows[0]["Share"].ToString(), 0); } if ((LotteryNumber != "") && (Multiple > 0) && (Money > 0) && (SumShare > 0)) { EmailSubject = EmailSubject.Replace("[UserName]", Name); EmailBody = EmailBody.Replace("[UserName]", Name); EmailBody = EmailBody.Replace("[SchemeID]", SchemeID.ToString()); EmailBody = EmailBody.Replace("[LotteryNumber]", LotteryNumber.Replace("\n", "<BR />")); EmailBody = EmailBody.Replace("[Multiple]", Multiple.ToString()); EmailBody = EmailBody.Replace("[Money]", Money.ToString("N")); EmailBody = EmailBody.Replace("[Share]", SumShare.ToString()); EmailBody = EmailBody.Replace("[BuyShare]", Share.ToString()); PF.SendEmail(Site, Email, EmailSubject, EmailBody); } } } //Send SMS if ((Mobile != "") && isMobileValided && (DAL.Functions.F_GetIsSendNotification(SiteID, NotificationManners.SMS, NotificationTypes.JoinScheme, ID))) { string Body = Site.SiteNotificationTemplates[NotificationManners.SMS, NotificationTypes.JoinScheme]; if (Body != "") { Body = Body.Replace("[UserName]", Name); Body = Body.Replace("[SchemeID]", SchemeID.ToString()); PF.SendSMS(Site, ID, Mobile, Body); } } //Send StationSMS if (DAL.Functions.F_GetIsSendNotification(SiteID, NotificationManners.StationSMS, NotificationTypes.JoinScheme, ID)) { string Body = Site.SiteNotificationTemplates[NotificationManners.StationSMS, NotificationTypes.JoinScheme]; if (Body != "") { Body = Body.Replace("[UserName]", Name); Body = Body.Replace("[SchemeID]", SchemeID.ToString()); PF.SendStationSMS(Site, Site.AdministratorID, ID, StationSMSTypes.SystemMessage, Body); } } return 0; }
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(); } } } } }
// 接收奖期通知 private void IsuseNotice(string TransMessage) { System.Xml.XmlDocument XmlDoc = new XmlDocument(); try { XmlDoc.Load(new StringReader(TransMessage)); } catch { } DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses(); string Body = TransMessage.Substring(TransMessage.IndexOf("<elements"), TransMessage.LastIndexOf("</elements>") - TransMessage.IndexOf("<elements")) + "</elements>"; DataSet ds = new DataSet(); ds.ReadXml(new StringReader(Body)); if (ds == null) { return; } if (ds.Tables.Count == 0) { return; } DataTable dt = ds.Tables[0]; if (dt.Rows.Count < 1) { return; } string MessageID = ""; for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string LotteryName = dr["lotteryid"].ToString(); int LotteryID = GetLotteryID(LotteryName); string IsuseName = GetIsusesNameToCaiyou(LotteryID.ToString(), dr["issue"].ToString()); string Status = dr["status"].ToString(); string StartTime = dr["starttime"].ToString(); string EndTime = dr["endtime"].ToString(); string WinNumber = ""; if (Shove._Convert.StrToInt(Status, 0) > 1) { try { WinNumber = GetWinNumber(LotteryID, dr["bonuscode"].ToString()); } catch { } } if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName))) { continue; } if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and year(StartTime) = YEAR(GETDATE())") < 1) { DateTime _StartTime = DateTime.Now; DateTime _EndTime = DateTime.Now; try { _StartTime = DateTime.Parse(StartTime); _EndTime = DateTime.Parse(EndTime); } catch { continue; } long IsuseID = -1; string ReturnDescription = ""; if (DAL.Procedures.P_IsuseAdd(LotteryID, IsuseName, _StartTime, _EndTime, "", ref IsuseID, ref ReturnDescription) < 0) { continue; } if (IsuseID < 0) { continue; } } DataTable dtIsuse = t_Isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and year(StartTime) = YEAR(GETDATE())", ""); if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1)) { continue; } if (Status == "1") { int ReturnValue = 0; string ReturnDescprtion = ""; if (DAL.Procedures.P_ElectronTicketAgentSchemeQuash(Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), ref ReturnValue, ref ReturnDescprtion) < 0) { new Log("ElectronTicket\\ZCW").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash"); continue; } } bool isHasUpdate = false; if (dtIsuse.Rows[0]["State"].ToString() != Status) { isHasUpdate = true; } if (isHasUpdate) { int ReturnValue = 0; string ReturnDescprtion = ""; if (DAL.Procedures.P_IsuseUpdate(LotteryID, Shove._Web.Utility.FilteSqlInfusion(IsuseName), Shove._Convert.StrToShort(Status, 0), Shove._Convert.StrToDateTime(StartTime, DateTime.Now.ToString()), Shove._Convert.StrToDateTime(EndTime, DateTime.Now.ToString()), DateTime.Now, WinNumber, ref ReturnValue, ref ReturnDescprtion) < 0) { new Log("ElectronTicket\\ZCW").Write("电子票撤销追号错误P_IsuseEdit。"); } if (ReturnValue < 0) { new Log("ElectronTicket\\ZCW").Write(ReturnDescprtion); } } if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber)) { DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", "LotteryID =" + LotteryID.ToString(), ""); double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2]; for (int k = 0; k < dtWinTypes.Rows.Count; k++) { if (Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1) < 1) { MessageID = GetFromXPath(TransMessage, "message/header/messengerid"); ReNotice(MessageID, "13008"); return; } WinMoneyList[k * 2] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1); WinMoneyList[k * 2 + 1] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1); } #region 开奖第一步 DataTable dtWin = null; dtWin = new DAL.Tables.T_Schemes().Open("LotteryNumber,PlayTypeID,Multiple,ID", "isOpened = 0 and IsuseID = " + dtIsuse.Rows[0]["ID"].ToString(), "[ID]"); if (dtWin == null) { return; } for (int y = 0; y < dtWin.Rows.Count; y++) { string LotteryNumber = ""; try { LotteryNumber = dtWin.Rows[y]["LotteryNumber"].ToString(); } catch { } string Description = ""; double WinMoneyNoWithTax = 0; try { double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtWin.Rows[y]["PlayTypeID"].ToString()), WinMoneyList); Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtWin.Rows[y]["ID"].ToString(), new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)), new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description)); } catch { continue; } } #endregion #region 开奖第二步 string OpenAffiche = new OpenAfficheTemplates()[LotteryID]; int SchemeCount, QuashCount, WinCount, WinNoBuyCount; bool isEndOpen = false; int ReturnValue = 0; string ReturnDescription = ""; while (!isEndOpen) { SchemeCount = 0; QuashCount = 0; WinCount = 0; WinNoBuyCount = 0; // 总方案数,处理时撤单数,中奖数,中奖但未成功数 ReturnValue = 0; ReturnDescription = ""; DataSet dsWin = null; DAL.Procedures.P_Win(ref dsWin, Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), WinNumber, OpenAffiche, 1, true, ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount, ref isEndOpen, ref ReturnValue, ref ReturnDescription); } #endregion } } MessageID = GetFromXPath(TransMessage, "message/header/messengerid"); ReNotice(MessageID, "13008"); }
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 btnGO_Step3_Click(object sender, EventArgs e) { btnGO_Step1.AlertText = ""; if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID) { Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。"); return; } tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text)) { Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!"); return; } int SchemeCount = 0, QuashCount = 0, WinCount = 0, WinNoBuyCount = 0; // 总方案数,处理时撤单数,中奖数,中奖但未成功数 int ReturnValue = -1; string ReturnDescription = ""; DataSet ds = null; bool isEndOpen = false; string ConnectionString2 = Shove._Web.WebConfig.GetAppSettingsString("ConnectionString"); SqlConnection conn1 = Shove.Database.MSSQL.CreateDataConnection<System.Data.SqlClient.SqlConnection>(ConnectionString2 + ";Connect Timeout=120;"); int Result = P_Win(conn1, ref ds, long.Parse(ddlIsuse.SelectedValue), tbWinNumber.Text.Trim(), tbOpenAffiche.Value, _User.ID, true, ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount, ref isEndOpen, ref ReturnValue, ref ReturnDescription); if ((ds == null) || (ReturnDescription != "") || (ReturnValue < 0) || (Result < 0)) { Response.Write(ddlIsuse.SelectedValue + "<br>"); Response.Write(tbWinNumber.Text.Trim() + "<br>"); Response.Write(tbOpenAffiche.Value + "<br>"); Response.Write(_User.ID.ToString() + "<br>"); Response.Write(SchemeCount.ToString() + "<br>"); Response.Write(QuashCount.ToString() + "<br>"); Response.Write(WinCount.ToString() + "<br>"); Response.Write(WinNoBuyCount.ToString() + "<br>"); Response.Write(isEndOpen.ToString() + "<br>"); Response.Write(ReturnValue.ToString() + "<br>"); Response.Write(ReturnDescription.ToString() + "<br>"); Response.Write(Result.ToString() + "<br>"); //PF.GoError(ErrorNumber.DataReadWrite, "数据库读写错误。", this.GetType().BaseType.FullName + Result); return; } PF.SendWinNotification(ds); btnGO_Step1.Enabled = false; btnGO_Step2.Enabled = false; btnGO_Step3.Enabled = true; string Message = "开奖成功,总方案 {0} 个,撤单未满员或未出票方案 {1} 个,有效中奖方案 {2} 个。本期开奖还未全部完成, 请继续操作第三步。"; if (isEndOpen) { BindDataForIsuse(); btnGO_Step3.Enabled = false; Message = "开奖成功,总方案 {0} 个,撤单未满员或未出票方案 {1} 个,有效中奖方案 {2} 个。本期开奖已全部完成。"; } DataTable dt = new DAL.Tables.T_Schemes().Open("", "IsuseID=" + Shove._Convert.StrToLong(ddlIsuse.SelectedValue, 0).ToString(), ""); if (dt == null) { Shove._Web.JavaScript.Alert(this.Page, "开奖出现异常!请联系开发维护人员"); return; } SchemeCount = dt.Rows.Count; DataRow[] dr = dt.Select("QuashStatus <> 0"); QuashCount = dr.Length; dr = dt.Select("WinMoney > 0"); WinCount = dr.Length; Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + ddlLottery.SelectedValue); Shove._Web.JavaScript.Alert(this.Page, String.Format(Message, SchemeCount, QuashCount, WinCount)); }
protected void btnGO_Click(object sender, System.EventArgs e) { tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text)) { Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!"); return; } double[] WinMoneyList = new double[g.Rows.Count * 2]; for (int i = 0; i < g.Rows.Count; i++) { WinMoneyList[i * 2] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0); WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0); if (WinMoneyList[i * 2] < 0) { Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!"); return; } } DAL.Tables.T_Schemes T_Schemes = new DAL.Tables.T_Schemes(); DataTable dt = T_Schemes.Open("", "IsuseID = " + ddlIsuse.SelectedValue + " and isOpened = 1", ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } for (int i = 0; i < dt.Rows.Count; i++) { string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString(); string Description = ""; double WinMoneyNoWithTax = 0; double WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList); int Multiple = Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1); T_Schemes.WinDescription.Value = Description; T_Schemes.Update("[ID] = " + dt.Rows[i]["ID"].ToString()); } //tbWinNumber.Text = ""; Shove._Web.JavaScript.Alert(this.Page, "重构中奖描述成功。"); }