85 lines
2.5 KiB
C#
85 lines
2.5 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(Iczyrole))]
|
|
public class czyroleBll : Iczyrole
|
|
{
|
|
|
|
public List<Entities.czyrole> GetListByCzyID(string czyid)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
return db.czyroles.Where(t => t.czyid.Equals(czyid)).ToList();
|
|
}
|
|
}
|
|
|
|
public Role GetRoleByczyid(string czyid)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from d in db.Roles
|
|
join czyrole in db.czyroles on d.id equals czyrole.roleid
|
|
where czyrole.czyid == czyid
|
|
select d;
|
|
Role role = data.OrderBy(t => t.tczl).First();
|
|
return role;
|
|
}
|
|
}
|
|
|
|
public Boolean zbCzyQxYz(string czyid)
|
|
{
|
|
Boolean f = false;
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var list = db.czyroles.Where(t => t.czyid.Equals(czyid)).ToList();
|
|
list.ForEach(t=> {
|
|
if(t.roleid == 52)
|
|
{
|
|
f= true;
|
|
}
|
|
});
|
|
}
|
|
return f;
|
|
}
|
|
|
|
public Data.OperationResult Save(List<czyrole> al,string czyid)
|
|
{
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
using (DbTransaction tan = db.DataAccessor.CreateTransaction())
|
|
{
|
|
|
|
try
|
|
{
|
|
db.czyroles.Delete(t => t.czyid == czyid);
|
|
foreach (czyrole e in al)
|
|
{
|
|
db.czyroles.Insert(e);
|
|
}
|
|
tan.Commit();
|
|
or.Message = "设置成功!";
|
|
or.State = 1;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
or.Message = "设置失败!请联系管理员!"+e.Message;
|
|
or.State = 2;
|
|
}
|
|
}
|
|
}
|
|
return or;
|
|
}
|
|
}
|
|
}
|