Skip to content

Commit

Permalink
Merge pull request #144 from Lombiq/issue/OSOE-683
Browse files Browse the repository at this point in the history
OSOE-683: Resolving analyzer warnings.
  • Loading branch information
sarahelsaig authored Sep 23, 2023
2 parents 0e217ef + 97c0804 commit 6b8f718
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using OrchardCore.Html.Models;
using OrchardCore.Title.Models;
using System;
using System.Globalization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
Expand Down Expand Up @@ -78,13 +79,17 @@ private static void AlterIfPartExists<TPart>(ContentItem contentItem, Action<TPa
if (contentItem.Has<TPart>()) contentItem.Alter(action);
}

public static void ImportCommonPart(ContentItem contentItem, XElement parentElement)
private static void ImportCommonPart(ContentItem contentItem, XElement parentElement)
{
if (parentElement.Element("CommonPart") is not { } commonPart) return;

string Attribute(string name) => commonPart.Attribute(name)?.Value;

DateTime? Date(string name) => DateTime.TryParse(Attribute(name), out var date) ? date : null;
DateTime? Date(string name) => DateTime.TryParse(
Attribute(name),
CultureInfo.CurrentCulture,
DateTimeStyles.None,
out var date) ? date : null;

if (Attribute("Owner")?.Replace("/User.UserName=", string.Empty) is { } owner)
{
Expand Down

0 comments on commit 6b8f718

Please sign in to comment.