using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebService.SDK; using HZQR.Common; namespace Test.WebSite { public partial class TestPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void BtnSend_Click(object sender, EventArgs e) { Hashtable hashtable = new Hashtable { { "code", code.Text }, { "tableName", tableName.Text }, { "jsonString", jsonString.Text }, { "orderString", orderString.Text }, { "UniqueCode", UniqueCode.Text }, { "redisInsert", redisInsert.Text } }; SoapWSHelper.QuerySoapWebServiceString(Url.Text, method_name.Text, hashtable); string Path = "D:\\Project\\000_通用版本\\000_通用版本\\011_支付宝\\DataTransferService\\Log\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + code.Text + ".log"; switch (tableName.Text) { case "HIGHWAY_EXCHANGE.T_ENDACCOUNT_NEW": GetRedisData(tableName.Text, code.Text, UniqueCode.Text); break; case "HIGHWAY_EXCHANGE.T_PERSONSELL_NEW": GetRedisData(tableName.Text, code.Text, UniqueCode.Text); break; } LogData.Text = ReadTextFile(Path); } #region 读取文本文件 public string ReadTextFile(string Path) { string txt = ""; StreamReader sr = new StreamReader(Path); while (!sr.EndOfStream) { string str = sr.ReadLine(); txt += str + "\n"; } sr.Close(); return txt; } #endregion #region 读取缓存数据库内容 public void GetRedisData(string tableName, string code, string UniqueCode) { DataTable dataTable = new DataTable(); switch (tableName) { case "HIGHWAY_EXCHANGE.T_ENDACCOUNT_NEW": dataTable.Columns.Add("ENDACCOUNT_CODE", typeof(string)); Model.Redis.Endaccount EndaccountModel = RedisHelp.Redis.HashGet( 0, "Endaccount:" + code, UniqueCode); if (EndaccountModel != null) { DataRow dataRow = dataTable.NewRow(); dataRow["ENDACCOUNT_CODE"] = EndaccountModel.ENDACCOUNT_CODE; dataTable.Rows.Add(dataRow); } break; case "HIGHWAY_EXCHANGE.T_PERSONSELL_NEW": dataTable.Columns.Add("PERSONSELL_CODE", typeof(string)); Model.Redis.Personsell PersonsellModel = RedisHelp.Redis.HashGet( 0, "Personsell:" + code, UniqueCode); if (PersonsellModel != null) { DataRow dataRow = dataTable.NewRow(); dataRow["PERSONSELL_CODE"] = PersonsellModel.PERSONSELL_CODE; dataTable.Rows.Add(dataRow); } break; } GridView_Redis.DataSource = dataTable; GridView_Redis.DataBind(); } #endregion } }