This commit is contained in:
2022-02-16 10:47:45 +00:00
parent 5d15b28456
commit 4a394d3ff7
75 changed files with 3127 additions and 691 deletions
+21 -3
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Rendering;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
@@ -63,6 +64,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
protected SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
// Consoles.
protected SaxDataCacheConsole DataCacheConsole { get { return Internals.DataCacheConsole; } }
protected SaxSessionDataConsole SessionDataConsole { get { return Internals.SessionDataConsole; } }
protected SaxActivityConsole ActivityConsole { get { return Internals.ActivityConsole; } }
// Managers.
public SaxReferenceMgr ReferenceMgr { get { return Internals.ReferenceMgr; } }
@@ -189,8 +191,10 @@ namespace Saxonite.Net.Core.Web.Base.Models
}
public bool IsPaged { get { return paging.Paged; } }
public uint PageNo { get { return paging.PageNo; } set { paging.PageNo = value; } }
public String PageNoValue { get { return paging.PageNo.ToString(); } set { paging.PageNo = (uint)StringUtil.ToInt(value); } }
public ushort PageLength { get { return paging.PageLength; } set { paging.PageLength = value; } }
public uint PageCount { get { return (PageLength > 0 ? (uint)Math.Ceiling((decimal)ItemTotal / PageLength) : 0); } }
public String PageLengthValue { get { return paging.PageLength.ToString(); } set { paging.PageLength = (ushort)StringUtil.ToShort(value); } }
public uint PageCount { get { return (PageLength > 0 ? (uint)Math.Ceiling((decimal)ItemTotal / paging.PageLength) : 0); } }
public ushort ItemCount { get; set; }
private ulong itemTotal = 0;
public ulong ItemTotal
@@ -241,6 +245,17 @@ namespace Saxonite.Net.Core.Web.Base.Models
return maxLength;
}
//-------------------------------------------------------------------
// Display data - Dates.
public String FormatDateForDisplay(DateTime value)
{
return DateUtil.Format(value, "d-MMM-yy", SessionCulture);
}
public String FormatDateTimeForDisplay(DateTime value)
{
return StringUtil.TrimAll(DateUtil.Format(value, "d-MMM-yy HH:mm", SessionCulture));
}
//-------------------------------------------------------------------
// Form data - Dates.
// Format may depend on locale, but as long as these methods are used consistently,
@@ -362,13 +377,16 @@ namespace Saxonite.Net.Core.Web.Base.Models
}
}
/// <summary>List of Organisation Categories for dropdown.</summary>
/// <summary>
/// List of Organisation Categories for dropdown.
/// <para>NB Does not include 'Partner' or 'Other'.</para>
/// </summary>
public IEnumerable<SelectListItem> OrganisationCategoriesForSelect
{
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc organisationCategory in OrganisationCategoryCodes)
foreach (TypeCodeDesc organisationCategory in OrganisationCategoryCodes.FindAll(item => item.Type != (int)Sax.OrganisationCategory.Partner && item.Type != (int)Sax.OrganisationCategory.Other))
values.Add(new SelectListItem(Localiser.GetOrganisationCategoryCaption((Sax.OrganisationCategory)organisationCategory.Type), organisationCategory.Code));
return values;
}