using LeaRun.Application.Entity.SystemManage;
using LeaRun.Application.Entity.SystemManage.ViewModel;
using LeaRun.Application.IService.SystemManage;
using LeaRun.Application.Service.SystemManage;
using LeaRun.Cache.Factory;
using LeaRun.Util;
using System;
using System.Collections.Generic;
namespace LeaRun.Application.Busines.SystemManage
{
///
/// 版 本 6.1
/// Copyright (c) 2013-2016 上海力软信息技术有限公司
/// 创建人:佘赐雄
/// 日 期:2015.11.17 9:56
/// 描 述:数据字典明细
///
public class DataItemDetailBLL
{
private IDataItemDetailService service = new DataItemDetailService();
///
/// 缓存key
///
public string cacheKey = "dataItemCache";
#region 获取数据
///
/// 明细列表
///
/// 分类Id
///
public IEnumerable GetList(string itemId)
{
return service.GetList(itemId);
}
///
/// 明细实体
///
/// 主键值
///
public DataItemDetailEntity GetEntity(string keyValue)
{
return service.GetEntity(keyValue);
}
///
/// 数据字典列表
///
///
public IEnumerable GetDataItemList()
{
return service.GetDataItemList();
}
#endregion
#region 验证数据
///
/// 项目值不能重复
///
/// 项目值
/// 主键
/// 分类Id
///
public bool ExistItemValue(string itemValue, string keyValue, string itemId)
{
return service.ExistItemValue(itemValue, keyValue, itemId);
}
///
/// 项目名不能重复
///
/// 项目名
/// 主键
/// 分类Id
///
public bool ExistItemName(string itemName, string keyValue, string itemId)
{
return service.ExistItemName(itemName, keyValue, itemId);
}
#endregion
#region 提交数据
///
/// 删除明细
///
/// 主键
public void RemoveForm(string keyValue)
{
try
{
service.RemoveForm(keyValue);
CacheFactory.Cache().RemoveCache(cacheKey);
}
catch (Exception)
{
throw;
}
}
///
/// 保存明细表单(新增、修改)
///
/// 主键值
/// 明细实体
///
public void SaveForm(string keyValue, DataItemDetailEntity dataItemDetailEntity)
{
try
{
dataItemDetailEntity.SimpleSpelling = Str.PinYin(dataItemDetailEntity.ItemName);
service.SaveForm(keyValue, dataItemDetailEntity);
CacheFactory.Cache().RemoveCache(cacheKey);
}
catch (Exception)
{
throw;
}
}
#endregion
}
}