示例#1
0
        public CaseInsurance GetActiveInsuranceAtDate(DateTime refDate)
        {
            var insurances =
                Insurances
                .Where(x =>
                       x.DatePlanEffective.GetValueOrDefault(DateTime.MinValue) <= refDate &&
                       x.DatePlanTerminated.GetValueOrDefault(DateTime.MaxValue) >= refDate)
                .OrderBy(x => x.DatePlanTerminated)
                .OrderByDescending(x => x.DatePlanEffective)
                .ToList();

            return(insurances.FirstOrDefault());
        }
示例#2
0
        public List <CaseInsurance> GetActiveInsurance(DateTime StartDate, DateTime EndDate)
        {
            var insurances =
                Insurances
                .Where(x =>
                       x.DatePlanEffective.GetValueOrDefault(DateTime.MinValue) <= EndDate &&
                       x.DatePlanTerminated.GetValueOrDefault(DateTime.MaxValue) >= StartDate)
                .OrderBy(x => x.DatePlanTerminated)
                .OrderByDescending(x => x.DatePlanEffective)
                .ToList();

            return(insurances);
        }