public string GetStringForSave() { if (ExpiresDate <= DateTimeUtil.Now) { return(OriginalData); } return(string.Concat(string.Format(FlagStartChar, ExpiresDate.ToString("yyyyMMddHHmm")) , PropData , FlagEndChar, OriginalData)); }
public override bool Equals(object obj) { var alert = obj as WeatherAlert; return(alert != null && Type == alert.Type && Severity == alert.Severity && Title == alert.Title && Message == alert.Message && Attribution == alert.Attribution && Date.Equals(alert.Date) && ExpiresDate.Equals(alert.ExpiresDate)); }
public string ToJson() { using (var sw = new System.IO.StringWriter()) using (var writer = new JsonTextWriter(sw)) { // { writer.WriteStartObject(); // "Type" : "" writer.WritePropertyName(nameof(Type)); writer.WriteValue((int)Type); // "Title" : "" writer.WritePropertyName(nameof(Title)); writer.WriteValue(Title); // "Message" : "" writer.WritePropertyName(nameof(Message)); writer.WriteValue(Message); // "Attribution" : "" writer.WritePropertyName(nameof(Attribution)); writer.WriteValue(Attribution); // "Date" : "" writer.WritePropertyName(nameof(Date)); writer.WriteValue(Date.ToString("dd.MM.yyyy HH:mm:ss zzzz")); // "ExpiresDate" : "" writer.WritePropertyName(nameof(ExpiresDate)); writer.WriteValue(ExpiresDate.ToString("dd.MM.yyyy HH:mm:ss zzzz")); // "Notified" : "" writer.WritePropertyName(nameof(Notified)); writer.WriteValue(Notified); // } writer.WriteEndObject(); return(sw.ToString()); } }