ScanResultPost.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using DaJiaoYan.Utils;
  2. using Newtonsoft.Json;
  3. using System.Collections.Generic;
  4. using static DaJiaoYan.Models.UploadHandlerPostParam;
  5. namespace DaJiaoYan.Models
  6. {
  7. public class ScanResultPost
  8. {
  9. public class ImageInfo
  10. {
  11. [JsonProperty(PropertyName = "has_error")]
  12. public int HasError { get; set; }
  13. [JsonProperty(PropertyName = "image")]
  14. public string Image { get; set; }
  15. [JsonProperty(PropertyName = "index")]
  16. public int Index { get; set; }
  17. }
  18. [JsonProperty(PropertyName = "test_id")]
  19. public int TestId { get; set; }
  20. [JsonProperty(PropertyName = "school_id")]
  21. public int SchoolId { get; set; }
  22. [JsonProperty(PropertyName = "campus_id")]
  23. public int CampusId { get; set; }
  24. [JsonProperty(PropertyName = "class_id")]
  25. public int ClassId { get; set; }
  26. [JsonProperty(PropertyName = "batch_id")]
  27. public string BatchId { get; set; }
  28. [JsonProperty(PropertyName = "file_path")]
  29. public string FilePath { get; set; }
  30. [JsonProperty(PropertyName = "images")]
  31. public List<ImageInfo> Images { get; set; }
  32. [JsonProperty(PropertyName = "finish")]
  33. public bool Finish { get; set; }
  34. [JsonProperty(PropertyName = "is_school_no")]
  35. public int IsSchoolNo { get; set; }
  36. [JsonProperty(PropertyName = "sign_weight")]
  37. public int SignWeight { get; set; }
  38. [JsonProperty(PropertyName = "total")]
  39. public int Total { get; set; }
  40. [JsonProperty(PropertyName = "marking_type")]
  41. public MarkType MarkingType { get; set; }
  42. [JsonProperty(PropertyName = "ver")]
  43. public int Ver { get; set; }
  44. 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)
  45. {
  46. Init(testId, schoolId, campusId, classId, isSchoolNo, signWeight, directory, markType, batchId, finish, ver);
  47. }
  48. public ScanResultPost(UploadHandlerPostParam p, string batchId = null, bool finish = false)
  49. {
  50. Init(p.TestId, p.SchoolId, p.CampusId, p.ClassId, p.IsSchoolNo, p.SignWeight, p.Directory, p.MarkingType, batchId, finish, p.Ver);
  51. }
  52. 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)
  53. {
  54. Images = new List<ImageInfo>();
  55. BatchId = string.IsNullOrEmpty(batchId) ? Functions.GenUUID() : batchId;
  56. TestId = testId;
  57. SchoolId = schoolId;
  58. CampusId = campusId;
  59. ClassId = classId;
  60. IsSchoolNo = isSchoolNo;
  61. SignWeight = signWeight;
  62. MarkingType = markingType;
  63. Finish = finish;
  64. FilePath = directory;
  65. Ver = ver;
  66. }
  67. }
  68. }