DriverAllocationTemplateTableSync::SearchResult DriverAllocationTemplateTableSync::Search( util::Env& env, boost::gregorian::date date /*= boost::gregorian::date(not_a_date_time)*/, size_t first /*= 0*/, boost::optional<std::size_t> number /*= boost::optional<std::size_t>()*/, bool orderByDate /*= true*/, bool raisingOrder /*= true*/, util::LinkLevel linkLevel /*= util::UP_LINKS_LOAD_LEVEL */ ) { SelectQuery<DriverAllocationTemplateTableSync> query; if (!date.is_not_a_date()) { query.addWhereField(SimpleObjectFieldDefinition<Date>::FIELD.name, to_iso_extended_string(date)); } if (orderByDate) { query.addOrderField(SimpleObjectFieldDefinition<Date>::FIELD.name, raisingOrder); } if (number) { query.setNumber(*number + 1); } if (first > 0) { query.setFirst(first); } return LoadFromQuery(query, env, linkLevel); }
/// <summary>Checks a date of disability onset.</summary> /// /// <exception cref="PiaException"><see cref="PiaException"/> of type /// <see cref="PIA_IDS_ONSET1"/> if month of onset is out of range; of type /// <see cref="PIA_IDS_ONSET2"/> if day of onset is out of range; of type /// <see cref="PIA_IDS_ONSET3"/> if year of onset is before 1937; of type /// <see cref="PIA_IDS_ONSET4"/> if year of onset is after /// maximum allowed.</exception> /// /// <param name="dateModyyr">The date to check.</param> void DisabPeriod::onsetDateCheck( const boost::gregorian::date& dateModyyr ) { if (dateModyyr.is_not_a_date()) { throw PiaException(PIA_IDS_ONSET1); } if (dateModyyr.year() < 1937) { // disability onset before 1937 throw PiaException(PIA_IDS_ONSET3); } try { Date::yearCheck(dateModyyr.year()); } catch (PiaException&) { // disability onset after last possible year throw PiaException(PIA_IDS_ONSET4); } }