Modifications
This commit is contained in:
@ -169,8 +169,8 @@
|
||||
createdon = ModuleState.CreatedOn;
|
||||
modifiedby = ModuleState.ModifiedBy;
|
||||
modifiedon = ModuleState.ModifiedOn;
|
||||
_effectivedate = ModuleState.EffectiveDate;
|
||||
_expirydate = ModuleState.ExpiryDate;
|
||||
_effectivedate = Utilities.UtcAsLocalDate(ModuleState.EffectiveDate);
|
||||
_expirydate = Utilities.UtcAsLocalDate(ModuleState.ExpiryDate);
|
||||
|
||||
if (ModuleState.ModuleDefinition != null)
|
||||
{
|
||||
@ -232,7 +232,7 @@
|
||||
|
||||
if (!string.IsNullOrEmpty(_title))
|
||||
{
|
||||
if (!ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
if (!Utilities.ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
{
|
||||
AddModuleMessage(SharedLocalizer["Message.EffectiveExpiryDateError"], MessageType.Warning);
|
||||
return;
|
||||
@ -241,8 +241,8 @@
|
||||
pagemodule.PageId = int.Parse(_pageId);
|
||||
pagemodule.Title = _title;
|
||||
pagemodule.Pane = _pane;
|
||||
pagemodule.EffectiveDate = _effectivedate;
|
||||
pagemodule.ExpiryDate = _expirydate;
|
||||
pagemodule.EffectiveDate = Utilities.LocalDateAndTimeAsUtc(_effectivedate);
|
||||
pagemodule.ExpiryDate = Utilities.LocalDateAndTimeAsUtc(_expirydate);
|
||||
pagemodule.ContainerType = (_containerType != "-") ? _containerType : string.Empty;
|
||||
if (!string.IsNullOrEmpty(pagemodule.ContainerType) && pagemodule.ContainerType == PageState.Page.DefaultContainerType)
|
||||
{
|
||||
@ -292,33 +292,4 @@
|
||||
AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
private bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
// Check if both dates are null, in which case the validation passes
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is not null and ExpiryDate is null
|
||||
if (effectiveDate != DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is null and ExpiryDate is not null
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate != DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if ExpiryDate is not null and EffectiveDate is after ExpiryDate
|
||||
if (expiryDate != DateTime.MinValue && effectiveDate != DateTime.MinValue && effectiveDate > expiryDate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If none of the above conditions are met, validation passes
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -279,8 +279,8 @@
|
||||
_children.Add(p);
|
||||
}
|
||||
}
|
||||
_effectivedate = PageState.Page.EffectiveDate;
|
||||
_expirydate = PageState.Page.ExpiryDate;
|
||||
_effectivedate = Utilities.UtcAsLocalDate(PageState.Page.EffectiveDate);
|
||||
_expirydate = Utilities.UtcAsLocalDate(PageState.Page.ExpiryDate);
|
||||
ThemeSettings();
|
||||
_initialized = true;
|
||||
}
|
||||
@ -363,7 +363,7 @@
|
||||
Page page = null;
|
||||
try
|
||||
{
|
||||
if (!ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
if (!Utilities.ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
{
|
||||
AddModuleMessage(SharedLocalizer["Message.EffectiveExpiryDateError"], MessageType.Warning);
|
||||
return;
|
||||
@ -442,8 +442,8 @@
|
||||
page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
|
||||
page.Url = _url;
|
||||
page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable));
|
||||
page.EffectiveDate = _effectivedate;
|
||||
page.ExpiryDate = _expirydate;
|
||||
page.EffectiveDate = Utilities.LocalDateAndTimeAsUtc(_effectivedate);
|
||||
page.ExpiryDate = Utilities.LocalDateAndTimeAsUtc(_expirydate);
|
||||
page.UserId = null;
|
||||
|
||||
// appearance
|
||||
@ -513,33 +513,4 @@
|
||||
{
|
||||
_icon = NewIcon;
|
||||
}
|
||||
private bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
// Check if both dates are null, in which case the validation passes
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is not null and ExpiryDate is null
|
||||
if (effectiveDate != DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is null and ExpiryDate is not null
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate != DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if ExpiryDate is not null and EffectiveDate is after ExpiryDate
|
||||
if (expiryDate != DateTime.MinValue && effectiveDate != DateTime.MinValue && effectiveDate > expiryDate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If none of the above conditions are met, validation passes
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -384,8 +384,8 @@
|
||||
}
|
||||
_url = _page.Url;
|
||||
_icon = _page.Icon;
|
||||
_effectivedate = _page.EffectiveDate;
|
||||
_expirydate = _page.ExpiryDate;
|
||||
_effectivedate = Utilities.UtcAsLocalDate(_page.EffectiveDate);
|
||||
_expirydate = Utilities.UtcAsLocalDate(_page.ExpiryDate);
|
||||
_ispersonalizable = _page.IsPersonalizable.ToString();
|
||||
|
||||
// appearance
|
||||
@ -503,7 +503,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
if (!Utilities.ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
{
|
||||
AddModuleMessage(SharedLocalizer["Message.EffectiveExpiryDateError"], MessageType.Warning);
|
||||
return;
|
||||
@ -584,8 +584,8 @@
|
||||
_page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
|
||||
_page.Url = _url;
|
||||
_page.Icon = _icon ?? string.Empty;
|
||||
_page.EffectiveDate = _effectivedate;
|
||||
_page.ExpiryDate = _expirydate;
|
||||
_page.EffectiveDate = Utilities.LocalDateAndTimeAsUtc(_effectivedate);
|
||||
_page.ExpiryDate = Utilities.LocalDateAndTimeAsUtc(_expirydate);
|
||||
_page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable));
|
||||
|
||||
// appearance
|
||||
@ -689,33 +689,4 @@
|
||||
{
|
||||
_icon = NewIcon;
|
||||
}
|
||||
private bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
// Check if both dates are null, in which case the validation passes
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is not null and ExpiryDate is null
|
||||
if (effectiveDate != DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is null and ExpiryDate is not null
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate != DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if ExpiryDate is not null and EffectiveDate is after ExpiryDate
|
||||
if (expiryDate != DateTime.MinValue && effectiveDate != DateTime.MinValue && effectiveDate > expiryDate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If none of the above conditions are met, validation passes
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ else
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@context.Role.Name</td>
|
||||
<td>@context.EffectiveDate</td>
|
||||
<td>@context.ExpiryDate</td>
|
||||
<td>@Utilities.UtcAsLocalDate(context.EffectiveDate)</td>
|
||||
<td>@Utilities.UtcAsLocalDate(context.ExpiryDate)</td>
|
||||
<td>
|
||||
<ActionDialog Header="Remove Role" Message="@string.Format(Localizer["Confirm.User.RemoveRole"], context.Role.Name)" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned || (context.Role.Name == RoleNames.Host && userid == PageState.User.UserId))" ResourceKey="DeleteUserRole" />
|
||||
</td>
|
||||
@ -113,6 +113,7 @@ else
|
||||
try
|
||||
{
|
||||
userroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId, userid);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -127,7 +128,7 @@ else
|
||||
{
|
||||
if (roleid != -1)
|
||||
{
|
||||
if (!ValidateEffectiveExpiryDates(_effectivedate,_expirydate))
|
||||
if (!Utilities.ValidateEffectiveExpiryDates(_effectivedate, _expirydate))
|
||||
{
|
||||
AddModuleMessage(SharedLocalizer["Message.EffectiveExpiryDateError"], MessageType.Warning);
|
||||
return;
|
||||
@ -144,8 +145,8 @@ else
|
||||
userrole = new UserRole();
|
||||
userrole.UserId = userid;
|
||||
userrole.RoleId = roleid;
|
||||
userrole.EffectiveDate = _effectivedate;
|
||||
userrole.ExpiryDate = _expirydate;
|
||||
userrole.EffectiveDate = Utilities.UtcAsLocalDate(_effectivedate);
|
||||
userrole.ExpiryDate = Utilities.UtcAsLocalDate(_expirydate);
|
||||
await UserRoleService.AddUserRoleAsync(userrole);
|
||||
}
|
||||
|
||||
@ -182,34 +183,4 @@ else
|
||||
AddModuleMessage(Localizer["Error.User.RemoveRole"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
// Check if both dates are null, in which case the validation passes
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is not null and ExpiryDate is null
|
||||
if (effectiveDate != DateTime.MinValue && expiryDate == DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if EffectiveDate is null and ExpiryDate is not null
|
||||
if (effectiveDate == DateTime.MinValue && expiryDate != DateTime.MinValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if ExpiryDate is not null and EffectiveDate is after ExpiryDate
|
||||
if (expiryDate != DateTime.MinValue && effectiveDate != DateTime.MinValue && effectiveDate > expiryDate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If none of the above conditions are met, validation passes
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user