79 lines
2.8 KiB
C#
79 lines
2.8 KiB
C#
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.Core.Web.Base.Controllers;
|
|
using Saxonite.Net.Core.Web.Base.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using static Saxonite.Net.Standard.Base.App.Sax.Config;
|
|
|
|
namespace Saxonite.Net.Core.Web.Online.Models
|
|
{
|
|
//=======================================================================
|
|
public class Model_Support : SaxModel_Online
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public Model_Support(SaxLocaliser localiser) :
|
|
base(localiser)
|
|
{
|
|
AdditionalFiles_CSS.Add("css/sax-appl.css");
|
|
AdditionalFiles_JS.Add("js/sax-appl.js");
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// User Report proerties.
|
|
public class UserReportData
|
|
{
|
|
public String Id { get; set; }
|
|
public String Exists { get; set; }
|
|
public String UserAccountId { get; set; }
|
|
public String ReportType { get; set; }
|
|
public String Title { get; set; }
|
|
public String Report { get; set; }
|
|
// Filter.
|
|
public class UserReportFilterData
|
|
{
|
|
public String User { get; set; }
|
|
public String Report { get; set; }
|
|
}
|
|
public UserReportFilterData Filter { get; } = new UserReportFilterData();
|
|
}
|
|
public UserReportData UserReport { get; } = new UserReportData();
|
|
public Standard.Base.App.Sax.UserReportType GetReportType() { return (Standard.Base.App.Sax.UserReportType)(UserReportTypeCodes.GetTypeForCode(UserReport.ReportType)); }
|
|
|
|
//-------------------------------------------------------------------
|
|
// Validate User Report data.
|
|
public bool ValidateUserReportData(SaxController_Base.AjaxResponse_Data responseData)
|
|
{
|
|
|
|
// Report Type.
|
|
String controlName = "UserReportType";
|
|
if (UserReport.ReportType != null)
|
|
{
|
|
if (StringUtil.IsEmpty(UserReport.ReportType))
|
|
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.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)]);
|
|
}
|
|
|
|
return !responseData.HasControlErrors();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|