Beispiel #1
0
    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 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 = "未执行";
             }
         }
     }
 }