protected override void EstablishContext() { base.EstablishContext(); LifeTime = ExpirationTime.Add(NotificationReporter.LifeTime).AddTicks(1); TimeServiceMock.Setup(s => s.UtcTime).Returns(LifeTime); TimerServiceMock.Raise(s => s.Elapsed += null, EventArgs.Empty); }
public FileExpiration(string expiration) { switch (expiration) { case "PT1H": Expiration = ExpirationTime.OneHour; ExpirationSpan = new TimeSpan(0, 1, 0, 0); break; case "P1D": Expiration = ExpirationTime.OneDay; ExpirationSpan = new TimeSpan(1, 0, 0, 0); break; case "P5D": Expiration = ExpirationTime.FiveDays; ExpirationSpan = new TimeSpan(5, 0, 0, 0); break; case "P10D": Expiration = ExpirationTime.TenDays; ExpirationSpan = new TimeSpan(10, 0, 0, 0); break; case "P30D": Expiration = ExpirationTime.ThirtyDays; ExpirationSpan = new TimeSpan(30, 0, 0, 0); break; default: throw new ArgumentException($"Invalid Expiration of {expiration}"); } }
// // GET: /ExpirationTime/ public ActionResult Index() { List <ExpirationTimeModel> Model = new List <ExpirationTimeModel>(); DataTable dt = ExpirationTime.CreateInstance().GetProduct_ExpirationTimeList(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { Model.Add(new ExpirationTimeModel { ID = Convert.ToInt32(item["ID"]), Product_ID = Convert.ToInt32(item["Product_ID"]), Erp_ID = item["Erp_ID"].ToString(), Product_Name = Convert.ToString(item["Product_Name"] ?? string.Empty), Image = Convert.ToString(item["Image"] ?? string.Empty), ShowPrice = Convert.ToString(item["Price"]), Goods_Unit = Convert.ToString(item["Goods_Unit"] ?? string.Empty), ExpirationTime = item["ExpirationTime"] == null ? string.Empty : Convert.ToDateTime(item["ExpirationTime"]).ToString("yyyy-MM-dd") }); } } return(View(Model)); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.tokenKey) { hashcode = (hashcode * 397) + TokenKey.GetHashCode(); } if (__isset.expirationTime) { hashcode = (hashcode * 397) + ExpirationTime.GetHashCode(); } if (__isset.applicationType) { hashcode = (hashcode * 397) + ApplicationType.GetHashCode(); } if (__isset.systemName) { hashcode = (hashcode * 397) + SystemName.GetHashCode(); } if (__isset.accessLocation) { hashcode = (hashcode * 397) + AccessLocation.GetHashCode(); } } return(hashcode); }
public InvitationRevokedEvent(InvitationId invitationId, GroupId groupId, InvitationCode invitationCode, ExpirationTime expirationTime, UsageCounter usageCounter) { InvitationId = invitationId; GroupId = groupId; InvitationCode = invitationCode; ExpirationTime = expirationTime; UsageCounter = usageCounter; }
/// <summary> /// 检查缓存项是否达到过期时间。 /// </summary> /// <returns>过期为 true,有效为 false。</returns> public bool HasExpired() { return(ExpirationTime.Kind switch { DateTimeKind.Utc => DateTime.UtcNow > ExpirationTime, DateTimeKind.Unspecified => DateTime.Now > ExpirationTime.ToLocalTime(), _ => DateTime.Now > ExpirationTime });
/// <summary> /// Returns true if SimpleFixedPriceTradeInfo instances are equal /// </summary> /// <param name="other">Instance of SimpleFixedPriceTradeInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(SimpleFixedPriceTradeInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( InputAddress == other.InputAddress || InputAddress != null && InputAddress.Equals(other.InputAddress) ) && ( InputCoinType == other.InputCoinType || InputCoinType != null && InputCoinType.Equals(other.InputCoinType) ) && ( InputAmount == other.InputAmount || InputAmount != null && InputAmount.Equals(other.InputAmount) ) && ( OutputAddress == other.OutputAddress || OutputAddress != null && OutputAddress.Equals(other.OutputAddress) ) && ( OutputCoinType == other.OutputCoinType || OutputCoinType != null && OutputCoinType.Equals(other.OutputCoinType) ) && ( OutputAmount == other.OutputAmount || OutputAmount != null && OutputAmount.Equals(other.OutputAmount) ) && ( RefundAddress == other.RefundAddress || RefundAddress != null && RefundAddress.Equals(other.RefundAddress) ) && ( ExpirationTime == other.ExpirationTime || ExpirationTime != null && ExpirationTime.Equals(other.ExpirationTime) ) && ( FlatTransactionFeeInInputCoinType == other.FlatTransactionFeeInInputCoinType || FlatTransactionFeeInInputCoinType != null && FlatTransactionFeeInInputCoinType.Equals(other.FlatTransactionFeeInInputCoinType) )); }
public override string ToString() { var sb = new StringBuilder("LoginSession("); bool __first = true; if (TokenKey != null && __isset.tokenKey) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("TokenKey: "); TokenKey.ToString(sb); } if (__isset.expirationTime) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ExpirationTime: "); ExpirationTime.ToString(sb); } if (__isset.applicationType) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ApplicationType: "); ApplicationType.ToString(sb); } if (SystemName != null && __isset.systemName) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("SystemName: "); SystemName.ToString(sb); } if (AccessLocation != null && __isset.accessLocation) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("AccessLocation: "); AccessLocation.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
internal Hashgraph.ExchangeRate ToExchangeRate() { return(new Hashgraph.ExchangeRate { HBarEquivalent = HbarEquiv, USDCentEquivalent = CentEquiv, Expiration = ExpirationTime.ToDateTime() }); }
public override int GetHashCode() { unchecked { int hashCode = Enabled.GetHashCode(); hashCode = (hashCode * 397) ^ RefreshTime.GetHashCode(); hashCode = (hashCode * 397) ^ ExpirationTime.GetHashCode(); return(hashCode); } }
//optimized serialization public void WriteToStream(Stream stream) { using (var writer = new BinaryWriter(stream)) { writer.Write(string.IsNullOrEmpty(UserName) ? "" : UserName); writer.Write(ExpirationTime.ToBinary()); writer.Write((uint)PermissionsToken); writer.Write(string.IsNullOrEmpty(Cookie) ? "" : Cookie); writer.Write(string.IsNullOrEmpty(ImpersonatedUserName) ? "" : ImpersonatedUserName); } }
public override int GetHashCode() { if (ID == 0) { var hashCode = 420877175; hashCode = hashCode * -1521134295 + Name.GetHashCode(); hashCode = hashCode * -1521134295 + ExpirationTime.GetHashCode(); return(hashCode); } return(ID.GetHashCode()); }
internal Hashgraph.TopicInfo ToTopicInfo() { return(new Hashgraph.TopicInfo { Memo = Memo, RunningHash = RunningHash.ToArray(), SequenceNumber = SequenceNumber, Expiration = ExpirationTime.ToDateTime(), Administrator = AdminKey?.ToEndorsement(), Participant = SubmitKey?.ToEndorsement(), AutoRenewPeriod = AutoRenewPeriod.ToTimeSpan(), RenewAccount = AutoRenewAccount?.ToAddress() }); }
internal Hashgraph.ContractInfo ToContractInfo() { return(new Hashgraph.ContractInfo { Contract = ContractID.ToAddress(), Address = AccountID.ToAddress(), SmartContractId = ContractAccountID, Administrator = AdminKey?.ToEndorsement(), Expiration = ExpirationTime.ToDateTime(), RenewPeriod = AutoRenewPeriod.ToTimeSpan(), Size = Storage, Memo = Memo, Balance = Balance, Tokens = TokenRelationships.ToBalances(), Deleted = Deleted }); }
public override int GetHashCode() { int hash = 1; if (HasId) { hash ^= Id.GetHashCode(); } if (HasInviterIdentity) { hash ^= InviterIdentity.GetHashCode(); } if (HasInviteeIdentity) { hash ^= InviteeIdentity.GetHashCode(); } if (HasInviterName) { hash ^= InviterName.GetHashCode(); } if (HasInviteeName) { hash ^= InviteeName.GetHashCode(); } if (HasInvitationMessage) { hash ^= InvitationMessage.GetHashCode(); } if (HasCreationTime) { hash ^= CreationTime.GetHashCode(); } if (HasExpirationTime) { hash ^= ExpirationTime.GetHashCode(); } if (_extensions != null) { hash ^= _extensions.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
internal Hashgraph.AccountInfo ToAccountInfo() { return(new Hashgraph.AccountInfo { Address = AccountID.ToAddress(), SmartContractId = ContractAccountID, Deleted = Deleted, Proxy = ProxyAccountID.ToAddress(), ProxiedToAccount = ProxyReceived, Endorsement = Key.ToEndorsement(), Balance = Balance, Tokens = TokenRelationships.ToBalances(), ReceiveSignatureRequired = ReceiverSigRequired, AutoRenewPeriod = AutoRenewPeriod.ToTimeSpan(), Expiration = ExpirationTime.ToDateTime() }); }
/// <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 (InputAddress != null) { hashCode = hashCode * 59 + InputAddress.GetHashCode(); } if (InputCoinType != null) { hashCode = hashCode * 59 + InputCoinType.GetHashCode(); } if (InputAmount != null) { hashCode = hashCode * 59 + InputAmount.GetHashCode(); } if (OutputAddress != null) { hashCode = hashCode * 59 + OutputAddress.GetHashCode(); } if (OutputCoinType != null) { hashCode = hashCode * 59 + OutputCoinType.GetHashCode(); } if (OutputAmount != null) { hashCode = hashCode * 59 + OutputAmount.GetHashCode(); } if (RefundAddress != null) { hashCode = hashCode * 59 + RefundAddress.GetHashCode(); } if (ExpirationTime != null) { hashCode = hashCode * 59 + ExpirationTime.GetHashCode(); } if (FlatTransactionFeeInInputCoinType != null) { hashCode = hashCode * 59 + FlatTransactionFeeInInputCoinType.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (Token.Length != 0) { hash ^= Token.GetHashCode(); } if (ExpirationTime != 0L) { hash ^= ExpirationTime.GetHashCode(); } if (Iv.Length != 0) { hash ^= Iv.GetHashCode(); } return(hash); }
/// <inheritdoc/> public bool Equals(RestApiModel other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (Id == other.Id && Type == other.Type && Parent == other.Parent && Author == other.Author && Title == other.Title && Text == other.Text && Url == other.Url && HtmlContent == other.HtmlContent && Upvotes == other.Upvotes && Downvotes == other.Downvotes && MathF.Abs(VotesRatio - other.VotesRatio) < 0.001f && Views == other.Views && Clicks == other.Clicks && MathF.Abs(ClicksRatio - other.ClicksRatio) < 0.001f && NumberOfComments == other.NumberOfComments && CreationTime.Equals(other.CreationTime) && UpdateTime.Equals(other.UpdateTime) && ExpirationTime.Equals(other.ExpirationTime) && Flag1 == other.Flag1 && Flag2 == other.Flag2 && Flag3 == other.Flag3 && Flag4 == other.Flag4 && Flag5 == other.Flag5 && Optional1 == other.Optional1 && Optional2 == other.Optional2 && Optional3 == other.Optional3 && (Info == null && other.Info == null || Info?.Equals(other.Info) == true)); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.id) { hashcode = (hashcode * 397) + Id.GetHashCode(); } if (__isset.expirationTime) { hashcode = (hashcode * 397) + ExpirationTime.GetHashCode(); } if (__isset.maxUseCount) { hashcode = (hashcode * 397) + MaxUseCount.GetHashCode(); } } return(hashcode); }
public override int GetHashCode() { unchecked { int hashCode = Enabled.GetHashCode(); hashCode = (hashCode * 397) ^ ResponseKindsToCache.GetHashCode(); hashCode = (hashCode * 397) ^ ResponseKindsToIgnore.GetHashCode(); hashCode = (hashCode * 397) ^ RefreshMode.GetHashCode(); hashCode = (hashCode * 397) ^ RefreshTime.GetHashCode(); hashCode = (hashCode * 397) ^ ExpirationTime.GetHashCode(); hashCode = (hashCode * 397) ^ FailedRefreshDelay.GetHashCode(); hashCode = (hashCode * 397) ^ RequestGroupingBehavior.GetHashCode(); hashCode = (hashCode * 397) ^ RefreshBehavior.GetHashCode(); hashCode = (hashCode * 397) ^ RevokedResponseBehavior.GetHashCode(); hashCode = (hashCode * 397) ^ ExpirationBehavior.GetHashCode(); hashCode = (hashCode * 397) ^ CacheResponsesWhenSupressedBehavior.GetHashCode(); hashCode = (hashCode * 397) ^ NotIgnoredResponseBehavior.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (HasInvitationMessage) { hash ^= InvitationMessage.GetHashCode(); } if (HasExpirationTime) { hash ^= ExpirationTime.GetHashCode(); } if (_extensions != null) { hash ^= _extensions.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public bool Equals(JsonResponseModel?other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (Id == other.Id && Type == other.Type && Count == other.Count && CreationTime.Equals(other.CreationTime) && UpdateTime.Equals(other.UpdateTime) && ExpirationTime.Equals(other.ExpirationTime) && PreviousPageId == other.PreviousPageId && FollowingPageId == other.FollowingPageId && ModelContainers?.Count == other.ModelContainers?.Count && ModelContainers.Zip(other.ModelContainers).All(p => p.First.Equals(p.Second))); }
public async Task GetTrialExpirationDate(ExpirationTime expirationTime, bool expected) { // Arrange var expirationDate = GetExpirationDateByExpirationTime(expirationTime); _settingsManager .Setup(x => x.GetObjectSettingAsync(PlatformConstants.Settings.Setup.TrialExpirationDate.Name, null, null)) .ReturnsAsync(new ObjectSettingEntry { Value = expirationDate }); // Act var result = await _controller.GetTrialExpirationDate(); var actual = ((OkObjectResult)result.Result).Value as TrialState; // Assert actual.Should().NotBeNull(); actual.ClientPassRegistration.Should().Be(expected); actual.ExpirationDate.Should().Be(expirationDate); }
public override string ToString() { var sb = new StringBuilder("Ticket("); bool __first = true; if (Id != null && __isset.id) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Id: "); Id.ToString(sb); } if (__isset.expirationTime) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ExpirationTime: "); ExpirationTime.ToString(sb); } if (__isset.maxUseCount) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("MaxUseCount: "); MaxUseCount.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
/// <summary> /// Method to create an object from a set of object attributes. /// </summary> /// <param name="obj_attributes">The object attributes to create/open from.</param> /// <returns>The newly created object.</returns> protected override object CreateObject(ObjectAttributes obj_attributes) { return(NtToken.Create(Access, obj_attributes, TokenType, AuthenticationId, ExpirationTime.ToFileTimeUtc(), new UserGroup(User, GroupAttributes.Owner), GetGroups(), Privileges.Select(p => new TokenPrivilege(p, PrivilegeAttributes.EnabledByDefault | PrivilegeAttributes.Enabled)), User, User, DefaultAcl, "NT.NET")); }
private DateTime?GetExpirationDateByExpirationTime(ExpirationTime expirationTime) => expirationTime switch {
/// <summary> /// Returns the hash code for this object. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(Key.GetHashCode() ^ Queue.GetHashCode() ^ EnqueueTime.GetHashCode() ^ LeasedUntil.GetHashCode() ^ LeaseDuration.GetHashCode() ^ ExpirationTime.GetHashCode() ^ DequeueCount.GetHashCode() ^ Item.GetHashCode()); }
public override string ToString() { return ($"RiftTempRole: {nameof(UserId)}: {UserId.ToString()}, {nameof(RoleId)}: {RoleId.ToString()}, {nameof(ExpirationTime)}: {ExpirationTime.Humanize()}"); }
public static ExpirationTimeDto ToDto(this ExpirationTime expirationTime) => expirationTime switch {