using System; using Newtonsoft.Json; namespace 報到系統客戶端.Data.Models { /// /// 本地 SignUps 表資料項目 /// 對應後端 DAC_SignUp1.cs 的 SignUpItem /// public class LocalSignUpItem { [JsonProperty("ID")] public int ID { get; set; } [JsonProperty("CourseID")] public int CourseID { get; set; } [JsonProperty("SeqNo")] public int SeqNo { get; set; } [JsonProperty("Name")] public string Name { get; set; } [JsonProperty("Mobile")] public string Mobile { get; set; } [JsonProperty("QRCode")] public string QRCode { get; set; } [JsonProperty("SignUpType")] public string SignUpType { get; set; } [JsonProperty("IDNumber")] public string IDNumber { get; set; } [JsonProperty("IDType")] public string IDType { get; set; } [JsonProperty("MealType")] public string MealType { get; set; } [JsonProperty("Email")] public string Email { get; set; } [JsonProperty("LossJobTimes")] public int? LossJobTimes { get; set; } [JsonProperty("Gender")] public string Gender { get; set; } [JsonProperty("AgreementStatus")] public string AgreementStatus { get; set; } [JsonProperty("CheckInTime")] public string CheckInTime { get; set; } [JsonProperty("CheckOutTime")] public string CheckOutTime { get; set; } [JsonProperty("CreatedAt")] public DateTime CreatedAt { get; set; } [JsonProperty("UpdatedAt")] public DateTime UpdatedAt { get; set; } /// /// 轉換為後端 API 使用的模型 /// public static 報到系統客戶端.Models.SignUpItem ConvertToApiModel(LocalSignUpItem local) { if (local == null) return null; return new 報到系統客戶端.Models.SignUpItem { ID = local.ID, CourseID = local.CourseID, Name = local.Name, Mobile = local.Mobile, QRCode = local.QRCode, SignUpType = local.SignUpType, Email = local.Email, LossJobTimes = local.LossJobTimes, Gender = local.Gender, AgreementStatus = local.AgreementStatus, CheckInTime = local.CheckInTime, CheckOutTime = local.CheckOutTime }; } /// /// 從後端 API 模型轉換 /// public static LocalSignUpItem ConvertFromApiModel(報到系統客戶端.Models.SignUpItem apiModel) { if (apiModel == null) return null; return new LocalSignUpItem { ID = apiModel.ID, CourseID = apiModel.CourseID, SeqNo = apiModel.SeqNo, Name = apiModel.Name, Mobile = apiModel.Mobile, QRCode = apiModel.QRCode, SignUpType = apiModel.SignUpType, IDNumber = apiModel.IDNumber, IDType = apiModel.IDType, MealType = apiModel.MealType, Email = apiModel.Email, LossJobTimes = apiModel.LossJobTimes, Gender = apiModel.Gender, AgreementStatus = apiModel.AgreementStatus, CheckInTime = apiModel.CheckInTime, CheckOutTime = apiModel.CheckOutTime, CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now }; } } }