This commit is contained in:
2021-10-17 13:12:05 +01:00
parent 7417981a34
commit 057b75462e
20 changed files with 326 additions and 155 deletions
@@ -47,9 +47,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
data.SportSpecialityLabel = model.GetSportSpecialityLabel(userSport.SportId);
data.SportAbout = userSport.About;
data.SportParticipationCode = SportParticipationCodes.GetCodeForType(userSport.Participation);
data.SportParticipation = Localiser.GetSportParticipationTypeCaption(userSport.Participation);
data.SportParticipation = Localiser.GetSportParticipationCaption(userSport.Participation);
data.SportOfficiatingCode = SportOfficiatingCodes.GetCodeForType(userSport.Officiating);
data.SportOfficiating = Localiser.GetSportOfficiatingTypeCaption(userSport.Officiating);
data.SportOfficiating = Localiser.GetSportOfficiatingCaption(userSport.Officiating);
data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy");
data.StatusCode = userSport.StatusCode;
data.StatusDesc = userSport.StatusDesc;
@@ -117,8 +117,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
SportId = model.GetEncryptedSportId(sportId),
SportName = values.GetString(colSportName.DataName),
SportSpecialityLabel = model.GetSportSpecialityLabel(sportId),
SportParticipation = Localiser.GetSportParticipationTypeCaption((Sax.SportParticipation)values.GetLong(colParticipation.DataName)),
SportOfficiating = Localiser.GetSportOfficiatingTypeCaption((Sax.SportOfficiating)values.GetLong(colOfficiating.DataName)),
SportParticipation = Localiser.GetSportParticipationCaption((Sax.SportParticipation)values.GetLong(colParticipation.DataName)),
SportOfficiating = Localiser.GetSportOfficiatingCaption((Sax.SportOfficiating)values.GetLong(colOfficiating.DataName)),
StatusCode = values.GetString(colStatus.DataName),
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
};
@@ -14,6 +14,7 @@ using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Net.Standard.Base.App;
namespace Saxonite.Net.Core.Web.Online.Controllers
{
@@ -29,10 +30,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
public String Id { get; set; }
public String Name { get; set; }
public String CategoryDesc { get; set; }
public String SportId { get; set; }
public String SportName { get; set; }
public String RegionId { get; set; }
public String RegionName { get; set; }
public String Location { get; set; }
}
private class AjaxResponse_Search_Organisations : AjaxResponse_Data
{
@@ -75,13 +78,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Item columns.
ColumnDfn colId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Id);
ColumnDfn colName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Name);
ColumnDfn colCategory = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.OrganisationCategory_Desc);
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colId, colName,
colId, colName, colCategory,
colSportId, colSportName,
colRegionId, colRegionName,
};
@@ -96,14 +100,16 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
Sax.OrganisationCategory category = (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(values.GetString(colCategory.DataName));
OrganisationListData organisationData = new OrganisationListData()
{
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
Name = values.GetString(colName.DataName),
SportId = model.GetEncryptedSportId(new SysId(values.GetLong(colSportId.DataName))),
CategoryDesc = Localiser.GetOrganisationCategoryCaption(category),
//SportId = model.GetEncryptedSportId(new SysId(values.GetLong(colSportId.DataName))),
SportName = values.GetString(colSportName.DataName),
RegionId = model.GetEncryptedRegionId(new SysId(values.GetLong(colRegionId.DataName))),
RegionName = values.GetString(colRegionName.DataName),
//RegionId = model.GetEncryptedRegionId(new SysId(values.GetLong(colRegionId.DataName))),
Location = values.GetString(colRegionName.DataName),
};
responseData.Organisations.Add(organisationData);
}
@@ -123,10 +129,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
public String Id { get; set; }
public String Name { get; set; }
public String SportId { get; set; }
public String SportName { get; set; }
public String RegionId { get; set; }
public String RegionName { get; set; }
public String Category { get; set; }
public String Sport { get; set; }
public String Location { get; set; }
public String Address { get; set; }
public String PostalCode { get; set; }
public String Phone { get; set; }
}
private class AjaxResponse_Search_Organisation : AjaxResponse_Data
{
@@ -143,7 +151,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
String fn = GetType().Name + ".GetProfileOrganisation";
AjaxResponse_Search_Organisation responseData = new AjaxResponse_Search_Organisation(model);
String messageTitle = Localiser["label.organisations"];
String messageTitle = Localiser["label.organisation"];
// Validate session and referrer.
if (!ValidReferer) return Forbid();
@@ -175,13 +183,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
Id = model.EncryptId(organisation.Id),
Name = organisation.Name,
SportId = model.GetEncryptedSportId(organisation.SportIdPrimary),
SportName = model.GetSportCaption(organisation.SportIdPrimary),
RegionId = model.GetEncryptedRegionId(organisation.RegionIdPrimary),
RegionName = model.GetRegionCaption(organisation.RegionIdPrimary),
Category = Localiser.GetOrganisationCategoryCaption(organisation.OrganisationCategory),
Sport = model.GetSportCaption(organisation.SportIdPrimary),
Location = model.GetRegionCaption(organisation.RegionIdPrimary),
};
responseData.Organisation = organisationData;
// Organisation address.
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
if (address != null)
{
String addressLines = (new List<string>() { address.Line1, address.Line2, address.Line3 }).Concat(", ", "", "", true, true);
String addressTownProvince = (new List<string>() { address.Town, address.Province }).Concat(", ", "", "", true, true);
organisationData.Address = (new List<String>() { addressLines, addressTownProvince }).Concat("\n", "", "", true, true);
organisationData.PostalCode = address.PostalCode;
}
}
// Complete response.