public string SerializeFCMv2() { string xheader; if (CreatedBy != null) { xheader = CreatedBy.Name + " " + CreatedDate.ToCompactString() + " "; } else { xheader = "- - "; } if (EditedBy != null) { xheader += EditedBy.Name + " " + EditedDate.ToCompactString(); } else { xheader += "- -"; } SecurityController.PlayerListCollection list = Controller.ExceptionList; return(String.Format("{0},{1},{2},{3}", String.Format("{0} {1} {2} {3} {4} {5} {6} {7}", Name, Bounds.XMin, Bounds.YMin, Bounds.HMin, Bounds.XMax, Bounds.YMax, Bounds.HMax, Controller.MinRank.GetFullName()), list.Included.JoinToString(" ", p => p.Name), list.Excluded.JoinToString(" ", p => p.Name), xheader)); }
public PlanTaskDto ToDto() { var result = new PlanTaskDto() { Title = Title, CompleteDate = CompleteDate.ToLocalTime(), CreatedDate = CreatedDate.ToLocalTime(), Creator = Creator.ToDto(), Deadline = Deadline.ToLocalTime(), Description = Description, Id = Id, IsTask = IsTask, SelectedForToday = SelectedForToday, Status = this.Status, RemindAt = RemindAt.ToLocalTime(), ReminderSent = ReminderSent, PlannedBeginDate = PlannedBeginDate.ToLocalTime(), AccessRights = (AccessRights == null ? new List <ACLEntryDto>() : AccessRights.Select(x => x.ToDto())).ToList(), IsShared = IsShared, PlannedDateProcessed = PlannedDateProcessed }; if (Parent != null) { result.ParentTaskId = Parent.Id; result.Parent = Parent.ToDto(); } return(result); }
protected IdCard(string version, XElement domElement, string cardId, AuthenticationLevel authenticationLevel, string issuer, SystemInfo systemInfo, string certHash, string alternativeIdentifier, string userName, string password) { ModelUtilities.ValidateNotEmpty(issuer, "'Issuer' cannot be null or empty"); ModelUtilities.ValidateNotNull(authenticationLevel, "'AuthenticationLevel' cannot be null"); Version = version; CreatedDate = DateTime.Now.AddMinutes(-IDCARD_BEGIN_TIME_BUFFER_IN_MINUTES); ExpiryDate = CreatedDate.AddHours(MAX_IDCARD_LIFE_IN_HOURS); Issuer = issuer; AuthenticationLevel = authenticationLevel; if (AuthenticationLevel.MocesTrustedUser.Equals(authenticationLevel) || AuthenticationLevel.VocesTrustedSystem.Equals(authenticationLevel)) { CertHash = certHash ?? ""; } AlternativeIdentifier = alternativeIdentifier; if (AuthenticationLevel.UsernamePasswordAuthentication.Equals(authenticationLevel)) { ModelUtilities.ValidateNotEmpty(userName, "'username' cannot be null or empty for authenticationlevel 2"); ModelUtilities.ValidateNotEmpty(password, "'password' cannot be null or empty for authenticationlevel 2"); Username = userName; Password = password; } Xassertion = domElement; NeedsSignature = (Xassertion == null); IdCardId = cardId; }
public void MergeFrom(Record other) { if (other == null) { return; } if (other.Id.Length != 0) { Id = other.Id; } if (other.createdDate_ != null) { if (createdDate_ == null) { CreatedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } CreatedDate.MergeFrom(other.CreatedDate); } if (other.payload_ != null) { if (payload_ == null) { Payload = new global::Google.Protobuf.WellKnownTypes.Any(); } Payload.MergeFrom(other.Payload); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public string CalculateTransactionHash(IKeyStore KeyStoreFromAddress) { string blockheader = CreatedDate.ToString(); string transactionHash = ""; foreach (var item in Inputs) { transactionHash += item.GetDataForHash(); } foreach (var item in Outputs) { transactionHash += item.GetDataForHash(); } string combined = transactionHash + blockheader; string completeTransactionHash; if (KeyStoreFromAddress == null || true) { completeTransactionHash = Convert.ToBase64String(HashData.ComputeHashSha256(Encoding.UTF8.GetBytes(combined))); } else { //Not sure need this completeTransactionHash = Convert.ToBase64String(Hmac.ComputeHmacSha256(Encoding.UTF8.GetBytes(combined), KeyStoreFromAddress.AuthenticatedHashKey)); } return(completeTransactionHash); }
public override int GetHashCode() { unchecked { return((Id.GetHashCode() * 397) ^ (CreatedDate != null ? CreatedDate.GetHashCode() : 0)); } }
public override int GetHashCode() { unchecked { return((Id * 397) ^ CreatedDate.GetHashCode()); } }
public XElement Serialize() { XElement root = new XElement(XmlRootElementName); root.Add(new XElement("name", Name)); if (CreatedBy != null) { XElement created = new XElement("created"); created.Add(new XAttribute("by", CreatedBy.Name)); created.Add(new XAttribute("on", CreatedDate.ToCompactString())); root.Add(created); } if (EditedBy != null) { XElement edited = new XElement("edited"); edited.Add(new XAttribute("by", EditedBy.Name)); edited.Add(new XAttribute("on", EditedDate.ToCompactString())); root.Add(edited); } root.Add(Bounds.Serialize()); root.Add(Controller.Serialize()); return(root); }
public string CalculateBlockHash(string previousBlockHash) { string data = JsonConvert.SerializeObject(this.Data); string blockHeader = this.BlockNumber + CreatedDate.ToBinary().ToString() + this.Signature.SignerId + this.Signature.PublicKey + previousBlockHash; return(Hasher.ComputeHash(data + blockHeader)); }
public string CalculateBlockHash(string previousBlockHash) { var blockHeader = BlockNumber + CreatedDate.ToString() + previousBlockHash; var combined = merkleTree.RootNode + blockHeader; return(Convert.ToBase64String(Hashing.ComputeHashSha256(Encoding.UTF8.GetBytes(combined)))); }
//Compute Hash with Cryptography public string CalculateBlockHash(string previousBlockHash) { List <string> transHash = new List <string>(); //transHash.Add(Transaction.ForEach(x => x.CalculateTransactionHash()); foreach (var trans in Transaction) { string hash = trans.CalculateTransactionHash(); transHash.Add(hash); } string blockheader = BlockNumber + CreatedDate.ToString() + previousBlockHash; //string combined = transHash + blockheader; String combined = ""; foreach (var trans in transHash) { combined = combined + trans; } string combinedHash = combined + blockheader; //return Convert.ToBase64String(HashData.ComputeHashSha256(Encoding.UTF8.GetBytes(combinedHash.ToString()))); string completeBlockHash; if (KeyStore == null) { completeBlockHash = Convert.ToBase64String(Cryptography.HashData.ComputeHashSha256(Encoding.UTF8.GetBytes(combinedHash))); } else { completeBlockHash = Convert.ToBase64String(Cryptography.Hmac.ComputeHmacsha256(Encoding.UTF8.GetBytes(combinedHash), KeyStore.AuthenticatedHashKey)); } return(completeBlockHash); }
/// <summary> /// Returns true if History instances are equal /// </summary> /// <param name="other">Instance of History to be compared</param> /// <returns>Boolean</returns> public bool Equals(History other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( HistoryText == other.HistoryText || HistoryText != null && HistoryText.Equals(other.HistoryText) ) && ( CreatedDate == other.CreatedDate || CreatedDate != null && CreatedDate.Equals(other.CreatedDate) )); }
public override string ToString() { StringBuilder objValue = new StringBuilder(); objValue.Append("CompressedSize" + PropertyValueDelimeter + CompressedSize.ToString()); objValue.Append(PropertyDelimeter); objValue.Append("CreatedDate" + PropertyValueDelimeter + CreatedDate.ToString()); objValue.Append(PropertyDelimeter); objValue.Append("FileName" + PropertyValueDelimeter + FileName); objValue.Append(PropertyDelimeter); objValue.Append("OriginalFilePath" + PropertyValueDelimeter + OriginalFilePath); objValue.Append(PropertyDelimeter); objValue.Append("RelativePath" + PropertyValueDelimeter + RelativePath); objValue.Append(PropertyDelimeter); objValue.Append("Size" + PropertyValueDelimeter + Size.ToString()); objValue.Append(PropertyDelimeter); objValue.Append("Version" + PropertyValueDelimeter + Version); objValue.Append(PropertyDelimeter); StringBuilder objKeyValues = new StringBuilder(); foreach (string strKey in Keys) { objKeyValues.Append(strKey); objKeyValues.Append(KeyValueDelimeter); } objValue.Append("Keys" + PropertyValueDelimeter + objKeyValues.ToString()); return(objValue.ToString()); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode( ) { int hash = 13; hash = hash * 7 + Id.GetHashCode( ); if (Name != null) { hash = hash * 7 + Name.GetHashCode( ); } if (Description != null) { hash = hash * 7 + Description.GetHashCode( ); } if (CreatedDate != null) { hash = hash * 7 + CreatedDate.GetHashCode( ); } if (ModifiedDate != null) { hash = hash * 7 + ModifiedDate.GetHashCode( ); } return(hash); }
public void Dispose() { if (Name == null) { return; } Name.Dispose(); Name = null; Modes.Dispose(); Modes = null; Topic.Dispose(); Topic = null; TopicSetBy.Dispose(); TopicSetBy = null; TopicSetDate.Dispose(); TopicSetDate = null; CreatedDate.Dispose(); CreatedDate = null; _knownUsers.Do(u => u.Dispose()); _knownUsers.Clear(); _knownUsers.Dispose(); _knownUsers = null; _users.Clear(); _users.Dispose(); _users = null; }
public override int GetHashCode() { return(Name.GetHashCode() + Id.GetHashCode() + CreatedDate.GetHashCode() + orders.Sum(x => x.GetHashCode())); }
public virtual bool IsNew(int days = 3) { if (CreatedDate.AddDays(days) >= DateTime.Now) { return(true); } return(false); }
public string CalculateBlockHash(string previousBlockHash) { string txnHash = ClaimNumber + SettlementAmount + SettlementDate + CarRegistration + Mileage + ClaimType; string blockheader = BlockNumber + CreatedDate.ToString() + previousBlockHash; string combined = txnHash + blockheader; return(Convert.ToBase64String(HashData.ComputeHashSha256(Encoding.UTF8.GetBytes(combined)))); }
public override int GetHashCode() { var hashCode = -404744490; hashCode = hashCode * -1521134295 + CreatedDate.GetHashCode(); hashCode = hashCode * -1521134295 + Active.GetHashCode(); return(hashCode); }
public Card(string title, string description = null) { Title = title; Description = description; CreatedDate = DateTime.Now; DueByDate = CreatedDate.AddDays(7); DueState = DueState.OnTime; }
/// <summary> /// The add descriptions. /// </summary> protected override void AddDescriptions() { AddDescription(nameof(Id), Id.ToStr()); AddDescription(nameof(Status), Status.ToStr()); AddDescription(nameof(Note), Note.ToStr()); AddDescription(nameof(CreatedDate), CreatedDate.ToStr()); AddDescription(nameof(ChangedDate), ChangedDate.ToStr()); }
public string CalculateBlockHash(string previousBlockHash) { string txnHash = ClaimNumber + SettlementAmount + SettlementDate + CarRegistration + Mileage + ClaimType; string blockHeader = BlockNumber + CreatedDate.ToString() + previousBlockHash; string combined = txnHash + blockHeader; return(HashFun.GetSha256(combined)); }
public Project() { DefaultSprintTime = 15; CurrentSprintNo = 1; DayCount = 60; CreatedDate = DateTime.Now.Date; EndDate = CreatedDate.AddDays(DayCount); IsDone = false; }
protected override IEnumerable <Event> Given() { yield return(new LoanCreatedEvent(CreatedDate, LoanAmount, new Duration(12, DurationUnit.Month), PaymentPlan.Weekly)); yield return(new LoanCustomerContactChangedEvent("bob", "0444444444", "0812341234", "10 Random Street")); yield return(new LoanBankAccountChangedEvent("066-000", "12345678")); yield return(new LoanDisbursedFundsEvent(CreatedDate.AddHours(1), -LoanAmount, new BankAccount("066-000", "12345678"))); }
/// <summary> /// Creates a new instance of <see cref="CacheItem"/> object. /// </summary> /// <param name="key">The key of the cache item.</param> /// <param name="value">The value of the cache item.</param> /// <param name="expirationInMinutes">The expiration in minutes of the cache item.</param> public CacheItem(string key, object value, int expirationInMinutes) { if (expirationInMinutes < 0) { throw new ArgumentOutOfRangeException("Expiration in minutes must not be negative values."); } Key = key; Value = value; CreatedDate = DateTime.UtcNow; Expiration = CreatedDate.AddMinutes(expirationInMinutes); }
public EntityBase(CreatedDate createdDate, ModifiedDate modifiedDate, DataState dataState) { _ = createdDate ?? throw new ArgumentException("Cannot be null.", "createdDate"); _ = modifiedDate ?? throw new ArgumentException("Cannot be null.", "modifiedDate"); CreatedDate = createdDate; ModifiedDate = modifiedDate; DataState = dataState; }
public void WriteXml(XmlWriter writer) { writer.WriteElementString("FirstName", FirstName.Encrypt()); writer.WriteElementString("LastName", LastName.Encrypt()); writer.WriteElementString("Phone", Phone.Encrypt()); writer.WriteElementString("Email", Email.Encrypt()); writer.WriteElementString("Gender", Gender.ToString().Encrypt()); writer.WriteElementString("Notes", FirstName.Encrypt()); writer.WriteElementString("IsDeleted", IsDeleted.ToString()); writer.WriteElementString("CreatedDate", CreatedDate.ToUniversalTime().ToString()); writer.WriteElementString("LasUpdatedDate", CreatedDate.ToUniversalTime().ToString()); }
public List <string[]> ToArrayList() { var name = string.IsNullOrEmpty(ParameterName) ? string.Format("{0}.{1}", SchemaName, Name) : string.Format("{0}.{1}.{2}", SchemaName, Name, ParameterName); var result = new List <string[]> { new[] { "Name:", name }, new[] { "Created:", CreatedDate.ToString(CultureInfo.CurrentCulture) }, new[] { "Modified:", ModifiedDate.ToString(CultureInfo.CurrentCulture) }, }; return(result); }
/// <summary> /// Updates the value of the current item based from the source item. /// </summary> /// <param name="item">The source item.</param> /// <param name="throwException">Throws an exception if the operation has failed to update an item.</param> internal void UpdateFrom(CacheItem <T> item, bool throwException = true) { if (!IsExpired() && throwException) { throw new InvalidOperationException($"Cannot update the item that is not yet expired."); } Value = item.Value; CreatedDate = item.CreatedDate; Expiration = CreatedDate.AddMinutes(item.CacheItemExpiration ?? Constant.DefaultCacheItemExpirationInMinutes); }
/// <summary> /// Returns true if Note instances are equal /// </summary> /// <param name="other">Instance of Note to be compared</param> /// <returns>Boolean</returns> public bool Equals(Note other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Title == other.Title || Title != null && Title.Equals(other.Title) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) ) && ( Importance == other.Importance || Importance != null && Importance.Equals(other.Importance) ) && ( CreatedDate == other.CreatedDate || CreatedDate != null && CreatedDate.Equals(other.CreatedDate) ) && ( DueDate == other.DueDate || DueDate != null && DueDate.Equals(other.DueDate) ) && ( FinishedDate == other.FinishedDate || FinishedDate != null && FinishedDate.Equals(other.FinishedDate) ) && ( Finished == other.Finished || Finished != null && Finished.Equals(other.Finished) )); }