Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.bargainor_id = this.so["OnlinePay_Tenpay_UserNumber"].Value.ToString();
     this.key          = this.so["OnlinePay_Tenpay_MD5Key"].Value.ToString();
     this.date         = Utility.GetRequest("date");
     this.sp_billno    = Utility.GetRequest("sp_billno");
     if ((string.IsNullOrEmpty(this.date) || string.IsNullOrEmpty(this.sp_billno)) || (string.IsNullOrEmpty(this.bargainor_id) || string.IsNullOrEmpty(this.key)))
     {
         base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:参数不齐全,无法提交查询!\"); window.location.href='';</script>");
     }
     else
     {
         this.transaction_id = this.CreatePayNumber(this.sp_billno);
         string url = "";
         if (!this.GetQueryUrl(out url))
         {
             base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:" + url + "!\");window.location.href='';</script>");
         }
         else
         {
             string str2 = "";
             if (this.GetSus_Msg(PF.GetHtml(url, "GBK", 120), out str2))
             {
                 base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:" + str2 + "!\"); window.location.href='';</script>");
             }
             else
             {
                 base.Response.Write(str2);
             }
         }
     }
 }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //获取查询参数
        //Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + attach + "!\");window.location.href='';</script>");

        ////获取查询参数
        //Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " +UrlDecode(attach) + "!\");window.location.href='';</script>");

        //return;

        //卖家商户号
        bargainor_id = so["OnlinePay_Tenpay_UserNumber"].Value.ToString();

        //卖家商户key
        key = so["OnlinePay_Tenpay_MD5Key"].Value.ToString();

        date      = Shove._Web.Utility.GetRequest("date");
        sp_billno = Shove._Web.Utility.GetRequest("sp_billno");

        if (string.IsNullOrEmpty(date) || string.IsNullOrEmpty(sp_billno) || string.IsNullOrEmpty(bargainor_id) || string.IsNullOrEmpty(key))
        {
            Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:参数不齐全,无法提交查询!\"); window.location.href='';</script>");

            return;
        }

        transaction_id = CreatePayNumber(sp_billno);

        string url = "";

        if (!GetQueryUrl(out url))
        {
            Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:" + url + "!\");window.location.href='';</script>");

            return;
        }
        else
        {
            string returnUrl = "";

            if (GetSus_Msg(PF.GetHtml(url, "GBK", 120), out returnUrl))
            {
                Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:" + returnUrl + "!\"); window.location.href='';</script>");

                return;
            }

            Response.Write(returnUrl);
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SystemOptions options = new SystemOptions();

        this.MerID      = options["OnlinePay_007Ka_MerchantId"].ToString("").Trim();
        this.MerAccount = options["OnlinePay_007Ka_MerAccount"].ToString("").Trim();
        this.OrderID    = Utility.GetRequest("OrderID");
        this.key        = options["OnlinePay_007Ka_Key"].ToString("").Trim();
        this.MerURL     = Utility.GetUrl() + "/Home/Room/OnlinePay/007ka/QueryResult.aspx";
        this.Attach     = this.MerURL;
        this.SettingOrderInfo();
        this.Sign = this.GetMD5(this.Orderinfo + "|" + this.key);
        string str = HttpUtility.UrlEncode(PF.GetHtml("http://www.007ka.cn/interface/cardpay/query.php?Orderinfo=" + this.Orderinfo + "&Sign=" + this.Sign, "GBK", 1));

        base.Response.Redirect("QueryResult.aspx?Orderinfo=" + str, true);
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SystemOptions so = new SystemOptions();

        MerID      = so["OnlinePay_007Ka_MerchantId"].ToString("").Trim();
        MerAccount = so["OnlinePay_007Ka_MerAccount"].ToString("").Trim();
        OrderID    = Shove._Web.Utility.GetRequest("OrderID");
        key        = so["OnlinePay_007Ka_Key"].ToString("").Trim();
        MerURL     = Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/007ka/QueryResult.aspx";
        Attach     = MerURL;
        SettingOrderInfo();
        Sign = GetMD5(Orderinfo + "|" + key);

        string return_Orderinfo = PF.GetHtml("http://www.007ka.cn/interface/cardpay/query.php?Orderinfo=" + Orderinfo + "&Sign=" + Sign, "GBK", 1);

        return_Orderinfo = System.Web.HttpUtility.UrlEncode(return_Orderinfo);
        Response.Redirect("QueryResult.aspx?Orderinfo=" + return_Orderinfo, true);
    }
Ejemplo n.º 5
0
        public int Query(string PayType, string PaymentNumber, ref string AlipayPaymentNumber, ref string ReturnDescription)
        {
            SystemOptions so = new SystemOptions();

            string gateway        = so["QueryAddMoney_Alipay_Gateway"].ToString("");
            string service        = "single_trade_query";
            string partner        = ""; //卖家商户号
            string Key            = "";
            string _input_charset = "utf-8";
            string sign_type      = "MD5";

            if (PayType == "ALIPAY_alipay")
            {
                partner = so["OnlinePay_Alipay_UserNumber"].ToString("");  //卖家商户号
                Key     = so["OnlinePay_Alipay_MD5Key"].ToString("");
            }
            else
            {
                partner = so["OnlinePay_Alipay_UserNumber1"].ToString("");  //卖家商户号
                Key     = so["OnlinePay_Alipay_MD5Key1"].ToString("");
            }

            if ((gateway == "") || (partner == "") || (Key == ""))
            {
                ReturnDescription = "系统设置信息错误";

                return(-1);
            }

            Utility utility = new Utility();

            string aliay_url = utility.Createurl(gateway, service, partner, Key, sign_type, _input_charset, "out_trade_no", PaymentNumber);

            string AlipayResult = "";

            try
            {
                AlipayResult = PF.GetHtml(aliay_url, "utf-8", 120);
            }
            catch
            {
                ReturnDescription = "数据获取异常,请重新审核";

                return(-2);
            }

            if (string.IsNullOrEmpty(AlipayResult))
            {
                ReturnDescription = "数据获取异常,请重新审核";

                return(-3);
            }

            XmlDocument XmlDoc = new XmlDocument();

            try
            {
                XmlDoc.Load(new StringReader(AlipayResult));
            }
            catch
            {
                ReturnDescription = "数据获取异常,请重新审核";

                return(-4);
            }

            System.Xml.XmlNodeList nodesIs_success = XmlDoc.GetElementsByTagName("is_success");

            if ((nodesIs_success == null) || (nodesIs_success.Count < 1))
            {
                ReturnDescription = "查询信息获取异常,请重新查询";

                return(-5);
            }

            string is_success = nodesIs_success[0].InnerText;

            if (is_success.ToUpper() != "T")
            {
                ReturnDescription = "该支付记录未支付成功";

                return(-6);
            }

            System.Xml.XmlNodeList nodesTrade_no = XmlDoc.GetElementsByTagName("trade_no");

            if ((nodesTrade_no == null) || (nodesTrade_no.Count < 1))
            {
                ReturnDescription = "没有对应的支付信息";

                return(-7);
            }

            AlipayPaymentNumber = nodesTrade_no[0].InnerText;

            System.Xml.XmlNodeList nodesTrade_Status = XmlDoc.GetElementsByTagName("trade_status");

            if ((nodesTrade_Status == null) || (nodesTrade_Status.Count < 1))
            {
                ReturnDescription = "没有对应的支付信息";

                return(-8);
            }

            string Trade_Status = nodesTrade_Status[0].InnerText.ToUpper();

            if (Trade_Status == "WAIT_BUYER_PAY")
            {
                ReturnDescription = "等待买家付款";

                return(-9);
            }

            if (Trade_Status == "WAIT_SELLER_SEND_GOODS")
            {
                ReturnDescription = "买家付款成功(担保交易,未确定支付给商家)";

                return(-10);
            }

            if (Trade_Status == "WAIT_BUYER_CONFIRM_GOODS")
            {
                ReturnDescription = "卖家发货成功(未确定支付给商家)";

                return(-11);
            }

            if (Trade_Status == "TRADE_CLOSED")
            {
                ReturnDescription = "交易被关闭,未成功付款";

                return(-12);
            }

            if (Trade_Status != "TRADE_FINISHED" && Trade_Status != "TRADE_SUCCESS")
            {
                ReturnDescription = "其他未成功支付的错误";

                return(-9999);
            }

            return(0);
        }
Ejemplo n.º 6
0
        public long Query(string Account, ref string RealityName)
        {
            SystemOptions options = new SystemOptions();
            string        gateway = options["MemberRegister_Alipay_Gateway"].ToString("");
            string        service = "user_query";
            string        partner = options["MemberRegister_Alipay_UserNumber"].ToString("");
            string        key     = options["MemberRegister_Alipay_MD5"].ToString("");
            string        charset = "utf-8";
            string        str6    = "MD5";

            if (((gateway == "") || (partner == "")) || (key == ""))
            {
                return(-1L);
            }
            Utility ul   = new Gateway.Utility();
            string  url  = ul.Createurl(gateway, service, partner, key, str6, charset, new string[] { "email", Account });
            string  str8 = "";

            try
            {
                str8 = PF.GetHtml(url, "utf-8", 20);
            }
            catch
            {
                return(-2L);
            }
            if (string.IsNullOrEmpty(str8))
            {
                return(-3L);
            }
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(new StringReader(str8));
            }
            catch
            {
                return(-4L);
            }
            XmlNodeList elementsByTagName = document.GetElementsByTagName("is_success");

            if ((elementsByTagName == null) || (elementsByTagName.Count < 1))
            {
                return(-5L);
            }
            if (elementsByTagName[0].InnerText.ToUpper() != "T")
            {
                return(-6L);
            }
            XmlNodeList list2 = document.GetElementsByTagName("user_id");

            if ((list2 == null) || (list2.Count < 1))
            {
                return(-7L);
            }
            XmlNodeList list3 = document.GetElementsByTagName("real_name");

            if ((list3 != null) && (list3.Count >= 1))
            {
                RealityName = list3[0].InnerText;
            }
            else
            {
                RealityName = "";
            }
            return(_Convert.StrToLong(list2[0].InnerText, -8L));
        }
Ejemplo n.º 7
0
        public int Query(string PayType, string PaymentNumber, ref string AlipayPaymentNumber, ref string ReturnDescription)
        {
            SystemOptions options = new SystemOptions();
            string        gateway = options["QueryAddMoney_Alipay_Gateway"].ToString("");
            string        service = "single_trade_query";
            string        partner = "";
            string        key     = "";
            string        charset = "utf-8";
            string        str6    = "MD5";

            if (PayType == "ALIPAY_alipay")
            {
                partner = options["OnlinePay_Alipay_UserNumber"].ToString("");
                key     = options["OnlinePay_Alipay_MD5Key"].ToString("");
            }
            else
            {
                partner = options["OnlinePay_Alipay_UserNumber1"].ToString("");
                key     = options["OnlinePay_Alipay_MD5Key1"].ToString("");
            }
            if (((gateway == "") || (partner == "")) || (key == ""))
            {
                ReturnDescription = "系统设置信息错误";
                return(-1);
            }
            string url  = new Utility().Createurl(gateway, service, partner, key, str6, charset, new string[] { "out_trade_no", PaymentNumber });
            string str8 = "";

            try
            {
                str8 = PF.GetHtml(url, "utf-8", 120);
            }
            catch
            {
                ReturnDescription = "数据获取异常,请重新审核";
                return(-2);
            }
            if (string.IsNullOrEmpty(str8))
            {
                ReturnDescription = "数据获取异常,请重新审核";
                return(-3);
            }
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(new StringReader(str8));
            }
            catch
            {
                ReturnDescription = "数据获取异常,请重新审核";
                return(-4);
            }
            XmlNodeList elementsByTagName = document.GetElementsByTagName("is_success");

            if ((elementsByTagName == null) || (elementsByTagName.Count < 1))
            {
                ReturnDescription = "查询信息获取异常,请重新查询";
                return(-5);
            }
            if (elementsByTagName[0].InnerText.ToUpper() != "T")
            {
                ReturnDescription = "该支付记录未支付成功";
                return(-6);
            }
            XmlNodeList list2 = document.GetElementsByTagName("trade_no");

            if ((list2 == null) || (list2.Count < 1))
            {
                ReturnDescription = "没有对应的支付信息";
                return(-7);
            }
            AlipayPaymentNumber = list2[0].InnerText;
            XmlNodeList list3 = document.GetElementsByTagName("trade_status");

            if ((list3 == null) || (list3.Count < 1))
            {
                ReturnDescription = "没有对应的支付信息";
                return(-8);
            }
            string str10 = list3[0].InnerText.ToUpper();

            switch (str10)
            {
            case "WAIT_BUYER_PAY":
                ReturnDescription = "等待买家付款";
                return(-9);

            case "WAIT_SELLER_SEND_GOODS":
                ReturnDescription = "买家付款成功(担保交易,未确定支付给商家)";
                return(-10);

            case "WAIT_BUYER_CONFIRM_GOODS":
                ReturnDescription = "卖家发货成功(未确定支付给商家)";
                return(-11);

            case "TRADE_CLOSED":
                ReturnDescription = "交易被关闭,未成功付款";
                return(-12);
            }
            if (str10 != "TRADE_FINISHED")
            {
                ReturnDescription = "其他未成功支付的错误";
                return(-9999);
            }
            return(0);
        }
Ejemplo n.º 8
0
        public long Query(string Account, ref string RealityName)
        {
            SystemOptions so = new SystemOptions();

            string gateway        = so["MemberRegister_Alipay_Gateway"].ToString("");
            string service        = "user_query";
            string partner        = so["MemberRegister_Alipay_UserNumber"].ToString(""); //卖家商户号
            string Key            = so["MemberRegister_Alipay_MD5"].ToString("");
            string _input_charset = "utf-8";
            string sign_type      = "MD5";

            if ((gateway == "") || (partner == "") || (Key == ""))
            {
                return(-1);
            }

            Utility utility = new Utility();

            string aliay_url = utility.Createurl(gateway, service, partner, Key, sign_type, _input_charset, "email", Account);

            string AlipayResult = "";

            try
            {
                AlipayResult = PF.GetHtml(aliay_url, "utf-8", 20);
            }
            catch
            {
                return(-2);
            }

            if (string.IsNullOrEmpty(AlipayResult))
            {
                return(-3);
            }

            XmlDocument XmlDoc = new XmlDocument();

            try
            {
                XmlDoc.Load(new StringReader(AlipayResult));
            }
            catch
            {
                return(-4);
            }

            System.Xml.XmlNodeList nodesIs_success = XmlDoc.GetElementsByTagName("is_success");

            if ((nodesIs_success == null) || (nodesIs_success.Count < 1))
            {
                return(-5);
            }

            string is_success = nodesIs_success[0].InnerText;

            if (is_success.ToUpper() != "T")
            {
                return(-6);
            }

            System.Xml.XmlNodeList nodesUserID = XmlDoc.GetElementsByTagName("user_id");

            if ((nodesUserID == null) || (nodesUserID.Count < 1))
            {
                return(-7);
            }

            System.Xml.XmlNodeList nodesUserRealityName = XmlDoc.GetElementsByTagName("real_name");

            if ((nodesUserRealityName != null) && (nodesUserRealityName.Count >= 1))
            {
                RealityName = nodesUserRealityName[0].InnerText;
            }
            else
            {
                RealityName = "";
            }

            return(Shove._Convert.StrToLong(nodesUserID[0].InnerText, -8));
        }
Ejemplo n.º 9
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);
    }
Ejemplo n.º 10
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);
    }