/// <summary>
/// 获取置业专家列表
/// </summary>
/// <returns>置业专家列表</returns>
public static DataTable GetAgentXML()
{
DataTable dt = null;
string cacheName = "agentall_zyzj";
if (CacheManager.IsCached(cacheName))
{
object o = CacheManager.GetCache(cacheName);
if (o != null)
{
dt = o as DataTable;
}
}
if (dt == null)
{
//读取xml文件到DataTable中
dt = GetAgentXMLFromFile();
if (dt != null)
{
try
{
if (dt.Rows.Count > 0)
{
dt.PrimaryKey = new DataColumn[] { dt.Columns["newcode"], dt.Columns["agentid"] };
}
}
catch
{ }
CacheManager.InsertCache(cacheName, dt, System.DateTime.Now.AddMinutes(60));
}
}
return dt;
}
/// <summary>
/// 判断是否为置业专家
/// </summary>
/// <returns>是否为置业专家</returns>
public static bool CheckZyzj(long agentID, long newCode)
{
DataTable Agentdt = new DataTable();
bool isZyzj = false;
try
{
Agentdt = GetAgentXML();
if (Agentdt != null && Agentdt.Rows.Count > 0)
{
DataRow[] drs = Agentdt.Select(" agentid=" + agentID + " and newcode=" + newCode);
if (drs != null && drs.Length > 0)
{
isZyzj = true;
}
}
}
catch (Exception ex)
{
isZyzj = false;
}
return isZyzj;
}