v1.2.11.2
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
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 Sarand.Net.Standard.Proc.Excel;
|
||||
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 Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
//=======================================================================
|
||||
/// <summary>
|
||||
/// Model for Organisation Upload.
|
||||
/// </summary>
|
||||
public class Model_OrganisationUpload : SaxModel_Admin
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_OrganisationUpload(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation data files - only one allowed per request.
|
||||
public List<IFormFile> OrganisationDataFile { get; set; }
|
||||
// Data file properties.
|
||||
public String SheetNameOrNumber { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
public bool ValidateProperties(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
|
||||
// Data file.
|
||||
{
|
||||
String controlName = nameof(OrganisationDataFile);
|
||||
// A single data file must be supplied.
|
||||
if (OrganisationDataFile == null || !OrganisationDataFile.Any())
|
||||
responseData.SetControlError(controlName, Localiser["msg.error.data.file.missing"]);
|
||||
else if (OrganisationDataFile != null && OrganisationDataFile.Count() > 1)
|
||||
responseData.SetControlError(controlName, Localiser["msg.error.data.file.multiple"]);
|
||||
}
|
||||
|
||||
// Sheet name or number.
|
||||
{
|
||||
String controlName = nameof(SheetNameOrNumber);
|
||||
if (StringUtil.IsBlank(SheetNameOrNumber))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!ExcelHelper.IsValidSheetName(SheetNameOrNumber))
|
||||
responseData.SetControlError(controlName, Localiser["msg.error.sheet.name.invalid"]);
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user