Using System;
Using System. Xml;
Namespace GetBaseInfo
{
/// <Summary>
/// Summary of GetXMLBaseInfo.
/// </Summary>
Public class GetXMLBaseInfo
{
Public GetXMLBaseInfo ()
{
//
// TODO: add the constructor logic here
//
}
/// <Summary>
/// Obtain the connection string based on the node parameters
/// </Summary>
/// <Returns> </returns>
Public static string GetConnectionString (string nodeName)
{
XmlDocument dom = new XmlDocument ();
Dom. Load (@ ". \ dataaccsponaseinfo. xml ");
XmlNode xn = dom. SelectSingleNode ("// DataBase/" + nodeName );
XmlElement xel = (XmlElement) xn;
Return xel. GetAttribute ("ConnectionString ");
}
/// <Summary>
/// Obtain the operation time based on the node parameters
/// </Summary>
/// <Param name = "nodeName"> </param>
/// <Returns> </returns>
Public static string GetTimeInfo (string nodeName)
{
XmlDocument dom = new XmlDocument ();
Dom. Load (@ ". \ dataaccsponaseinfo. xml ");
XmlNode xn = dom. SelectSingleNode ("// TimeSet/" + nodeName );
XmlElement xel = (XmlElement) xn;
Return xel. GetAttribute ("SetTime ");
}
/// <Summary>
/// Modify the operation time based on node parameters
/// </Summary>
/// <Param name = "nodeName"> </param>
/// <Returns> </returns>
Public static void UpdateTimeInfo (string nodeName, string nodeValue)
{
XmlDocument dom = new XmlDocument ();
Dom. Load (@ ". \ dataaccsponaseinfo. xml ");
XmlNode xn = dom. SelectSingleNode ("// TimeSet/" + nodeName );
XmlElement xel = (XmlElement) xn;
Xel. SetAttribute ("SetTime", nodeValue );
Dom. Save (@ ". \ DataAccessBaseInfo. xml ");
}
/// <Summary>
/// Modify Database Information Based on node parameters
/// </Summary>
/// <Param name = "nodeName"> </param>
/// <Returns> </returns>
Public static void UpdateDBInfo (string nodeName, string nodeValue)
{
XmlDocument dom = new XmlDocument ();
Dom. Load (@ ". \ dataaccsponaseinfo. xml ");
XmlNode xn = dom. SelectSingleNode ("// DataBase/" + nodeName );
XmlElement xel = (XmlElement) xn;
Xel. SetAttribute ("ConnectionString", nodeValue );
Dom. Save (@ ". \ DataAccessBaseInfo. xml ");
}
}
}