This commit is contained in:
2021-09-30 18:23:11 +01:00
parent c2d2d7f674
commit 46b90cea74
73 changed files with 1621 additions and 793 deletions
@@ -19,12 +19,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
{
//-------------------------------------------------------------------
// Sport data.
private class SportData_List
private class SportData_List : AjaxResponse_Data.ItemData_Base
{
public String Id { get; set; }
public String Name { get; set; }
public String StatusCode { get; set; }
public String StatusDesc { get; set; }
public String SpecialityLabelCode { get; set; }
public String SpecialityLabelDesc { get; set; }
}
private class SportData_Full : SportData_List
{
@@ -33,6 +32,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
{
data.Id = SysId.ToString(sport.Id);
data.Name = sport.Name;
data.SpecialityLabelCode = SportSpecialityLabelCodes.GetCodeForType(sport.SpecialityLabel);
data.SpecialityLabelDesc = SportSpecialityLabelCodes.GetDescForType(sport.SpecialityLabel);
data.StatusCode = sport.StatusCode;
data.StatusDesc = sport.StatusDesc;
}
@@ -82,11 +83,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Item columns.
ColumnDfn colId = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Id);
ColumnDfn colName = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Name);
ColumnDfn colSpecialityLabel = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.SpecialityLabel);
ColumnDfn colStatus = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Status);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colId,
colName,
colName, colSpecialityLabel,
colStatus
};
@@ -99,10 +101,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
Sax.SportSpecialityLabel specialityLabel = (Sax.SportSpecialityLabel)values.GetLong(colSpecialityLabel.DataName);
SportData_List sportData = new SportData_List()
{
Id = values.GetString(colId.DataName),
Name = values.GetString(colName.DataName),
SpecialityLabelCode = SportSpecialityLabelCodes.GetCodeForType(specialityLabel),
SpecialityLabelDesc = SportSpecialityLabelCodes.GetDescForType(specialityLabel),
StatusCode = values.GetString(colStatus.DataName),
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
};
@@ -199,6 +204,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Populate item properties.
if (model.SportName != null)
sport.Name = model.SportName;
if (model.SportSpecialityLabelCode != null)
sport.SpecialityLabel = model.SportSpecialityLabel;
if (model.SportStatusCode != null)
sport.Status = model.SportStatus;
@@ -38,6 +38,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
// Sport properties.
public String SportId { get; set; }
public String SportName { get; set; }
public String SportSpecialityLabelCode { get; set; }
public Sax.SportSpecialityLabel SportSpecialityLabel { get { return (Sax.SportSpecialityLabel)SportSpecialityLabelCodes.GetTypeForCode(SportSpecialityLabelCode); } }
public String SportStatusCode { get; set; }
public SaStatus SportStatus { get { return SacsSystem.GetStatusForCode(SportStatusCode); } }
@@ -69,6 +71,16 @@ namespace Saxonite.Net.Core.Web.Admin.Models
}
}
// Sport Speciality Label.
if (SportSpecialityLabelCode != null)
{
if (!StringUtil.IsEmpty(SportSpecialityLabelCode))
{
if (SportSpecialityLabel <= 0)
responseData.SetControlError(nameof(SportSpecialityLabel), Localiser["msg.validation.invalid.value"]);
}
}
// Sport status.
if (SportStatusCode != null)
{