TG.WXCRM.V4/DAL/Redis/LoadDataToRedis.cs

43 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
namespace WX.CRM.DAL.Redis
{
public class LoadDataToRedis
{
public DataTable LoadDataToCache(string storeProcedure, string tableType, decimal pkid)
{
OracleConnection conn = new OracleConnection(OracleHelper.AYCRMConn);
if (conn.State == ConnectionState.Closed)
conn.Open();
try
{
using (OracleTransaction trans = conn.BeginTransaction())
{
var param = new List<OracleParameter>
{
new OracleParameter() { ParameterName = "v_storeProcedure", OracleType = OracleType.VarChar, Value = storeProcedure },
new OracleParameter() { ParameterName = "v_tabletype", OracleType = OracleType.VarChar,Value = tableType},
new OracleParameter() { ParameterName = "v_pkid", OracleType = OracleType.Number,Value = pkid},
new OracleParameter() { ParameterName = "v_data", OracleType = OracleType.Cursor,Direction = ParameterDirection.Output }
};
var ds = OracleHelper.DataQueray(CommandType.StoredProcedure, "PACK_REDIS.LoadDataToCache", param.ToArray());
return ds.Tables[0];
}
}
catch (Exception)
{
throw;
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
}
}