118 lines
3.5 KiB
C#
118 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using EAS.Services;
|
|
using SOH.Entities;
|
|
using SOH.Data;
|
|
using EAS.Data.Linq;
|
|
using EAS.Data.ORM;
|
|
|
|
namespace SOH.BLL
|
|
{
|
|
[ServiceObject("分店维护模块")]
|
|
[ServiceBind(typeof(IFenDian))]
|
|
public class FenDianBll : IFenDian
|
|
{
|
|
|
|
public List<Entities.FenDian> getAllFenDian()
|
|
{
|
|
//var tm = new BasicBll().gettmh(2, 1, 1);
|
|
//var hy = new BasicBll().gethyh(2, 1);
|
|
//throw new NotImplementedException();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
|
|
var a = db.keshis.Join(db.FenDians, t => new { a = t.fddm, b = t.ksmc }, p => new { a = p.fddm, b = p.fdmc }, (t, p) => new { });
|
|
return db.FenDians.ToList();
|
|
}
|
|
|
|
}
|
|
|
|
public FenDian getFenDianById(int fdid)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from f in db.FenDians where f.fddm == fdid select f;
|
|
FenDian fd = null;
|
|
if (data.Any())
|
|
{
|
|
fd = data.First();
|
|
}
|
|
return fd;
|
|
}
|
|
}
|
|
|
|
|
|
public SOH.Data.OperationResult AddFenDian(FenDian fd)
|
|
{
|
|
//throw new NotImplementedException();
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
|
|
db.FenDians.Insert(fd);
|
|
}
|
|
or.State = 1;
|
|
or.Message = "添加成功";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(fd);
|
|
return or;
|
|
}
|
|
|
|
|
|
public OperationResult Modify(FenDian fd)
|
|
{
|
|
//throw new NotImplementedException();
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
|
|
// var a = db.FenDians.Update(t => t.fddm == fd.fddm, p => new FenDian{fdmc=fd.fdmc,fddz=fd.fddz,fdlxr=fd.fdlxr,fddh=fd.fddh});
|
|
try
|
|
{
|
|
db.FenDians.Update(fd);
|
|
or.State = 1;
|
|
or.Message = "修改成功";
|
|
}
|
|
catch (EAS.Data.DataConcurrencyException ex)
|
|
{
|
|
or.State = 0;
|
|
or.Message = ex.Message;
|
|
}
|
|
}
|
|
|
|
//or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(fd);
|
|
return or;
|
|
}
|
|
|
|
|
|
public OperationResult Delete(FenDian fd)
|
|
{
|
|
//throw new NotImplementedException();
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
// fd.fddm = 0;
|
|
try
|
|
{
|
|
//long aa = DateTime.Now-new DateTime(;
|
|
db.FenDians.Delete(fd);
|
|
//db.FenDians.OrmAccessor.Delete2(fd);
|
|
//db.FenDians.OrmAccessor.Delete(fd);
|
|
or.State = 1;
|
|
or.Message = "删除成功";
|
|
}
|
|
catch (EAS.Data.DataConcurrencyException ex)
|
|
{
|
|
or.State = 0;
|
|
or.Message = ex.Message;
|
|
}
|
|
// var a= db.FenDians.Delete(t => t.fddm == fd.fddm);
|
|
}
|
|
|
|
//or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(fd);
|
|
return or;
|
|
}
|
|
}
|
|
}
|