private string GenerateHash() { using (SHA256 sha256Hash = SHA256.Create()) { byte[] input = Encryption.ConcatBytes(APP_SECRET, EmailAddress, ValidUntil.ToString(), Nonce); byte[] data = sha256Hash.ComputeHash(input); return(Encryption.HashToStr(data)); } }
public static bool IsTokenStillValid(string TokenValidUntil) { DateTime ValidUntil; var parsedToken = DateTime.TryParse(TokenValidUntil, out ValidUntil); if (parsedToken && ValidUntil.Subtract(DateTime.Now).TotalDays > 0) { return(true); } else { return(false); } }
public bool Equals(AwaAuthorizationResult input) { if (input == null) { return(false); } return (( UserSelection == input.UserSelection || (UserSelection != null && UserSelection.Equals(input.UserSelection)) ) && ( ResponseReason == input.ResponseReason || (ResponseReason != null && ResponseReason.Equals(input.ResponseReason)) ) && ( DeveloperNote == input.DeveloperNote || (DeveloperNote != null && DeveloperNote.Equals(input.DeveloperNote)) ) && ( ActionToken == input.ActionToken || (ActionToken != null && ActionToken.Equals(input.ActionToken)) ) && ( MaximumNumberOfUses == input.MaximumNumberOfUses || (MaximumNumberOfUses.Equals(input.MaximumNumberOfUses)) ) && ( ValidUntil == input.ValidUntil || (ValidUntil != null && ValidUntil.Equals(input.ValidUntil)) ) && ( Type == input.Type || (Type != null && Type.Equals(input.Type)) ) && ( MembershipType == input.MembershipType || (MembershipType != null && MembershipType.Equals(input.MembershipType)) )); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.productId) { hashcode = (hashcode * 397) + ProductId.GetHashCode(); } if (__isset.packageId) { hashcode = (hashcode * 397) + PackageId.GetHashCode(); } if (__isset.version) { hashcode = (hashcode * 397) + Version.GetHashCode(); } if (__isset.onSale) { hashcode = (hashcode * 397) + OnSale.GetHashCode(); } if (__isset.validUntil) { hashcode = (hashcode * 397) + ValidUntil.GetHashCode(); } if (__isset.stickerIdRanges) { hashcode = (hashcode * 397) + TCollections.GetHashCode(StickerIdRanges); } if (__isset.grantedByDefault) { hashcode = (hashcode * 397) + GrantedByDefault.GetHashCode(); } if (__isset.displayOrder) { hashcode = (hashcode * 397) + DisplayOrder.GetHashCode(); } } return(hashcode); }
public IAuction CreateAuction(string description, DateTime endsOn, double startingPrice) { if (!this.IsValid()) { throw new InvalidOperationException(); } if (description == null) { throw new ArgumentNullException(); } if (description == string.Empty) { throw new ArgumentException(); } if (startingPrice < 0) { throw new ArgumentOutOfRangeException(); } if (endsOn < SessionSite.Now) { throw new UnavailableTimeMachineException(); } int auctionId = factoryContext.Auctions.Count <Auction>(); Auction newAuction = new Auction(auctionId, User as User, description, endsOn, startingPrice, (User as User).UserSite, factoryContext); factoryContext.Auctions.Add(newAuction); factoryContext.SaveChanges(); factoryContext.Database.Connection.Close(); ValidUntil = ValidUntil.AddSeconds(SessionSite.SessionExpirationInSeconds); SaveValidUntil(); return(newAuction); }
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 void SlideValidDate(int minutes = 60) { ValidUntil = ValidUntil.AddMinutes(minutes); Save(); }
public override string ToString() { var sb = new StringBuilder("ProductSimple("); bool __first = true; if (ProductId != null && __isset.productId) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ProductId: "); ProductId.ToString(sb); } if (__isset.packageId) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PackageId: "); PackageId.ToString(sb); } if (__isset.version) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Version: "); Version.ToString(sb); } if (__isset.onSale) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("OnSale: "); OnSale.ToString(sb); } if (__isset.validUntil) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ValidUntil: "); ValidUntil.ToString(sb); } if (StickerIdRanges != null && __isset.stickerIdRanges) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("StickerIdRanges: "); StickerIdRanges.ToString(sb); } if (__isset.grantedByDefault) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("GrantedByDefault: "); GrantedByDefault.ToString(sb); } if (__isset.displayOrder) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("DisplayOrder: "); DisplayOrder.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
public override string ToString() => $"UserName={UserName} ValidUntil={ValidUntil.ToShortDateString()}";
public int CompareTo(Salt other) { return(ValidUntil.CompareTo(other.ValidSince)); }