/// <summary> /// 供应商/销售商筛选条件 Pwp 2015-09-23 /// </summary> /// <param name="specialcontractQuery"></param> /// <returns></returns> private Func<IQueryable<Contract>, IQueryable<Contract>> BuildSellerSupplierQuery(SpecialContractQuery specialcontractQuery) { return (query) => { if (specialcontractQuery != null) { if(specialcontractQuery.SpecialId != 0) query = query.Where(p => p.SpecialId == specialcontractQuery.SpecialId); if (!string.IsNullOrEmpty(specialcontractQuery.SpecialName)) query = query.Where(p => p.Name.Contains(specialcontractQuery.SpecialName)); } return query; }; }
/// <summary> /// 专线合同筛选条件 /// </summary> /// <param name="specialcontractQuery"></param> /// <returns></returns> private Func<IQueryable<Contract>, IQueryable<Contract>> BuildContractQuery(SpecialContractQuery specialcontractQuery) { return (query) => { if (specialcontractQuery != null) { if (specialcontractQuery.BranchId != 0) query = query.Where(p => p.BranchId == specialcontractQuery.BranchId); if (!string.IsNullOrEmpty(specialcontractQuery.SpecialName)) query = query.Where(p => p.Special.Name.Contains(specialcontractQuery.SpecialName)); if (specialcontractQuery.StartTime.HasValue) { DateTime start = specialcontractQuery.StartTime.Value.Date; query = query.Where(p => p.EndDate >= start); } if (specialcontractQuery.EndTime.HasValue) { DateTime end = specialcontractQuery.EndTime.Value.AddDays(1).Date; query = query.Where(p => p.EndDate < end); } } return query; }; }