1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using EInk.Dtos;
- namespace EInk.Dtos
- {
- public class ColourCastDto
- {
- public string id { get; set; }
- 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<int> values { get; set; } = new List<int>();
- public int alarmLocation { get; set; }
- public int threshold { get; set; }
- 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(createTime) || String.IsNullOrEmpty(createTime.Trim()))
- {
- throw new Exception("Empty createTime");
- }
- try
- {
- DateTime valid = Convert.ToDateTime(createTime);
- }
- catch
- {
- throw new Exception("Incorrect createTime");
- }
- if (String.IsNullOrEmpty(topic) || String.IsNullOrEmpty(topic.Trim()))
- {
- throw new Exception("Empty topic");
- }
- if (String.IsNullOrEmpty(pattern) || String.IsNullOrEmpty(pattern.Trim()))
- {
- throw new Exception("Empty pattern");
- }
- if (String.IsNullOrEmpty(result) || (result != "NG" && 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");
- }
- }
- }
- }
|