v1.0.6.0
Refresh Online Session with profile region and sports.
This commit is contained in:
@@ -28,8 +28,21 @@ namespace Saxonite.Net.Core.Web.Admin.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User details.
|
||||
private class UserData_Admin : UserData
|
||||
{
|
||||
public UserData_Admin(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) :
|
||||
base(sessionContext, userAccount, userRoles)
|
||||
{ }
|
||||
public UserData_Admin(UserData userData) :
|
||||
base(userData)
|
||||
{ }
|
||||
}
|
||||
protected override UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) { return new UserData_Admin(sessionContext, userAccount, userRoles); }
|
||||
/// <summary>User - JSON deserialisation route.</summary>
|
||||
public new UserData User { get { return base.User; } set { SetUser(value); } }
|
||||
public new UserData User { get { return base.User; } set { SetUser(new UserData_Admin(value)); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -47,10 +47,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
data.Id = SysId.ToString(organisation.Id);
|
||||
data.Name = organisation.Name;
|
||||
data.TypeCode = OrganisationTypes.GetCodeForType(organisation.OrganisationType);
|
||||
data.TypeDesc = OrganisationTypes.GetDescForType(organisation.OrganisationType);
|
||||
data.CategoryCode = OrganisationCategories.GetCodeForType(organisation.OrganisationCategory);
|
||||
data.CategoryDesc = OrganisationCategories.GetDescForType(organisation.OrganisationCategory);
|
||||
data.TypeCode = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType);
|
||||
data.TypeDesc = OrganisationTypeCodes.GetDescForType(organisation.OrganisationType);
|
||||
data.CategoryCode = OrganisationCategoryCodes.GetCodeForType(organisation.OrganisationCategory);
|
||||
data.CategoryDesc = OrganisationCategoryCodes.GetDescForType(organisation.OrganisationCategory);
|
||||
data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id);
|
||||
// Sport.
|
||||
data.SportId = SysId.ToLong(organisation.SportIdPrimary);
|
||||
@@ -145,9 +145,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
Id = values.GetString(colId.DataName),
|
||||
Name = values.GetString(colName.DataName),
|
||||
TypeCode = values.GetString(colOrganisationType.DataName),
|
||||
TypeDesc = OrganisationTypes.GetDescForCode(values.GetString(colOrganisationType.DataName)),
|
||||
TypeDesc = OrganisationTypeCodes.GetDescForCode(values.GetString(colOrganisationType.DataName)),
|
||||
CategoryCode = values.GetString(colOrganisationCategory.DataName),
|
||||
CategoryDesc = OrganisationCategories.GetDescForCode(values.GetString(colOrganisationCategory.DataName)),
|
||||
CategoryDesc = OrganisationCategoryCodes.GetDescForCode(values.GetString(colOrganisationCategory.DataName)),
|
||||
MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
data.OrganisationName = organisation.Name;
|
||||
// Exclude 'Member' role.
|
||||
foreach (Sax.OrganisationRole organisationRole in userOrganisation.OrganisationRoles.FindAll(item => item != Sax.OrganisationRole.Member))
|
||||
data.RoleCodes.Add(OrganisationRoles.GetCodeForType(organisationRole));
|
||||
data.RoleCodes.Add(OrganisationRoleCodes.GetCodeForType(organisationRole));
|
||||
data.RoleCount = userOrganisation.OrganisationRoles.Count - 1;
|
||||
data.StatusCode = userOrganisation.StatusCode;
|
||||
data.StatusDesc = userOrganisation.StatusDesc;
|
||||
@@ -91,7 +91,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
|
||||
// Reference data - organisation roles.
|
||||
// Exclude 'Member' as this is added automatically when stored.
|
||||
foreach (TypeCodeDesc organisationRole in OrganisationRoles.FindAll(item => item.Type != (int)Sax.OrganisationRole.Member))
|
||||
foreach (TypeCodeDesc organisationRole in OrganisationRoleCodes.FindAll(item => item.Type != (int)Sax.OrganisationRole.Member))
|
||||
responseData.MemberRoles.Add(organisationRole.Code, Localiser.GetOrganisationRoleCaption((Sax.OrganisationRole)organisationRole.Type));
|
||||
|
||||
// Reference data - statuses.
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
private void PopulateRegionResponseData(SaxRegion region, RegionData_List data)
|
||||
{
|
||||
data.Id = SysId.ToString(region.Id);
|
||||
data.RegionTypeCode = RegionTypes.GetCodeForType(region.RegionType);
|
||||
data.RegionTypeDesc = RegionTypes.GetDescForType(region.RegionType);
|
||||
data.RegionTypeCode = RegionTypeCodes.GetCodeForType(region.RegionType);
|
||||
data.RegionTypeDesc = RegionTypeCodes.GetDescForType(region.RegionType);
|
||||
data.CountryIso2Code = region.CountryIso2Code;
|
||||
data.Name = region.Name;
|
||||
data.StatusCode = region.StatusCode;
|
||||
@@ -117,8 +117,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
RegionData_List regionData = new RegionData_List()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
RegionTypeCode = RegionTypes.GetCodeForType(regionType),
|
||||
RegionTypeDesc = RegionTypes.GetDescForType(regionType),
|
||||
RegionTypeCode = RegionTypeCodes.GetCodeForType(regionType),
|
||||
RegionTypeDesc = RegionTypeCodes.GetDescForType(regionType),
|
||||
CountryIso2Code = values.GetString(colIso2Code.DataName),
|
||||
Name = values.GetString(colName.DataName),
|
||||
ParentName = values.GetString(colParentName.DataName),
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (userRoles != null)
|
||||
{
|
||||
foreach (SaxUserRole userRole in userRoles.GetUserRolesByStatus(SaStatus.Active))
|
||||
data.userRoleCodes.Add(UserRoles.GetCodeForType(userRole.UserRole));
|
||||
data.userRoleCodes.Add(UserRoleCodes.GetCodeForType(userRole.UserRole));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Reference data - user roles.
|
||||
foreach (TypeCodeDesc userRole in UserRoles)
|
||||
foreach (TypeCodeDesc userRole in UserRoleCodes)
|
||||
responseData.UserRoles.Add(userRole.Code, Localiser.GetUserRoleCaption((Sax.UserRole)userRole.Type));
|
||||
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SaxUserAccount.DefaultStatus);
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
foreach (String userRoleCode in userRoleCodes)
|
||||
{
|
||||
// Role to activate.
|
||||
Sax.UserRole role = (Sax.UserRole)UserRoles.GetTypeForCode(userRoleCode);
|
||||
Sax.UserRole role = (Sax.UserRole)UserRoleCodes.GetTypeForCode(userRoleCode);
|
||||
SaxUserRole userRole = userRoles.GetUserRoleByRole(role);
|
||||
if (userRole == null)
|
||||
{
|
||||
@@ -292,7 +292,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Roles to deactivate.
|
||||
foreach (SaxUserRole userRole in userRoles)
|
||||
{
|
||||
if (!userRoleCodes.Exists(item => item.EqualsCI(UserRoles.GetCodeForType(userRole.UserRole))))
|
||||
if (!userRoleCodes.Exists(item => item.EqualsCI(UserRoleCodes.GetCodeForType(userRole.UserRole))))
|
||||
userRole.Status = SaStatus.Inactive;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public Sax.OrganisationType FilterOrganisationType
|
||||
{
|
||||
get { return (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(Filter.OrganisationTypeCode); }
|
||||
get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(Filter.OrganisationTypeCode); }
|
||||
}
|
||||
public Sax.OrganisationCategory FilterOrganisationCategory
|
||||
{
|
||||
get { return (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(Filter.OrganisationCategoryCode); }
|
||||
get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(Filter.OrganisationCategoryCode); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -49,9 +49,9 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String OrganisationId { get; set; }
|
||||
public String OrganisationName { get; set; }
|
||||
public String OrganisationTypeValue { get; set; }
|
||||
public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(OrganisationTypeValue); } }
|
||||
public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(OrganisationTypeValue); } }
|
||||
public String OrganisationCategoryValue { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
// Common properties.
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public Sax.RegionType FilterRegionType
|
||||
{
|
||||
get { return (Sax.RegionType)RegionTypes.GetTypeForCode(Filter.RegionTypeCode); }
|
||||
get { return (Sax.RegionType)RegionTypeCodes.GetTypeForCode(Filter.RegionTypeCode); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -45,8 +45,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String RegionTypeCode { get; set; }
|
||||
public Sax.RegionType RegionType
|
||||
{
|
||||
get { return (Sax.RegionType)RegionTypes.GetTypeForCode(RegionTypeCode); }
|
||||
set { RegionTypeCode = RegionTypes.GetCodeForType(value); }
|
||||
get { return (Sax.RegionType)RegionTypeCodes.GetTypeForCode(RegionTypeCode); }
|
||||
set { RegionTypeCode = RegionTypeCodes.GetCodeForType(value); }
|
||||
}
|
||||
public String RegionCountryIso2Code { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user