Beispiel #1
0
    // 接收开奖通知

    /*
     * 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 = 102)", "");
     *
     *  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);
     *
     *  string BonusXML = "<Schemes>";
     *  string AgentBonusXML = "<Schemes>";
     *
     *  int Result = -1;
     *
     *  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;
     *          }
     *      }
     *  }
     *
     *  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\\HPSH").Write("电子票开奖,第 " + number + " 期解析开奖数据错误:" + e.Message);
     *
     *          this.Response.End();
     *
     *          return;
     *      }
     *
     *      if ((dsXML == null) || (dsXML.Tables.Count < 3))
     *      {
     *          new Log("ElectronTicket\\HPSH").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\\HPSH").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\\HPSH").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 = -1;
     *  string ReturnDescription = "";
     *
     *  DataSet ds = null;
     *  int Times = 0;
     *
     *  while ((Result < 0) && (Times < 5))
     *  {
     *      ReturnValue = -1;
     *      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\\HPSH").Write("电子票第 " + (Times + 1).ToString() + " 次派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString());
     *          Times++;
     *
     *          if (Times < 5)
     *          {
     *              System.Threading.Thread.Sleep(10000);
     *          }
     *
     *          continue;
     *      }
     *  }
     *
     *  if (ReturnValue < 0)
     *  {
     *      new Log("ElectronTicket\\HPSH").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 IsuseID = " + IsuseID + " and 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)
     *          {
     *              Result = 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);
     *
     *              if (Result < 0)
     *              {
     *                  new Log("ElectronTicket\\HPSH").Write("执行电子票--判断是否停止追号的时候出现错误");
     *              }
     *
     *              continue;
     *          }
     *      }
     *  }
     *  ReturnResponse();
     * }
     */
    private int P_ElectronTicketWin(SqlConnection conn, ref DataSet ds, long IsuseID, string BonusXML, string AgentBonusXML, ref int ReturnValue, ref string ReturnDescription)
    {
        MSSQL.OutputParameter Outputs = new MSSQL.OutputParameter();

        int CallResult = MSSQL.ExecuteStoredProcedureWithQuery(conn, "P_ElectronTicketWin", ref ds, ref Outputs,
                                                               new MSSQL.Parameter("IsuseID", SqlDbType.BigInt, 0, ParameterDirection.Input, IsuseID),
                                                               new MSSQL.Parameter("BonusXML", SqlDbType.NText, 0, ParameterDirection.Input, BonusXML),
                                                               new MSSQL.Parameter("AgentBonusXML", SqlDbType.NText, 0, ParameterDirection.Input, AgentBonusXML),
                                                               new MSSQL.Parameter("ReturnValue", SqlDbType.Int, 4, ParameterDirection.Output, ReturnValue),
                                                               new MSSQL.Parameter("ReturnDescription", SqlDbType.VarChar, 100, ParameterDirection.Output, ReturnDescription)
                                                               );

        return(CallResult);
    }
Beispiel #2
0
    private int P_Win(SqlConnection conn, ref DataSet ds, long IsuseID, string WinLotteryNumber, string OpenAffiche, long OpenOperatorID, bool isEndTheIsuse, ref int SchemeCount, ref int QuashCount, ref int WinCount, ref int WinNoBuyCount, ref bool isEndOpen, ref int ReturnValue, ref string ReturnDescription)
    {
        MSSQL.OutputParameter Outputs = new MSSQL.OutputParameter();

        int CallResult = MSSQL.ExecuteStoredProcedureWithQuery(conn, "P_Win", ref ds, ref Outputs,
                                                               new MSSQL.Parameter("IsuseID", SqlDbType.BigInt, 0, ParameterDirection.Input, IsuseID),
                                                               new MSSQL.Parameter("WinLotteryNumber", SqlDbType.VarChar, 0, ParameterDirection.Input, WinLotteryNumber),
                                                               new MSSQL.Parameter("OpenAffiche", SqlDbType.VarChar, 0, ParameterDirection.Input, OpenAffiche),
                                                               new MSSQL.Parameter("OpenOperatorID", SqlDbType.BigInt, 0, ParameterDirection.Input, OpenOperatorID),
                                                               new MSSQL.Parameter("isEndTheIsuse", SqlDbType.Bit, 0, ParameterDirection.Input, isEndTheIsuse),
                                                               new MSSQL.Parameter("SchemeCount", SqlDbType.Int, 4, ParameterDirection.Output, SchemeCount),
                                                               new MSSQL.Parameter("QuashCount", SqlDbType.Int, 4, ParameterDirection.Output, QuashCount),
                                                               new MSSQL.Parameter("WinCount", SqlDbType.Int, 4, ParameterDirection.Output, WinCount),
                                                               new MSSQL.Parameter("WinNoBuyCount", SqlDbType.Int, 4, ParameterDirection.Output, WinNoBuyCount),
                                                               new MSSQL.Parameter("isEndOpen", SqlDbType.Bit, 0, ParameterDirection.Output, isEndOpen),
                                                               new MSSQL.Parameter("ReturnValue", SqlDbType.Int, 4, ParameterDirection.Output, ReturnValue),
                                                               new MSSQL.Parameter("ReturnDescription", SqlDbType.VarChar, 100, ParameterDirection.Output, ReturnDescription)
                                                               );

        try
        {
            SchemeCount = System.Convert.ToInt32(Outputs["SchemeCount"]);
        }
        catch { }

        try
        {
            QuashCount = System.Convert.ToInt32(Outputs["QuashCount"]);
        }
        catch { }

        try
        {
            WinCount = System.Convert.ToInt32(Outputs["WinCount"]);
        }
        catch { }

        try
        {
            WinNoBuyCount = System.Convert.ToInt32(Outputs["WinNoBuyCount"]);
        }
        catch { }

        try
        {
            isEndOpen = System.Convert.ToBoolean(Outputs["isEndOpen"]);
        }
        catch { }

        try
        {
            ReturnValue = System.Convert.ToInt32(Outputs["ReturnValue"]);
        }
        catch { }

        try
        {
            ReturnDescription = System.Convert.ToString(Outputs["ReturnDescription"]);
        }
        catch { }

        return(CallResult);
    }