本文整理汇总了C#中ISettingService.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingService.Get方法的具体用法?C# ISettingService.Get怎么用?C# ISettingService.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettingService
的用法示例。
在下文中一共展示了ISettingService.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPrizeDistributionPercentage
public static decimal GetPrizeDistributionPercentage(int winnerPosition, int totalWinners, ISettingService _settingService)
{
//load the setting first
var settingKey = string.Format("winner_distribution_{0}", totalWinners);
var setting = _settingService.Get(x => x.Key == settingKey, null).FirstOrDefault();
if (setting == null)
return 0;
//the settings are stored in numerics with + as separator
var values = setting.Value.Split('+');
if (values.Length < totalWinners || winnerPosition - 1 > values.Length)
{
return 0;
}
decimal percent;
decimal.TryParse(values[winnerPosition - 1], out percent);
return percent / 100;
}
示例2: GetSettingList
public static SelectList GetSettingList(ISettingService settingService)
{
return new SelectList(settingService.Get(), "Id", "Name");
}
示例3: LoadFrom
public static UPSSettings LoadFrom(ISettingService service)
{
var json = service.Get(Strings.TrackerName, "ShipmentTracking");
return Deserialize(json);
}