Ejemplo n.º 1
0
        private static IEnumerable <ValidateChargeLimitArgs> GetAllChargeLimits(ChargeLimitsConfig oldConfig, ChargeLimitsConfig newConfig)
        {
            var q1 = from tb1 in oldConfig.PeriodDayLimits.Values
                     join tb2 in newConfig.PeriodDayLimits.Values on tb1.PeriodDays equals tb2.PeriodDays
                     select new ValidateChargeLimitArgs()
            {
                OldLimit         = tb1,
                LastModifiedTime = oldConfig.LastModifiedTime,
                NewLimit         = tb2,
                ModifyTime       = newConfig.LastModifiedTime
            };

            return(q1);
        }
Ejemplo n.º 2
0
        public bool Validate(ChargeLimitsConfig oldConfig, ChargeLimitsConfig newConfig)
        {
            var allChargeLimits = GetAllChargeLimits(oldConfig, newConfig)
                                  .ToList();

            if (!IsNoAnyChanged(allChargeLimits))
            {
                return(false);
            }

            var rule = ChainOfResponsibilityHandler.Chain(
                new In24HrRule(),
                new Out24HrRule());

            return(HandleAllChargeLimitsByRule(allChargeLimits, rule));
        }