爱思开
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

71 lines
2.3 KiB

using NFine.Code;
using NFine.Domain.Entity.SystemManage;
using NFine.Domain.IRepository.SystemManage;
using NFine.Repository.SystemManage;
using System;
using System.Collections.Generic;
using System.Linq;
namespace NFine.Application.SystemManage
{
public class ModuleButtonApp
{
private IModuleButtonRepository service = new ModuleButtonRepository();
public List<ModuleButtonEntity> GetList(string moduleId = "")
{
var expression = ExtLinq.True<ModuleButtonEntity>();
if (!string.IsNullOrEmpty(moduleId))
{
expression = expression.And(t => t.F_ModuleId == moduleId);
}
return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
}
public ModuleButtonEntity GetForm(string keyValue)
{
return service.FindEntity(keyValue);
}
public void DeleteForm(string keyValue)
{
if (service.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0)
{
throw new Exception("删除失败!操作的对象包含了下级数据。");
}
else
{
service.Delete(t => t.F_Id == keyValue);
}
}
public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
{
if (!string.IsNullOrEmpty(keyValue))
{
moduleButtonEntity.Modify(keyValue);
service.Update(moduleButtonEntity);
}
else
{
moduleButtonEntity.Create();
service.Insert(moduleButtonEntity);
}
}
public void SubmitCloneButton(string moduleId, string Ids)
{
string[] ArrayId = Ids.Split(',');
var data = this.GetList();
List<ModuleButtonEntity> entitys = new List<ModuleButtonEntity>();
foreach (string item in ArrayId)
{
ModuleButtonEntity moduleButtonEntity = data.Find(t => t.F_Id == item);
moduleButtonEntity.F_Id = Common.GuId();
moduleButtonEntity.F_ModuleId = moduleId;
entitys.Add(moduleButtonEntity);
}
service.SubmitCloneButton(entitys);
}
}
}