//===========================================================================
// Smarclient FPMS Demo Project a sample project for SmartClient technology.
// Smarclient FPMS Demo is designed and implemented bases Microsoft Application Block tech.
// Author: SFPMS Team, Date 2004-11
// Vision 1.0
// Revison History
//=============================================================================

using System;
using System.Collections;
using System.Data;
using System.Xml;

namespace JSW.FPMS.Tool
{
	/// <summary>
	/// 巡检系统配置处理工具类	
	/// </summary>
	public class clsPeiZhiChuLi
	{
		#region 常量定义区域
		public const String BANBEN_DIAOSHI	= "DIAOSHI";
		public const String BANBEN_FAXING	= "FAXING";
		#endregion

		#region 私有方法区域				
		private static XmlDocument PeiZhiXML = null;
		
		private static void ChuShiHua() 
		{
			if(PeiZhiXML == null) 
			{
				PeiZhiXML = new XmlDocument();
				PeiZhiXML.Load("peizhi.xml"); 
			}
		}
		#endregion

		#region 公共方法区域

		/// <summary>
		/// 得到数据库配置
		/// </summary>
		/// <param name="JieDianMing">配置节点名称</param>
		/// <returns>配置节点值</returns>
		/// <exception cref="Exception">出现错误，抛出异常</exception>

		public static String DeDaoShuJuKuPeiZhi(String JieDianMing) 
		{
			try 
			{
				ChuShiHua();
				XmlNodeList JieDian=PeiZhiXML.GetElementsByTagName(JieDianMing); 				
				if(JieDian != null && JieDian.Count > 0 ) 
				{
					return JieDian[0].InnerText.Trim(); 
				}
				//返回空字符串
				return "";
			}
			catch(Exception genException) 
			{
				Console.WriteLine (genException.Message );
				throw genException;
			}			
		}
		
		/// <summary>
		/// 得到版本类型
		/// </summary>
		/// <returns>版本类型<list type="String"><item>BANBEN_DIAOSHI 调试版本</item><item>BANBEN_FAXING 发行版本</item></list></returns>
		public static String DeDaoBanBenLeiXing() 
		{
			try 
			{
				ChuShiHua();
				XmlNodeList JieDian=PeiZhiXML.GetElementsByTagName("banbenleixing"); 				
				if(JieDian != null && JieDian.Count > 0 ) 
				{
					return JieDian[0].InnerText.Trim(); 
				}
				//返回空字符串
				return "";
			}
			catch(Exception genException) 
			{
				Console.WriteLine (genException.Message );
				throw genException;
			}			
		}
		

		#endregion
	}
}
