private static XmlParamter CreateParameter(string name, string value, ParameterDirection direciton) { XmlParamter p = new XmlParamter(); p.Name = name; p.Value = value; p.Direction = direciton; return(p); }
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 ""; }
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; }
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); } }
private static XmlParamter CreateParameter(string name, string value, ParameterDirection direciton) { XmlParamter p = new XmlParamter(); p.Name = name; p.Value = value; p.Direction = direciton; return p; }