using Learun.Util;
using System;
using System.Data;
using System.Collections.Generic;
namespace Learun.Application.Base.CodeSchemaModule
{
///
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-03-01 11:09
/// 描 述:代码模板
///
public class CodeSchemaBLL : CodeSchemaIBLL
{
private CodeSchemaService codeSchemaService = new CodeSchemaService();
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 分页参数
/// 查询参数
///
public IEnumerable GetPageList(Pagination pagination, string queryJson)
{
try
{
return codeSchemaService.GetPageList(pagination, queryJson);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
///
/// 获取LR_Base_CodeSchema表实体数据
///
/// 主键
///
public LR_Base_CodeSchemaEntity GetLR_Base_CodeSchemaEntity(string keyValue)
{
try
{
return codeSchemaService.GetLR_Base_CodeSchemaEntity(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
///
/// 获取左侧树形数据
///
///
public List GetTree()
{
try
{
DataTable list = codeSchemaService.GetSqlTree();
List treeList = new List();
foreach (DataRow item in list.Rows)
{
TreeModel node = new TreeModel
{
id = item["f_itemdetailid"].ToString(),
text = item["f_itemname"].ToString(),
value = item["f_itemdetailid"].ToString(),
showcheck = false,
checkstate = 0,
isexpand = true,
parentId = item["f_parentid"].ToString()
};
treeList.Add(node); }
return treeList.ToTree();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion
#region 提交数据
///
/// 删除实体数据
///
/// 主键
public void DeleteEntity(string keyValue)
{
try
{
codeSchemaService.DeleteEntity(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
///
/// 保存实体数据(新增、修改)
///
/// 主键
/// 实体
public void SaveEntity(string keyValue, LR_Base_CodeSchemaEntity entity)
{
try
{
codeSchemaService.SaveEntity(keyValue, entity);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion
}
}