using System; using System.Collections.Generic; using System.Text; namespace Alipay.EasySDK.Kernel.Util { /// /// 生成页面信息辅助类 /// public static class PageUtil { /// /// 生成表单 /// /// 表单提交链接 /// 表单参数 /// 表单字符串 public static string BuildForm(string actionUrl, IDictionary parameters) { return "
\n" + BuildHiddenFields(parameters) + "\n" + "
\n" + ""; } private static string BuildHiddenFields(IDictionary parameters) { if (parameters == null || parameters.Count == 0) { return ""; } StringBuilder stringBuilder = new StringBuilder(); foreach (var pair in parameters) { if (pair.Key == null || pair.Value == null) { continue; } stringBuilder.Append(BuildHiddenField(pair.Key, pair.Value)); } return stringBuilder.ToString(); } private static string BuildHiddenField(string key, string value) { StringBuilder builder = new StringBuilder(64); builder.Append("\n"); return builder.ToString(); } } }