コード例 #1
0
        //福彩3D
        private void GetLotteryOpenNumberForFC3D(int LotteryID)
        {
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml(FC3D_Open_URL);
            }
            catch
            {
                new Log("SystemGetLotteryOpenNumber").Write("福彩3D获取开奖号码页面异常");

                return;
            }

            if ((ds == null) || (ds.Tables.Count < 1) || (ds.Tables[0].Rows.Count < 1))
            {
                new Log("SystemGetLotteryOpenNumber").Write("福彩3D获取开奖号码页面异常");

                return;
            }

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //期数
                string t_IsuseName = dr["expect"].ToString();

                //开奖号码
                string t_winLotteryNumber = dr["opencode"].ToString().Replace(",", "");

                if (t_Isuses.GetCount(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())") < 1)
                {
                    continue;
                }

                try
                {
                    t_Isuses.WinLotteryNumber.Value = t_winLotteryNumber;

                    t_Isuses.Update(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())");

                    if (GP_Open_RulFC3D == "1")
                    {
                        //开奖
                        DrawingLottery(LotteryID, t_IsuseName, t_winLotteryNumber);
                    }
                }
                catch (Exception e)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("福彩3D获取开奖号码异常:" + e.Message);
                }
            }
        }
コード例 #2
0
    // 接收奖期通知
    private void IsuseNotice(string TransMessage)
    {
        XmlDocument XmlDoc = new XmlDocument();
        //XmlNodeList nodes = null;
        XmlNodeList nodesIssue = null;

        try
        {
            XmlDoc.Load(new StringReader(TransMessage));
            //nodes = XmlDoc.GetElementsByTagName("");
            nodesIssue = XmlDoc.GetElementsByTagName("issue");
        }
        catch {
            this.Response.End();
            return;
        }

        if (nodesIssue == null)
        {
            this.Response.End();
            return;
        }

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        for (int j = 0; j < nodesIssue.Count; j++)
        {
            string lotoid    = null;
            string issue     = null;
            string starttime = null;
            string endtime   = null;
            string bonuscode = null;
            string status    = null;
            int    LotteryID = 0;
            string IssueName = null;
            string WinNumber = null;
            var    sunlotto  = new SLS.Common.EtSunLotto();
            try{
                lotoid    = nodesIssue[j].Attributes["lotoid"].Value;
                issue     = nodesIssue[j].Attributes["issue"].Value;
                starttime = nodesIssue[j].Attributes["starttime"].Value;
                endtime   = nodesIssue[j].Attributes["endtime"].Value;
                status    = nodesIssue[j].Attributes["status"].Value;
                LotteryID = sunlotto.GetSystemLotteryID(lotoid);
                IssueName = sunlotto.ConvertIntoSystemIssue(lotoid, issue);
            }
            catch (Exception e) {
                new Log("ElectronTicket\\SunLotto").Write(nodesIssue[j].Value + " 错误 : " + e.Message);
                continue;
            }
            if (nodesIssue[j].Attributes.Count == 6)
            {
                try{
                    bonuscode = nodesIssue[j].Attributes["bonuscode"].Value;
                    WinNumber = sunlotto.ConverToSystemLottoNum(lotoid, bonuscode);
                }
                catch {
                    new Log("ElectronTicket\\SunLotto").Write(nodesIssue[j].Value + " 错误");
                    continue;
                }
            }
            if ((LotteryID < 1) || (String.IsNullOrEmpty(issue)))
            {
                new Log("ElectronTicket\\SunLotto").Write(lotoid + " : 期号 " + issue + " 错误");
                continue;
            }
            long IssueID = 0;
            if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IssueName) + "'") < 1)
            {
                DateTime _StartTime = DateTime.Now;
                DateTime _EndTime   = DateTime.Now;

                try
                {
                    _StartTime = DateTime.ParseExact(starttime, "yyyyMMddhhmmss", System.Globalization.CultureInfo.CurrentCulture);
                    _EndTime   = DateTime.ParseExact(endtime, "yyyyMMddhhmmss", System.Globalization.CultureInfo.CurrentCulture);
                }
                catch {
                    new Log("ElectronTicket\\SunLotto").Write(LotteryID.ToString() + " : 期号 " + IssueID.ToString() + " 时间错误");
                    continue;
                }
                string ReturnDescription = "";

                if (DAL.Procedures.P_IsuseAdd(LotteryID, IssueName, _StartTime, _EndTime, "", ref IssueID, ref ReturnDescription) < 0)
                {
                    new Log("ElectronTicket\\SunLotto").Write(LotteryID.ToString() + " : 期号 " + IssueID.ToString() + " 新增错误");
                    continue;
                }

                if (IssueID < 0)
                {
                    new Log("ElectronTicket\\SunLotto").Write(LotteryID.ToString() + " : 期号 " + IssueID.ToString() + " 错误");
                    continue;
                }
            }

            DataTable dtIssue = t_Isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IssueName) + "' and LotteryID  in (select id from T_Lotteries where PrintOutType = 301)", "");

            if ((dtIssue == null) || (dtIssue.Rows.Count < 1))
            {
                continue;
            }

            if (status == "4")
            {
                int    ReturnValue      = -1;
                string ReturnDescprtion = "";

                int Result = DAL.Procedures.P_ElectronTicketAgentSchemeQuash(Shove._Convert.StrToLong(dtIssue.Rows[0]["ID"].ToString(), 0), ref ReturnValue, ref ReturnDescprtion);
                if (Result < 0)
                {
                    new Log("ElectronTicket\\SunLotto").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash : " + IssueID.ToString());
                    continue;
                }
            }

            bool isHasUpdate = false;

            if (dtIssue.Rows[0]["State"].ToString() != status)
            {
                isHasUpdate = true;
            }

            /*
             * if (!String.IsNullOrEmpty(WinNumber) && (dtIssue.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
             * {
             *  if (LotteryID == SLS.Lottery.SHSSL.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 = -1;
             *          string ReturnDescprtion = "";
             *
             *          int Result = 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);
             *
             *          if (Result < 0)
             *          {
             *              new Log("ElectronTicket\\HPSH").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。");
             *          }
             *      }
             *  }
             * }
             */
            //if (isHasUpdate)
            //{
            //    int ReturnValue = -1;
            //    string ReturnDescprtion = "";

            //    int Result = DAL.Procedures.P_IsuseUpdate(LotteryID, Shove._Web.Utility.FilteSqlInfusion(IssueName), Shove._Convert.StrToShort(status, 1), , endtime, DateTime.Now, WinNumber, ref ReturnValue, ref ReturnDescprtion);

            //    if (Result < 0)
            //    {
            //        new Log("ElectronTicket\\HPSH").Write("电子票更新期号P_IsuseEdit。");
            //    }

            //    if (ReturnValue < 0)
            //    {
            //        new Log("ElectronTicket\\HPSH").Write(ReturnDescprtion);
            //    }
            //}
        }
        ReturnResponse();
    }
コード例 #3
0
        //江西时时彩
        private void GetLotteryOpenNumberForJXSSC(int LotteryID)
        {
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml(JXSSC_Open_URL);
            }
            catch
            {
                new Log("SystemGetLotteryOpenNumber").Write("江西时时彩获取开奖号码页面异常");

                return;
            }

            if ((ds == null) || (ds.Tables.Count < 1) || (ds.Tables[0].Rows.Count < 1))
            {
                new Log("SystemGetLotteryOpenNumber").Write("江西时时彩获取开奖号码页面异常");

                return;
            }

            int i = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //期数
                string t_IsuseName = dr["expect"].ToString().Substring(4);

                //开奖号码
                string t_winLotteryNumber = dr["opencode"].ToString().Replace(",", "");

                if (t_Isuses.GetCount(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())") < 1)
                {
                    continue;
                }

                try
                {
                    t_Isuses.WinLotteryNumber.Value = t_winLotteryNumber;
                    t_Isuses.Update(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())");

                    if (GP_Open_RulSYYDJ == "1")
                    {
                        //开奖
                        DrawingLottery(LotteryID, t_IsuseName, t_winLotteryNumber);
                    }
                }
                catch (Exception e)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("江西时时彩获取开奖号码异常:" + e.Message);
                }

                if (i == 0)
                {
                    DateTime EndTime = Shove._Convert.StrToDateTime(dr["opentime"].ToString(), DateTime.Now.ToString());

                    int    Result          = 0;
                    string ReturnDescption = "";

                    DAL.Procedures.P_IsuseUpdate(conn, LotteryID, t_IsuseName, 1, EndTime.AddMinutes(-10), EndTime, DateTime.Now, t_winLotteryNumber, ref Result, ref ReturnDescption);
                }

                i++;
            }
        }
コード例 #4
0
    // 接收奖期通知
    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");
    }
コード例 #5
0
ファイル: Receive.aspx.cs プロジェクト: object8421/ichari
    // 接收奖期通知
    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 = 104)", "");

                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\\HPSH").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash");

                        continue;
                    }
                }

                bool isHasUpdate = false;

                if (dtIsuse.Rows[0]["State"].ToString() != Status)
                {
                    isHasUpdate = true;
                }

                if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
                {
                    if (LotteryID == SLS.Lottery.SHSSL.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\\HPSH").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。");
                            }
                        }
                    }
                }

                if (isHasUpdate)
                {
                    int    ReturnValue      = 0;
                    string ReturnDescprtion = "";

                    if (DAL.Procedures.P_IsuseUpdate(LotteryID, Shove._Web.Utility.FilteSqlInfusion(IsuseName), Shove._Convert.StrToShort(Status, 1), 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\\HPSH").Write("电子票撤销追号错误P_IsuseEdit。");
                    }

                    if (ReturnValue < 0)
                    {
                        new Log("ElectronTicket\\HPSH").Write(ReturnDescprtion);
                    }
                }
            }
        }

        string MessageID = nodes[0].Attributes["id"].Value;

        ReNotice(MessageID, "501");
    }
コード例 #6
0
        //江西十一选五
        private void GetLotteryOpenNumberForJX11X5(int LotteryID)
        {
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml(JX11X5_Open_URL);
            }
            catch
            {
                new Log("SystemGetLotteryOpenNumber").Write("江西11选5获取开奖号码页面异常");

                return;
            }

            if ((ds == null) || (ds.Tables.Count < 1) || (ds.Tables[0].Rows.Count < 1))
            {
                new Log("SystemGetLotteryOpenNumber").Write("江西11选5获取开奖号码页面异常");

                return;
            }

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //期数
                string t_IsuseName = dr["expect"].ToString();

                //开奖号码
                string t_winLotteryNumber = dr["opencode"].ToString().Replace(","," ");

                if (t_Isuses.GetCount(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())") < 1)
                {
                    continue;
                }

                try
                {
                    t_Isuses.WinLotteryNumber.Value = t_winLotteryNumber;
                    t_Isuses.Update(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())");

                    if (GP_Open_RulJX11X5 == "1")
                    {
                        //开奖
                        DrawingLottery(LotteryID, t_IsuseName, t_winLotteryNumber);
                    }
                }
                catch (Exception e)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("江西11选5获取开奖号码异常:" + e.Message);
                }
            }
        }
コード例 #7
0
ファイル: OpenTask.cs プロジェクト: ichari/ichari
        //江西时时彩
        private void GetLotteryOpenNumberForJXSSC(int LotteryID)
        {
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml(JXSSC_Open_URL);
            }
            catch
            {
                new Log("SystemGetLotteryOpenNumber").Write("江西时时彩获取开奖号码页面异常");

                return;
            }

            if ((ds == null) || (ds.Tables.Count < 1) || (ds.Tables[0].Rows.Count < 1))
            {
                new Log("SystemGetLotteryOpenNumber").Write("江西时时彩获取开奖号码页面异常");

                return;
            }

            int i = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //期数
                string t_IsuseName = dr["expect"].ToString().Substring(4);

                //开奖号码
                string t_winLotteryNumber = dr["opencode"].ToString().Replace(",", "");

                if (t_Isuses.GetCount(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())") < 1)
                {
                    continue;
                }

                try
                {
                    t_Isuses.WinLotteryNumber.Value = t_winLotteryNumber;
                    t_Isuses.Update(conn, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + t_IsuseName + "' and isnull(WinLotteryNumber, '') = '' and year(StartTime) = YEAR(GETDATE())");

                    if (GP_Open_RulSYYDJ == "1")
                    {
                        //开奖
                        DrawingLottery(LotteryID, t_IsuseName, t_winLotteryNumber);
                    }
                }
                catch (Exception e)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("江西时时彩获取开奖号码异常:" + e.Message);
                }

                if (i == 0)
                {
                    DateTime EndTime = Shove._Convert.StrToDateTime(dr["opentime"].ToString(), DateTime.Now.ToString());

                    int Result = 0;
                    string ReturnDescption = "";

                    DAL.Procedures.P_IsuseUpdate(conn, LotteryID, t_IsuseName, 1, EndTime.AddMinutes(-10), EndTime, DateTime.Now, t_winLotteryNumber, ref Result, ref ReturnDescption);
                }

                i++;
            }
        }
コード例 #8
0
    //中奖明细对账文件生成通知
    private void AwardResultNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        string elements = TransMessage.Substring(TransMessage.IndexOf("<body"), TransMessage.LastIndexOf("</body>") - TransMessage.IndexOf("<body")) + "</body>";

        DataSet ds = new DataSet();

        ds.ReadXml(new StringReader(elements));

        if (ds == null)
        {
            return;
        }

        if (ds.Tables.Count == 0)
        {
            return;
        }

        DataTable dtFile = ds.Tables[0];

        if (dtFile.Rows.Count < 1)
        {
            return;
        }

        int    LotteryID = 0;
        string IssueName = "";
        string FileName  = "";

        string Body = "";

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        string BonusXML      = "<Schemes>";
        string AgentBonusXML = "<Schemes>";


        DataTable dtIsuse = null;

        foreach (DataRow dr in dtFile.Rows)
        {
            LotteryID = GetLotteryID(dr["lotteryId"].ToString());
            IssueName = dr["issue"].ToString();
            FileName  = dr["fileName"].ToString();

            if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + IssueName + "' and year(getdate()) = year(StartTime) and LotteryID  in (select id from T_Lotteries where PrintOutType = 108)") < 1)
            {
                continue;
            }

            dtIsuse = t_Isuses.Open("ID, StartTime, EndTime, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IssueName) + "' and LotteryID  in (select id from T_Lotteries where PrintOutType = 108) and year(getdate()) = year(StartTime) and IsOpened = 0", "");

            if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
            {
                continue;
            }

            string DownLoadFileNameUrl = ElectronTicket_CTTCSD_DownloadGetway + "/" + ElectronTicket_CTTCSD_UserName + "/" + dr["lotteryId"].ToString() + "/Award/" + FileName;

            string Html = PF.GetHtml(DownLoadFileNameUrl, "utf-8", 120);

            if (Html == "")
            {
                Body = "<body><result>100004</result></body>";

                new Log("ElectronTicket\\CTTCSD").Write("没有获取到中奖信息:期号为:" + IssueName);
            }

            if (Html.IndexOf("<body/>") >= 0)
            {
                continue;
            }

            elements = Html.Substring(Html.IndexOf("<head>"), Html.LastIndexOf("</body>") - Html.IndexOf("<head>")) + "</body>";

            DataSet ds1 = new DataSet();

            ds1.ReadXml(new StringReader(Html));

            if (ds1 == null)
            {
                Body = "<body><result>100004</result></body>";

                new Log("ElectronTicket\\CTTCSD").Write("中奖文件获取异常:读取内容为:" + Html);

                continue;
            }

            if (Shove._Security.Encrypt.MD5(elements).ToLower() != ds1.Tables[0].Rows[0]["sign"].ToString().ToLower())
            {
                Body = "<body><result>100004</result></body>";

                new Log("ElectronTicket\\CTTCSD").Write("校验错误:" + Shove._Security.Encrypt.MD5(elements).ToLower() + "----------" + ds1.Tables[0].Rows[0]["sign"].ToString().ToLower());

                continue;
            }

            DataTable dtTicket = ds1.Tables[ds1.Tables.Count - 1];

            if (dtTicket.Rows.Count < 1)
            {
                Body = "<body><result>0</result></body>";

                continue;
            }

            LotteryID = GetLotteryID(ds1.Tables[1].Rows[0]["lotteryId"].ToString());
            IssueName = ds1.Tables[1].Rows[0]["issue"].ToString();

            string[] StrTickets = null;

            DataTable dtTicketTemp = new DataTable();

            dtTicketTemp.Columns.Add("ID", typeof(System.String));
            dtTicketTemp.Columns.Add("AwardValue", typeof(System.String));

            DataRow drTicketTemp = null;

            foreach (DataRow drTicket in dtTicket.Rows)
            {
                StrTickets = drTicket[0].ToString().Split(',');

                if (StrTickets.Length != 7)
                {
                    continue;
                }

                drTicketTemp = dtTicketTemp.NewRow();

                drTicketTemp["ID"]         = StrTickets[0].ToString();
                drTicketTemp["AwardValue"] = StrTickets[3].ToString().Insert(StrTickets[3].ToString().Length - 2, ".");

                dtTicketTemp.Rows.Add(drTicketTemp);
                dtTicketTemp.AcceptChanges();
            }

            DataTable dtSchemes = MSSQL.Select("SELECT SchemeID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + dtIsuse.Rows[0]["ID"].ToString() + ")");

            if (dtSchemes == null)
            {
                new Log("ElectronTicket\\CTTCSD").Write("电子票开奖,第 " + IssueName + " 期,读取本地方案错误。");

                this.Response.End();

                return;
            }

            try
            {
                var query1 = from NewDtTickets in dtTicketTemp.AsEnumerable()
                             join NewdtScheme in dtSchemes.AsEnumerable()
                             on NewDtTickets.Field <string>("ID") equals NewdtScheme.Field <string>("Identifiers")
                             select new
                {
                    ID       = NewdtScheme.Field <long>("SchemeID"),
                    Multiple = NewdtScheme.Field <int>("Multiple"),
                    Bonus    = Shove._Convert.StrToDouble(NewDtTickets.Field <string>("AwardValue"), 0)
                };

                var query2 = from NewDt in query1.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.Multiple } into gg
                    select new
                {
                    ID       = gg.Key.ID,
                    Multiple = gg.Key.Multiple,
                    Bonus    = gg.Sum(NewDt => NewDt.Bonus)
                };

                var query3 = from NewDt in query2.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.Multiple } into t_dtSchemes
                    select new
                {
                    SchemeID = t_dtSchemes.Key.ID,
                    Multiple = t_dtSchemes.Key.Multiple,
                    Bonus    = t_dtSchemes.Sum(NewDt => NewDt.Bonus)
                };

                foreach (var Scheme in query3)
                {
                    BonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"\" />";
                }
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\CTTCSD").Write("电子票开奖,第 " + IssueName + " 期详细中奖数据解析错误:" + e.Message);

                this.Response.End();

                return;
            }
        }

        BonusXML      += "</Schemes>";
        AgentBonusXML += "</Schemes>";

        if (dtIsuse.Rows.Count > 0)
        {
            int    ReturnValue       = 0;
            string ReturnDescription = "";

            int Times  = 0;
            int Result = -1;

            while ((Result < 0) && (Times < 5))
            {
                ReturnValue       = 0;
                ReturnDescription = "";

                Result = DAL.Procedures.P_ElectronTicketWin(Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), BonusXML, AgentBonusXML, ref ReturnValue, ref ReturnDescription);

                if (Result < 0)
                {
                    new Log("ElectronTicket\\CTTCSD").Write("电子票第 " + (Times + 1).ToString() + " 次派奖出现错误(IsuseOpenNotice) 期号为: " + IssueName + ",彩种为: " + LotteryID.ToString());
                    Times++;

                    if (Times < 5)
                    {
                        System.Threading.Thread.Sleep(10000);
                    }

                    continue;
                }
            }

            if (ReturnValue < 0)
            {
                new Log("ElectronTicket\\CTTCSD").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + IssueName + ",彩种为: " + LotteryID.ToString() + ",错误:" + ReturnDescription);

                this.Response.End();

                return;
            }
        }

        if (string.IsNullOrEmpty(Body))
        {
            Body = "<body><result>0</result></body>";
        }

        ReNotice("1301", Body);
    }
コード例 #9
0
    //投注结果对账文件生成通知
    private void BetResultNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        string elements = TransMessage.Substring(TransMessage.IndexOf("<body"), TransMessage.LastIndexOf("</body>") - TransMessage.IndexOf("<body")) + "</body>";

        DataSet ds = new DataSet();

        ds.ReadXml(new StringReader(elements));

        if (ds == null)
        {
            return;
        }

        if (ds.Tables.Count == 0)
        {
            return;
        }

        DataTable dtFile = ds.Tables[0];

        if (dtFile.Rows.Count < 1)
        {
            return;
        }

        int    LotteryID = 0;
        string IssueName = "";
        string FileName  = "";

        string Body = "";

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        foreach (DataRow dr in dtFile.Rows)
        {
            LotteryID = GetLotteryID(dr["lotteryId"].ToString());
            IssueName = dr["issue"].ToString();
            FileName  = dr["fileName"].ToString();

            if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + IssueName + "' and year(getdate()) = year(StartTime) and LotteryID  in (select id from T_Lotteries where PrintOutType = 108)") < 1)
            {
                continue;
            }

            DataTable dtIsuse = t_Isuses.Open("ID, StartTime, EndTime, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IssueName) + "' and LotteryID  in (select id from T_Lotteries where PrintOutType = 108) and year(getdate()) = year(StartTime)", "");

            if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
            {
                continue;
            }

            string DownLoadFileNameUrl = ElectronTicket_CTTCSD_DownloadGetway + "/" + ElectronTicket_CTTCSD_UserName + "/" + dr["lotteryId"].ToString() + "/" + "Reports/" + FileName;

            string Html = PF.GetHtml(DownLoadFileNameUrl, "utf-8", 120);

            if (Html == "")
            {
                Body = "<body><result>100004</result></body>";
            }

            elements = Html.Substring(Html.IndexOf("<head>"), Html.LastIndexOf("</body>") - Html.IndexOf("<head>")) + "</body>";

            ds = new DataSet();

            ds.ReadXml(new StringReader(Html));

            if (ds == null)
            {
                Body = "<body><result>100004</result></body>";

                continue;
            }

            if (ds.Tables.Count != 4)
            {
                Body = "<body><result>100004</result></body>";

                continue;
            }

            if (Shove._Security.Encrypt.MD5(elements) != ds.Tables[0].Rows[0]["sign"].ToString())
            {
                Body = "<body><result>100004</result></body>";

                continue;
            }

            DataTable dtTicket = ds.Tables[3];

            if (dtTicket.Rows.Count < 1)
            {
                Body = "<body><result>0</result></body>";

                continue;
            }

            LotteryID = GetLotteryID(ds.Tables[1].Rows[0]["lotteryId"].ToString());
            IssueName = ds.Tables[1].Rows[0]["issue"].ToString();

            string[] StrTickets = null;
            string   TicketID   = "";

            foreach (DataRow drTicket in dtTicket.Rows)
            {
                StrTickets = drTicket[0].ToString().Split(',');

                if (StrTickets.Length != 8)
                {
                    continue;
                }

                TicketID = StrTickets[0].ToString();

                int    ReturnValue       = 0;
                string ReturnDescription = "";

                int Result = DAL.Procedures.P_SchemesSendToCenterHandle(TicketID, DateTime.Now, true, "", ref ReturnValue, ref ReturnDescription);

                if ((Result < 0) || ((ReturnValue < 0) && (ReturnValue != -2)))
                {
                    new Log("ElectronTicket\\CTTCSD").Write("对彩通天成电子票网所发送的电子票数据处理出错:部分票更新错误。票号:" + TicketID.ToString());

                    continue;
                }
            }
        }

        if (string.IsNullOrEmpty(Body))
        {
            Body = "<body><result>0</result></body>";
        }

        ReNotice("1300", Body);
    }
コード例 #10
0
    //对停售通知进行处理
    private void StopIssueNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        string elements = TransMessage.Substring(TransMessage.IndexOf("<body"), TransMessage.LastIndexOf("</body>") - TransMessage.IndexOf("<body")) + "</body>";

        DataSet ds = new DataSet();

        ds.ReadXml(new StringReader(elements));

        if (ds == null)
        {
            return;
        }

        if (ds.Tables.Count == 0)
        {
            return;
        }

        DataTable dtIsuses = ds.Tables[0];

        if (dtIsuses.Rows.Count < 1)
        {
            return;
        }

        int    LotteryID = 0;
        string IssueName = "";

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        foreach (DataRow dr in dtIsuses.Rows)
        {
            LotteryID = GetLotteryID(dr["lotteryId"].ToString());
            IssueName = dr["issue"].ToString();

            if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + IssueName + "' and year(getdate()) = year(StartTime) and LotteryID  in (select id from T_Lotteries where PrintOutType = 108)") < 1)
            {
                continue;
            }

            DataTable dtIsuse = t_Isuses.Open("ID, StartTime, EndTime, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IssueName) + "' and LotteryID  in (select id from T_Lotteries where PrintOutType = 108) and year(getdate()) = year(StartTime)", "");

            if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
            {
                continue;
            }

            int    ReturnValue      = 0;
            string ReturnDescprtion = "";

            if (DAL.Procedures.P_IsuseUpdate(LotteryID, IssueName, 5, Shove._Convert.StrToDateTime(dr["startTime"].ToString().Insert(12, ":").Insert(10, ":").Insert(8, " ").Insert(6, "-").Insert(4, "-"), DateTime.Now.ToString()), Shove._Convert.StrToDateTime(dr["endTime"].ToString().Insert(12, ":").Insert(10, ":").Insert(8, " ").Insert(6, "-").Insert(4, "-"), DateTime.Now.ToString()), DateTime.Now, "", ref ReturnValue, ref ReturnDescprtion) < 0)
            {
                new Log("ElectronTicket\\CTTCSD").Write("电子票期号截止更新错误_P_IsuseUpdate");

                continue;
            }
        }

        string Body = "<body><result>0</result></body>";

        ReNotice("1204", Body);
    }