示例#1
0
        public static double CantidadDias(DateTime dateTimeInicio, DateTime dateTimeFinal, TotalTiempo prm_Frecuencia, bool RedondeoTruncate)
        {
            TimeSpan ts = dateTimeFinal - dateTimeInicio;
            double   differenceInFrecuencia = 0;

            switch (prm_Frecuencia)
            {
            case TotalTiempo.Dias:
                if (RedondeoTruncate)
                {
                    differenceInFrecuencia = Math.Truncate(ts.TotalDays);
                }
                else
                {
                    differenceInFrecuencia = ts.TotalDays;
                }
                break;

            case TotalTiempo.Horas:
                differenceInFrecuencia = ts.TotalHours;
                break;

            case TotalTiempo.Minutos:
                differenceInFrecuencia = ts.TotalMinutes;
                break;

            case TotalTiempo.Segundos:
                differenceInFrecuencia = ts.TotalSeconds;
                break;

            case TotalTiempo.MiliSegundos:
                differenceInFrecuencia = ts.TotalMilliseconds;
                break;
            }
            return(differenceInFrecuencia);
        }
示例#2
0
        public static double CantidadTiempoEn_100(DateTime FechaActual, DateTime FichaFinal, TotalTiempo prm_Frecuencia)
        {
            TimeSpan ts = FichaFinal - FechaActual;
            double   differenceInHours = 0;

            switch (prm_Frecuencia)
            {
            case  TotalTiempo.Horas:
                differenceInHours = ts.TotalHours;
                break;

            case TotalTiempo.Minutos:
                differenceInHours = ts.TotalMinutes;
                break;

            case TotalTiempo.Segundos:
                differenceInHours = ts.TotalSeconds;
                break;

            case TotalTiempo.MiliSegundos:
                differenceInHours = ts.TotalSeconds;
                break;

            case TotalTiempo.Dias:
                differenceInHours = ts.TotalSeconds;
                break;
            }

            return(differenceInHours);
        }