127 lines
4.1 KiB
C#
127 lines
4.1 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;
|
|
using System.Data;
|
|
|
|
namespace SOH.BLL
|
|
{
|
|
[ServiceObject("组合项目明细")]
|
|
[ServiceBind(typeof(It_zhxmmx))]
|
|
public class t_zhxmmxBll : It_zhxmmx
|
|
{
|
|
|
|
public OperationResult Insertxmmx(int zhbm, List<int> xmbm)
|
|
{
|
|
OperationResult or = new OperationResult();
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
using (DbTransaction tan = db.DataAccessor.CreateTransaction())
|
|
{
|
|
try
|
|
{
|
|
|
|
db.t_zhxmmxs.Delete(t => t.zhbm == zhbm);
|
|
//List<t_zhxmmx> al1 = new List<t_zhxmmx>();
|
|
for (int i = 0; i < xmbm.Count; i++)
|
|
{
|
|
t_zhxmmx mx1 = new t_zhxmmx();
|
|
mx1.zhbm = zhbm;
|
|
mx1.xmbm = Convert.ToInt32(xmbm[i]);
|
|
//al1.Add(mx1);
|
|
db.t_zhxmmxs.Insert(mx1);
|
|
}
|
|
tan.Commit();
|
|
or.Message = "检查项目保存成功!";
|
|
or.State = 1;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
or.Message = "检查项目保存失败!请联系管理员!"+ex.Message;
|
|
or.State = 2;
|
|
}
|
|
}
|
|
|
|
}
|
|
return or;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据组合套餐编码查询组合项目明细
|
|
/// </summary>
|
|
/// <param name="tcbm"></param>
|
|
/// <returns></returns>
|
|
public List<t_zhxm> GetZhxmmxByTcbm(short tcbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
//var data = from t in db.t_tcxmmxs
|
|
// join s in db.t_zhxms
|
|
// on t.zhbm equals s.zhbm
|
|
// into k
|
|
// from g in k.DefaultIfEmpty()
|
|
// where t.tcbm==tcbm
|
|
// select new
|
|
// {
|
|
// zhbm = t.zhbm,
|
|
// zhmc = g.zhmc,
|
|
// jg = g.jg_v
|
|
// };
|
|
//try {
|
|
// //var list = data.ToList();
|
|
// string json = Newtonsoft.Json.JsonConvert.SerializeObject(data.ToList());
|
|
// DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(json);
|
|
// return dt;
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// return null;
|
|
//}
|
|
|
|
|
|
var data = from t in db.t_zhxms
|
|
join s in db.t_tcxmmxs
|
|
on t.zhbm equals s.zhbm
|
|
where s.tcbm == tcbm
|
|
select t;
|
|
|
|
if (data.Any())
|
|
{
|
|
List<t_zhxm> ltz = data.ToList();
|
|
return ltz;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
|
|
//var data = from t in db.t_zhxms
|
|
// join s in db.t_tcxmmxs
|
|
// on t.zhbm equals s.zhbm
|
|
// where s.tcbm == tcbm
|
|
// select new
|
|
// {
|
|
// zhbm=t.zhbm,
|
|
// zhmc=t.zhmc,
|
|
// jg=t.jg_v
|
|
// };
|
|
//if (data.Any())
|
|
//{
|
|
// List<Entities.DTO.dto_zhxm> ldz = data.ToList();
|
|
//}
|
|
//else
|
|
//{
|
|
// return null;
|
|
//}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|