/// <summary> /// 获取Umbraco中Dictionary中的值 /// </summary> /// <param name="key"></param> /// <returns></returns> public static Models.UmbDictionaryModel GetDictionaryByKey(string key) { Models.UmbDictionaryModel model = new Models.UmbDictionaryModel(); Dictionary.DictionaryItem item = Dictionary.getTopMostItems.Where(d => d.key.Equals(key)).FirstOrDefault(); model.EnValue = item.Value(1); model.CnValue = item.Value(2); model.DicKey = item.key; return(model); }
public static double ConvertToUsd(double cny) { Models.UmbDictionaryModel umbmodel = Helpers.UmbracoDictionaryHelper.GetDictionaryByKey("ExchangeRate"); double exrate; if (!double.TryParse(umbmodel.CnValue, out exrate)) { exrate = 6.2475; } return(Math.Round((cny / exrate), 2)); }