Exemple #1
0
        public static MonthlySettings Random(string name, string clf, DateTime date, bool interval = false)
        {
            MonthlySettings result = new MonthlySettings();

            result.Wiring  = Wiring.Random(interval);
            Wiring.Current = result.Wiring;

            result.Name             = name;
            result.Classification   = clf;
            result.Date             = new DateTime(date.Year, date.Month, 1);
            result.Indicator        = RandomUtil.GetRandomAlpha(GROUP_SIZE);
            result.NumericIndicator = RandomUtil.GetRandomNumeric(GROUP_SIZE);

            for (int d = 1; d <= DateTime.DaysInMonth(date.Year, date.Month); d++)
            {
                result.DailySettings.Add(Settings.Random());

                result.DailySettings.Last().Date = new DateTime(date.Year, date.Month, d);
            }

            result.DailySettings.ForEach(s =>
            {
                s.ParentSettings = result;
                s.ParentId       = result.Id;
            });

            IndicatorUtil.FixDuplicateIndicators(result.DailySettings);

            return(result);
        }
Exemple #2
0
        public static YearlySettings Random(string title, string classification, DateTime date, bool interval = false)
        {
            YearlySettings result = new YearlySettings
            {
                Date             = date,
                Classification   = classification,
                Name             = title,
                Indicator        = RandomUtil.GetRandomAlpha(5),
                NumericIndicator = RandomUtil.GetRandomNumeric(5)
            };

            for (int i = 1; i <= 12; i++)
            {
                result.MonthlySettings.Add(KL7A.Configuration.MonthlySettings.Random(title, classification, new DateTime(date.Year, i, 1), interval));
            }

            result.MonthlySettings.ForEach(m =>
            {
                m.ParentId       = result.Id;
                m.ParentSettings = result;
            });

            IndicatorUtil.FixDuplicateIndicators(result.MonthlySettings);
            IndicatorUtil.FixDuplicateIndicators(result.MonthlySettings.SelectMany(m => m.DailySettings));

            return(result);
        }