protected override void SetStateByEvent(IEvent @event) { switch (@event) { case TodoCreated e: { this.Title = new Title(e.Title); this.Text = new Text(e.Text); this.ValidTo = new ValidTo(e.ValidTo); } break; case TodoHasFinished e: { this.Done = new Done(true); } break; case TextUpdated e: { this.Text = new Text(e.Text); } break; case TitleUpdated e: { this.Title = new Title(e.Title); } break; default: throw new CustomExceptionsBase("امکان اجرای عملیات درخواستی وجود ندارد"); } }
public override sealed string ToString() { StringBuilder bb = new StringBuilder(); bb.Append("Version: "); bb.AppendLine(Version.ToString()); bb.Append("SerialNumber: "); bb.AppendLine(SerialNumber.ToString()); bb.Append("Signature: "); bb.Append(SignatureAlgorithm.ToString()); bb.Append(", OID = "); bb.Append(HashAlgorithmConverter.GetString(SignatureAlgorithm)); bb.Append("\n"); bb.Append("Issuer: "); bb.Append(Issuer); bb.Append("\n"); bb.Append("Validity: [From: "); bb.Append(ValidFrom.ToUniversalTime().ToString()); bb.Append(" GMT To: "); bb.Append(ValidTo.ToUniversalTime().ToString()); bb.Append(" GMT]\n"); bb.Append("Subject: "); bb.Append(Subject); bb.Append("\n"); bb.Append("Public Key Algorithm: "); bb.Append(PublicKeyAlgorithm.ToString()); bb.Append("\n"); bb.Append("Key: "); bb.Append(PublicKey.ToHex()); bb.Append("\n"); if (PublicKey.Scheme == Ecdsa.Enums.Ecc.P256) { bb.Append("ASN1 OID: prime256v1\n"); bb.Append("NIST CURVE: P-256"); } else if (PublicKey.Scheme == Ecdsa.Enums.Ecc.P384) { bb.Append("ASN1 OID: prime384v1\n"); bb.Append("\n"); bb.Append("NIST CURVE: P-384"); } bb.Append("\n"); bb.Append("Basic constraints: "); bb.Append(BasicConstraints); bb.Append("\n"); bb.Append("SubjectKeyIdentifier: "); bb.Append(GXCommon.ToHex(SubjectKeyIdentifier, true)); bb.Append("\n"); bb.Append("KeyUsage: "); bb.Append(KeyUsage); bb.Append("\n"); bb.Append("Signature Algorithm: "); bb.Append(SignatureAlgorithm.ToString()); bb.Append("\n"); bb.Append("Signature: "); bb.Append(GXCommon.ToHex(Signature, false)); bb.Append("\n"); return(bb.ToString()); }
/// <summary> /// Returns true if Agreement instances are equal /// </summary> /// <param name="other">Instance of Agreement to be compared</param> /// <returns>Boolean</returns> public bool Equals(Agreement other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AgreementId == other.AgreementId || AgreementId != null && AgreementId.Equals(other.AgreementId) ) && ( Demand == other.Demand || Demand != null && Demand.Equals(other.Demand) ) && ( Offer == other.Offer || Offer != null && Offer.Equals(other.Offer) ) && ( ValidTo == other.ValidTo || ValidTo != null && ValidTo.Equals(other.ValidTo) ) && ( ApprovedDate == other.ApprovedDate || ApprovedDate != null && ApprovedDate.Equals(other.ApprovedDate) ) && ( State == other.State || State != null && State.Equals(other.State) ) && ( ProposedSignature == other.ProposedSignature || ProposedSignature != null && ProposedSignature.Equals(other.ProposedSignature) ) && ( ApprovedSignature == other.ApprovedSignature || ApprovedSignature != null && ApprovedSignature.Equals(other.ApprovedSignature) ) && ( CommittedSignature == other.CommittedSignature || CommittedSignature != null && CommittedSignature.Equals(other.CommittedSignature) )); }
public JsonValue ToJson(IJsonContext context) { var dict = new JsonDictionary(); dict["UserName"] = context.ToJson(UserName); dict["ValidTo"] = context.ToJson(ValidTo.ToUnixTime()); dict["ApiToken"] = context.ToJson(ApiToken); return(dict); }
private static JwtSecurityToken GetJwt() { HttpContext.Request.Cookies.TryGetValue("bearer", out var bearer); if (bearer == null) { return(null); } var jwt = new JwtSecurityTokenHandler().ReadToken(bearer) as JwtSecurityToken; return(jwt !.ValidTo.CompareTo(DateTime.UtcNow) < 0 ? null : jwt); }
public void RemoveRentItem(int position) { if (ValidTo.HasExpired()) { throw new RentHasExpiredException(); } var rentItem = _rentItems.Single(item => item.ItemPosition == position); _rentItems.Remove(rentItem); }
public string Serialize() { return(new XElement("license", new XElement("issued", Issued.ToFileTimeUtc()), new XElement("valid", ValidTo.ToFileTimeUtc()), new XElement("params", Features.Select(x => new XElement("feature", new XAttribute("name", x.Key), new XAttribute("value", x.Value))), Limits.Select(x => new XElement("limit", new XAttribute("name", x.Key), new XAttribute("value", x.Value))), CodeExecutionChain.Select(x => new XElement("execute", new XAttribute("entry", x.Key), new XCData(DataEncoder.ToString(x.Value)))), CustomValidators.Select(x => new XElement("validate", new XCData(DataEncoder.ToString(x))))) ).ToString(SaveOptions.DisableFormatting)); }
public void AddRentItem(RentItem item) { if (ValidTo.HasExpired()) { throw new RentHasExpiredException(); } if (_rentItems.Any(i => i.ItemPosition == item.ItemPosition)) { throw new RentItemAlreadyExistsOnPosition(); } }
protected bool Equals(Certificate other) { return(string.Equals(ThumbPrint, other.ThumbPrint) && string.Equals(Issuer, other.Issuer) && string.Equals(Subject, other.Subject) && ValidFrom.Equals(other.ValidFrom) && ValidTo.Equals(other.ValidTo) && string.Equals(KeyAlgoritm, other.KeyAlgoritm) && KeyLength == other.KeyLength && string.Equals(SerialNumber, other.SerialNumber) && string.Equals(Version, other.Version) && string.Equals(SubjectAlternativeName, other.SubjectAlternativeName) && string.Equals(CommonName, other.CommonName)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (AgreementId != null) { hashCode = hashCode * 59 + AgreementId.GetHashCode(); } if (Demand != null) { hashCode = hashCode * 59 + Demand.GetHashCode(); } if (Offer != null) { hashCode = hashCode * 59 + Offer.GetHashCode(); } if (ValidTo != null) { hashCode = hashCode * 59 + ValidTo.GetHashCode(); } if (ApprovedDate != null) { hashCode = hashCode * 59 + ApprovedDate.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (ProposedSignature != null) { hashCode = hashCode * 59 + ProposedSignature.GetHashCode(); } if (ApprovedSignature != null) { hashCode = hashCode * 59 + ApprovedSignature.GetHashCode(); } if (CommittedSignature != null) { hashCode = hashCode * 59 + CommittedSignature.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = (ThumbPrint != null ? ThumbPrint.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Issuer != null ? Issuer.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ValidFrom.GetHashCode(); hashCode = (hashCode * 397) ^ ValidTo.GetHashCode(); hashCode = (hashCode * 397) ^ (KeyAlgoritm != null ? KeyAlgoritm.GetHashCode() : 0); hashCode = (hashCode * 397) ^ KeyLength; hashCode = (hashCode * 397) ^ (SerialNumber != null ? SerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SubjectAlternativeName != null ? SubjectAlternativeName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CommonName != null ? CommonName.GetHashCode() : 0); return(hashCode); } }
public UpdateOrganisationInfoLimitedToVlimpers(OrganisationId organisationId, string name, Article article, string?shortName, ValidFrom validFrom, ValidTo validTo, ValidFrom operationalValidFrom, ValidTo operationalValidTo) { Id = organisationId; Name = name; Article = article; ShortName = shortName; ValidFrom = validFrom; ValidTo = validTo; OperationalValidFrom = operationalValidFrom; OperationalValidTo = operationalValidTo; }
public override sealed string ToString() { StringBuilder bb = new StringBuilder(); bb.Append("Version: "); bb.Append(Version.ToString()); bb.Append("\n"); bb.Append("Subject: "); bb.Append(Subject); bb.Append("\n"); bb.Append("Signature: "); bb.Append(SignatureAlgorithm.ToString()); bb.Append(", OID = "); bb.Append(HashAlgorithmConverter.GetString(SignatureAlgorithm)); bb.Append("\n"); bb.Append("Key: "); if (PublicKey != null) { bb.Append(PublicKey.ToString()); } bb.Append("\n"); bb.Append("Validity: [From: "); bb.Append(ValidFrom.ToString()); bb.Append(", \n"); bb.Append("To: "); bb.Append(ValidTo.ToString()); bb.Append("]\n"); bb.Append("Issuer: "); bb.Append(Issuer); bb.Append("\n"); bb.Append("SerialNumber: "); bb.Append(SerialNumber); bb.Append("\n"); bb.Append("Algorithm: "); bb.Append(PublicKeySignature.ToString()); bb.Append("\n"); bb.Append("Signature: "); bb.Append(GXCommon.ToHex(Signature, false)); bb.Append("\n"); return(bb.ToString()); }
public bool HasExpired() => ValidTo.HasExpired();
public override string ToString() { return($"ID STK: {Id}, ID vozidla: {Vehicle.Id}, platnost do: {ValidTo.ToString("d")}"); }