Skip to content

Commit

Permalink
Updates and fixes
Browse files Browse the repository at this point in the history
- Added `MinimumYear` and `MaximumYear` properties to the `Holiday` base class. This allows defining the year range for which a holiday is valid. The defaults are a minimum year of 1 and a maximum year of 9999.
- The `AddFixed` and `AddFloating` methods of the `HolidayCollection` class now return the added instance.
- The `HolidayCollection` class will now only return a holiday date if the instance falls within the valid year range for the holiday definition.
- The `AddStandardHolidays` method of the `HolidayCollection` class was updated to allow passing in a set of one or more additional holiday instances to add to the standard set. If none are specified, only the standard set is used.
  • Loading branch information
EWSoftware committed Nov 24, 2021
1 parent df7d80f commit aefa24a
Show file tree
Hide file tree
Showing 45 changed files with 1,068 additions and 574 deletions.
5 changes: 5 additions & 0 deletions Doc/Content/VersionHistory/VersionHistory.aml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Data Interchange (PDI) Library </legacyBold> over the life of the project.</para
<para>Select a version below to see a description of its changes.</para>

<list class="bullet">
<listItem>
<para>
<link xlink:href="3ebeed58-ecb5-475f-93c1-c9e0098ac5a0" />
</para>
</listItem>
<listItem>
<para>
<link xlink:href="d3124c41-0d7f-435c-ab09-4deda9e40173" />
Expand Down
2 changes: 1 addition & 1 deletion Doc/Content/VersionHistory/v2015.1.19.0.aml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ sort the results in a different way without incurring any overhead from the meth
</listItem>

<listItem>
<para><codeEntityReference qualifyHint="true" autoUpgrade="true">M:EWSoftware.PDI.HolidayCollection.AddStandardHolidays</codeEntityReference>
<para><codeEntityReference qualifyHint="false" autoUpgrade="true">M:EWSoftware.PDI.HolidayCollection.AddStandardHolidays(EWSoftware.PDI.Holiday[])</codeEntityReference>
has been changed to return a reference to the collection rather than void.</para>
</listItem>

Expand Down
48 changes: 48 additions & 0 deletions Doc/Content/VersionHistory/v2021.11.23.0.aml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="3ebeed58-ecb5-475f-93c1-c9e0098ac5a0" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>Release notes for version 2021.11.23.0.</para>
</introduction>

<!-- Ignore Spelling: Giménez -->
<section>
<content>
<list class="bullet">
<listItem>
<para>Added <codeInline>MinimumYear</codeInline> and <codeInline>MaximumYear</codeInline> properties
to the <codeInline>Holiday</codeInline> base class. This allows defining the year range for which a holiday is
valid. The defaults are a minimum year of 1 and a maximum year of 9999.</para>
</listItem>

<listItem>
<para>The <codeInline>AddFixed</codeInline> and <codeInline>AddFloating</codeInline> methods of the
<codeInline>HolidayCollection</codeInline> class now return the added instance.</para>
</listItem>

<listItem>
<para>The <codeInline>HolidayCollection</codeInline> class will now only return a holiday date if the
instance falls within the valid year range for the holiday definition.</para>
</listItem>

<listItem>
<para>The <codeInline>AddStandardHolidays</codeInline> method of the
<codeInline>HolidayCollection</codeInline> class was updated to allow passing in a set of one or more additional
holiday instances to add to the standard set. If none are specified, only the standard set is used.</para>
</listItem>

<listItem>
<para>Merged a change from Jorge Giménez to the <codeInline>Recurrence</codeInline> class that fixes
a bug that caused incorrect results for a rule with a yearly frequency and only a By Month Day rule.</para>
</listItem>
</list>

</content>
</section>

<relatedTopics>
<link xlink:href="8885fe94-537b-45a2-84e9-112fa9c976ff" />
</relatedTopics>

</developerConceptualDocument>
</topic>
9 changes: 7 additions & 2 deletions Doc/ContentLayout.content
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,17 @@
<HelpKeyword index="K" term="support, donate" />
</HelpKeywords>
</Topic>
<Topic id="8885fe94-537b-45a2-84e9-112fa9c976ff" visible="True" isExpanded="true" title="Version History">
<Topic id="8885fe94-537b-45a2-84e9-112fa9c976ff" visible="True" isExpanded="true" isSelected="true" title="Version History">
<HelpKeywords>
<HelpKeyword index="K" term="history" />
<HelpKeyword index="K" term="version history" />
</HelpKeywords>
<Topic id="d3124c41-0d7f-435c-ab09-4deda9e40173" visible="True" isSelected="true" title="Version 2020.11.25.0">
<Topic id="3ebeed58-ecb5-475f-93c1-c9e0098ac5a0" visible="True" title="Version 2021.11.23.0">
<HelpKeywords>
<HelpKeyword index="K" term="versions, 2021.11.23.0" />
</HelpKeywords>
</Topic>
<Topic id="d3124c41-0d7f-435c-ab09-4deda9e40173" visible="True" title="Version 2020.11.25.0">
<HelpKeywords>
<HelpKeyword index="K" term="versions, 2020.11.25.0" />
</HelpKeywords>
Expand Down
14 changes: 5 additions & 9 deletions Doc/EWSoftwarePDI.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
</HtmlHelp1xCompilerPath>
<WorkingPath>
</WorkingPath>
<FrameworkVersion>Cross-platform (.NET Core/.NET Standard)</FrameworkVersion>
<FrameworkVersion>.NET Framework 4.0</FrameworkVersion>
<HelpTitle>EWSoftware.PDI Namespace Documentation</HelpTitle>
<CopyrightHref>https://github.com/EWSoftware/PDI</CopyrightHref>
<CopyrightText>[v{%40HelpFileVersion}] Copyright \xA9 2003-2020, Eric Woodruff, All Rights Reserved</CopyrightText>
<CopyrightText>[v{%40HelpFileVersion}] Copyright \xA9 2003-2021, Eric Woodruff, All Rights Reserved</CopyrightText>
<FeedbackEMailAddress>Eric%40EWoodruff.us</FeedbackEMailAddress>
<PresentationStyle>VS2013</PresentationStyle>
<SyntaxFilters>Standard</SyntaxFilters>
Expand All @@ -49,7 +49,7 @@
<NamespaceSummaryItem name="EWSoftware.PDI.Web.Design" isDocumented="True">Personal Data Interchange ASP.NET web server control designers developed by Eric Woodruff.</NamespaceSummaryItem>
<NamespaceSummaryItem name="EWSoftware.PDI.Windows.Forms" isDocumented="True">Personal Data Interchange Windows Forms controls developed by Eric Woodruff.</NamespaceSummaryItem>
</NamespaceSummaries>
<HelpFileVersion>2020.11.25.0</HelpFileVersion>
<HelpFileVersion>2021.11.23.0</HelpFileVersion>
<ApiFilter />
<PlugInConfigurations>
<PlugInConfig id="Output Deployment" enabled="True">
Expand All @@ -60,12 +60,6 @@
<userCredentials useDefault="true" userName="" password="" />
</proxyCredentials>
</deploymentLocation>
<deploymentLocation id="help2x" location="">
<userCredentials useDefault="true" userName="" password="" />
<proxyCredentials useProxy="false" proxyServer="">
<userCredentials useDefault="true" userName="" password="" />
</proxyCredentials>
</deploymentLocation>
<deploymentLocation id="helpViewer" location="" renameMSHA="false">
<userCredentials useDefault="true" userName="" password="" />
<proxyCredentials useProxy="false" proxyServer="">
Expand Down Expand Up @@ -106,6 +100,7 @@
<Argument Key="logoAltText" Value="EWSoftware.PDI Library" />
<Argument Key="logoPlacement" Value="left" />
<Argument Key="logoAlignment" Value="left" />
<Argument Key="logoUrl" Value="https://github.com/EWSoftware/PDI" />
<Argument Key="maxVersionParts" Value="" />
<Argument Key="defaultLanguage" Value="cs" />
<Argument Key="includeEnumValues" Value="true" />
Expand Down Expand Up @@ -191,6 +186,7 @@
<None Include="Content\VersionHistory\v2020.1.18.0.aml" />
<None Include="Content\VersionHistory\v2020.11.25.0.aml" />
<None Include="Content\VersionHistory\v2020.7.24.0.aml" />
<None Include="Content\VersionHistory\v2021.11.23.0.aml" />
<None Include="Content\Welcome.aml" />
<None Include="Content\VersionHistory\v2.0.0.2.aml" />
<None Include="Content\VersionHistory\v2.0.0.0.aml" />
Expand Down
38 changes: 38 additions & 0 deletions Source/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,41 @@ csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false

# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none

# IDE0010: Add missing cases
dotnet_diagnostic.IDE0010.severity = none

# IDE0032: Use auto property
dotnet_diagnostic.IDE0032.severity = none

# IDE0045: Convert to conditional expression
dotnet_diagnostic.IDE0045.severity = none

# IDE0046: Convert to conditional expression
dotnet_diagnostic.IDE0046.severity = none

# IDE0047: Remove unnecessary parentheses
dotnet_diagnostic.IDE0047.severity = none

# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = none

# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = none

# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none

# These are disabled as we're still targeting .NET Framework as well and I don't want a lot of conditional code
# to suppress these.
# IDE0056: Use index operator
dotnet_diagnostic.IDE0056.severity = none

# IDE0057: Use range operator
dotnet_diagnostic.IDE0057.severity = none

# IDE0063: Use simple 'using' statement
dotnet_diagnostic.IDE0063.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// System : EWSoftware PDI Demonstration Applications
// File : AssemblyInfo.cs
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 11/25/2020
// Note : Copyright 2004-2020, Eric Woodruff, All rights reserved
// Updated : 11/23/2021
// Note : Copyright 2004-2021, Eric Woodruff, All rights reserved
//
// PDI library demos common assembly attributes
//
Expand All @@ -27,7 +27,7 @@
// General assembly information
[assembly: AssemblyProduct("EWSoftware Personal Data Interchange Library")]
[assembly: AssemblyCompany("Eric Woodruff")]
[assembly: AssemblyCopyright("Copyright \xA9 2003-2020, Eric Woodruff, All Rights Reserved")]
[assembly: AssemblyCopyright("Copyright \xA9 2003-2021, Eric Woodruff, All Rights Reserved")]
[assembly: AssemblyCulture("")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand All @@ -51,5 +51,5 @@
// Day of release
// Revision (typically zero unless multiple releases are made on the same day)
//
[assembly: AssemblyVersion("2020.11.25.0")]
[assembly: AssemblyFileVersion("20.11.25.0")]
[assembly: AssemblyVersion("2021.11.23.0")]
[assembly: AssemblyFileVersion("21.11.23.0")]
6 changes: 3 additions & 3 deletions Source/CSharpDemos/PDIDatesTest/PDIDatesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// System : EWSoftware PDI Demonstration Applications
// File : PDIDatesTest.cs
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 11/19/2018
// Note : Copyright 2003-2018, Eric Woodruff, All rights reserved
// Compiler: Visual C#
// Updated : 11/22/2021
// Note : Copyright 2003-2021, Eric Woodruff, All rights reserved
//
// This is a console mode application that runs through a few simple configurations to test the basics in the
// date utility, holiday, and recurrence classes.
Expand Down Expand Up @@ -529,6 +528,7 @@ static void Main(string[] args)
holidays.AddFloating(DayOccurrence.Third, DayOfWeek.Monday, 1, 0, "Martin Luther King Day");
holidays.AddFloating(DayOccurrence.Third, DayOfWeek.Monday, 2, 0, "President's Day");
holidays.AddFloating(DayOccurrence.Last, DayOfWeek.Monday, 5, 0, "Memorial Day");
holidays.AddFixed(6, 19, true, "Juneteenth").MinimumYear = 2021;
holidays.AddFixed(7, 4, true, "Independence Day");
holidays.AddFloating(DayOccurrence.First, DayOfWeek.Monday, 9, 0, "Labor Day");
holidays.AddFixed(11, 11, true, "Veteran's Day");
Expand Down
2 changes: 1 addition & 1 deletion Source/CSharpDemos/PDIDatesTest/PDIDatesTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GenerateAssemblyTitleAttribute>False</GenerateAssemblyTitleAttribute>
<GenerateAssemblyVersionAttribute>False</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>False</GenerateAssemblyFileVersionAttribute>
Expand Down
2 changes: 1 addition & 1 deletion Source/CSharpDemos/PDIParserTest/PDIParserTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GenerateAssemblyTitleAttribute>False</GenerateAssemblyTitleAttribute>
<GenerateAssemblyVersionAttribute>False</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>False</GenerateAssemblyFileVersionAttribute>
Expand Down
7 changes: 3 additions & 4 deletions Source/CSharpDemos/PDIWebDemoCS/App_Code/Global.asax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// System : EWSoftware PDI Demonstration Applications
// File : Global.asax.cs
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 11/21/2018
// Note : Copyright 2004-2018, Eric Woodruff, All rights reserved
// Compiler: Microsoft Visual C#
// Updated : 11/21/2021
// Note : Copyright 2004-2021, Eric Woodruff, All rights reserved
//
// At application start up, a common set of time zones is loaded into the VCalendar.TimeZones collection and a
// common set of holidays is loaded into the Recurrence.Holidays collection.
Expand Down Expand Up @@ -74,7 +73,7 @@ protected void Application_Start(object sender, EventArgs e)
lock(((ICollection)Recurrence.Holidays).SyncRoot)
{
if(Recurrence.Holidays.Count == 0)
Recurrence.Holidays.AddStandardHolidays();
Recurrence.Holidays.AddStandardHolidays(new FixedHoliday(6, 19, true, "Juneteenth") { MinimumYear = 2021 });
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions Source/CSharpDemos/PDIWebDemoCS/HolidayTestForm.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ the test search range to a maximum of 50 years from the starting year.</p>
<td colspan="2">
<asp:DropDownList ID="cboMonth" runat="server" CssClass="form-control" /></td>
</tr>
<tr>
<td class="control-label">Minimum Year</td>
<td colspan="2">
<asp:TextBox ID="txtMinimumYear" runat="server" Columns="4" MaxLength="4" CssClass="form-control" />
<asp:RequiredFieldValidator ID="rfvMinimumYear" runat="server" Display="None"
ErrorMessage="A minimum year is required. Use 1 for no minimum." ControlToValidate="txtMinimumYear" />
<asp:RangeValidator ID="rvMinimumYear" runat="server" Display="None"
ErrorMessage="Minimum year should be between 1 and 9999" Type="Integer"
MinimumValue="1" MaximumValue="9999" ControlToValidate="txtMinimumYear" /></td>
</tr>
<tr>
<td class="control-label">Maximum Year</td>
<td colspan="2">
<asp:TextBox ID="txtMaximumYear" runat="server" Columns="4" MaxLength="4" CssClass="form-control" />
<asp:RequiredFieldValidator ID="rfvMaximumYear" runat="server" Display="None"
ErrorMessage="A maximum year is required. Use 9999 for no maximum." ControlToValidate="txtMaximumYear" />
<asp:RangeValidator ID="rvMaximumYear" runat="server" Display="None"
ErrorMessage="Maximum year should be between 1 and 9999" Type="Integer"
MinimumValue="1" MaximumValue="9999" ControlToValidate="txtMaximumYear" /></td>
</tr>
<tr>
<td>
<asp:RadioButton ID="rbFloating" runat="server"
Expand Down
19 changes: 14 additions & 5 deletions Source/CSharpDemos/PDIWebDemoCS/HolidayTestForm.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// System : EWSoftware PDI Demonstration Applications
// File : HolidayTestForm.aspx.cs
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 11/22/2018
// Note : Copyright 2004-2018, Eric Woodruff, All rights reserved
// Compiler: Microsoft Visual C#
// Updated : 11/23/2021
// Note : Copyright 2004-2021, Eric Woodruff, All rights reserved
//
// This page is used to demonstrate the Holiday and date utility classes
//
Expand Down Expand Up @@ -48,7 +47,7 @@ protected void Page_Load(object sender, EventArgs e)
if(hc == null)
{
hc = new HolidayCollection();
hc.AddStandardHolidays();
hc.AddStandardHolidays(new FixedHoliday(6, 19, true, "Juneteenth") { MinimumYear = 2021 });
Session["Holidays"] = hc;
}

Expand Down Expand Up @@ -105,7 +104,7 @@ protected void dgHolidays_ItemCommand(object source, DataGridCommandEventArgs e)
// Revert to the default set
hc = (HolidayCollection)Session["Holidays"];
hc.Clear();
hc.AddStandardHolidays();
hc.AddStandardHolidays(new FixedHoliday(6, 19, true, "Juneteenth") { MinimumYear = 2021 });

dgHolidays.EditItemIndex = -1;
dgHolidays.DataSource = hc;
Expand Down Expand Up @@ -229,6 +228,8 @@ protected void dgHolidays_UpdateCommand(object source, DataGridCommandEventArgs
{
Month = cboMonth.SelectedIndex + 1,
Description = ((TextBox)e.Item.FindControl("txtDescription")).Text,
MinimumYear = Convert.ToInt32(((TextBox)e.Item.FindControl("txtMinimumYear")).Text),
MaximumYear = Convert.ToInt32(((TextBox)e.Item.FindControl("txtMaximumYear")).Text),
Occurrence = (DayOccurrence)((DropDownList)e.Item.FindControl("cboOccurrence")).SelectedIndex + 1,
Weekday = (DayOfWeek)((DropDownList)e.Item.FindControl("cboDayOfWeek")).SelectedIndex,
Offset = Convert.ToInt32(((TextBox)e.Item.FindControl("txtOffset")).Text)
Expand All @@ -251,6 +252,8 @@ protected void dgHolidays_UpdateCommand(object source, DataGridCommandEventArgs
{
Month = cboMonth.SelectedIndex + 1,
Description = ((TextBox)e.Item.FindControl("txtDescription")).Text,
MinimumYear = Convert.ToInt32(((TextBox)e.Item.FindControl("txtMinimumYear")).Text),
MaximumYear = Convert.ToInt32(((TextBox)e.Item.FindControl("txtMaximumYear")).Text),
AdjustFixedDate = ((CheckBox)e.Item.FindControl("chkAdjustDate")).Checked,
Day = Convert.ToInt32(((TextBox)e.Item.FindControl("txtDayOfMonth")).Text)
};
Expand Down Expand Up @@ -335,6 +338,12 @@ protected void dgHolidays_ItemDataBound(object sender, DataGridItemEventArgs e)

cboMonth.SelectedIndex = hc[e.Item.ItemIndex].Month - 1;
((TextBox)e.Item.FindControl("txtDescription")).Text = hc[e.Item.ItemIndex].Description;
((TextBox)e.Item.FindControl("txtMinimumYear")).Text =
((hc[e.Item.ItemIndex].MinimumYear < 1) ? 1 : (hc[e.Item.ItemIndex].MinimumYear > 9999) ?
9999 : hc[e.Item.ItemIndex].MinimumYear).ToString();
((TextBox)e.Item.FindControl("txtMaximumYear")).Text =
((hc[e.Item.ItemIndex].MaximumYear < 1) ? 1 : (hc[e.Item.ItemIndex].MaximumYear > 9999) ?
9999 : hc[e.Item.ItemIndex].MaximumYear).ToString();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/CSharpDemos/PDIWebDemoCS/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</system.web>
<appSettings>
<add key="AppName" value="EWSoftware PDI Class Library Web Demo"/>
<add key="Version" value="2020.11.25.0"/>
<add key="Version" value="2021.11.23.0"/>
<add key="MenuAppName" value="EWSoftware PDI Demo"/>
<add key="LogoImage" value="EWSPDI.bmp"/>
<add key="LogoText" value="EWSoftware.PDI"/>
Expand Down
10 changes: 10 additions & 0 deletions Source/CSharpDemos/PDIWebDemoCS/vwd.webinfo
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@
















Expand Down

0 comments on commit aefa24a

Please sign in to comment.