113 lines
3.3 KiB
C#
113 lines
3.3 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(It_ygzd))]
|
|
public class t_ygzdBll : It_ygzd
|
|
{
|
|
public IList<t_ygzd> GetList(string jzm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
return db.t_ygzds.Where(t => t.zjm.Contains(jzm) && t.zhuxiao == 0).ToList();
|
|
}
|
|
}
|
|
|
|
public IList<t_ygzd> GetListByZX(string jzm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
return db.t_ygzds.Where(t => t.zjm.Contains(jzm) && t.zhuxiao==0).ToList();
|
|
}
|
|
}
|
|
|
|
public Data.OperationResult Update(t_ygzd ygzd)
|
|
{
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
try
|
|
{
|
|
t_czygl czygl = db.t_czygls.Where(t=> t.ygbm==ygzd.bm).FirstOrDefault();
|
|
if (czygl != null)
|
|
{
|
|
//czygl.zhuxiao = 1;
|
|
db.t_czygls.OrmAccessor.Update(czygl);
|
|
}
|
|
db.t_ygzds.OrmAccessor.Update(ygzd);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
or.State = 0;
|
|
or.Message = ex.Message;
|
|
}
|
|
}
|
|
|
|
or.State = 1;
|
|
or.Message = "用户信息修改成功。";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(ygzd);
|
|
return or;
|
|
//throw new NotImplementedException();
|
|
}
|
|
public Data.OperationResult Insert(t_ygzd ygzd)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
db.keshis.OrmAccessor.Insert(ygzd);
|
|
}
|
|
OperationResult or = new OperationResult();
|
|
or.State = 1;
|
|
or.Message = "用户信息添加成功。";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(ygzd);
|
|
return or;
|
|
|
|
}
|
|
|
|
|
|
public IList<t_ygzd> GetygmodelByCzym(string czym)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from gl in db.t_czygls
|
|
where gl.czym==czym
|
|
select gl;
|
|
if (data.Any())
|
|
{
|
|
List<t_czygl> d = data.ToList();
|
|
short d1 = Convert.ToInt16(d[0].ygbm);
|
|
var data1 = from g in db.t_ygzds where g.bm == d1 select g;
|
|
if (data1.Any())
|
|
{
|
|
return data1.ToList();
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public List<t_ygzd> GetListByFddm(short fddm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from a in db.t_ygzds where a.zhuxiao == 0 && a.fendian.fddm == fddm select a;
|
|
if (data.Any())
|
|
{
|
|
return data.ToList();
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|