protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         NoticeFacade facade = new NoticeFacade();
         DateTime fromTime = facade.GetCurrentUpdateTime();
         string r = Post("http://222.186.12.129:8099/GetResponseText.aspx", fromTime.ToString("yyyy-MM-dd HH:mm:ss"), 5000);
         if (!string.IsNullOrEmpty(r))
         {
             r = Server.UrlDecode(r);
             string[] list = r.Split('@');
             int i = 0;
             foreach (string body in list)
             {
                 string str = Post("http://localhost:47599/J.SLS.Site/HP_Recevie.aspx", body, 5000);
                 Response.Write(Server.UrlDecode(str) + "<br />");
                 i++;
             }
             facade.ModifyCurrentUpdateTime(DateTime.Now);
             Response.Write("<br />");
             Response.Write("<b>成功同步 " + i + "条请求数据!</b><br />");
         }
         else
         {
             Response.Write("<b>nothing</b><br />");
         }
     }
     catch (Exception ex)
     {
         LogWriter.Write(LogCategory.Application, "同步通知失败", ex);
         Response.Write("<b>同步发生异常 - " + ex.Message + "</b><br />");
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DateTime fromTime = GetRequestDate();
         NoticeFacade facade = new NoticeFacade();
         IList<string> list = facade.GetRequestTextList(fromTime);
         string r = string.Join("@", list.ToArray());
         byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(Server.UrlEncode(r));
         Response.OutputStream.Write(bytes, 0, bytes.Length);
     }
     catch (Exception ex)
     {
         LogWriter.Write(LogCategory.Application, "同步通知数据失败", ex);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        string requestString = Server.UrlDecode(GetRequestMessage());
        try
        {
            NoticeFacade noticeFacade = new NoticeFacade();
            CommunicationObject noticeInfo = noticeFacade.HandleNotice(requestString);
            string accountUserName = GetAgenceAccountUserName();
            string accountPassword = GetAgenceAccountPassword();
            // 响应的交易类型,如请求奖期通知101,则响应为501.
            TranType returnType = (TranType)((int)noticeInfo.TransactionType + 400);
            string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
            string body = "<body><response code=\"0000\" message=\"成功,系统处理正常!\" /></body>";
            string digest = PostManager.MD5(noticeInfo.Id + timestamp + accountPassword + body, "gb2312");

            StringBuilder sb = new StringBuilder();
            // <?xml version=\"1.0\" encoding=\"GBK\"?>
            sb.Append(noticeInfo.XmlHeader);
            // <message version=\"1.0\" id=\"6000012007111300000231\">
            sb.AppendFormat("<message version=\"{0}\" id=\"{1}\">", noticeInfo.Version, noticeInfo.Id);
            // <header><messengerID>{0}</messengerID><timestamp>20071113092456</timestamp><transactionType>501</transactionType><digest>8123f913e123e123990028d9c72e0dfgds</digest></header>
            sb.AppendFormat("<header><messengerID>{0}</messengerID><timestamp>{1}</timestamp><transactionType>{2}</transactionType><digest>{3}</digest></header>"
                , accountUserName
                , timestamp
                , (int)returnType
                , digest);
            sb.Append(body);
            sb.Append("</message>");

            string rtnResponse = "transType=" + (int)returnType + "&transMessage=" + sb.ToString();
            noticeFacade.AddNotifyResponse(noticeInfo, rtnResponse, sb.ToString());

            //Response.Write(rtnResponse);
            byte[] bytes = Encoding.GetEncoding("GBK").GetBytes(rtnResponse);
            Response.OutputStream.Write(bytes, 0, bytes.Length);
        }
        catch (Exception ex)
        {
            Exception ext = new Exception("处理通知发生未知异常 - " + requestString, ex);
            LogWriter.Write(LogCategory.Notice, "处理通知失败", ext);
        }
    }