/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(ChargingProfileId.GetHashCode() * 31 ^ StackLevel.GetHashCode() * 29 ^ ChargingProfilePurpose.GetHashCode() * 23 ^ ChargingProfileKind.GetHashCode() * 19 ^ ChargingSchedule.GetHashCode() * 17 ^ (TransactionId != null ? TransactionId.GetHashCode() * 13 : 0) ^ (RecurrencyKind.HasValue ? RecurrencyKind.GetHashCode() * 11 : 0) ^ (ValidFrom.HasValue ? ValidFrom.GetHashCode() * 7 : 0) ^ (ValidTo.HasValue ? ValidTo.GetHashCode() * 5 : 0)); } }
public bool IsPeriodBetween(Period period, byte monthFrom, byte monthUpto) { Period periodFrom = new Period(ValidFrom.YearUInt(), monthFrom); Period periodUpto = new Period(ValidFrom.YearUInt(), monthUpto); return(period >= periodFrom && period <= periodUpto); }
public override void AfterConstruction() { TableId = TableBase.GetTable(Session, TableBase.TableEnum.CurrencyPairExchangeRate); base.AfterConstruction(); ValidFrom = DateTime.Today.Date; ValidTo = ValidFrom.AddMonths(1); }
public override int GetHashCode() { int hash = 1; if (Path.Length != 0) { hash ^= Path.GetHashCode(); } if (SerialNumber.Length != 0) { hash ^= SerialNumber.GetHashCode(); } hash ^= subjectAltNames_.GetHashCode(); if (DaysUntilExpiration != 0UL) { hash ^= DaysUntilExpiration.GetHashCode(); } if (validFrom_ != null) { hash ^= ValidFrom.GetHashCode(); } if (expirationTime_ != null) { hash ^= ExpirationTime.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
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()); }
public Token( long userId, string username, string password, TimeSpan expiration) : this() { UserId = userId; Value = $"{username}-{password}-{Guid.NewGuid()}"; ValidFrom = DateTime.UtcNow; ValidTo = ValidFrom.Add(expiration); }
public override int GetHashCode() { unchecked { var hashCode = Identifier != null?Identifier.GetHashCode() : 0; hashCode = (hashCode * 397) ^ ValidFrom.GetHashCode(); hashCode = (hashCode * 397) ^ ValidTo.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int hash = 37; hash += 7 * SourceUniqueCode.GetHashCode(); hash += 7 * TargetUniqueCode.GetHashCode(); hash += 7 * ValidFrom.GetHashCode(); hash += 7 * Rate.GetHashCode(); hash += 7 * UserKey.GetHashCode(); return(hash); }
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> /// Returns true if Cert instances are equal /// </summary> /// <param name="other">Instance of Cert to be compared</param> /// <returns>Boolean</returns> public bool Equals(Cert other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( Certificates == other.Certificates || Certificates != null && Certificates.SequenceEqual(other.Certificates) ) && ( IssuerDN == other.IssuerDN || IssuerDN != null && IssuerDN.Equals(other.IssuerDN) ) && ( SerialNumber == other.SerialNumber || SerialNumber != null && SerialNumber.Equals(other.SerialNumber) ) && ( SubjectDN == other.SubjectDN || SubjectDN != null && SubjectDN.Equals(other.SubjectDN) ) && ( ValidFrom == other.ValidFrom || ValidFrom != null && ValidFrom.Equals(other.ValidFrom) ) && ( ValidTo == other.ValidTo || ValidTo != null && ValidTo.Equals(other.ValidTo) )); }
public virtual bool Equals(ConfigurationBuilt other, bool strict) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(strict ? Equals(Identifier, other.Identifier) && ValidFrom.Equals(other.ValidFrom) && ValidTo.Equals(other.ValidTo) : Equals(Identifier, other.Identifier)); }
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); } }
/// <summary> /// Converts to a <see cref="IPriceValue"/> instance. /// </summary> /// <returns>The converted object.</returns> public IPriceValue ToPriceValue() { return (new PriceValue { CustomerPricing = (CustomerPricing != null) ? new CustomerPricing(CustomerPricing.PriceTypeId, CustomerPricing.PriceCode) : null, MarketId = MarketId, MinQuantity = MinQuantity, UnitPrice = UnitPrice, ValidFrom = ValidFrom.ToUniversalTime(), // IPriceValue accepts time in UTC only ValidUntil = ValidUntil.HasValue ? ValidUntil.Value.ToUniversalTime() : ValidUntil // IPriceValue accepts time in UTC only }); }
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 Certificate(string name, string email, string comment, string passphrase) { Name = name; Email = email; Comment = comment; salt = RandomPassphrase(8); hashedPassphrase = SHA256Salted.GenerateSaltedHash(Encoding.ASCII.GetBytes(passphrase), salt); ValidFrom = DateTime.Today; ValidUntil = ValidFrom.AddYears(2); using (RSACryptoServiceProvider cryptoServiceProvider = new RSACryptoServiceProvider(2048)) { rsaPublicKeyInfo = cryptoServiceProvider.ExportParameters(false); rsaPrivateKeyInfo = cryptoServiceProvider.ExportParameters(true); } // https://stackoverflow.com/a/42026123/5589417 ID = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", ""); }
public override int GetHashCode() { int hash = 1; if (PublicKey.Length != 0) { hash ^= PublicKey.GetHashCode(); } if (PublicKeyType != 0) { hash ^= PublicKeyType.GetHashCode(); } if (EntityType != 0) { hash ^= EntityType.GetHashCode(); } if (EntityHash.Length != 0) { hash ^= EntityHash.GetHashCode(); } if (EntityHashSignature.Length != 0) { hash ^= EntityHashSignature.GetHashCode(); } if (ValidFrom != 0) { hash ^= ValidFrom.GetHashCode(); } if (ValidTo != 0) { hash ^= ValidTo.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <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 (Status != null) { hashCode = hashCode * 59 + Status.GetHashCode(); } if (Certificates != null) { hashCode = hashCode * 59 + Certificates.GetHashCode(); } if (IssuerDN != null) { hashCode = hashCode * 59 + IssuerDN.GetHashCode(); } if (SerialNumber != null) { hashCode = hashCode * 59 + SerialNumber.GetHashCode(); } if (SubjectDN != null) { hashCode = hashCode * 59 + SubjectDN.GetHashCode(); } if (ValidFrom != null) { hashCode = hashCode * 59 + ValidFrom.GetHashCode(); } if (ValidTo != null) { hashCode = hashCode * 59 + ValidTo.GetHashCode(); } return(hashCode); } }
public void MergeFrom(CertificateDetails other) { if (other == null) { return; } if (other.Path.Length != 0) { Path = other.Path; } if (other.SerialNumber.Length != 0) { SerialNumber = other.SerialNumber; } subjectAltNames_.Add(other.subjectAltNames_); if (other.DaysUntilExpiration != 0UL) { DaysUntilExpiration = other.DaysUntilExpiration; } if (other.validFrom_ != null) { if (validFrom_ == null) { ValidFrom = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } ValidFrom.MergeFrom(other.ValidFrom); } if (other.expirationTime_ != null) { if (expirationTime_ == null) { ExpirationTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } ExpirationTime.MergeFrom(other.ExpirationTime); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(Identification != null ? Identification.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(Location != null ? Location.ToStepValue() : "$"); parameters.Add(Purpose != null ? Purpose.ToStepValue() : "$"); parameters.Add(IntendedUse != null ? IntendedUse.ToStepValue() : "$"); parameters.Add(Scope != null ? Scope.ToStepValue() : "$"); parameters.Add(Revision != null ? Revision.ToStepValue() : "$"); parameters.Add(DocumentOwner != null ? DocumentOwner.ToStepValue() : "$"); parameters.Add(Editors != null ? Editors.ToStepValue() : "$"); parameters.Add(CreationTime != null ? CreationTime.ToStepValue() : "$"); parameters.Add(LastRevisionTime != null ? LastRevisionTime.ToStepValue() : "$"); parameters.Add(ElectronicFormat != null ? ElectronicFormat.ToStepValue() : "$"); parameters.Add(ValidFrom != null ? ValidFrom.ToStepValue() : "$"); parameters.Add(ValidUntil != null ? ValidUntil.ToStepValue() : "$"); parameters.Add(Confidentiality.ToStepValue()); parameters.Add(Status.ToStepValue()); return(string.Join(", ", parameters.ToArray())); }
public string ClassName() { StringBuilder classNameBuilder = new StringBuilder(ValidFrom.YearToString()); return(classNameBuilder.ToString()); }
private void btnAddLicence_Click(object sender, RoutedEventArgs e) { #region Validation if (CurrentEmployeeLicenceForm.Licence?.Description == null) { MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Obavezno_poljeDvotačka_Licence")); return; } #endregion Thread th = new Thread(() => { SubmitButtonEnabled = false; CurrentEmployeeLicenceForm.Employee = CurrentEmployee; CurrentEmployeeLicenceForm.Company = new CompanyViewModel() { Id = MainWindow.CurrentCompanyId }; CurrentEmployeeLicenceForm.CreatedBy = new UserViewModel() { Id = MainWindow.CurrentUserId }; new EmployeeLicenceItemSQLiteRepository().Delete(CurrentEmployeeLicenceForm.Identifier); var response = new EmployeeLicenceItemSQLiteRepository().Create(CurrentEmployeeLicenceForm); if (!response.Success) { MainWindow.ErrorMessage = response.Message; CurrentEmployeeLicenceForm = new EmployeeLicenceItemViewModel(); CurrentEmployeeLicenceForm.Identifier = Guid.NewGuid(); CurrentEmployeeLicenceForm.ItemStatus = ItemStatus.Added; CurrentEmployeeLicenceForm.IsSynced = false; return; } CurrentEmployeeLicenceForm = new EmployeeLicenceItemViewModel(); CurrentEmployeeLicenceForm.Identifier = Guid.NewGuid(); CurrentEmployeeLicenceForm.ItemStatus = ItemStatus.Added; CurrentEmployeeLicenceForm.IsSynced = false; EmployeeCreatedUpdated(); DisplayEmployeeLicenceData(); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { ValidFrom.Focus(); }) ); SubmitButtonEnabled = true; }); th.IsBackground = true; th.Start(); }