Exemple #1
0
 public static String GetString(string key)
 {
     try
     {
         XmlParamter xpKey = new XmlParamter("Key", key);
         xpKey.Direction = System.IO.ParameterDirection.Equal;
         Xml.XmlNode xn = XMLHelper.GetDataOne(path, "KeyValue", xpKey);
         if (xn != null)
         {
             return(xn.Attributes["Value"].Value);
         }
     }
     catch { }
     return("");
 }
Exemple #2
0
        public static void Edit(string key, string value, string description)
        {
            if (GetByKey(key) != null)
            {
                XmlParamter xpKey = new XmlParamter("Key", key);
                xpKey.Direction = System.IO.ParameterDirection.Equal;
                XmlParamter xpValue = new XmlParamter("Value", value);
                xpValue.Direction = System.IO.ParameterDirection.Update;
                XmlParamter xpDescription = new XmlParamter("Description", description);
                xpDescription.Direction = System.IO.ParameterDirection.Update;
                XmlParamter xpUpdateTime = new XmlParamter("UpdateTime", DateTools.GetNow().ToString("yyyy-MM-dd HH:mm:ss"));
                xpUpdateTime.Direction = System.IO.ParameterDirection.Update;

                XMLHelper.UpdateData(path, "KeyValue", xpKey, xpValue, xpDescription, xpUpdateTime);
            }
        }
Exemple #3
0
 public static Data.KeyValue GetByKey(string key)
 {
     Data.KeyValue kv = new Data.KeyValue();
     try
     {
         XmlParamter xpKey = new XmlParamter("Key", key);
         xpKey.Direction = System.IO.ParameterDirection.Equal;
         Xml.XmlNode xn = XMLHelper.GetDataOne(path, "KeyValue", xpKey);
         if (xn == null)
         {
             return(null);
         }
         else
         {
             kv.Key         = xn.Attributes["Key"].Value;
             kv.Value       = xn.Attributes["Value"].Value;
             kv.Description = xn.Attributes["Description"].Value;
             kv.UpdateTime  = Convert.ToDateTime(xn.Attributes["UpdateTime"].Value);
         }
     }
     catch { }
     return(kv);
 }