v1.2.10.5

This commit is contained in:
2023-02-07 20:05:38 +00:00
parent aa2f350a35
commit ca29099508
19 changed files with 1004 additions and 14 deletions
@@ -0,0 +1,95 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers;
using Saxonite.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.Bus.Support;
using System;
namespace Saxonite.Net.Core.Web.Admin.Models.Support
{
//=======================================================================
public class Model_UserReport : SaxModel_Admin_Support
{
//-------------------------------------------------------------------
// Construction.
public Model_UserReport(SaxLocaliser localiser) :
base(localiser)
{
}
//-------------------------------------------------------------------
// User Report list configuration.
public class FilterData
{
public String Report { get; set; }
}
public FilterData Filter { get; } = new FilterData();
//-------------------------------------------------------------------
// Sport properties.
public class UserReportData
{
public String Id { get; set; }
public String Exists { get; set; }
public String ReportType { get; set; }
public String Title { get; set; }
public String Report { get; set; }
public String Status { get; set; }
}
public UserReportData UserReport { get; } = new UserReportData();
public Sax.UserReportType UserReportType{ get { return (Sax.UserReportType)UserReportTypeCodes.GetTypeForCode(UserReport.ReportType); } }
public SaStatus UserReportStatus { get { return SacsSystem.GetStatusForCode(UserReport.Status); } }
//-------------------------------------------------------------------
// Validation.
//-------------------------------------------------------------------
// User Report.
public bool ValidateUserReportData(SaxController_Base.AjaxResponse_Data responseData)
{
// Record disposable items as they are created so all can be disposed when needed.
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
{
// Report Type.
String controlName = "UserReportType";
if (UserReport.ReportType != null)
{
if (StringUtil.IsEmpty(UserReport.ReportType))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (UserReportType <= 0)
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
// Report Title.
controlName = "UserReportTitle";
if (UserReport.Title != null)
{
responseData.SetControlValue(controlName, UserReport.Title);
if (StringUtil.IsEmpty(UserReport.Title))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (StringUtil.GetLength(UserReport.Title) > GetControlMaxLength(SaxDbDfn_Support.ColumnIdx.UserReport_Title))
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Support.ColumnIdx.UserReport_Title)]);
}
// Status.
controlName = "UserReportStatus";
if (UserReport.Status != null)
{
if (StringUtil.IsEmpty(UserReport.Status))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (!SaxUserReport.ValidStatuses.Contains(UserReportStatus))
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
}
return !responseData.HasControlErrors();
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,21 @@
using Saxonite.Net.Core.Web.Base.App;
namespace Saxonite.Net.Core.Web.Admin.Models.Support
{
//=======================================================================
public class SaxModel_Admin_Support : SaxModel_Admin
{
//-------------------------------------------------------------------
// Protected construction.
protected SaxModel_Admin_Support(SaxLocaliser localiser) :
base(localiser)
{
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
}
//=======================================================================
}