v1.2.10.3 interim-1
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.10.2";
|
||||
private static String version { get; } = "1.2.10.3";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
EventType,
|
||||
OpportunityType,
|
||||
ActivityReaction,
|
||||
// Support.
|
||||
UserReportType,
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -100,6 +102,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
ItemAddress = 405,
|
||||
ItemAssociation = 410,
|
||||
ItemSport = 420,
|
||||
// Support.
|
||||
UserReport = 1010,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -395,6 +399,19 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Exceptional = 5,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Support.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User Report Type</summary>
|
||||
public enum UserReportType
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the values or codes - tied to database. */
|
||||
Enhancement= 10,
|
||||
Information = 20,
|
||||
Bug = 30,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 12-Dec-2022 13:20:42
|
||||
// Code generated by Sarand Database Utilities Sat 14-Jan-2023 12:13:03
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 12-Dec-2022 13:20:42
|
||||
// Code generated by Sarand Database Utilities Sat 14-Jan-2023 12:13:03
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -29,6 +29,7 @@ namespace Saxonite.Base.App
|
||||
UserReport_Id,
|
||||
UserReport_UserAccountId,
|
||||
UserReport_ReportType,
|
||||
UserReport_Title,
|
||||
UserReport_Report,
|
||||
UserReport_RecordedOn,
|
||||
UserReport_ReportData,
|
||||
@@ -60,7 +61,7 @@ namespace Saxonite.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 2;
|
||||
private static readonly int columnCount = 29;
|
||||
private static readonly int columnCount = 30;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -237,6 +238,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(1,"Id",5,-5,true,19),
|
||||
new ColumnDfn(1,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(1,"ReportType",3,5,false,5),
|
||||
new ColumnDfn(1,"Title",0,-9,false,1000),
|
||||
new ColumnDfn(1,"Report",0,-9,false,4000),
|
||||
new ColumnDfn(1,"RecordedOn",9,93,false,16),
|
||||
new ColumnDfn(1,"ReportData",0,-9,false,0),
|
||||
|
||||
@@ -10,6 +10,7 @@ using Saxonite.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Support;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
@@ -29,6 +30,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public SaxAccountMgr accountMgr = null;
|
||||
public SaxActivityMgr activityMgr = null;
|
||||
public SaxItemDataMgr itemDataMgr = null;
|
||||
public SaxSupportMgr supportMgr = null;
|
||||
}
|
||||
private readonly Managers mgr = new Managers();
|
||||
private class Consoles
|
||||
@@ -70,6 +72,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
if (mgr.accountMgr != null) mgr.accountMgr.Dispose(); mgr.accountMgr = null;
|
||||
if (mgr.activityMgr != null) mgr.activityMgr.Dispose(); mgr.activityMgr = null;
|
||||
if (mgr.itemDataMgr != null) mgr.itemDataMgr.Dispose(); mgr.itemDataMgr = null;
|
||||
if (mgr.supportMgr != null) mgr.supportMgr.Dispose(); mgr.supportMgr = null;
|
||||
if (con.activityConsole != null) con.activityConsole.Dispose(); con.activityConsole = null;
|
||||
}
|
||||
}
|
||||
@@ -88,6 +91,12 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// System codes.
|
||||
private readonly Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypes = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>();
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||
{
|
||||
if (!codeTypes.ContainsKey(codeType))
|
||||
codeTypes.Add(codeType, SaxSystem.GetCodesOfType(codeType));
|
||||
return new List<TypeCodeDesc>(codeTypes[codeType]);
|
||||
}
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } }
|
||||
public List<TypeCodeDesc> YesNoCodes { get { return GetCodesOfType(Sax.CodeType.YesNo); } }
|
||||
public List<TypeCodeDesc> GenderCodes { get { return GetCodesOfType(Sax.CodeType.Gender); } }
|
||||
@@ -108,12 +117,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public List<TypeCodeDesc> EventTypeCodes { get { return GetCodesOfType(Sax.CodeType.EventType); } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return GetCodesOfType(Sax.CodeType.ActivityReaction); } }
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||
{
|
||||
if (!codeTypes.ContainsKey(codeType))
|
||||
codeTypes.Add(codeType, SaxSystem.GetCodesOfType(codeType));
|
||||
return new List<TypeCodeDesc>(codeTypes[codeType]);
|
||||
}
|
||||
// Support.
|
||||
public List<TypeCodeDesc> UserReportTypeCodes { get { return GetCodesOfType(Sax.CodeType.UserReportType); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Consoles.
|
||||
@@ -161,6 +166,15 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return mgr.itemDataMgr;
|
||||
}
|
||||
}
|
||||
public SaxSupportMgr SupportMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.supportMgr == null)
|
||||
mgr.supportMgr = System.CreateSupportMgr(SessionContext, this);
|
||||
return mgr.supportMgr;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Regions.
|
||||
|
||||
@@ -149,6 +149,12 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private readonly List<RoleData> roles = new List<RoleData>();
|
||||
public List<RoleData> Roles { get { return new List<RoleData>(roles); } protected set { roles.Clear(); roles.AddRange(value); } }
|
||||
[JsonIgnore]
|
||||
public bool IsSystemAdmin { get { return roles?.Exists(item => item.Role == Sax.UserRole.SystemAdmin) ?? false; } }
|
||||
[JsonIgnore]
|
||||
public bool IsSystemReviewer { get { return roles?.Exists(item => item.Role == Sax.UserRole.SystemReviewer) ?? false; } }
|
||||
[JsonIgnore]
|
||||
public bool SupportMenuAllowed { get { return roles?.Exists(item => item.Role == Sax.UserRole.SystemAdmin || item.Role == Sax.UserRole.SystemReviewer) ?? false; } }
|
||||
[JsonIgnore]
|
||||
public bool IsJournalist { get { return roles?.Exists(item => item.Role == Sax.UserRole.Journalist) ?? false; } }
|
||||
}
|
||||
protected abstract UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles);
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private static readonly List<TypeCodeDesc> eventTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> activityReactionCodes = new List<TypeCodeDesc>();
|
||||
// Support.
|
||||
private static readonly List<TypeCodeDesc> userReportTypeCodes = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o d e T y p e s
|
||||
@@ -89,6 +91,10 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
case Sax.CodeType.ActivityReaction:
|
||||
return new List<TypeCodeDesc>(activityReactionCodes);
|
||||
|
||||
// Support.
|
||||
case Sax.CodeType.UserReportType:
|
||||
return new List<TypeCodeDesc>(userReportTypeCodes);
|
||||
|
||||
default:
|
||||
throw new NotSupportedException(nameof(SaxSystem) + ".GetCodesOfType Unexpected code type: " + codeType.ToString());
|
||||
}
|
||||
@@ -289,6 +295,14 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.VeryGood, "VeryGood", "Very Good");
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.Exceptional, "Exceptional", "Exceptional");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Support.
|
||||
|
||||
// User Report Types.
|
||||
userReportTypeCodes.Add(Sax.UserReportType.Enhancement, "Enhancement", "Enhancement request");
|
||||
userReportTypeCodes.Add(Sax.UserReportType.Information, "Information", "Information request");
|
||||
userReportTypeCodes.Add(Sax.UserReportType.Bug, "Bug", "Bug report");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Support;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
@@ -27,6 +28,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public abstract SaxAccountMgr CreateAccountMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxItemDataMgr CreateItemDataMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxActivityMgr CreateActivityMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxSupportMgr CreateSupportMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
Organisation_Sport_Name,
|
||||
Organisation_Member_Count,
|
||||
Organisation_Opportunity_Count,
|
||||
Organisation_LogoImage_Count,
|
||||
// Properties.
|
||||
AdminComment,
|
||||
// Associated data.
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using static Sarand.Net.Standard.Base.Bus.SacsHierarchyItem;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus.Support
|
||||
{
|
||||
//=======================================================================
|
||||
// UserReport.
|
||||
//=======================================================================
|
||||
public abstract class SaxUserReport : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
UserAccountId,
|
||||
ReportType,
|
||||
ReportType_Desc,
|
||||
Title,
|
||||
Report,
|
||||
RecordedOn,
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId UserAccountId { get; set; }
|
||||
public Sax.UserReportType ReportType { get; set; }
|
||||
public String Title { get; set; } = String.Empty;
|
||||
public String Report { get; set; } = String.Empty;
|
||||
public DateTime RecordedOn { get; set; }
|
||||
public String ReportData { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
|
||||
}
|
||||
public Sax.UserReportType ReportType
|
||||
{
|
||||
get { return data.ReportType; }
|
||||
set { CheckChanged((short)data.ReportType, (short)value); data.ReportType = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { CheckChanged(data.Title, value); data.Title = value; }
|
||||
}
|
||||
public String Report
|
||||
{
|
||||
get { return data.Report; }
|
||||
set { CheckChanged(data.Report, value); data.Report = value; }
|
||||
}
|
||||
public DateTime RecordedOn
|
||||
{
|
||||
get { return data.RecordedOn; }
|
||||
set { CheckChanged(data.RecordedOn, value); data.RecordedOn = value; }
|
||||
}
|
||||
public String ReportData
|
||||
{
|
||||
get { return data.ReportData; }
|
||||
set { CheckChanged(data.ReportData, value); data.ReportData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
ReportType = data.ReportType;
|
||||
Title = data.Title;
|
||||
Report = data.Report;
|
||||
RecordedOn = data.RecordedOn;
|
||||
ReportData = data.ReportData;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Error field - identify properties with validation error.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ReportType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Title { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Report { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RecordedOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ReportData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserReport(SysId id, SysId userAccountId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.UserAccountId = userAccountId;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Preparation,
|
||||
SaStatus.InProgress,
|
||||
SaStatus.Cancelled,
|
||||
SaStatus.Closed,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Preparation; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
if (status == SaStatus.Preparation) return DataValue.TriStateType.Yellow;
|
||||
if (status == SaStatus.InProgress) return DataValue.TriStateType.Green;
|
||||
if (status == SaStatus.Completed) return DataValue.TriStateType.Blue;
|
||||
if (status == SaStatus.Cancelled) return DataValue.TriStateType.Red;
|
||||
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public ItemId GetItemId()
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.UserReport, Id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
||||
throw new NotSupportedException(fn + " UserAccountId cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
protected set { data.UserAccountId = value; }
|
||||
}
|
||||
public Sax.UserReportType ReportType
|
||||
{
|
||||
get { return data.ReportType; }
|
||||
set { data.ReportType = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { data.Title = value; }
|
||||
}
|
||||
public String Report
|
||||
{
|
||||
get { return data.Report; }
|
||||
set { data.Report = value; }
|
||||
}
|
||||
public DateTime RecordedOn
|
||||
{
|
||||
get { return data.RecordedOn; }
|
||||
set { data.RecordedOn = value; }
|
||||
}
|
||||
public String ReportData
|
||||
{
|
||||
get { return data.ReportData; }
|
||||
set { data.ReportData = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
Preparation,
|
||||
Open,
|
||||
Completed,
|
||||
Cancelled,
|
||||
Closed,
|
||||
NotDeleted,
|
||||
Deleted,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
/// </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<Sax.UserReportType> ReportTypesIncluded { get; } = new List<Sax.UserReportType>();
|
||||
/// <summary>Generic filter - caption, report, or other matching value (tbd).</summary>
|
||||
public String UserReportFilter { get; set; }
|
||||
public String TitlePartial { get; set; }
|
||||
public String ReportPartial { get; set; }
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Open;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxUserReportList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static SaxUserReport GetUserReportById(this IEnumerable<SaxUserReport> values, SysId userReportId)
|
||||
{
|
||||
if (!SysId.IsValid(userReportId)) return null;
|
||||
foreach (SaxUserReport userReport in values)
|
||||
if (userReport.Id.Equals(userReportId)) return userReport;
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
// Data members.
|
||||
private class DataMembers
|
||||
{
|
||||
public SaxInternals internals;
|
||||
public SaxInternals internals = null;
|
||||
public bool internalsCreatedHere = false;
|
||||
}
|
||||
private DataMembers data = new DataMembers();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Consoles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr.Support
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxItemMgr_Support : SaxItemMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected SaxItemMgr_Support(SaxSessionContext sessionContext, SaxInternals internals) :
|
||||
base (sessionContext, internals)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISacsDatabase SupportDatabase { get { return SaxGlobals.App.GetDatabase(SessionContext, Sax.Database.Support); } }
|
||||
public IDatabaseInfo SupportDbInfo() { return SaxGlobals.App.CreateDbInfo(SessionContext, Sax.Database.Support); }
|
||||
// Support.
|
||||
public List<TypeCodeDesc> UserReportTypeCodes { get { return Internals.UserReportTypeCodes; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Bus.Support;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr.Support
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxSupportMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Support Mgr - User Report
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxUserReport CreateUserReport(SysId userAccountId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UserReportExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxUserReport.Params prmUserReport = new SaxUserReport.Params();
|
||||
prmUserReport.IdsIncluded.Add(id);
|
||||
prmUserReport.StatusCat = SaxUserReport.StatusCat.Any;
|
||||
return GetUserReportCount(prmUserReport) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxUserReport GetUserReport(SaxUserReport.Params prmUserReport);
|
||||
public SaxUserReport GetUserReportById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxUserReport.Params prmUserReport = new SaxUserReport.Params();
|
||||
prmUserReport.IdsIncluded.Add(id);
|
||||
prmUserReport.StatusCat = SaxUserReport.StatusCat.Any;
|
||||
return GetUserReport(prmUserReport);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUserReport(SaxUserReport userReport)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userReport == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserReportData(userReport.GetData(), new SaxUserReport.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserReportData(SaxUserReport.Data data, SaxUserReport.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
// User Account.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UserAccountId))
|
||||
{
|
||||
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User Account Id must be specified");
|
||||
}
|
||||
// Report Type.
|
||||
if (errField.ReportType != SacsHierarchyItem.ValidValue.Ignore && (int)data.ReportType < 1)
|
||||
{
|
||||
errField.ReportType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Report type must be specified");
|
||||
}
|
||||
// Title.
|
||||
if (errField.Title != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Title, "title", (long)SaxDbDfn_Support.GetColTextLen(SaxDbDfn_Support.ColumnIdx.UserReport_Title), true))
|
||||
{
|
||||
errField.Title = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Report.
|
||||
if (errField.Report != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Report, "report", (long)SaxDbDfn_Support.GetColTextLen(SaxDbDfn_Support.ColumnIdx.UserReport_Report)))
|
||||
{
|
||||
errField.Report = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Recorded On.
|
||||
if (errField.RecordedOn != SacsHierarchyItem.ValidValue.Ignore && !DateUtil.IsValid(data.RecordedOn))
|
||||
{
|
||||
errField.RecordedOn = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Recorded on date must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Support.GetColTextLen(SaxDbDfn_Support.ColumnIdx.UserReport_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Support.GetColTextLen(SaxDbDfn_Support.ColumnIdx.UserReport_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxUserReport.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUserReport(SaxUserReport userReport, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserReport(SaxUserReport userReport, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserReportCanBeDeleted(SaxUserReport userReport)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserReport(SaxUserReport userReport, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUserReportColumnDfn(SaxUserReport.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserReportQueryFilter(SaxUserReport.Params prmUserReport);
|
||||
public abstract long GetUserReportCount(SaxUserReport.Params prmUserReport);
|
||||
public abstract List<SaxUserReport> GetUserReportList(SaxUserReport.Params prmUserReport);
|
||||
public abstract DbResultSet ExecuteUserReportQuery(List<ColumnDfn> columns, SaxUserReport.Params prmUserReport);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public virtual DataValue GetUserReportDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxUserReport.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Report Type.
|
||||
case SaxUserReport.Column.ReportType_Desc:
|
||||
{
|
||||
Sax.UserReportType userReportType = (Sax.UserReportType)values.GetValue(column.DataName).AsLong();
|
||||
value = new DataValue(UserReportTypeCodes.GetDescForType(userReportType));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxUserReport.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxUserReport.Column.Status_Desc:
|
||||
case SaxUserReport.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxUserReport.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxUserReport.Column.Status_Ind)
|
||||
value = new DataValue(SaxUserReport.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr.Support
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SaxSupportMgr : SaxItemMgr_Support
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
protected SaxSupportMgr(SaxSessionContext sessionContext, SaxInternals internals) :
|
||||
base(sessionContext, internals)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user