public CDecoupage(DateTime dtStart, DateTime dtEnd, int nbPeriode, EEchelleTemps periodicite, bool arrondire, EEchelleTemps niveauArrondit) { m_bArrondire = arrondire; m_dtFin = dtEnd; m_dtStart = dtStart; m_nivArrondit = niveauArrondit; if (m_bArrondire) { m_dtFin = Arrondire(m_dtFin, m_nivArrondit); m_dtStart = Arrondire(m_dtStart, m_nivArrondit); } m_periodicite = periodicite; m_nbPeriode = nbPeriode; m_nLimiteTranche = -1; MAJDecoupage(); }
public static DateTime Arrondire(DateTime date, EEchelleTemps periode) { switch (periode) { case EEchelleTemps.Heure: return(new DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0)); case EEchelleTemps.Jour: return(date.Date); case EEchelleTemps.Mois: return(new DateTime(date.Year, date.Month, 1)); case EEchelleTemps.Semaine: return(CUtilDate.LundiDeSemaine(date)); case EEchelleTemps.Annee: return(new DateTime(date.Year, 1, 1)); } return(date); }