internal static RecurrenceInfo GetFriendlyRecurrenceInfo(string seriesInfo)
        {
            RecurrenceInfo info         = new RecurrenceInfo();
            EndDateType    endType      = EndDateType.NotDefined;
            DateTime       endDateValue = DateTime.MinValue;
            int            noOccurrences;

            // Exit if not a Daily seriesInfo type
            if (!seriesInfo.StartsWith("D"))
            {
                return(null);
            }

            info.SetRecurrenceType(RecurrenceType.Daily);
            info.SetSeriesInfo(seriesInfo);
            // FORMATTING DEFINITIONS
            //  Y = Yearly Designator
            //  |       0 = Start Date (8 chars)
            //  |       |        1 = End Date (8 chars)
            //  |       |        |        2 = Number of occurrences (4 chars)
            //  |       |        |        |      3 = Regeneration Type (1 char)
            //  |       |        |        |      |    4 = End date type (1 char)
            //  |       |        |        |      |    |      5 = Regen Every x weeks
            //  |       |        |        |      |    |      |
            //  |       |        |        |      |    |      |
            // [0]    [1-8]    [9-16]  [17-20]  [21] [22] [23-25]
            //  D   20071231  20171231   0000    1     1    000
            string startDate = seriesInfo.Substring(1, 8);

            DateTime dtStartDate    = new DateTime(int.Parse(startDate.Substring(0, 4)), int.Parse(startDate.Substring(4, 2)), int.Parse(startDate.Substring(6, 2)));
            string   endDate        = seriesInfo.Substring(9, 8);
            string   occurrences    = seriesInfo.Substring(17, 4);
            string   dailyRegenType = seriesInfo.Substring(21, 1);
            string   endDateType    = seriesInfo.Substring(22, 1);
            int      regenXDays     = int.Parse(seriesInfo.Substring(23, 3));

            endType       = (EndDateType)(int.Parse(endDateType));
            noOccurrences = int.Parse(occurrences);

            endType       = (EndDateType)(int.Parse(endDateType));
            noOccurrences = int.Parse(occurrences);

            // Get the EndDate before any modifications on it are performed
            if (endType == EndDateType.SpecificDate)
            {
                endDateValue = new DateTime(int.Parse(endDate.Substring(0, 4)), int.Parse(endDate.Substring(4, 2)), int.Parse(endDate.Substring(6, 2)));
            }

            info.SetEndDateType(endType);
            // Determine the Constructor by the type of End Date.
            // All constructors start with a Start date at a minimum.
            switch (endType)
            {
            case EndDateType.NumberOfOccurrences:
                info.SetStartDate(dtStartDate);
                info.SetNumberOfOccurrences(noOccurrences);
                break;

            case EndDateType.SpecificDate:
                info.SetStartDate(dtStartDate);
                info.SetEndDate(endDateValue);
                break;

            case EndDateType.NoEndDate:
                info.SetStartDate(dtStartDate);
                break;
            }

            info.SetDailyRegenType((DailyRegenType)(int.Parse(dailyRegenType)));
            // Determine the Type of dates to get, specific, custom, etc.
            switch (info.DailyRegenType)
            {
            case DailyRegenType.OnEveryXDays:
                info.SetDailyRegenEveryXDays(regenXDays);
                break;

            case DailyRegenType.OnEveryWeekday:
                // This is default. Nothing to set
                break;

            case DailyRegenType.NotSet:

                break;
            }

            return(info);
        }
        /// <summary>
        ///     Get a user-friendly class that is a easy way using Properties that define the Series Info
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         String of Series Info that was first generated by this MonthlyRecurrenceSettings Class object.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A RecurrenceGenerator.RecurrenceInfo value...
        /// </returns>
        internal static RecurrenceInfo GetFriendlyRecurrenceInfo(string seriesInfo)
        {
            RecurrenceInfo info         = new RecurrenceInfo();
            EndDateType    endType      = EndDateType.NotDefined;
            DateTime       endDateValue = DateTime.MinValue;
            int            noOccurrences;

            // Exit if not a Monthly seriesInfo type
            if (!seriesInfo.StartsWith("M"))
            {
                return(null);
            }

            info.SetSeriesInfo(seriesInfo);
            info.SetRecurrenceType(RecurrenceType.Monthly);
            // FORMATTING DEFINITIONS
            //  Y = Yearly Designator
            //  |       0 = Start Date (8 chars)
            //  |       |        1 = End Date (8 chars)
            //  |       |        |        2 = Number of occurrences (4 chars)
            //  |       |        |        |      3 = Regeneration Type (1 char)
            //  |       |        |        |      |    4 = End date type (1 char)
            //  |       |        |        |      |    |      5 = Regenerate on specific date DAY value (2 chars)
            //  |       |        |        |      |    |      |       6 = Custom Date Part One (1 char)
            //  |       |        |        |      |    |      |       |       7 = Custom Date Part Two (1 char)
            //  |       |        |        |      |    |      |       |       |       8 = Adjustment Value (3 chars)
            //  |       |        |        |      |    |      |       |       |       |     9  Regen Every x months
            //  |       |        |        |      |    |      |       |       |       |     |
            // [0]    [1-8]    [9-16]  [17-20]  [21] [22] [23-24]  [25]    [26]    [27-29] [30-32]
            //  M   01082007  20171231   0000    1     1     00      A      A       000    000
            string startDate = seriesInfo.Substring(1, 8);

            DateTime dtStartDate = new DateTime(int.Parse(startDate.Substring(0, 4)), int.Parse(startDate.Substring(4, 2)), int.Parse(startDate.Substring(6, 2)));
            string   endDate     = seriesInfo.Substring(9, 8);

            string occurrences                 = seriesInfo.Substring(17, 4);
            string monthlyRegenType            = seriesInfo.Substring(21, 1);
            string endDateType                 = seriesInfo.Substring(22, 1);
            string regenOnSpecificDateDayValue = seriesInfo.Substring(23, 2);
            string specDatePartOne             = seriesInfo.Substring(25, 1);
            string specDatePartTwo             = seriesInfo.Substring(26, 1);
            string adjustValue                 = seriesInfo.Substring(27, 3);
            int    regenXMonths                = int.Parse(seriesInfo.Substring(30, 3));

            endType       = (EndDateType)(int.Parse(endDateType));
            noOccurrences = int.Parse(occurrences);

            MonthlySpecificDatePartOne partOne = MonthlySpecificDatePartOne.NotSet;
            MonthlySpecificDatePartTwo partTwo = MonthlySpecificDatePartTwo.NotSet;

            if (specDatePartOne == "Z")
            {
                partOne = MonthlySpecificDatePartOne.NotSet;
            }
            else
            {
                partOne = (MonthlySpecificDatePartOne)(Convert.ToInt32(specDatePartOne[0]) - 65);
            }

            if (specDatePartTwo == "Z")
            {
                partTwo = MonthlySpecificDatePartTwo.NotSet;
            }
            else
            {
                partTwo = (MonthlySpecificDatePartTwo)(Convert.ToInt32(specDatePartTwo[0]) - 65);
            }

            endType       = (EndDateType)(int.Parse(endDateType));
            noOccurrences = int.Parse(occurrences);

            // Get the EndDate before any modifications on it are performed
            if (endType == EndDateType.SpecificDate)
            {
                endDateValue = new DateTime(int.Parse(endDate.Substring(0, 4)), int.Parse(endDate.Substring(4, 2)), int.Parse(endDate.Substring(6, 2)));
            }

            info.SetEndDateType(endType);
            // Determine the Constructor by the type of End Date.
            // All constructors start with a Start date at a minimum.
            switch (endType)
            {
            case EndDateType.NumberOfOccurrences:
                info.SetStartDate(dtStartDate);
                info.SetNumberOfOccurrences(noOccurrences);
                break;

            case EndDateType.SpecificDate:
                info.SetStartDate(dtStartDate);
                info.SetEndDate(endDateValue);
                break;

            case EndDateType.NoEndDate:
                info.SetStartDate(dtStartDate);
                break;
            }

            // Set the adjusted values
            info.SetAdjustmentValue(Convert.ToInt32(adjustValue));
            info.SetMonthlyRegenType((MonthlyRegenType)(int.Parse(monthlyRegenType)));

            // Determine the Type of dates to get, specific, custom, etc.
            switch (info.MonthlyRegenType)
            {
            case MonthlyRegenType.OnSpecificDayOfMonth:
                info.SetMonthlyRegenerateOnSpecificDateDayValue(int.Parse(regenOnSpecificDateDayValue));
                info.SetRegenEveryXMonths(regenXMonths);
                break;

            case MonthlyRegenType.OnCustomDateFormat:
                info.SetMonthlySpecificDatePartOne(partOne);
                info.SetMonthlySpecificDatePartTwo(partTwo);
                info.SetRegenEveryXMonths(regenXMonths);
                break;

            case MonthlyRegenType.AfterOccurrenceCompleted:

                break;
            }

            return(info);
        }
        internal static RecurrenceInfo GetFriendlyRecurrenceInfo(string seriesInfo)
        {
            RecurrenceInfo info         = new RecurrenceInfo();
            EndDateType    endType      = EndDateType.NotDefined;
            DateTime       endDateValue = DateTime.MinValue;
            int            noOccurrences;

            // Exit if not a Weekly seriesInfo type
            if (!seriesInfo.StartsWith("W"))
            {
                return(null);
            }

            info.SetSeriesInfo(seriesInfo);
            info.SetRecurrenceType(RecurrenceType.Weekly);

            // FORMATTING DEFINITIONS
            //  Y = Yearly Designator
            //  |       0 = Start Date (8 chars)
            //  |       |        1 = End Date (8 chars)
            //  |       |        |        2 = Number of occurrences (4 chars)
            //  |       |        |        |      3 = Regeneration Type (1 char)
            //  |       |        |        |      |    4 = End date type (1 char)
            //  |       |        |        |      |    |      5 = Regenerate on Sunday
            //  |       |        |        |      |    |      |       6 = Regenerate on Monday
            //  |       |        |        |      |    |      |       |       7 = Regenerate on Tuesday
            //  |       |        |        |      |    |      |       |       |       8 = Regenerate on Wednesday
            //  |       |        |        |      |    |      |       |       |       |      9 = Regenerate on Thursday
            //  |       |        |        |      |    |      |       |       |       |      |      10 = Regenerate on Friday
            //  |       |        |        |      |    |      |       |       |       |      |       |      11 = Regenerate on Saturday
            //  |       |        |        |      |    |      |       |       |       |      |       |      |        12  Regen Every x weeks
            //  |       |        |        |      |    |      |       |       |       |      |       |      |         |
            // [0]    [1-8]    [9-16]  [17-20]  [21] [22]  [23]    [24]    [25]    [26]   [27]     [28]   [29]      [30-32]
            //  W   20071231  20171231   0000    1     1     T       T      F        F      F       F      F        000
            string startDate = seriesInfo.Substring(1, 8);

            DateTime dtStartDate = new DateTime(int.Parse(startDate.Substring(0, 4)), int.Parse(startDate.Substring(4, 2)), int.Parse(startDate.Substring(6, 2)));
            string   endDate     = seriesInfo.Substring(9, 8);
            SelectedDayOfWeekValues selectedDays = new SelectedDayOfWeekValues();
            string occurrences     = seriesInfo.Substring(17, 4);
            string weeklyRegenType = seriesInfo.Substring(21, 1);
            string endDateType     = seriesInfo.Substring(22, 1);
            int    regenXWeeks     = int.Parse(seriesInfo.Substring(30, 3));

            endType       = (EndDateType)(int.Parse(endDateType));
            noOccurrences = int.Parse(occurrences);

            selectedDays.Sunday    = (seriesInfo.Substring(23, 1) == "Y") ? true : false;
            selectedDays.Monday    = (seriesInfo.Substring(24, 1) == "Y") ? true : false;
            selectedDays.Tuesday   = (seriesInfo.Substring(25, 1) == "Y") ? true : false;
            selectedDays.Wednesday = (seriesInfo.Substring(26, 1) == "Y") ? true : false;
            selectedDays.Thursday  = (seriesInfo.Substring(27, 1) == "Y") ? true : false;
            selectedDays.Friday    = (seriesInfo.Substring(28, 1) == "Y") ? true : false;
            selectedDays.Saturday  = (seriesInfo.Substring(29, 1) == "Y") ? true : false;

            endType       = (EndDateType)(int.Parse(endDateType));
            noOccurrences = int.Parse(occurrences);

            // Get the EndDate before any modifications on it are performed
            if (endType == EndDateType.SpecificDate)
            {
                endDateValue = new DateTime(int.Parse(endDate.Substring(0, 4)), int.Parse(endDate.Substring(4, 2)), int.Parse(endDate.Substring(6, 2)));
            }

            info.SetEndDateType(endType);
            // Determine the Constructor by the type of End Date.
            // All constructors start with a Start date at a minimum.
            // Determine the Constructor by the type of End Date.
            // All constructors start with a Start date at a minimum.
            switch (endType)
            {
            case EndDateType.NumberOfOccurrences:
                info.SetStartDate(dtStartDate);
                info.SetNumberOfOccurrences(noOccurrences);
                break;

            case EndDateType.SpecificDate:
                info.SetStartDate(dtStartDate);
                info.SetEndDate(endDateValue);
                break;

            case EndDateType.NoEndDate:
                info.SetStartDate(dtStartDate);
                break;
            }

            info.SetWeeklyRegenType((WeeklyRegenType)(int.Parse(weeklyRegenType)));
            // Determine the Type of dates to get, specific, custom, etc.
            switch (info.WeeklyRegenType)
            {
            case WeeklyRegenType.OnEveryXWeeks:
                info.SetSelectedDayOfWeekValues(selectedDays);
                info.SetRegenEveryXWeeks(regenXWeeks);
                break;

            case WeeklyRegenType.NotSet:

                break;
            }

            return(info);
        }