/*****************************************************************************************************************/ /// <summary>Stores the DB cookie.</summary> public void Store() { if (string.IsNullOrEmpty(Session)) { throw new Exception("Empty Session ID"); } if (string.IsNullOrEmpty(Identifier)) { throw new Exception("Empty Identifier"); } if (string.IsNullOrEmpty(Value)) { throw new Exception("Empty value"); } //delete old value if exists Delete(false); string sql = string.Format("INSERT INTO cookie (session, identifier, value, expire, creation_date) VALUES ({0},{1},{2},{3},{4});", StringUtils.EscapeSql(Session), StringUtils.EscapeSql(Identifier), StringUtils.EscapeSql(Value), Expire.Equals(DateTime.MinValue) ? StringUtils.EscapeSql(DateTime.UtcNow.AddDays(1).ToString(@"yyyy\-MM\-dd\THH\:mm\:ss")) : StringUtils.EscapeSql(Expire.ToString(@"yyyy\-MM\-dd\THH\:mm\:ss")), StringUtils.EscapeSql(DateTime.UtcNow.ToString(@"yyyy\-MM\-dd\THH\:mm\:ss")) ); Context.Execute(sql); Console.WriteLine(sql); }
/// <summary> /// Two DnsResourceDataStartOfAuthority are equal iff their main name server, responsible mailbox, serial, refresh, retry, expire /// and minimum TTL fields are equal. /// </summary> public bool Equals(DnsResourceDataStartOfAuthority other) { return(other != null && MainNameServer.Equals(other.MainNameServer) && ResponsibleMailbox.Equals(other.ResponsibleMailbox) && Serial.Equals(other.Serial) && Refresh.Equals(other.Refresh) && Retry.Equals(other.Retry) && Expire.Equals(other.Expire) && MinimumTtl.Equals(other.MinimumTtl)); }