首页 新闻 会员 周边 捐助

linq 怎么去除重复

0
悬赏园豆:5 [已解决问题] 解决于 2012-10-29 13:51
var contracts = from c in db.B_Contract_Out
join h
in db.B_Hospital on c.HospitalID equals h.ID into ch
where c.C4 == "1" && c.ContractDate < DateTime.Now
from chs
in ch.DefaultIfEmpty()
join u
in db.sys_User on c.PrincipalUser equals u.UserID into cu
from cus
in cu.DefaultIfEmpty()
orderby c.ContractDate descending
join p
in db.B_PayRecord on c.ID equals p.ContractID into cp
from cps
in cp.DefaultIfEmpty()
where c.AllMoney != Convert.ToDouble(cps.PayMoney)
orderby c.ContractDate descending
//select new { c.WinFee, c.C1, c.BankFee, c.PayType,c.C2,c.Contract,c.Remark, c.ID, c.ContractType, ArmNames = GetArmariumName(c.ID), PayMoney = GetPayedMoney(c.ID), c.CreateTime, c.ArriveDate, c.SetupDate, qiankuan = c.AllMoney - double.Parse(GetPayedMoney(c.ID).ToString()), c.ContractDate, c.ContactNum, cus.U_CName, c.AllMoney, chs.HospitalName };
select new { PayMoney = GetPayedMoney(c.ID), ArmNames = GetArmariumName(c.ID), ArmInPrice = GetArmInPrice(c.ID), USInPrice = GetUSInPrice(c.ID), Duty = GetDuty(Convert.ToDouble(c.AllMoney), c.ID), Profit = GetProfit(Convert.ToDouble(c.AllMoney), c.ID, Convert.ToDouble(c.BankFee), Convert.ToDouble(c.WinFee)), c.WinFee, c.C1, c.BankFee, c.PayType, c.C2, c.Contract, c.Remark, c.ID, c.ContractType, c.CreateTime, c.ArriveDate, c.SetupDate, c.ContractDate, c.ContactNum, cus.U_CName, c.AllMoney, chs.HospitalName, qiankuan = (c.AllMoney - Convert.ToDouble(cps.PayMoney)) };
zzc_king的主页 zzc_king | 初学一级 | 园豆:190
提问于:2011-05-12 14:37
< >
分享
最佳答案
0

Linq的查询表达式不支持distinct,使用查询操作符,参考 http://www.cnblogs.com/2018/archive/2010/11/12/1875850.html 

收获园豆:5
2012 | 高人七级 |园豆:21645 | 2011-05-13 13:59
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册