60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using EAS.Services;
|
|
using SOH.Entities;
|
|
using SOH.Data;
|
|
|
|
namespace SOH.BLL
|
|
{
|
|
[ServiceObject("角色信息维护")]
|
|
[ServiceBind(typeof(IRole))]
|
|
public class RoleBll : IRole
|
|
{
|
|
|
|
public List<Entities.Role> GetRoles(string d)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
return db.Roles.Where(t => t.RoleNmae.Contains(d)).ToList();
|
|
}
|
|
}
|
|
public Data.OperationResult Update(Role rl)
|
|
{
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
try
|
|
{
|
|
db.Roles.OrmAccessor.Update(rl);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
or.State = 0;
|
|
or.Message = ex.Message;
|
|
}
|
|
}
|
|
|
|
or.State = 1;
|
|
or.Message = "修改成功";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(rl);
|
|
return or;
|
|
//throw new NotImplementedException();
|
|
}
|
|
public Data.OperationResult Insert(Role rl)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
db.keshis.OrmAccessor.Insert(rl);
|
|
}
|
|
OperationResult or = new OperationResult();
|
|
or.State = 1;
|
|
or.Message = "添加成功";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(rl);
|
|
return or;
|
|
|
|
}
|
|
}
|
|
}
|