v1.2.4
This commit is contained in:
@@ -109,7 +109,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
Organisation = model.GetOrganisationName(organisationEvent.OrganisationId);
|
||||
EventAt = DateUtil.Format(organisationEvent.EventAt, "d-MMM-yy");
|
||||
if (organisationEvent.EventAt.Hour>0 || organisationEvent.EventAt.Minute > 0)
|
||||
if (organisationEvent.EventAt.Hour > 0 || organisationEvent.EventAt.Minute > 0)
|
||||
EventAt += DateUtil.Format(organisationEvent.EventAt, " HH:ss");
|
||||
Summary = organisationEvent.Summary;
|
||||
Details = organisationEvent.Details;
|
||||
@@ -118,7 +118,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
PublishedOnFmt = model.Localiser.FormatDate(organisationEvent.PublishedAt);
|
||||
}
|
||||
public String Organisation { get; set; }
|
||||
public String EventAt{ get; set; }
|
||||
public String EventAt { get; set; }
|
||||
public String Summary { get; set; }
|
||||
public String Details { get; set; }
|
||||
public String Sport { get; set; }
|
||||
@@ -172,18 +172,23 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// User context.
|
||||
SysId userAccountId = UserAccountId;
|
||||
SaxActivityConsole.IndexContext indexContext = new SaxActivityConsole.IndexContext(userAccountId);
|
||||
if (SysId.IsValid(userAccountId))
|
||||
indexContext.UserAccountIdsOwner.Add(userAccountId);
|
||||
SysId organisationId = model.DecryptId(model.Filter.OrganisationId);
|
||||
if (SysId.IsValid(organisationId))
|
||||
indexContext.OrganisationIdsOwner.Add(organisationId);
|
||||
|
||||
// Period.
|
||||
indexContext.EffectiveTo = DateTime.Today;
|
||||
|
||||
// Regions.
|
||||
if (SysId.IsValid(sessionData.User.RegionIdProvince))
|
||||
indexContext.RegionIds.Add(sessionData.User.RegionIdProvince);
|
||||
else if (SysId.IsValid(sessionData.User.RegionIdCountry))
|
||||
indexContext.RegionIds.Add(sessionData.User.RegionIdCountry);
|
||||
|
||||
// Sports.
|
||||
indexContext.SportIds.AddRange(sessionData.Profile.Sports.Select(item => item.SportId));
|
||||
// Sport and region combinations.
|
||||
foreach (SysId sportId in sessionData.Profile.Sports.Select(item => item.SportId))
|
||||
{
|
||||
if (SysId.IsValid(sessionData.User.RegionIdProvince))
|
||||
indexContext.SportRegionIdsIncluded.Add(new SaxActivityIndex.SportRegionIds(sportId, sessionData.User.RegionIdProvince));
|
||||
else if (SysId.IsValid(sessionData.User.RegionIdCountry))
|
||||
indexContext.SportRegionIdsIncluded.Add(new SaxActivityIndex.SportRegionIds(sportId, sessionData.User.RegionIdCountry));
|
||||
}
|
||||
|
||||
// Populate activities.
|
||||
List<ItemId> activityItemIds = new List<ItemId>();
|
||||
|
||||
@@ -50,18 +50,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Article data.
|
||||
private class ArticleData_List
|
||||
private class ArticleData_List : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String OrganisationId { get; set; }
|
||||
public String Headline { get; set; }
|
||||
public String Summary { get; set; }
|
||||
public String RegionCaptionPrimary { get; set; }
|
||||
public String SportCaptionPrimary { get; set; }
|
||||
public String PublishedOnFmt { get; set; }
|
||||
public String CreatedOnFmt { get; set; }
|
||||
public String StatusCode { get; set; }
|
||||
public String StatusDesc { get; set; }
|
||||
}
|
||||
private class ArticleData_Full : ArticleData_List
|
||||
{
|
||||
@@ -75,7 +71,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
private void PopulateArticleResponseData(Model_Article model, SaxArticle article, ArticleData_List data)
|
||||
{
|
||||
data.Id = SysId.ToString(article.Id);
|
||||
data.Id = model.EncryptId(article.Id);
|
||||
data.OrganisationId = SysId.ToString(article.OrganisationId);
|
||||
data.Headline = article.Headline;
|
||||
data.Summary = article.Summary;
|
||||
@@ -245,8 +241,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
ArticleData_List articleData = new ArticleData_List()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
OrganisationId = values.GetString(colOrganisationId.DataName),
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
OrganisationId = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
|
||||
Headline = values.GetString(colHeadline.DataName),
|
||||
Summary = values.GetString(colSummary.DataName),
|
||||
RegionCaptionPrimary = model.GetRegionCaption(values.GetString(colRegionIdPrimary.DataName).ToSysId()),
|
||||
@@ -586,6 +582,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
List<SaxItemImage> itemImages = ItemDataMgr.GetItemImageList(prmItemImage);
|
||||
|
||||
// If Article doesn't yet exist, create it now so that images can be assigned.
|
||||
bool articleCreated = false;
|
||||
if (!SysId.IsValid(article.Id))
|
||||
{
|
||||
if (!ActivityMgr.InsertArticle(article, DbUpdateInfo))
|
||||
@@ -593,6 +590,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaLogger.Warn(fn + " Failed to insert article: " + ActivityMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
articleCreated = true;
|
||||
}
|
||||
|
||||
// Content.
|
||||
@@ -651,6 +649,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaLogger.Warn(fn + " Failed to update article [Id:" + SysId.ToString(article.Id) + "]: " + ActivityMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
SaLogger.Info(fn + " Article " + (articleCreated ? "created" : "updated") + ". Id: " + article.Id.ToString() + ". User: " + SessionData.User.EmailAddress, true);
|
||||
|
||||
// Store Article Activity Index data.
|
||||
ActivityConsole.StoreActivityIndex(article, DbUpdateInfo);
|
||||
|
||||
@@ -404,6 +404,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisationEvent.Status = model.EventStatus;
|
||||
|
||||
// Store item.
|
||||
bool eventCreated = false;
|
||||
if (!SysId.IsValid(organisationEvent.Id))
|
||||
{
|
||||
if (!ActivityMgr.InsertOrganisationEvent(organisationEvent, DbUpdateInfo))
|
||||
@@ -411,6 +412,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaLogger.Warn(fn + " Failed to insert organisationEvent: " + ActivityMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
eventCreated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -420,6 +422,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
}
|
||||
SaLogger.Info(fn + " Event " + (eventCreated ? "created" : "updated") + ". Id: " + organisationEvent.Id.ToString() + ". User: " + SessionData.User.EmailAddress + ". Organisation: " + organisation.Name, true);
|
||||
|
||||
// Store Event Activity Index data.
|
||||
ActivityConsole.StoreActivityIndex(organisationEvent, DbUpdateInfo);
|
||||
|
||||
@@ -385,6 +385,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
opportunity.Status = model.OpportunityStatus;
|
||||
|
||||
// Store item.
|
||||
bool opportunityCreated = false;
|
||||
if (!SysId.IsValid(opportunity.Id))
|
||||
{
|
||||
if (!ActivityMgr.InsertOrganisationOpportunity(opportunity, DbUpdateInfo))
|
||||
@@ -392,6 +393,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaLogger.Warn(fn + " Failed to insert opportunity: " + ActivityMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
opportunityCreated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -401,6 +403,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
}
|
||||
SaLogger.Info(fn + " Opportunity " + (opportunityCreated ? "created" : "updated") + ". Id: " + opportunity.Id.ToString() + ". User: " + SessionData.User.EmailAddress + ". Organisation: " + organisation.Name, true);
|
||||
|
||||
// Store Opportunity Activity Index data.
|
||||
ActivityConsole.StoreActivityIndex(opportunity, DbUpdateInfo);
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public class FilterData
|
||||
{
|
||||
public String Activity { get; set; }
|
||||
public String OrganisationId { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user