using EInk.Models; using Microsoft.Extensions.FileSystemGlobbing.Internal; using System.ComponentModel; using static System.Collections.Specialized.BitVector32; namespace EInk.Dtos { public class Lot3Dto { public string id { get; set; } public string slidesNumber { get; set; } public string topic { get; set; } public string createTime { get; set; } public string result { get; set; } public string isrepeatupload { get; set; } public List? itemCheckDatas { get; set; } = new List(); public void Valid() { if (String.IsNullOrEmpty(id) || String.IsNullOrEmpty(id.Trim())) { throw new Exception("Empty id"); } if (String.IsNullOrEmpty(slidesNumber) || String.IsNullOrEmpty(slidesNumber.Trim())) { throw new Exception("Empty slidesNumber"); } if (String.IsNullOrEmpty(topic) || String.IsNullOrEmpty(topic.Trim())) { throw new Exception("Empty topic"); } if (String.IsNullOrEmpty(result) || String.IsNullOrEmpty(result.Trim())) { throw new Exception("Empty result"); } if (result != "NG" && result != "OK") { throw new Exception("Incorrect result"); } if (String.IsNullOrEmpty(isrepeatupload) || String.IsNullOrEmpty(isrepeatupload.Trim())) { throw new Exception("Empty isrepeatupload"); } //0、正常数据 //1、上抛失败重抛数据 //2、不完整数据 //3、数据不完整,后补充重复上报数据 if (isrepeatupload != "0" && isrepeatupload != "1" && isrepeatupload != "2" && isrepeatupload != "3") { throw new Exception("Incorrect isrepeatupload"); } if (String.IsNullOrEmpty(createTime) || String.IsNullOrEmpty(createTime.Trim())) { throw new Exception("Empty createTime"); } try { DateTime valid = Convert.ToDateTime(createTime); } catch { throw new Exception("Incorrect createTime"); } foreach (var itemCheckData in itemCheckDatas) { itemCheckData.Valid(); } } } }