123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
-
- using System;
- using System.Configuration;
- namespace iNethinkCMS.Command
- {
- public class Command_Configuration
- {
- static string strXmlFile = System.Web.HttpContext.Current.Server.MapPath("~/config/sys.config");
-
-
-
-
-
- public static string GetConfigString(string byKey)
- {
- string rInfo = iNethinkCMS.Helper.XMLHelper.GetXmlNodeByXpath(strXmlFile, "//sys_configuration//" + byKey).InnerText.Trim();
- return rInfo;
- }
-
-
-
-
-
- public static string GetVersionsString(string byKey)
- {
- string rInfo = iNethinkCMS.Helper.XMLHelper.GetXmlNodeByXpath(strXmlFile, "//sys_versions//" + byKey).InnerText.Trim();
- return rInfo;
- }
-
-
-
-
-
- public static bool GetConfigBool(string byKey)
- {
- bool result = false;
- string cfgVal = iNethinkCMS.Helper.XMLHelper.GetXmlNodeByXpath(strXmlFile, "//sys_configuration//" + byKey).InnerText.Trim();
- if (null != cfgVal && string.Empty != cfgVal)
- {
- try
- {
- result = bool.Parse(cfgVal);
- }
- catch (FormatException)
- {
- }
- }
- return result;
- }
-
-
-
-
-
- public static decimal GetConfigDecimal(string byKey)
- {
- decimal result = 0;
- string cfgVal = iNethinkCMS.Helper.XMLHelper.GetXmlNodeByXpath(strXmlFile, "//sys_configuration//" + byKey).InnerText.Trim();
- if (null != cfgVal && string.Empty != cfgVal)
- {
- try
- {
- result = decimal.Parse(cfgVal);
- }
- catch (FormatException)
- {
- }
- }
- return result;
- }
-
-
-
-
-
- public static int GetConfigInt(string byKey)
- {
- int result = 0;
- string cfgVal = iNethinkCMS.Helper.XMLHelper.GetXmlNodeByXpath(strXmlFile, "//sys_configuration//" + byKey).InnerText.Trim();
- if (null != cfgVal && string.Empty != cfgVal)
- {
- try
- {
- result = int.Parse(cfgVal);
- }
- catch (FormatException)
- {
- }
- }
- return result;
- }
- }
- }
|