v1.2.6.1
This commit is contained in:
@@ -229,6 +229,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_ProfileOrganisation(SaxModel_Online model) : base(model) { }
|
||||
// Reference data.
|
||||
public List<AjaxResponse_Data.ItemCodeDesc> Categories { get; } = new List<ItemCodeDesc>();
|
||||
public List<AjaxResponse_Data.ItemCodeDesc> Types { get; } = new List<ItemCodeDesc>();
|
||||
// Organisation list.
|
||||
public ProfileOrganisationData Organisation { get; set; }
|
||||
}
|
||||
@@ -280,6 +283,19 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construct response.
|
||||
responseData.Organisation = new ProfileOrganisationData();
|
||||
PopulateOrganisationResponseData(model, organisation, userOrganisation, address, responseData.Organisation);
|
||||
|
||||
// Reference data.
|
||||
foreach (TypeCodeDesc organisationCategory in OrganisationCategoryCodes)
|
||||
{
|
||||
// Categories only include Partner/Other if selected organisation has that category.
|
||||
if (organisationCategory.Type != (int)organisation.OrganisationCategory && organisationCategory.Type.In(new[] { (int)Sax.OrganisationCategory.Partner, (int)Sax.OrganisationCategory.Other }))
|
||||
continue;
|
||||
responseData.Categories.Add(new AjaxResponse_Data.ItemCodeDesc() { Code = organisationCategory.Code, Desc = Localiser.GetOrganisationCategoryCaption((Sax.OrganisationCategory)organisationCategory.Type) });
|
||||
}
|
||||
foreach (TypeCodeDesc organisationType in OrganisationTypeCodes)
|
||||
{
|
||||
responseData.Types.Add(new AjaxResponse_Data.ItemCodeDesc() { Code = organisationType.Code, Desc = Localiser.GetOrganisationTypeCaption((Sax.OrganisationType)organisationType.Type) });
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
@@ -409,6 +425,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisation.SportIdPrimary = model.ExtractSysId(model.Organisation.SportId);
|
||||
if (model.Organisation.RegionIdCountry != null)
|
||||
organisation.RegionIdPrimary = model.ExtractSysId(model.Organisation.RegionIdCountry);
|
||||
if (model.Organisation.About != null)
|
||||
organisation.About = model.Organisation.About;
|
||||
if (model.Organisation.Facilities != null)
|
||||
organisation.Facilities = model.Organisation.Facilities;
|
||||
if (model.Organisation.PhoneMain != null)
|
||||
organisation.PhoneMain = model.Organisation.PhoneMain;
|
||||
if (!AccountMgr.UpdateOrganisation(organisation, DbUpdateInfo))
|
||||
|
||||
@@ -22,9 +22,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation data.
|
||||
public class OrganisationResponseData
|
||||
private class OrganisationResponseData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String RegionId { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
|
||||
@@ -26,9 +26,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Get Organisations.
|
||||
//-------------------------------------------------------------------
|
||||
private class OrganisationListData
|
||||
private class OrganisationListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String CategoryDesc { get; set; }
|
||||
public String SportId { get; set; }
|
||||
@@ -129,15 +128,17 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Get Organisations.
|
||||
// Account - Get Organisation.
|
||||
//-------------------------------------------------------------------
|
||||
private class OrganisationData
|
||||
private class OrganisationData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String Category { get; set; }
|
||||
public String Type { get; set; }
|
||||
public String Sport { get; set; }
|
||||
public String Location { get; set; }
|
||||
public String About { get; set; }
|
||||
public String Facilities { get; set; }
|
||||
public String Address { get; set; }
|
||||
public String PostalCode { get; set; }
|
||||
public String Phone { get; set; }
|
||||
@@ -190,8 +191,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
Id = model.EncryptId(organisation.Id),
|
||||
Name = organisation.Name,
|
||||
Category = Localiser.GetOrganisationCategoryCaption(organisation.OrganisationCategory),
|
||||
Type = Localiser.GetOrganisationTypeCaption(organisation.OrganisationType),
|
||||
Sport = model.GetSportCaption(organisation.SportIdPrimary),
|
||||
Location = model.GetRegionCaption(organisation.RegionIdPrimary),
|
||||
About = organisation.About,
|
||||
Facilities = organisation.Facilities,
|
||||
};
|
||||
responseData.Organisation = organisationData;
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public Sax.OrganisationCategory GetOrganisationCategory() { return (Sax.OrganisationCategory)Model.OrganisationCategoryCodes.GetTypeForCode(Category); }
|
||||
public String SportId { get; set; }
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String About { get; set; }
|
||||
public String Facilities { get; set; }
|
||||
public String PhoneMain { get; set; }
|
||||
// Address.
|
||||
public ModelData_Address Address { get; }
|
||||
@@ -91,6 +93,16 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
else if (!SysId.IsValid(Model.ExtractSysId(RegionIdCountry)))
|
||||
responseData.SetControlError(ControlNameSuffix + "RegionIdCountry", Model.Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// About - optional.
|
||||
responseData.SetControlValue(ControlNameSuffix + "About", About);
|
||||
if (StringUtil.GetLength(About) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_About))
|
||||
responseData.SetControlError(ControlNameSuffix + "About", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_About)]);
|
||||
|
||||
// Facilities - optional.
|
||||
responseData.SetControlValue(ControlNameSuffix + "Facilities", Facilities);
|
||||
if (StringUtil.GetLength(Facilities) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Facilities))
|
||||
responseData.SetControlError(ControlNameSuffix + "Facilities", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Facilities)]);
|
||||
|
||||
// Phone Main - optional.
|
||||
if (PhoneMain != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user