Exemplo n.º 1
0
        public static void Edit(string key, string value, string description)
        {
            KeyValueData kv = GetByKey(key);

            if (kv != 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(GetPath(), "KeyValue", xpKey, xpValue, xpDescription, xpUpdateTime);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 根据Value倒序排列
 /// </summary>
 /// <param name="kv1"></param>
 /// <param name="kv2"></param>
 /// <returns></returns>
 public static int CompareByValueDesc(KeyValueData kv1, KeyValueData kv2)
 {
     return(String.Compare(kv2.KeyValue, kv1.KeyValue));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 根据Key排列
 /// </summary>
 /// <param name="kv1"></param>
 /// <param name="kv2"></param>
 /// <returns></returns>
 public static int CompareByKey(KeyValueData kv1, KeyValueData kv2)
 {
     return(String.Compare(kv1.KeyName, kv2.KeyName));
 }
Exemplo n.º 4
0
 public static Data.KeyValueData GetByKey(string key)
 {
     Data.KeyValueData kv = null;
     try
     {
         kv = new Data.KeyValueData();
         XmlParamter xpKey = new XmlParamter("Key", key);
         xpKey.Direction = System.IO.ParameterDirection.Equal;
         Xml.XmlNode xn = XMLHelper.GetDataOne(GetPath(), "KeyValue", xpKey);
         if (xn == null)
         {
             return null;
         }
         else
         {
             kv.KeyName = xn.Attributes["Key"].Value;
             kv.KeyValue = xn.Attributes["Value"].Value;
             kv.Description = xn.Attributes["Description"].Value;
             kv.UpdateTime = Convert.ToDateTime(xn.Attributes["UpdateTime"].Value);
         }
     }
     catch { }
     return kv;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 根据Value倒序排列
 /// </summary>
 /// <param name="kv1"></param>
 /// <param name="kv2"></param>
 /// <returns></returns>
 public static int CompareByValueDesc(KeyValueData kv1, KeyValueData kv2)
 {
     return String.Compare(kv2.KeyValue, kv1.KeyValue);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 根据Key排列
 /// </summary>
 /// <param name="kv1"></param>
 /// <param name="kv2"></param>
 /// <returns></returns>
 public static int CompareByKey(KeyValueData kv1, KeyValueData kv2)
 {
     return String.Compare(kv1.KeyName, kv2.KeyName);
 }