using EInk.Dtos; namespace EInk.Dtos { public class ColourCastDto { public string slidesNumber { get; set; } public string createTime { get; set; } public string topic { get; set; } public string pattern { get; set; } public string result { get; set; } public List values { get; set; } = new List(); public int alarmLocation { get; set; } public int threshold { get; set; } public void Valid() { if (String.IsNullOrEmpty(slidesNumber.Trim())) { throw new Exception("Empty slidesNumber"); } try { DateTime valid = Convert.ToDateTime(createTime); } catch { throw new Exception("Incorrect createTime"); } if (String.IsNullOrEmpty(topic.Trim())) { throw new Exception("Empty topic"); } if (String.IsNullOrEmpty(pattern.Trim())) { throw new Exception("Empty pattern"); } if (result != "en" && result != "ok") { throw new Exception("Incorrect result"); } try { int valid = Convert.ToInt32(alarmLocation); } catch { throw new Exception("Incorrect alarmLocation"); } try { int valid = Convert.ToInt32(threshold); } catch { throw new Exception("Incorrect threshold"); } } } }