57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using EAS.Services;
|
|||
|
|
using SOH.Entities;
|
|||
|
|
using EAS.Data.Access;
|
|||
|
|
using EAS.Data.Linq;
|
|||
|
|
using SOH.Data;
|
|||
|
|
|
|||
|
|
namespace SOH.BLL
|
|||
|
|
{
|
|||
|
|
[ServiceObject("角色菜单关系")]
|
|||
|
|
[ServiceBind(typeof(IRoleCD))]
|
|||
|
|
public class RoleCDBll : IRoleCD
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public List<Entities.RoleCD> GetListByRoleID(string RoleID)
|
|||
|
|
{
|
|||
|
|
using (DbEntities db = new DbEntities())
|
|||
|
|
{
|
|||
|
|
int d = Convert.ToInt32(RoleID);
|
|||
|
|
return db.RoleCDs.Where(t => t.roleid.Equals(d)).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public OperationResult Save(List<RoleCD> al, int roleid)
|
|||
|
|
{
|
|||
|
|
OperationResult or = new OperationResult();
|
|||
|
|
using (DbEntities db = new DbEntities())
|
|||
|
|
{
|
|||
|
|
using (DbTransaction tan = db.DataAccessor.CreateTransaction())
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
db.RoleCDs.Delete(t => t.roleid == roleid);
|
|||
|
|
foreach (RoleCD e in al)
|
|||
|
|
{
|
|||
|
|
db.RoleCDs.Insert(e);
|
|||
|
|
}
|
|||
|
|
tan.Commit();
|
|||
|
|
or.Message = "设置成功!";
|
|||
|
|
or.State = 1;
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
or.Message = "设置失败!请联系管理员!"+e.Message;
|
|||
|
|
or.State = 2;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return or;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|