using DaJiaoYan.Utils; using Newtonsoft.Json; using System.Collections.Generic; using static DaJiaoYan.Models.UploadHandlerPostParam; namespace DaJiaoYan.Models { public class ScanResultPost { public class ImageInfo { [JsonProperty(PropertyName = "has_error")] public int HasError { get; set; } [JsonProperty(PropertyName = "image")] public string Image { get; set; } [JsonProperty(PropertyName = "index")] public int Index { get; set; } } [JsonProperty(PropertyName = "test_id")] public int TestId { get; set; } [JsonProperty(PropertyName = "school_id")] public int SchoolId { get; set; } [JsonProperty(PropertyName = "campus_id")] public int CampusId { get; set; } [JsonProperty(PropertyName = "class_id")] public int ClassId { get; set; } [JsonProperty(PropertyName = "batch_id")] public string BatchId { get; set; } [JsonProperty(PropertyName = "file_path")] public string FilePath { get; set; } [JsonProperty(PropertyName = "images")] public List Images { get; set; } [JsonProperty(PropertyName = "finish")] public bool Finish { get; set; } [JsonProperty(PropertyName = "is_school_no")] public int IsSchoolNo { get; set; } [JsonProperty(PropertyName = "sign_weight")] public int SignWeight { get; set; } [JsonProperty(PropertyName = "total")] public int Total { get; set; } [JsonProperty(PropertyName = "marking_type")] public MarkType MarkingType { get; set; } [JsonProperty(PropertyName = "ver")] public int Ver { get; set; } public ScanResultPost(int testId, int schoolId, int campusId, int classId, int isSchoolNo, int signWeight, string directory, MarkType markType, string batchId = null, bool finish = false, int ver = 1) { Init(testId, schoolId, campusId, classId, isSchoolNo, signWeight, directory, markType, batchId, finish, ver); } public ScanResultPost(UploadHandlerPostParam p, string batchId = null, bool finish = false) { Init(p.TestId, p.SchoolId, p.CampusId, p.ClassId, p.IsSchoolNo, p.SignWeight, p.Directory, p.MarkingType, batchId, finish, p.Ver); } private void Init(int testId, int schoolId, int campusId, int classId, int isSchoolNo, int signWeight, string directory, MarkType markingType, string batchId = null, bool finish = false, int ver = 1) { Images = new List(); BatchId = string.IsNullOrEmpty(batchId) ? Functions.GenUUID() : batchId; TestId = testId; SchoolId = schoolId; CampusId = campusId; ClassId = classId; IsSchoolNo = isSchoolNo; SignWeight = signWeight; MarkingType = markingType; Finish = finish; FilePath = directory; Ver = ver; } } }