public HPResponseInfo DoBuy(UserInfo user, string gameName, string issueNumber
                                    , BuyType buyType, List <string> anteCodes, decimal money, int multiple)
        {
            try
            {
                HPBuyRequestInfo requestInfo  = new HPBuyRequestInfo();
                string           messengerId  = GetAgenceAccountUserName();
                string           userPassword = GetAgenceAccountPassword();
                string           messageId    = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber;
                string           timestamp    = DateTime.Now.ToString("yyyyMMddHHmmss");

                IssueMappingInfo issueInfo = new IssueMappingInfo();
                issueInfo.GameName = gameName;
                issueInfo.Number   = issueNumber;

                TicketMappingInfo ticket = new TicketMappingInfo();
                ticket.TicketId    = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber;
                ticket.BuyType     = buyType;
                ticket.Money       = money;
                ticket.Amount      = multiple;
                ticket.AnteCodes   = anteCodes;
                ticket.IssueInfo   = issueInfo;
                ticket.UserProfile = GetAgencyUserProfileInfo();

                HPBuyRequestInfo.Body requestBody = new HPBuyRequestInfo.Body();
                requestBody._Request            = new HPBuyRequestInfo.Body.Request();
                requestBody._Request.TicketList = new XmlMappingList <TicketMappingInfo>();
                requestBody._Request.TicketList.Add(ticket);

                string bodyXml = requestBody.ToXmlString("body");

                CommunicationObject.RequestHeaderObject requestHeader = new CommunicationObject.RequestHeaderObject();
                requestHeader.MessengerId     = GetAgenceAccountUserName();
                requestHeader.Timestamp       = timestamp;
                requestHeader.TransactionType = TranType.Request103;
                requestHeader.Digest          = PostManager.MD5(messageId + timestamp + userPassword + bodyXml, "gb2312");

                string headerXml   = requestHeader.ToXmlString("header");
                string requestXml  = "<?xml version=\"1.0\" encoding=\"GBK\"?><message version=\"1.0\" id=\"" + messageId + "\">" + headerXml + bodyXml + "</message>";
                string requestText = "transType=" + (int)TranType.Request103 + "&transMessage=" + requestXml;

                BuyTicket(ticket, user);
                string         xml  = PostManager.Post(GateWayManager.HPIssueQuery_GateWay, requestText, 1200);
                HPResponseInfo info = XmlAnalyzer.AnalyseResponse <HPResponseInfo>(xml);
                UpdateTicketStatus(ticket, user, info);

                return(info);
            }
            catch (Exception ex)
            {
                throw HandleException(LogCategory.Ticket, "认购失败!", ex);
            }
        }
    private void DoBuy()
    {
        string issueIdString   = HidIsuseID.Value;
        string isuseNumber     = HidIsuseNumber.Value;
        string endTime         = HidIsuseEndTime.Value;
        string playTypeString  = Shove._Web.Utility.GetRequest("playType");
        string lotteryNumber   = Shove._Web.Utility.FilteSqlInfusion(base.Request["tb_LotteryNumber"]);
        string sumMoneyString  = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string sumNumberString = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string lotteryIdString = Shove._Web.Utility.GetRequest("HidLotteryID");
        string multipleString  = Shove._Web.Utility.GetRequest("tb_Multiple");

        if (multipleString == "")
        {
            multipleString = "1";
        }
        StringBuilder sb = new StringBuilder();

        try
        {
            HPBuyRequestInfo requestInfo = new HPBuyRequestInfo();

            decimal money     = decimal.Parse(sumMoneyString);
            int     multiple  = int.Parse(multipleString);
            int     sumNumber = int.Parse(sumNumberString);
            int     playType  = int.Parse(playTypeString);
            int     lotteryId = int.Parse(lotteryIdString);
            long    isuseId   = long.Parse(issueIdString);

            string messengerId  = GetAgenceAccountUserName();
            string userPassword = GetAgenceAccountPassword();
            string messageId    = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber;
            string timestamp    = DateTime.Now.ToString("yyyyMMddHHmmss");

            IssueMappingInfo issueInfo = new IssueMappingInfo();
            issueInfo.GameName = LotteryCode;
            issueInfo.Number   = isuseNumber;

            List <string> anteCodes = new List <string>();
            lotteryNumber = lotteryNumber.Replace(" + ", "#").Replace(' ', ',');
            anteCodes.AddRange(lotteryNumber.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));

            TicketMappingInfo ticket = new TicketMappingInfo();
            ticket.TicketId  = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber;
            ticket.BuyType   = BuyType.A101; // TODO
            ticket.Money     = money;
            ticket.Amount    = multiple;
            ticket.AnteCodes = anteCodes;
            ticket.IssueInfo = issueInfo;
            //ticket.UserProfile = GetAgencyUserProfileInfo();

            HPBuyRequestInfo.Body requestBody = new HPBuyRequestInfo.Body();
            requestBody._Request            = new HPBuyRequestInfo.Body.Request();
            requestBody._Request.TicketList = new XmlMappingList <TicketMappingInfo>();
            requestBody._Request.TicketList.Add(ticket);

            string bodyXml = requestBody.ToXmlString("body");

            CommunicationObject.RequestHeaderObject requestHeader = new CommunicationObject.RequestHeaderObject();
            requestHeader.MessengerId     = GetAgenceAccountUserName();
            requestHeader.Timestamp       = timestamp;
            requestHeader.TransactionType = TranType.Request103;
            requestHeader.Digest          = PostManager.MD5(messageId + timestamp + userPassword + bodyXml, "gb2312");

            string headerXml = requestHeader.ToXmlString("header");

            string requestXml = "<?xml version=\"1.0\" encoding=\"GBK\"?><message version=\"1.0\" id=\"" + messageId + "\">" + headerXml + bodyXml + "</message>";

            string result = @"投注结果\n\n";
            try
            {
                string requestText = "transType=" + (int)TranType.Request103 + "&transMessage=" + requestXml;
                string xml         = PostManager.Post(GateWayManager.HPIssueQuery_GateWay, requestText, 1200);
                //string xml = gateway.LotteryRequest(accountN, transType, tickets);
                HPResponseInfo info = XmlAnalyzer.AnalyseResponse <HPResponseInfo>(xml);
                result += info.Code + " - " + info.Message;
            }
            catch (Exception ex)
            {
                result += "错误 - " + ex.Message;
                LogWriter.Write(LogCategory.Lottery, "投注错误", ex);
            }
            JavaScript.Alert(this.Page, result);
            return;
        }
        catch
        {
            JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
            return;
        }
    }