This commit is contained in:
2021-12-08 18:23:15 +00:00
parent 74fb9448ec
commit 5d15b28456
62 changed files with 1675 additions and 635 deletions
@@ -37,7 +37,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
public short ItemType { get; set; }
public String ItemTypeClass { get; set; }
public long ItemIdx { get; set; }
public String ItemId { get; set; }
public String Organisation { get; set; }
public String Author { get; set; }
public String Caption { get; set; }
@@ -102,6 +102,29 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
public ContentData Content { get; } = new ContentData();
}
/// <summary>Event activity info. </summary>
private class ActivityResponseData_Event
{
public ActivityResponseData_Event(SaxModel_Online model, SaxOrganisationEvent organisationEvent)
{
Organisation = model.GetOrganisationName(organisationEvent.OrganisationId);
EventAt = DateUtil.Format(organisationEvent.EventAt, "d-MMM-yy");
if (organisationEvent.EventAt.Hour>0 || organisationEvent.EventAt.Minute > 0)
EventAt += DateUtil.Format(organisationEvent.EventAt, " HH:ss");
Summary = organisationEvent.Summary;
Details = organisationEvent.Details;
Sport = model.GetSportCaption(organisationEvent.SportIdPrimary);
Region = model.GetRegionCaption(organisationEvent.RegionIdCountry);
PublishedOnFmt = model.Localiser.FormatDate(organisationEvent.PublishedAt);
}
public String Organisation { get; set; }
public String EventAt{ get; set; }
public String Summary { get; set; }
public String Details { get; set; }
public String Sport { get; set; }
public String Region { get; set; }
public String PublishedOnFmt { get; set; }
}
/// <summary>Opportunity activity info. </summary>
private class ActivityResponseData_Opportunity
{
@@ -115,7 +138,6 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
PublishedOnFmt = model.Localiser.FormatDate(opportunity.PublishedAt);
}
public String Organisation { get; set; }
public String Author { get; set; }
public String Position { get; set; }
public String Outline { get; set; }
public String Sport { get; set; }
@@ -170,10 +192,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
activityData.ItemType = itemData.ItemId.Type;
if (itemData.ItemId.Type == (int)Sax.DataItemType.Article)
activityData.ItemTypeClass = "Article";
else if (itemData.ItemId.Type == (int)Sax.DataItemType.OrganisationEvent)
activityData.ItemTypeClass = "Event";
else if (itemData.ItemId.Type == (int)Sax.DataItemType.OrganisationOpportunity)
activityData.ItemTypeClass = "Opportunity";
// ToDo Mask activity index Id with cross-reference stored in session data.
activityData.ItemIdx = SysId.ToLong(itemData.ItemId.Id);
activityData.ItemId = model.EncryptId(itemData.ItemId.Id);
activityData.Organisation = itemData.Organisation;
activityData.Author = itemData.Author;
activityData.Caption = itemData.Caption;
@@ -199,6 +223,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
private class AjaxResponse_ActivityInfo : AjaxResponse_Base
{
public ActivityResponseData_Article Article { get; set; }
public ActivityResponseData_Event Event { get; set; }
public ActivityResponseData_Opportunity Opportunity { get; set; }
}
//-------------------------------------------------------------------
@@ -224,8 +249,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
// Identify activity.
Sax.DataItemType itemType = (Sax.DataItemType)StringUtil.ToShort(model.ActivityType);
SysId itemId = model.ExtractSysId(model.ActivityIdx);
Sax.DataItemType itemType = (Sax.DataItemType)StringUtil.ToShort(model.ActivityItemType);
SysId itemId = model.ExtractSysId(model.ActivityItemId);
if (itemType <= 0 || !SysId.IsValid(itemId))
{
SaLogger.Warn(fn + " Activity type/Id inncorrectly specified." + GetLogSuffix());
@@ -247,6 +272,18 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
disposableItems.Add(organisation);
responseData.Article = new ActivityResponseData_Article(this, model, article, organisation);
}
else if (itemType == Sax.DataItemType.OrganisationEvent)
{
// Organisation Event.
SaxOrganisationEvent organisationEvent = ActivityMgr.GetOrganisationEventById(itemId);
disposableItems.Add(organisationEvent);
if (organisationEvent == null)
{
SaLogger.Warn(fn + " Event not found for Activity Id: " + itemId.ToString() + "." + GetLogSuffix());
return Json(responseData);
}
responseData.Event = new ActivityResponseData_Event(model, organisationEvent);
}
else if (itemType == Sax.DataItemType.OrganisationOpportunity)
{
// Organisation Opportunity.
@@ -297,8 +334,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
SaxSessionData_Online sessionData = SessionData_Online;
// Identify activity.
Sax.DataItemType itemType = (Sax.DataItemType)StringUtil.ToShort(model.ActivityType);
SysId itemId = model.ExtractSysId(model.ActivityIdx);
Sax.DataItemType itemType = (Sax.DataItemType)StringUtil.ToShort(model.ActivityItemType);
SysId itemId = model.ExtractSysId(model.ActivityItemId);
if (itemType <= 0 || !SysId.IsValid(itemId))
{
SaLogger.Warn(fn + " Activity type/Id inncorrectly specified." + GetLogSuffix());
@@ -27,31 +27,34 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public String EventTimeFmt { get; set; }
public String TypeCode { get; set; }
public String TypeDesc { get; set; }
public String About { get; set; }
public String RegionCaption { get; set; }
public String SportCaption { get; set; }
public String Summary { get; set; }
public String Details { get; set; }
public String SportCaptionPrimary { get; set; }
public String RegionCaptionCountry { get; set; }
public String PublishedOnFmt { get; set; }
public String ExpiresOnFmt { get; set; }
}
private class EventData_Detail : EventData_List
{
public String EventAt_YYYYMMDD { get; set; }
public String EventOn_Calendar { get; set; }
public String EventOn_YYYYMMDD { get; set; }
public String EventAt_HHMM { get; set; }
public String RegionIdCountry { get; set; }
public String SportIdPrimary { get; set; }
public String RegionIdCountry { get; set; }
public String PublishedOn_YYYYMMDD { get; set; }
public String ExpiresOn_YYYYMMDD { get; set; }
}
private void PopulateEventResponseData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventData_List data)
{
data.Id = SysId.ToString(organisationEvent.Id);
data.Id = model.EncryptId(organisationEvent.Id);
data.EventDateFmt = Localiser.FormatDate(organisationEvent.EventAt);
data.EventTimeFmt = DateUtil.Format(organisationEvent.EventAt, "HH:mm");
data.TypeCode = EventTypeCodes.GetCodeForType(organisationEvent.EventType);
data.TypeDesc = Localiser.GetEventTypeCaption(organisationEvent.EventType);
data.About = organisationEvent.About;
data.RegionCaption = model.GetRegionCaption(organisationEvent.RegionIdCountry);
data.SportCaption = model.GetSportCaption(organisationEvent.SportIdPrimary);
data.Summary = organisationEvent.Summary;
data.Details = organisationEvent.Details;
data.SportCaptionPrimary = model.GetSportCaption(organisationEvent.SportIdPrimary);
data.RegionCaptionCountry = model.GetRegionCaption(organisationEvent.RegionIdCountry);
data.CreatedOnFmt = Localiser.FormatDate(organisationEvent.CreateStamp.On);
data.PublishedOnFmt = Localiser.FormatDate(organisationEvent.PublishedAt);
data.ExpiresOnFmt = Localiser.FormatDate(organisationEvent.ExpiresAt);
@@ -61,7 +64,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
private void PopulateEventResponseData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventData_Detail data)
{
PopulateEventResponseData(model, organisationEvent, data as EventData_List);
data.EventAt_YYYYMMDD = DateUtil.Format(organisationEvent.EventAt, "yyyyMMdd");
data.EventOn_Calendar = model.FormatDateForForm(organisationEvent.EventAt);
data.EventOn_YYYYMMDD = DateUtil.Format(organisationEvent.EventAt, "yyyyMMdd");
data.EventAt_HHMM = DateUtil.Format(organisationEvent.EventAt, "HH:mm");
data.RegionIdCountry = model.GetEncryptedRegionId(organisationEvent.RegionIdCountry);
data.SportIdPrimary = model.GetEncryptedSportId(organisationEvent.SportIdPrimary);
@@ -175,7 +179,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
ColumnDfn colId = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Id);
ColumnDfn colEventAt = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventAt_DateTime);
ColumnDfn colEventTypeCode = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventTypeCode);
ColumnDfn colAbout = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.About);
ColumnDfn colSummary = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Summary);
ColumnDfn colDetails = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Details);
ColumnDfn colRegionId = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.RegionIdCountry);
ColumnDfn colRegionName = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Region_Name);
ColumnDfn colSportId = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.SportIdPrimary);
@@ -186,7 +191,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
ColumnDfn colCreatedOn = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.CreateOn_Date);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colId, colEventAt, colEventTypeCode, colAbout,
colId, colEventAt, colEventTypeCode, colSummary, colDetails,
colRegionId, colRegionName, colSportId, colSportName,
colPublishedOn, colExpiresOn,
colStatus, colCreatedOn
@@ -204,14 +209,15 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
NamedValue.Map values = resultSet.GetRecordValues();
EventData_List eventData = new EventData_List()
{
Id = values.GetLong(colId.DataName).ToString(),
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
EventDateFmt = Localiser.FormatDate(values.GetDateTime(colEventAt.DataName)),
EventTimeFmt = DateUtil.Format(values.GetDateTime(colEventAt.DataName), "HH:mm"),
TypeCode = values.GetString(colEventTypeCode.DataName),
TypeDesc = Localiser.GetEventTypeCaption((Sax.EventType)EventTypeCodes.GetTypeForCode(values.GetString(colEventTypeCode.DataName))),
About = values.GetString(colAbout.DataName),
RegionCaption = model.GetRegionCaption(values.GetString(colRegionId.DataName).ToSysId()),
SportCaption = model.GetSportCaption(values.GetString(colSportId.DataName).ToSysId()),
Summary = ActivityMgr.GetOrganisationEventDataValue(colSummary, values).AsString(),
Details = ActivityMgr.GetOrganisationEventDataValue(colDetails, values).AsString(),
RegionCaptionCountry = model.GetRegionCaption(values.GetString(colRegionId.DataName).ToSysId()),
SportCaptionPrimary = model.GetSportCaption(values.GetString(colSportId.DataName).ToSysId()),
CreatedOnFmt = Localiser.FormatDate(values.GetDateTime(colCreatedOn.DataName)),
PublishedOnFmt = Localiser.FormatDate(values.GetDateTime(colPublishedOn.DataName)),
ExpiresOnFmt = Localiser.FormatDate(values.GetDateTime(colExpiresOn.DataName)),
@@ -390,8 +396,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
if (model.EventTypeCode != null)
organisationEvent.EventType = (Sax.EventType)EventTypeCodes.GetTypeForCode(model.EventTypeCode);
if (model.EventAbout != null)
organisationEvent.About = model.EventAbout;
if (model.EventSummary != null)
organisationEvent.Summary = model.EventSummary;
if (model.EventDetails != null)
organisationEvent.Details = model.EventDetails;
if (model.EventStatusCode != null)
organisationEvent.Status = model.EventStatus;
@@ -414,7 +422,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
// Store Event Activity Index data.
// ToDo ActivityConsole.StoreActivityIndex(organisationEvent, DbUpdateInfo);
ActivityConsole.StoreActivityIndex(organisationEvent, DbUpdateInfo);
// Construct response.
PopulateEventResponseData(model, organisationEvent, responseData.Event);
@@ -29,6 +29,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public bool? CurrentUser { get; set; } = null;
public String EmailAddress { get; set; }
public String DisplayName { get; set; }
public String MemberRoles { get; set; }
public List<String> RoleCodes { get; set; } = new List<string>();
public List<CodeDesc> Roles { get; set; } = new List<CodeDesc>();
public String AdminComment { get; set; }
@@ -41,8 +42,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
private void PopulateMemberResponseData(Model_Organisation_Members model, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation, MemberData_List data)
{
data.Id = SysId.ToString(userOrganisation.Id);
data.UserAccountId = SysId.ToString(userOrganisation.UserAccountId);
data.Id = model.EncryptId(userOrganisation.Id);
data.UserAccountId = model.EncryptId(userOrganisation.UserAccountId);
if (userOrganisation.UserAccountId.Equals(UserAccountId)) data.CurrentUser = true;
data.EmailAddress = userAccount.EmailAddress;
data.DisplayName = userAccount.GetDisplayName();
@@ -56,6 +57,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
data.RoleCodes.Add(memberRoleCode);
data.Roles.Add(memberRoleCode, Localiser.GetOrganisationRoleCaption(organisationRole));
}
data.MemberRoles = data.Roles.Select(item => item.Desc).ToList().Concat(", ");
data.AdminComment = userOrganisation.AdminComment;
// NB UserAccount status (not UserOrganisation).
data.StatusCode = userAccount.StatusCode;
@@ -138,7 +140,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
prmMember.OrganisationIdsIncluded.Add(organisationId);
prmMember.UserAccountStatusCat = responseData.User.CanManage ? SaxUserAccount.StatusCat.AwaitingOrActive : SaxUserAccount.StatusCat.ActiveOnly;
prmMember.OrganisationMembersOnly = true;
//prmMember.MemberFilter = model.Filter.Member;
prmMember.UserFilterPartial = model.Filter.Member;
prmMember.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmMember);
model.PopulatePagingTo(prmMember.ResultsPaging);
@@ -171,8 +173,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
NamedValue.Map values = resultSet.GetRecordValues();
MemberData_List memberData = new MemberData_List()
{
Id = values.GetLong(colId.DataName).ToString(),
UserAccountId = values.GetString(colUserAccountId.DataName),
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
UserAccountId = model.EncryptId(new SysId(values.GetLong(colUserAccountId.DataName))),
EmailAddress = values.GetString(colEmailAddress.DataName),
DisplayName = AccountMgr.GetUserOrganisationDataValue(colDisplayName, values).ToString(),
CreatedOnFmt = Localiser.FormatDate(values.GetDateTime(colCreatedOn.DataName)),
@@ -191,6 +193,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
memberData.RoleCodes.Add(memberRoleCode);
memberData.Roles.Add(memberRoleCode, Localiser.GetOrganisationRoleCaption(organisationRole));
}
memberData.MemberRoles = memberData.Roles.Select(item => item.Desc).ToList().Concat(", ");
responseData.Members.Add(memberData);
}
}
@@ -41,7 +41,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_List data)
{
data.Id = SysId.ToString(opportunity.Id);
data.Id = model.EncryptId(opportunity.Id);
data.TypeCode = OpportunityTypeCodes.GetCodeForType(opportunity.OpportunityType);
data.TypeDesc = Localiser.GetOpportunityTypeCaption(opportunity.OpportunityType);
data.Position = opportunity.Position;
@@ -198,7 +198,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
NamedValue.Map values = resultSet.GetRecordValues();
OpportunityData_List opportunityData = new OpportunityData_List()
{
Id = values.GetLong(colId.DataName).ToString(),
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
TypeCode = values.GetString(colOpportunityTypeCode.DataName),
TypeDesc = Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)OpportunityTypeCodes.GetTypeForCode(values.GetString(colOpportunityTypeCode.DataName))),
Position = values.GetString(colPosition.DataName),
@@ -24,11 +24,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Organisation data.
public class OrganisationResponseData
{
public long Id { get; set; }
public String Id { get; set; }
public String Name { get; set; }
public long RegionId { get; set; }
public String RegionId { get; set; }
public String RegionName { get; set; }
public long SportId { get; set; }
public String SportId { get; set; }
public String SportName { get; set; }
}
@@ -86,11 +86,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
NamedValue.Map values = resultSet.GetRecordValues();
OrganisationResponseData organisationData = new OrganisationResponseData()
{
Id = values.GetLong(colOrganisationId.DataName),
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
Name = values.GetString(colOrganisationName.DataName),
RegionId = values.GetLong(colRegionId.DataName),
RegionId = model.EncryptId(new SysId(values.GetLong(colRegionId.DataName))),
RegionName = values.GetString(colRegionName.DataName),
SportId = values.GetLong(colSportId.DataName),
SportId = model.EncryptId(new SysId(values.GetLong(colSportId.DataName))),
SportName = values.GetString(colSportName.DataName),
};
responseData.Organisations.Add(organisationData);
@@ -106,23 +106,23 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
//-------------------------------------------------------------------
// Get Member Organisation List ajax request.
// Get Member Admin Organisation List ajax request.
//-------------------------------------------------------------------
private class AjaxResponse_MemberOrganisationList : AjaxResponse_Data
private class AjaxResponse_MemberAdminOrganisationList : AjaxResponse_Data
{
// Construction.
public AjaxResponse_MemberOrganisationList(SaxModel_Online model) : base(model) { }
public AjaxResponse_MemberAdminOrganisationList(SaxModel_Online model) : base(model) { }
// Organisation list.
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
}
//-------------------------------------------------------------------
[HttpPost]
[Route("Organisation/Ajax/GetMemberOrganisationList")]
public IActionResult Ajax_GetMemberOrganisationList(Model_Organisation model)
[Route("Organisation/Ajax/GetMemberAdminOrganisationList")]
public IActionResult Ajax_GetMemberAdminOrganisationList(Model_Organisation model)
{
String fn = GetType().Name + ".Ajax_GetMemberOrganisationList";
String fn = GetType().Name + ".Ajax_GetMemberAdminOrganisationList";
String messageTitle = Localiser["organisation.caption.organisations"];
AjaxResponse_MemberOrganisationList responseData = new AjaxResponse_MemberOrganisationList(model);
AjaxResponse_MemberAdminOrganisationList responseData = new AjaxResponse_MemberAdminOrganisationList(model);
// Validate session and referrer.
if (!ValidReferer) return Forbid();
@@ -146,7 +146,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Organisation filter
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.OrganisationMembersOnly = true;
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.MemberAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.SortColumns.Add(colOrganisationName);
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
@@ -158,11 +161,161 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
NamedValue.Map values = resultSet.GetRecordValues();
OrganisationResponseData organisationData = new OrganisationResponseData()
{
Id = values.GetLong(colOrganisationId.DataName),
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
Name = values.GetString(colOrganisationName.DataName),
RegionId = values.GetLong(colRegionId.DataName),
RegionId = model.EncryptId(new SysId(values.GetLong(colRegionId.DataName))),
RegionName = values.GetString(colRegionName.DataName),
SportId = values.GetLong(colSportId.DataName),
SportId = model.EncryptId(new SysId(values.GetLong(colSportId.DataName))),
SportName = values.GetString(colSportName.DataName),
};
responseData.Organisations.Add(organisationData);
}
}
if (model.Paging.IsPaged)
model.Paging.ItemCount = (ushort)responseData.Organisations.Count;
// Complete response.
responseData.SetPaging(model);
responseData.Success = true;
return Json(responseData);
}
//-------------------------------------------------------------------
// Get Event Admin Organisation List ajax request.
//-------------------------------------------------------------------
private class AjaxResponse_EventAdminOrganisationList : AjaxResponse_Data
{
// Construction.
public AjaxResponse_EventAdminOrganisationList(SaxModel_Online model) : base(model) { }
// Organisation list.
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
}
//-------------------------------------------------------------------
[HttpPost]
[Route("Organisation/Ajax/GetEventAdminOrganisationList")]
public IActionResult Ajax_GetEventAdminOrganisationList(Model_Organisation model)
{
String fn = GetType().Name + ".Ajax_GetEventAdminOrganisationList";
String messageTitle = Localiser["organisation.caption.organisations"];
AjaxResponse_EventAdminOrganisationList responseData = new AjaxResponse_EventAdminOrganisationList(model);
// Validate session and referrer.
if (!ValidReferer) return Forbid();
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
RefreshModel(model);
// Query columns.
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
ColumnDfn colRegionId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_RegionId);
ColumnDfn colRegionName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Region_Name);
ColumnDfn colSportId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_SportId);
ColumnDfn colSportName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Sport_Name);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colOrganisationId, colOrganisationName,
colRegionId, colRegionName,
colSportId, colSportName
};
// Organisation filter
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.OrganisationMembersOnly = true;
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.ScheduleAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.SortColumns.Add(colOrganisationName);
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
model.PopulatePagingTo(prmUserOrganisation.ResultsPaging);
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(columns, prmUserOrganisation))
{
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
OrganisationResponseData organisationData = new OrganisationResponseData()
{
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
Name = values.GetString(colOrganisationName.DataName),
RegionId = model.EncryptId(new SysId(values.GetLong(colRegionId.DataName))),
RegionName = values.GetString(colRegionName.DataName),
SportId = model.EncryptId(new SysId(values.GetLong(colSportId.DataName))),
SportName = values.GetString(colSportName.DataName),
};
responseData.Organisations.Add(organisationData);
}
}
if (model.Paging.IsPaged)
model.Paging.ItemCount = (ushort)responseData.Organisations.Count;
// Complete response.
responseData.SetPaging(model);
responseData.Success = true;
return Json(responseData);
}
//-------------------------------------------------------------------
// Get Opportunity Admin Organisation List ajax request.
//-------------------------------------------------------------------
private class AjaxResponse_OpportunityAdminOrganisationList : AjaxResponse_Data
{
// Construction.
public AjaxResponse_OpportunityAdminOrganisationList(SaxModel_Online model) : base(model) { }
// Organisation list.
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
}
//-------------------------------------------------------------------
[HttpPost]
[Route("Organisation/Ajax/GetOpportunityAdminOrganisationList")]
public IActionResult Ajax_GetOpportunityAdminOrganisationList(Model_Organisation model)
{
String fn = GetType().Name + ".Ajax_GetOpportunityAdminOrganisationList";
String messageTitle = Localiser["organisation.caption.organisations"];
AjaxResponse_OpportunityAdminOrganisationList responseData = new AjaxResponse_OpportunityAdminOrganisationList(model);
// Validate session and referrer.
if (!ValidReferer) return Forbid();
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
RefreshModel(model);
// Query columns.
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
ColumnDfn colRegionId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_RegionId);
ColumnDfn colRegionName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Region_Name);
ColumnDfn colSportId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_SportId);
ColumnDfn colSportName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Sport_Name);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colOrganisationId, colOrganisationName,
colRegionId, colRegionName,
colSportId, colSportName
};
// Organisation filter
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.OrganisationMembersOnly = true;
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.OpportunityAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.SortColumns.Add(colOrganisationName);
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
model.PopulatePagingTo(prmUserOrganisation.ResultsPaging);
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(columns, prmUserOrganisation))
{
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
OrganisationResponseData organisationData = new OrganisationResponseData()
{
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
Name = values.GetString(colOrganisationName.DataName),
RegionId = model.EncryptId(new SysId(values.GetLong(colRegionId.DataName))),
RegionName = values.GetString(colRegionName.DataName),
SportId = model.EncryptId(new SysId(values.GetLong(colSportId.DataName))),
SportName = values.GetString(colSportName.DataName),
};
responseData.Organisations.Add(organisationData);
@@ -6,6 +6,7 @@ using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Online.Models;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
@@ -38,6 +39,33 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
return RedirectToAction("", "");
}
//-------------------------------------------------------------------
[HttpGet]
public IActionResult Members()
{
// Validate session.
if (!ValidUserSession)
return RedirectToAction("", "");
// Model.
Model_Organisation_Members model = new Model_Organisation_Members(Localiser);
// Get a suitable organisation for the filter.
SysId filterOrganisationId = SessionData_Online.Filter.OrganisationIdMember;
String filterOrganisationCaption = SessionData_Online.Filter.OrganisationCaptionMember;
OrganisationData organisationData = GetOrganisationForFilter(filterOrganisationId, filterOrganisationCaption, Sax.OrganisationRole.MemberAdmin);
if (organisationData == null)
return RedirectToAction("", "");
// Make a note of the filter values.
model.Filter.OrganisationId = model.EncryptId(organisationData.Id);
model.Filter.OrganisationCaption = organisationData.Caption;
SessionData_Online.Filter.OrganisationIdMember = organisationData.Id;
SessionData_Online.Filter.OrganisationCaptionMember = organisationData.Caption;
return View(model);
}
//-------------------------------------------------------------------
[HttpGet]
public IActionResult Events()
@@ -52,12 +80,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Get a suitable organisation for the filter.
SysId filterOrganisationId = SessionData_Online.Filter.OrganisationIdMember;
String filterOrganisationCaption = SessionData_Online.Filter.OrganisationCaptionMember;
OrganisationData organisationData = GetOrganisationForFilter(filterOrganisationId, filterOrganisationCaption);
OrganisationData organisationData = GetOrganisationForFilter(filterOrganisationId, filterOrganisationCaption, Sax.OrganisationRole.ScheduleAdmin);
if (organisationData == null)
return RedirectToAction("", "");
// Make a note of the filter values.
model.Filter.OrganisationId = SysId.ToString(organisationData.Id);
model.Filter.OrganisationId = model.EncryptId(organisationData.Id);
model.Filter.OrganisationCaption = organisationData.Caption;
SessionData_Online.Filter.OrganisationIdMember = organisationData.Id;
SessionData_Online.Filter.OrganisationCaptionMember = organisationData.Caption;
@@ -79,39 +107,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Get a suitable organisation for the filter.
SysId filterOrganisationId = SessionData_Online.Filter.OrganisationIdMember;
String filterOrganisationCaption = SessionData_Online.Filter.OrganisationCaptionMember;
OrganisationData organisationData = GetOrganisationForFilter(filterOrganisationId, filterOrganisationCaption);
OrganisationData organisationData = GetOrganisationForFilter(filterOrganisationId, filterOrganisationCaption, Sax.OrganisationRole.OpportunityAdmin);
if (organisationData == null)
return RedirectToAction("", "");
// Make a note of the filter values.
model.Filter.OrganisationId = SysId.ToString(organisationData.Id);
model.Filter.OrganisationCaption = organisationData.Caption;
SessionData_Online.Filter.OrganisationIdMember = organisationData.Id;
SessionData_Online.Filter.OrganisationCaptionMember = organisationData.Caption;
return View(model);
}
//-------------------------------------------------------------------
[HttpGet]
public IActionResult Members()
{
// Validate session.
if (!ValidUserSession)
return RedirectToAction("", "");
// Model.
Model_Organisation_Members model = new Model_Organisation_Members(Localiser);
// Get a suitable organisation for the filter.
SysId filterOrganisationId = SessionData_Online.Filter.OrganisationIdMember;
String filterOrganisationCaption = SessionData_Online.Filter.OrganisationCaptionMember;
OrganisationData organisationData = GetOrganisationForFilter(filterOrganisationId, filterOrganisationCaption);
if (organisationData == null)
return RedirectToAction("", "");
// Make a note of the filter values.
model.Filter.OrganisationId = SysId.ToString(organisationData.Id);
model.Filter.OrganisationId = model.EncryptId(organisationData.Id);
model.Filter.OrganisationCaption = organisationData.Caption;
SessionData_Online.Filter.OrganisationIdMember = organisationData.Id;
SessionData_Online.Filter.OrganisationCaptionMember = organisationData.Caption;
@@ -126,27 +127,46 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public SysId Id { get; }
public String Caption { get; set; }
}
private OrganisationData GetOrganisationForFilter(SysId filterOrganisationId, String filterOrganisationCaption)
private OrganisationData GetOrganisationForFilter(SysId filterOrganisationId, String filterOrganisationCaption, Sax.OrganisationRole organisationRole)
{
// Check that user is associated with organisations.
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
if (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) < 1)
return null;
// Filter organisation.
OrganisationData organisationData = new OrganisationData(filterOrganisationId);
organisationData.Caption = filterOrganisationCaption;
if (!SysId.IsValid(filterOrganisationId) || StringUtil.IsEmpty(filterOrganisationCaption))
// Roles (any) required for organisation list.
List<Sax.OrganisationRole> requiredRoles = new List<Sax.OrganisationRole>() { Sax.OrganisationRole.Admin };
if (organisationRole > 0)
requiredRoles.Add(organisationRole);
// Retrieve specified organisation.
OrganisationData organisationData = null;
if (SysId.IsValid(filterOrganisationId))
{
// Pick the first Organisation that the user is a member of.
organisationData = new OrganisationData(filterOrganisationId) { Caption = filterOrganisationCaption };
using (SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationData.Id))
{
// Validate organisation.
if (organisation != null && organisation.IsStatusActive && AccountMgr.UserHasAnyOrganisationRole(UserAccountId, organisation.Id, requiredRoles))
organisationData.Caption = organisation.Name;
else
organisationData = null;
}
}
if (organisationData == null)
{
// Pick the first valid Organisation that the user is a member of.
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
if (SysId.IsValid(filterOrganisationId))
prmUserOrganisation.OrganisationIdsIncluded.Add(filterOrganisationId);
if (organisationData != null && SysId.IsValid(organisationData.Id))
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationData.Id);
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.OrganisationMembersOnly = true;
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.SortColumns.Add(colOrganisationName);
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Online.Models
{
//=======================================================================
public class Model_Activity: SaxModel_Online
public class Model_Activity : SaxModel_Online
{
//-------------------------------------------------------------------
// Construction.
@@ -32,14 +32,14 @@ namespace Saxonite.Net.Core.Web.Online.Models
// Activity identity.
// ToDo Replace Type + Idx (Id) with Idx and cross-reference stored in Session data.
public String ActivityType { get; set; }
public String ActivityIdx { get; set; }
public String ActivityReaction{ get; set; }
public String ActivityItemType { get; set; }
public String ActivityItemId { get; set; }
public String ActivityReaction { get; set; }
public Sax.ActivityReaction GetActivityReaction()
{
Sax.ActivityReaction reaction = EnumUtil.ParseEnum(ActivityReaction, Sax.ActivityReaction.Unknown);
if (reaction <= 0 && StringUtil.IsNumeric(ActivityReaction))
reaction = (Sax.ActivityReaction)StringUtil.ToShort(ActivityReaction);
reaction = (Sax.ActivityReaction)StringUtil.ToShort(ActivityReaction);
return reaction;
}
@@ -49,7 +49,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
public String EventDate { get; set; }
public String EventTime { get; set; }
public String EventTypeCode { get; set; }
public String EventAbout { get; set; }
public String EventSummary { get; set; }
public String EventDetails { get; set; }
public String EventStatusCode { get; set; }
public SaStatus EventStatus { get { return SacsSystem.GetStatusForCode(EventStatusCode); } }
@@ -69,6 +70,9 @@ namespace Saxonite.Net.Core.Web.Online.Models
// Event date.
if (EventDate != null)
{
DateTime eventOn = ParseDateFromForm(EventDate);
if (!DateUtil.IsValid(eventOn))
responseData.SetControlError(nameof(EventDate), Localiser["msg.validation.mandatory.value"]);
}
// Event time.
@@ -76,14 +80,22 @@ namespace Saxonite.Net.Core.Web.Online.Models
{
}
// Event about.
if (EventAbout != null)
// Event summary.
if (EventSummary != null)
{
responseData.SetControlValue(nameof(EventAbout), EventAbout);
if (StringUtil.IsEmpty(EventAbout))
responseData.SetControlError(nameof(EventAbout), Localiser["msg.validation.mandatory.value"]);
else if (StringUtil.GetLength(EventAbout) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_About))
responseData.SetControlError(nameof(EventAbout), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_About)]);
responseData.SetControlValue(nameof(EventSummary), EventSummary);
if (StringUtil.IsEmpty(EventSummary))
responseData.SetControlError(nameof(EventSummary), Localiser["msg.validation.mandatory.value"]);
else if (StringUtil.GetLength(EventSummary) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary))
responseData.SetControlError(nameof(EventSummary), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary)]);
}
// Event details.
if (EventDetails != null)
{
responseData.SetControlValue(nameof(EventDetails), EventDetails);
if (StringUtil.GetLength(EventDetails) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Details))
responseData.SetControlError(nameof(EventDetails), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Details)]);
}
// Event sport.
@@ -91,7 +103,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
{
SysId articleSportId = ExtractSysId(EventSportIdPrimary);
if (!SysId.IsValid(articleSportId))
responseData.SetControlError(nameof(EventSportIdPrimary), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError("EventSportPrimary", Localiser["msg.validation.mandatory.value"]);
}
// Event region.
@@ -99,16 +111,16 @@ namespace Saxonite.Net.Core.Web.Online.Models
{
SysId articleRegionId = ExtractSysId(EventRegionIdCountry);
if (!SysId.IsValid(articleRegionId))
responseData.SetControlError(nameof(EventRegionIdCountry), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError("EventRegionCountry", Localiser["msg.validation.mandatory.value"]);
}
// Event status.
if (EventStatusCode != null)
{
if (StringUtil.IsEmpty(EventStatusCode))
responseData.SetControlError(nameof(EventStatusCode), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(nameof(EventStatus), Localiser["msg.validation.mandatory.value"]);
else if (!SaxOrganisationEvent.ValidStatuses.Contains(EventStatus))
responseData.SetControlError(nameof(EventStatusCode), Localiser["msg.validation.invalid.value"]);
responseData.SetControlError(nameof(EventStatus), Localiser["msg.validation.invalid.value"]);
}
return !responseData.HasControlErrors();
@@ -21,10 +21,14 @@ namespace Saxonite.Net.Core.Web.Online.Models
{
//-------------------------------------------------------------------
// Data members.
private bool? userCanManageOrganisationMembers = null;
private bool? userCanManageOrganisationOpportunities = null;
private bool? userCanManageOrganisationSchedule = null;
private bool? userCanManageOrganisationArticles = null;
private class UserCanManageOptions
{
public bool? OrganisationMembers { get; set; } = null;
public bool? OrganisationOpportunities { get; set; } = null;
public bool? OrganisationSchedule { get; set; } = null;
public bool? OrganisationArticles { get; set; } = null;
}
private readonly UserCanManageOptions userCanManage = new UserCanManageOptions();
//-------------------------------------------------------------------
// Protected construction.
@@ -42,9 +46,10 @@ namespace Saxonite.Net.Core.Web.Online.Models
//-------------------------------------------------------------------
// Menu options.
public bool MembersAllowed { get { return UserCanManageOrganisationMembers; } }
public bool OrganisationMembersAllowed { get { return UserCanManageOrganisationMembers; } }
public bool ArticlesAllowed { get { return UserIsJournalist || UserCanManageOrganisationArticles; } }
public bool OpportunitiesAllowed { get { return UserCanManageOrganisationOpportunities; } }
public bool OrganisationOpportunitiesAllowed { get { return UserCanManageOrganisationOpportunities; } }
public bool OrganisationEventsAllowed { get { return UserCanManageOrganisationSchedule; } }
//-------------------------------------------------------------------
// Security profile.
@@ -53,7 +58,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
{
get
{
if (userCanManageOrganisationMembers == null && ValidUserSession)
if (userCanManage.OrganisationMembers == null && ValidUserSession)
{
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
@@ -61,16 +66,16 @@ namespace Saxonite.Net.Core.Web.Online.Models
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.MemberAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
userCanManageOrganisationMembers = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
userCanManage.OrganisationMembers = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
}
return userCanManageOrganisationMembers == true ? true : false;
return userCanManage.OrganisationMembers == true ? true : false;
}
}
public bool UserCanManageOrganisationOpportunities
{
get
{
if (userCanManageOrganisationOpportunities == null && ValidUserSession)
if (userCanManage.OrganisationOpportunities == null && ValidUserSession)
{
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
@@ -78,16 +83,16 @@ namespace Saxonite.Net.Core.Web.Online.Models
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.OpportunityAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
userCanManageOrganisationOpportunities = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
userCanManage.OrganisationOpportunities = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
}
return userCanManageOrganisationOpportunities == true ? true : false;
return userCanManage.OrganisationOpportunities == true ? true : false;
}
}
public bool UserCanManageOrganisationSchedule
{
get
{
if (userCanManageOrganisationSchedule == null && ValidUserSession)
if (userCanManage.OrganisationSchedule == null && ValidUserSession)
{
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
@@ -95,16 +100,16 @@ namespace Saxonite.Net.Core.Web.Online.Models
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.ScheduleAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
userCanManageOrganisationSchedule = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
userCanManage.OrganisationSchedule = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
}
return userCanManageOrganisationSchedule == true ? true : false;
return userCanManage.OrganisationSchedule == true ? true : false;
}
}
public bool UserCanManageOrganisationArticles
{
get
{
if (userCanManageOrganisationArticles == null && ValidUserSession)
if (userCanManage.OrganisationArticles == null && ValidUserSession)
{
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
prmUserOrganisation.UserAccountIdsIncluded.Add(UserAccountId);
@@ -112,9 +117,9 @@ namespace Saxonite.Net.Core.Web.Online.Models
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.Admin);
prmUserOrganisation.OrganisationRolesAny.Add(Sax.OrganisationRole.ArticleAdmin);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
userCanManageOrganisationArticles = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
userCanManage.OrganisationArticles = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
}
return userCanManageOrganisationArticles == true ? true : false;
return userCanManage.OrganisationArticles == true ? true : false;
}
}