using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain;
using Dao;

namespace Service.Implement
{
	public class SysSettingManager : GenericManagerBase<SysSetting>, ISysSettingManager
	{
		public SysSetting Get(string name)
		{
			return ((ISysSettingRepository)CurrentRepository).Get(name);
		}

		public string GetValue(string name)
		{
			var setting = ((ISysSettingRepository)CurrentRepository).Get(name);

			return (setting != null && setting.Value != null) ? setting.Value : String.Empty;
		}

		public void SetValue(string name, string value)
		{
			SysSetting setting = ((ISysSettingRepository)CurrentRepository).Get(name);
			if (setting != null)
			{
				setting.Value = value;
				CurrentRepository.Update(setting);
			}
		}
	}
}
