Пример #1
0
        private void Open()
        {
            //查询自动开奖的彩种的期号
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            if ((AutomaticOpenLottery == null) || (AutomaticOpenLottery == ""))
            {
                new Log("SystemGetLotteryOpenNumber").Write("没有可自动开奖的彩种");

                return;
            }

            DataTable dt = null;

            try
            {
                dt = t_Isuses.Open(conn, "[ID], LotteryID, [Name], WinLotteryNumber", "LotteryID in (" + AutomaticOpenLottery + ") and IsOpened = 0 and EndTime < Getdate() and isnull(WinLotteryNumber, '') <> ''", "[EndTime] asc");
            }
            catch (Exception e)
            {
                new Log("SystemGetLotteryOpenNumber").Write(e.Message);
                return;
            }

            if (dt == null)
            {
                new Log("SystemGetLotteryOpenNumber").Write("数据读取错误." + AutomaticOpenLottery);

                return;
            }

            int    LotteryID        = -1;
            string IsuseName        = "";
            string WinLotteryNumber = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                LotteryID        = Shove._Convert.StrToInt(dt.Rows[i]["LotteryID"].ToString(), -1);
                IsuseName        = dt.Rows[i]["Name"].ToString();
                WinLotteryNumber = dt.Rows[i]["WinLotteryNumber"].ToString();

                try
                {
                    DrawingLottery(LotteryID, IsuseName, WinLotteryNumber);
                }
                catch (Exception EX)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("开奖有错误." + EX.Message);
                    continue;
                }
            }
        }
Пример #2
0
    public string returnHidValue(string id)
    {
        //期号 过期时间 玩法ID
        string IsuseID      = "";
        string IsuseEndTime = "";
        string playType     = "";
        string val;

        id = Shove._Web.Utility.FilteSqlInfusion(id);
        DAL.Tables.T_Isuses Isuses = new DAL.Tables.T_Isuses();
        DataTable           table  = Isuses.Open("ID,EndTime", "LotteryID = " + id + " and (GETDATE() between StartTime and EndTime)", "");

        if (table != null && table.Rows.Count > 0)
        {
            IsuseID      = table.Rows[0]["id"].ToString();
            IsuseEndTime = table.Rows[0]["EndTime"].ToString();
        }

        playType = id + "01";

        val = IsuseID + "|" + IsuseEndTime + "|" + playType;

        return(val);
    }
Пример #3
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();
    }
Пример #4
0
        private void GetLotteryOpenNumber()     //获取开奖号码
        {
            //查询自动开奖的彩种的期号
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            if ((AutomaticOpenLottery == null) || (AutomaticOpenLottery == ""))
            {
                new Log("SystemGetLotteryOpenNumber").Write("没有可自动开奖的彩种");

                return;
            }

            DataTable dt = null;

            try
            {
                dt = t_Isuses.Open(conn, "distinct LotteryID", "LotteryID in (" + AutomaticOpenLottery + ") and LotteryID not in (28, 61) and IsOpened = 0 and EndTime < Getdate() and DAY(EndTime) = DAY(GETDATE()) and month(getdate()) = MONTH(StartTime) and YEAR(GETDATE()) = YEAR(StartTime) and isnull(WinLotteryNumber, '') = ''", "");
            }
            catch (Exception e)
            {
                new Log("SystemGetLotteryOpenNumber").Write(e.Message);
                return;
            }

            if (dt == null)
            {
                new Log("SystemGetLotteryOpenNumber").Write("数据读取错误." + AutomaticOpenLottery);

                return;
            }

            int LotteryID = -1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                LotteryID = Shove._Convert.StrToInt(dt.Rows[i]["LotteryID"].ToString(), -1);

                new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString());

                switch (LotteryID)
                {
                case 6:
                    try
                    {
                        GetLotteryOpenNumberForFC3D(LotteryID);
                    }
                    catch (Exception EM)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                        break;
                    }
                    break;

                case 29:
                    try
                    {
                        GetLotteryOpenNumberForSHSSL(LotteryID);
                    }
                    catch (Exception EM)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                        break;
                    }
                    break;

                case 62:
                    try
                    {
                        GetLotteryOpenNumberForSYYDJ(LotteryID);
                    }
                    catch (Exception EM)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                        break;
                    }
                    break;

                case 63:
                    try
                    {
                        GetLotteryOpenNumberForSZPL3(LotteryID);
                    }
                    catch (Exception EM)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                        break;
                    }
                    break;

                case 64:
                    try
                    {
                        GetLotteryOpenNumberForSZPL5(LotteryID);
                    }
                    catch (Exception EM)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                        break;
                    }
                    break;

                case 70:
                    try
                    {
                        GetLotteryOpenNumberForJX11X5(LotteryID);
                    }
                    catch (Exception EM)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                        break;
                    }
                    break;
                }
            }
        }
Пример #5
0
    // 接收奖期通知
    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 Open()
        {
            //查询自动开奖的彩种的期号
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            if ((AutomaticOpenLottery == null) || (AutomaticOpenLottery == ""))
            {
                new Log("SystemGetLotteryOpenNumber").Write("没有可自动开奖的彩种");

                return;
            }

            DataTable dt = null;
            try
            {
                dt = t_Isuses.Open(conn, "[ID], LotteryID, [Name], WinLotteryNumber", "LotteryID in (" + AutomaticOpenLottery + ") and IsOpened = 0 and EndTime < Getdate() and isnull(WinLotteryNumber, '') <> ''", "[EndTime] asc");
            }
            catch (Exception e)
            {
                new Log("SystemGetLotteryOpenNumber").Write(e.Message);
                return;
            }

            if (dt == null)
            {
                new Log("SystemGetLotteryOpenNumber").Write("数据读取错误." + AutomaticOpenLottery);

                return;
            }

            int LotteryID = -1;
            string IsuseName = "";
            string WinLotteryNumber = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                LotteryID = Shove._Convert.StrToInt(dt.Rows[i]["LotteryID"].ToString(), -1);
                IsuseName = dt.Rows[i]["Name"].ToString();
                WinLotteryNumber = dt.Rows[i]["WinLotteryNumber"].ToString();

                try
                {
                    DrawingLottery(LotteryID, IsuseName, WinLotteryNumber);
                }
                catch(Exception EX)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("开奖有错误." + EX.Message);
                    continue;
                }
            }
        }
Пример #7
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");
    }
Пример #8
0
        private void GetLotteryOpenNumber()	//获取开奖号码
        {
            //查询自动开奖的彩种的期号
            DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

            if ((AutomaticOpenLottery == null) || (AutomaticOpenLottery == ""))
            {
                new Log("SystemGetLotteryOpenNumber").Write("没有可自动开奖的彩种");

                return;
            }

            DataTable dt = null;
            try
            {
                dt = t_Isuses.Open(conn, "distinct LotteryID", "LotteryID in (" + AutomaticOpenLottery + ") and LotteryID not in (28, 61) and IsOpened = 0 and EndTime < Getdate() and DAY(EndTime) = DAY(GETDATE()) and month(getdate()) = MONTH(StartTime) and YEAR(GETDATE()) = YEAR(StartTime) and isnull(WinLotteryNumber, '') = ''", "");
            }
            catch (Exception e)
            {
                new Log("SystemGetLotteryOpenNumber").Write(e.Message);
                return;
            }

            if (dt == null)
            {
                new Log("SystemGetLotteryOpenNumber").Write("数据读取错误." + AutomaticOpenLottery);

                return;
            }

            int LotteryID = -1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                LotteryID = Shove._Convert.StrToInt(dt.Rows[i]["LotteryID"].ToString(), -1);

                new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString());

                switch (LotteryID)
                {
                    case 6:
                        try
                        {
                            GetLotteryOpenNumberForFC3D(LotteryID);
                        }
                        catch (Exception EM)
                        {
                            new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                            break;
                        }
                        break;
                        
                    case 29:
                        try
                        {
                            GetLotteryOpenNumberForSHSSL(LotteryID);
                        }
                        catch (Exception EM)
                        {
                            new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                            break;
                        }
                        break;

                    case 62:
                        try
                        {
                            GetLotteryOpenNumberForSYYDJ(LotteryID);
                        }
                        catch (Exception EM)
                        {
                            new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                            break;
                        }
                        break;

                    case 63:
                        try
                        {
                            GetLotteryOpenNumberForSZPL3(LotteryID);
                        }
                        catch (Exception EM)
                        {
                            new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                            break;
                        }
                        break;

                    case 64:
                        try
                        {
                            GetLotteryOpenNumberForSZPL5(LotteryID);
                        }
                        catch (Exception EM)
                        {
                            new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                            break;
                        }
                        break;

                    case 70:
                        try
                        {
                            GetLotteryOpenNumberForJX11X5(LotteryID);
                        }
                        catch (Exception EM)
                        {
                            new Log("SystemGetLotteryOpenNumber").Write("开奖的彩种" + LotteryID.ToString() + ",  " + EM.Message);
                            break;
                        }
                        break;
                }
            }
        }
Пример #9
0
        // 查询奖期状态
        private void QueryIsuseState()
        {
            // 查询的几组条件说明:
            //  1 有效期内未开奖、未开启的
            //  2 已截止未开奖的
            DataTable dt = new DAL.Views.V_Isuses().Open(ConnectionString, "[ID], LotteryID, [Name]", "((isOpened = 0 and (Getdate() between StartTime and EndTime) and State = 0) or (isOpened = 0 and Getdate() > EndTime and State < 5)) and PrintOutType = 102", "EndTime");

            if (dt == null)
            {
                msg.Send("期号状态查询错误(QueryIsuseState)。");
                log.Write("期号状态查询错误(QueryIsuseState)。");

                return;
            }

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

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i % 100 == 0)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                #region 查询奖期

                string LotteryName = GetLotteryName(Shove._Convert.StrToInt(dt.Rows[i]["LotteryID"].ToString(), 0));
                string IsuseName = dt.Rows[i]["Name"].ToString();
                DateTime Now = DateTime.Now;

                string MessageID = ElectronTicket_HPSH_UserName + Now.ToString("yyyyMMdd") + Now.ToString("HHmmss") + (i % 100).ToString().PadLeft(2, '0');
                string Body = "<body><issueQuery><issue gameName=\"" + LotteryName + "\" number=\"" + IsuseName + "\"/></issueQuery></body>";
                string TimeStamp = Now.ToString("yyyyMMdd") + Now.ToString("HHmmss");

                string Message = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                Message += "<message version=\"1.0\" id=\"" + MessageID + "\">";
                Message += "<header>";
                Message += "<messengerID>" + ElectronTicket_HPSH_UserName + "</messengerID>";
                Message += "<timestamp>" + TimeStamp + "</timestamp>";
                Message += "<transactionType>102</transactionType>";
                Message += "<digest>" + Shove._Security.Encrypt.MD5(MessageID + TimeStamp + ElectronTicket_HPSH_UserPassword + Body, "gb2312") + "</digest>";
                Message += "</header>";
                Message += Body;
                Message += "</message>";

                WriteElectronTicketLog(true, "102", "transType=102&transMessage=" + Message);

                string ReceiveString = "";

                try
                {
                    ReceiveString = PublicFunction.Post(ElectronTicket_HPSH_Getway, "transType=102&transMessage=" + Message, TimeoutSeconds);
                }
                catch
                {
                    continue;
                }

                if (ReceiveString.Length <= 10)
                {
                    continue;
                }

                string[] t_strs = ReceiveString.Split('&');

                if ((t_strs == null) || (t_strs.Length < 2))
                {
                    continue;
                }

                string TransType = t_strs[0];
                string TransMessage = t_strs[1];

                TransType = TransType.Substring(10);
                TransMessage = TransMessage.Substring(13);

                WriteElectronTicketLog(false, TransType, ReceiveString);

                #endregion

                #region 处理结果

                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("response");
                    nodesIssue = XmlDoc.GetElementsByTagName("issue");
                }
                catch
                {
                    continue;
                }

                if (nodes == null)
                {
                    continue;
                }

                if (nodes[0].Attributes["code"].Value != "0000")
                {
                    continue;
                }

                if (nodesIssue == null)
                {
                    continue;
                }

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

                for (int j = 0; j < nodesIssue.Count; j++)
                {
                    LotteryName = nodesIssue[j].Attributes["gameName"].Value;
                    IsuseName = nodesIssue[j].Attributes["number"].Value;
                    string Status = nodesIssue[j].Attributes["status"].Value;
                    int LotteryID = GetLotteryID(LotteryName);
                    string WinNumber = "";

                    try
                    {
                        WinNumber = GetWinNumber(LotteryID, nodesIssue[j].Attributes["bonusCode"].Value);
                    }
                    catch
                    {

                    }

                    if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName)))
                    {
                        continue;
                    }

                    DataTable dtIsuse = t_Isuses.Open(ConnectionString, "ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + IsuseName + "'", "");

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

                    bool isHasUpdate = false;

                    if (dtIsuse.Rows[0]["State"].ToString() != Status)
                    {
                        t_Isuses.State.Value = Status;
                        t_Isuses.StateUpdateTime.Value = DateTime.Now;

                        isHasUpdate = true;
                    }

                    if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
                    {
                        t_Isuses.WinLotteryNumber.Value = WinNumber;

                        isHasUpdate = true;

                        if (LotteryID == SLS.Lottery.SHSSL.ID)
                        {
                            DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open(ConnectionString, "", "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(ConnectionString, "", "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(ConnectionString, Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SiteID"].ToString(), 1), Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SchemeID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescprtion) < 0)
                                {
                                    msg.Send("电子票撤销追号错误_P_ChaseTaskStopWhenWin。");
                                    log.Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。");
                                }
                            }
                        }
                    }

                    if (isHasUpdate)
                    {
                        t_Isuses.Update(ConnectionString, "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + IsuseName + "'");
                    }
                }

                #endregion
            }
        }
Пример #10
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);
    }
Пример #11
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);
    }
Пример #12
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);
    }