Exemplo n.º 1
0
    protected void btnK_Click(object sender, EventArgs e)
    {
        string x = "<body><order username=\"\" lotoid=\"002\" issue=\"2012177\" areaid=\"\" orderno=\"80000120127515447893\"><userinfo realname=\"xyz\" mobile=\"13699288098\" email=\"[email protected]\" cardtype=\"1\" cardno=\"342623198912207578\"/><ticket seq=\"2\">00-01-01,02,03,04,05,06#07|01,02,03,05,06,11#20-1-4</ticket></order></body>";//00-01-01,02,03,04,05,06#07&amp;01,02,04,06,08#11-1-4
        
        x = "<body><order username=\"\" lotoid=\"001\" issue=\"2012088\" areaid=\"\" orderno=\"12345675eweqqwqwe\">"
            + "<userinfo realname=\"\" mobile=\"13333333333\" email=\"[email protected]\" cardtype=\"1\" cardno=\"342623198912207578\"/>"
            + "<ticket seq=\"1\">00-01-01,02,03,04,05,06#07&amp;03,04,11,20,25,32#07-50-200</ticket>"
            + "<ticket seq=\"2\">00-01-01,02,03,04,05,06#07&amp;03,04,11,20,25,32#07-30-120</ticket>"
            + "<ticket seq=\"3\">00-01-03,04,11,20,25,32#07-4-8</ticket></order></body>";
        x = "<body><order username=\"xicaigufen\" lotoid=\"001\" issue=\"2011147\" areaid=\"00\" orderno=\"20120711182757000002012080\">"
            + "<userinfo realname=\"\" mobile=\"\" email=\"\" cardtype=\"1\" cardno=\"\" />"
            + "<ticket seq=\"00000\">00-01-02,03,13,15,23,25,27&amp;03,06,08,11,17,20,27&amp;09,12,15,18,21,23,24&amp;02,03,08,12,22,29,30&amp;08,10,15,18,20,26,28-1-10</ticket>"
           // + "<ticket seq=\"00001\">00-01-01,05,17,18,20,25,30&amp;09,12,14,16,17,21,26&amp;05,06,11,12,18,20,26&amp;05,06,13,26,27,29,30&amp;01,05,15,19,22,24,27-1-10</ticket>"
            //+ "<ticket seq=\"00002\">00-01-05,10,13,15,22,26,29&amp;06,09,15,16,22,25,27&amp;03,06,18,20,21,23,29&amp;06,15,18,20,24,25,27&amp;06,11,13,15,24,27,30-50-500</ticket>"
           // + "<ticket seq=\"00003\">00-01-05,10,13,15,22,26,29&amp;06,09,15,16,22,25,27&amp;03,06,18,20,21,23,29&amp;06,15,18,20,24,25,27&amp;06,11,13,15,24,27,30-50-500</ticket>"
            //+ "<ticket seq=\"00004\">00-01-05,10,13,15,22,26,29&amp;06,09,15,16,22,25,27&amp;03,06,18,20,21,23,29&amp;06,15,18,20,24,25,27&amp;06,11,13,15,24,27,30-11-110</ticket>"
            + "</order></body>";
        x = "<body><order username=\"xicaigufen\" lotoid=\"001\" issue=\"2011147\" areaid=\"00\" orderno=\"20120712101015000002012081\"><userinfo realname=\"\" mobile=\"\" email=\"\" cardtype=\"1\" cardno=\"\" /><ticket seq=\"00000\">00-01-01,02,04,08,23,24,27&amp;01,06,18,21,23,24,28&amp;02,07,13,16,19,25,27&amp;02,04,14,15,17,27,28&amp;05,06,09,10,13,15,22-1-10</ticket><ticket seq=\"00000\">00-01-10,11,16,17,18,20,27-1-2</ticket><ticket seq=\"00000\">00-02-03,05,06,08,11,15,16,19,22,23,27,29-1-1584</ticket><ticket seq=\"00000\">00-02-05,06,07,12,18,19,22,27-1-16</ticket></order></body>";
        x = tb.Text.Split('?')[1];
        string cmd = tb.Text.Split('?')[0];
        MD5CryptoServiceProvider md = new MD5CryptoServiceProvider();
        Encoding gb2312;
        gb2312 = Encoding.GetEncoding(936);
        byte[] mb = md.ComputeHash(gb2312.GetBytes("800060" + "xicaigufen" + x));
        string mdx;
        mdx = BitConverter.ToString(mb).Replace("-", "").ToLower();
        tbx.Text = mdx;
        string y;
        y = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><msg v=\"1.0\" id=\"20120711182757000002012080\"><ctrl><agentID>800060</agentID><cmd>" + cmd + "</cmd><timestamp>"
            + DateTime.Now.ToString("yyyyMMddHHmmss") + "</timestamp><md>" + mdx + "</md></ctrl>" + x + "</msg>";
        
        var sn = new SLS.Common.EtSunLotto();
        string resp = null;
        //y = "%3C%3F%78%6D%6C%20%76%65%72%73%69%6F%6E%3D%22%31%2E%30%22%20%65%6E%63%6F%64%69%6E%67%3D%22%55%54%46%2D%38%22%3F%3E%3C%6D%73%67%20%76%3D%22%31%2E%30%22%20%69%64%3D%22%31%33%34%31%39%39%32%39%37%38%36%36%34%22%3E%3C%63%74%72%6C%3E%3C%61%67%65%6E%74%49%44%3E%38%30%30%30%36%30%3C%2F%61%67%65%6E%74%49%44%3E%3C%63%6D%64%3E%32%30%30%31%3C%2F%63%6D%64%3E%3C%74%69%6D%65%73%74%61%6D%70%3E%31%33%34%31%39%39%32%39%37%38%36%36%39%3C%2F%74%69%6D%65%73%74%61%6D%70%3E%3C%6D%64%3E%63%39%38%64%65%32%32%35%39%65%33%64%65%64%64%36%38%64%36%64%64%37%32%63%38%31%64%64%35%66%31%30%3C%2F%6D%64%3E%3C%2F%63%74%72%6C%3E%3C%62%6F%64%79%3E%3C%6F%72%64%65%72%20%75%73%65%72%6E%61%6D%65%3D%22%22%20%6C%6F%74%6F%69%64%3D%22%30%30%31%22%20%69%73%73%75%65%3D%22%32%30%31%32%30%38%39%22%20%61%72%65%61%69%64%3D%22%22%20%6F%72%64%65%72%6E%6F%3D%22%31%32%33%34%35%36%37%38%65%77%65%71%71%77%71%77%65%22%3E%3C%75%73%65%72%69%6E%66%6F%20%72%65%61%6C%6E%61%6D%65%3D%22%E6%B5%8B%E8%AF%95%E6%B5%8B%E8%AF%95%22%20%6D%6F%62%69%6C%65%3D%22%31%33%33%33%33%33%33%33%33%33%33%22%20%65%6D%61%69%6C%3D%22%32%33%34%33%32%34%33%32%40%31%36%33%2E%63%6F%6D%22%20%63%61%72%64%74%79%70%65%3D%22%31%22%20%63%61%72%64%6E%6F%3D%22%33%34%32%36%32%33%31%39%38%39%31%32%32%30%37%35%37%38%22%2F%3E%3C%74%69%63%6B%65%74%20%73%65%71%3D%22%31%22%3E%30%30%2D%30%31%2D%30%31%2C%30%32%2C%30%33%2C%30%34%2C%30%35%2C%30%36%23%30%37%26%61%6D%70%3B%30%38%2C%30%39%2C%31%30%2C%31%31%2C%31%32%2C%31%33%23%31%34%2D%31%2D%34%3C%2F%74%69%63%6B%65%74%3E%3C%2F%6F%72%64%65%72%3E%3C%2F%62%6F%64%79%3E%3C%2F%6D%73%67%3E";

        tbK.Text = y + "\n" + HttpUtility.UrlEncode(y);
        byte[] bData = Encoding.UTF8.GetBytes("cmd=" + cmd + "&msg=" + HttpUtility.UrlEncode(y));
        HttpWebRequest req = null;
        req = (HttpWebRequest)WebRequest.Create(ConfigurationManager.AppSettings["SunPostAddr"]);
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = bData.Length;
        req.AllowWriteStreamBuffering = false;
       
        using (Stream writeStream = req.GetRequestStream())
        {
            writeStream.Write(bData, 0, bData.Length);
        }
        using (StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()))
        {
            resp = sr.ReadToEnd();
        }
        tbOut.Text = "=============== Response ===============\n" + resp;
        
        
    }
Exemplo n.º 2
0
 public eTickets(string connectionString)
 {
     eTicketProvider = new SLS.Common.EtSunLotto();
     ConnectionString = connectionString;
 }
Exemplo n.º 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();
    }
Exemplo n.º 4
0
 public eTickets(string connectionString)
 {
     eTicketProvider  = new SLS.Common.EtSunLotto();
     ConnectionString = connectionString;
 }