common.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace Watson.Common
{
public class Common
{
/// <summary>
/// Read error message from error ID
/// </summary>
/// <param name="errorId"></param>
/// <returns></returns>
public static string GerErrorMessage(string errorId)
{
XmlDataDocument xmlDoc = new XmlDataDocument();
string message = "Internal Error";
string errorListFile = System.AppDomain.CurrentDomain.BaseDirectory + "ErrorList\\ErrorList.xml";
xmlDoc.Load(errorListFile);
XmlNodeList xmlList = xmlDoc.SelectNodes("root/ErroMessages/ErroMessage");
if (xmlList != null)
{
foreach (XmlNode smsNode in xmlList)
{
if (smsNode.SelectSingleNode("ErrorID").InnerText == errorId)
{
message = smsNode.SelectSingleNode("ErrorDescription").InnerText;
break;
}
}
}
return message;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace Watson.Common
{
public class Common
{
/// <summary>
/// Read error message from error ID
/// </summary>
/// <param name="errorId"></param>
/// <returns></returns>
public static string GerErrorMessage(string errorId)
{
XmlDataDocument xmlDoc = new XmlDataDocument();
string message = "Internal Error";
string errorListFile = System.AppDomain.CurrentDomain.BaseDirectory + "ErrorList\\ErrorList.xml";
xmlDoc.Load(errorListFile);
XmlNodeList xmlList = xmlDoc.SelectNodes("root/ErroMessages/ErroMessage");
if (xmlList != null)
{
foreach (XmlNode smsNode in xmlList)
{
if (smsNode.SelectSingleNode("ErrorID").InnerText == errorId)
{
message = smsNode.SelectSingleNode("ErrorDescription").InnerText;
break;
}
}
}
return message;
}
}
}
0 comments:
Post a Comment