protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { string str = e.Item.Cells[4].Text.Trim(); if (str.Length > 8) { str = str.Substring(0, 7) + ".."; } string text = e.Item.Cells[1].Text; if (text == "我的追号") { e.Item.Cells[3].Text = "<a href='ChaseDetail.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + e.Item.Cells[3].Text + "</Font></a>"; e.Item.Cells[4].Text = "<a href='ChaseDetail.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + str + "</Font></a>"; } else { e.Item.Cells[3].Text = "<a href='ChaseDetails.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + e.Item.Cells[3].Text + "</Font></a>"; e.Item.Cells[4].Text = "<a href='ChaseDetails.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + str + "</Font></a>"; } double num = _Convert.StrToDouble(e.Item.Cells[5].Text, 0.0); e.Item.Cells[5].Text = (num == 0.0) ? "" : num.ToString("N"); int num2 = _Convert.StrToInt(e.Item.Cells[6].Text, 0); int num3 = _Convert.StrToInt(e.Item.Cells[7].Text, 0); int num4 = _Convert.StrToInt(e.Item.Cells[13].Text, 0); int num5 = _Convert.StrToInt(e.Item.Cells[11].Text, 0); if (text == "我的追号") { e.Item.Cells[9].Text = (num2 > (num3 + num4)) ? "<Font color='Red'>进行中</font>" : "已终止"; } else { e.Item.Cells[9].Text = (num5 == 1) ? "已终止" : ((num2 == num3) ? "已完成" : "<Font color='Red'>进行中</font>"); } int num6 = _Convert.StrToInt(e.Item.Cells[12].Text, 1); double num7 = _Convert.StrToDouble(e.Item.Cells[8].Text, 0.0); if ((num6 == 1) || (num7 == 0.0)) { e.Item.Cells[8].Text = "完成方案"; } else { e.Item.Cells[8].Text = "单期中奖金额达到" + num7.ToString("N") + "元"; } if ((this.tdIsuses.Visible && (e.Item.Cells[9].Text != "已终止")) && (e.Item.Cells[9].Text != "已完成")) { if (e.Item.Cells[1].Text == "我的追号") { DataTable table = new Tables.T_ChaseTaskDetails().Open("Executed", "ChaseTaskID=" + e.Item.Cells[10].Text + " and IsuseID=" + this.ddlIsuses.SelectedValue, ""); if ((table != null) && (table.Rows.Count > 0)) { if (_Convert.StrToBool(table.Rows[0]["Executed"].ToString(), false)) { e.Item.Cells[9].Text = "已执行"; } else { e.Item.Cells[9].Text = "未执行"; } } } else if (new Tables.T_ExecutedChases().GetCount("ChaseID=" + e.Item.Cells[10].Text + " and SchemeID in (select ID from T_Schemes where IsuseID=" + this.ddlIsuses.SelectedValue + ")") > 0L) { e.Item.Cells[9].Text = "已执行"; } else { e.Item.Cells[9].Text = "未执行"; } } } }
// 接收奖期通知 private void IsuseNotice(string TransMessage) { System.Xml.XmlDocument XmlDoc = new XmlDocument(); System.Xml.XmlNodeList nodes = null; System.Xml.XmlNodeList nodesIssue = null; try { XmlDoc.Load(new StringReader(TransMessage)); nodes = XmlDoc.GetElementsByTagName("*"); nodesIssue = XmlDoc.GetElementsByTagName("issue"); } catch { } if (nodes == null) { this.Response.End(); return; } DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses(); for (int i = 0; i < nodes.Count; i++) { if (!(nodes[i].Name.ToUpper() == "BODY" && nodes[i].FirstChild.Name.ToUpper() == "ISSUENOTIFY")) { continue; } for (int j = 0; j < nodesIssue.Count; j++) { string IsuseName = nodesIssue[j].Attributes["number"].Value; string LotteryName = nodesIssue[j].Attributes["gameName"].Value; string Status = nodesIssue[j].Attributes["status"].Value; string StartTime = nodesIssue[j].Attributes["startTime"].Value; string EndTime = nodesIssue[j].Attributes["stopTime"].Value; int LotteryID = GetLotteryID(LotteryName); string WinNumber = ""; try { WinNumber = GetWinNumber(LotteryID, nodesIssue[j].Attributes["bonusCode"].Value); } catch { } if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName))) { continue; } if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "'") < 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 LotteryID in (select id from T_Lotteries where PrintOutType = 103)", ""); if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1)) { continue; } if (Status == "4") { 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\\HPJX").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash"); continue; } } if (dtIsuse.Rows[0]["State"].ToString() != Status) { int ReturnValue = 0; string ReturnDescprtion = ""; if (DAL.Procedures.P_IsuseUpdate(LotteryID, 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\\HPJX").Write("电子票期号状态更新错误_P_IsuseUpdate"); continue; } } if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber)) { if (LotteryID == SLS.Lottery.JXSSC.ID) { 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++) { 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); } DataTable dtChaseTaskDetails = new DAL.Tables.T_ChaseTaskDetails().Open("", "IsuseID=" + dtIsuse.Rows[0]["ID"].ToString() + " and SchemeID IS NOT NULL", ""); for (int k = 0; k < dtChaseTaskDetails.Rows.Count; k++) { string LotteryNumber = dtChaseTaskDetails.Rows[k]["LotteryNumber"].ToString(); string Description = ""; double WinMoneyNoWithTax = 0; double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtChaseTaskDetails.Rows[k]["PlayTypeID"].ToString()), WinMoneyList); if (WinMoney < 1) { continue; } int ReturnValue = 0; string ReturnDescprtion = ""; if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SiteID"].ToString(), 1), Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SchemeID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescprtion) < 0) { new Log("ElectronTicket\\HPJX").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。"); } } } } } } string MessageID = nodes[0].Attributes["id"].Value; ReNotice(MessageID, "501"); }
private void IsuseNotice(string TransMessage) { XmlDocument document = new XmlDocument(); XmlNodeList elementsByTagName = null; XmlNodeList list2 = null; try { document.Load(new StringReader(TransMessage)); elementsByTagName = document.GetElementsByTagName("*"); list2 = document.GetElementsByTagName("issue"); } catch { } if (elementsByTagName == null) { base.Response.End(); } else { Tables.T_Isuses isuses = new Tables.T_Isuses(); for (int i = 0; i < elementsByTagName.Count; i++) { if ((elementsByTagName[i].Name.ToUpper() == "BODY") && (elementsByTagName[i].FirstChild.Name.ToUpper() == "ISSUENOTIFY")) { for (int j = 0; j < list2.Count; j++) { string str = list2[j].Attributes["number"].Value; string lotteryName = list2[j].Attributes["gameName"].Value; string str3 = list2[j].Attributes["status"].Value; string s = list2[j].Attributes["startTime"].Value; string str5 = list2[j].Attributes["stopTime"].Value; int lotteryID = this.GetLotteryID(lotteryName); string winNumber = ""; try { winNumber = this.GetWinNumber(lotteryID, list2[j].Attributes["bonusCode"].Value); } catch { } if ((lotteryID >= 0) && !string.IsNullOrEmpty(str)) { if (isuses.GetCount("LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(str) + "'") < 1L) { DateTime now = DateTime.Now; DateTime endTime = DateTime.Now; try { now = DateTime.Parse(s); endTime = DateTime.Parse(str5); } catch { goto Label_0611; } long isuseID = -1L; string returnDescription = ""; if ((Procedures.P_IsuseAdd(lotteryID, str, now, endTime, "", ref isuseID, ref returnDescription) < 0) || (isuseID < 0L)) { goto Label_0611; } } DataTable table = isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(str) + "'", ""); if ((table != null) && (table.Rows.Count >= 1)) { if (str3 == "4") { int returnValue = 0; string returnDescptrion = ""; if (Procedures.P_ElectronTicketAgentSchemeQuash(_Convert.StrToLong(table.Rows[0]["ID"].ToString(), 0L), ref returnValue, ref returnDescptrion) < 0) { new Log(@"ElectronTicket\HPSH").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash"); goto Label_0611; } } bool flag = false; if (table.Rows[0]["State"].ToString() != str3) { isuses.State.Value = str3; isuses.StateUpdateTime.Value = DateTime.Now; flag = true; } if (!string.IsNullOrEmpty(winNumber) && (table.Rows[0]["WinLotteryNumber"].ToString() != winNumber)) { isuses.WinLotteryNumber.Value = winNumber; flag = true; if (lotteryID == 0x1d) { DataTable table2 = new Tables.T_WinTypes().Open("", "LotteryID =" + lotteryID.ToString(), ""); double[] winMoneyList = new double[table2.Rows.Count * 2]; for (int k = 0; k < table2.Rows.Count; k++) { winMoneyList[k * 2] = _Convert.StrToDouble(table2.Rows[k]["DefaultMoney"].ToString(), 1.0); winMoneyList[(k * 2) + 1] = _Convert.StrToDouble(table2.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1.0); } DataTable table3 = new Tables.T_ChaseTaskDetails().Open("", "IsuseID=" + table.Rows[0]["ID"].ToString() + " and SchemeID IS NOT NULL", ""); for (int m = 0; m < table3.Rows.Count; m++) { string number = table3.Rows[m]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double winMoney = new Lottery()[lotteryID].ComputeWin(number, winNumber, ref description, ref winMoneyNoWithTax, int.Parse(table3.Rows[m]["PlayTypeID"].ToString()), winMoneyList); if (winMoney >= 1.0) { int num10 = 0; string str11 = ""; if (Procedures.P_ChaseTaskStopWhenWin(_Convert.StrToLong(table3.Rows[m]["SiteID"].ToString(), 1L), _Convert.StrToLong(table3.Rows[m]["SchemeID"].ToString(), 0L), winMoney, ref num10, ref str11) < 0) { new Log(@"ElectronTicket\HPSH").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。"); } } } } } if (flag) { isuses.Update("LotteryID = " + lotteryID.ToString() + " and [Name] = '" + Utility.FilteSqlInfusion(str) + "'"); } } Label_0611: ; } } } } string messageID = elementsByTagName[0].Attributes["id"].Value; this.ReNotice(messageID, "501"); } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem) { string str = e.Item.Cells[4].Text.Trim(); if (str.Length > 8) { str = str.Substring(0, 7) + ".."; } string type = e.Item.Cells[1].Text; if (type == "我的追号") { e.Item.Cells[3].Text = "<a href='ChaseDetail.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + e.Item.Cells[3].Text + "</Font></a>"; e.Item.Cells[4].Text = "<a href='ChaseDetail.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + str + "</Font></a>"; } else { e.Item.Cells[3].Text = "<a href='ChaseDetails.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + e.Item.Cells[3].Text + "</Font></a>"; e.Item.Cells[4].Text = "<a href='ChaseDetails.aspx?id=" + e.Item.Cells[10].Text + "'><font color=\"#330099\">" + str + "</Font></a>"; } double money = Shove._Convert.StrToDouble(e.Item.Cells[5].Text, 0); e.Item.Cells[5].Text = (money == 0) ? "" : money.ToString("N"); int SumIsuseNum = Shove._Convert.StrToInt(e.Item.Cells[6].Text, 0); int BuyedIsuseNum = Shove._Convert.StrToInt(e.Item.Cells[7].Text, 0); int QuashedIsuseNum = Shove._Convert.StrToInt(e.Item.Cells[13].Text, 0); int QuashStatus = Shove._Convert.StrToInt(e.Item.Cells[11].Text, 0); if (type == "我的追号") { e.Item.Cells[9].Text = (SumIsuseNum > (BuyedIsuseNum + QuashedIsuseNum)) ? "<Font color=\'Red\'>进行中</font>" : "已终止"; } else { e.Item.Cells[9].Text = QuashStatus == 1 ? "已终止" : (SumIsuseNum == BuyedIsuseNum ? "已完成" : "<Font color=\'Red\'>进行中</font>"); } int Type = Shove._Convert.StrToInt(e.Item.Cells[12].Text, 1); double StopMoney = Shove._Convert.StrToDouble(e.Item.Cells[8].Text, 0); if (Type == 1 || StopMoney == 0) { e.Item.Cells[8].Text = "完成方案"; } else { e.Item.Cells[8].Text = "单期中奖金额达到" + StopMoney.ToString("N") + "元"; } if (tdIsuses.Visible && e.Item.Cells[9].Text != "已终止" && e.Item.Cells[9].Text != "已完成") { if (e.Item.Cells[1].Text == "我的追号") { DataTable dt = new DAL.Tables.T_ChaseTaskDetails().Open("Executed", "ChaseTaskID=" + e.Item.Cells[10].Text + " and IsuseID=" + ddlIsuses.SelectedValue + "", ""); if (dt != null && dt.Rows.Count > 0) { if (Shove._Convert.StrToBool(dt.Rows[0]["Executed"].ToString(), false)) { e.Item.Cells[9].Text = "已执行"; } else { e.Item.Cells[9].Text = "未执行"; } } } else { if (new DAL.Tables.T_ExecutedChases().GetCount("ChaseID=" + e.Item.Cells[10].Text + " and SchemeID in (select ID from T_Schemes where IsuseID=" + ddlIsuses.SelectedValue + ")") > 0) { e.Item.Cells[9].Text = "已执行"; } else { e.Item.Cells[9].Text = "未执行"; } } } } }