Esempio n. 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((EqualityComparer <TKey> .Default.GetHashCode(Key) * 397) ^ ExpireAt.GetHashCode());
     }
 }
Esempio n. 2
0
        private string CreateContentString()
        {
            string str = $"{SessionId.ToString()}";

            if (!string.IsNullOrEmpty(User.Identifier))
            {
                str += $"|{User.Identifier}";
            }
            if (!string.IsNullOrEmpty(User.Name))
            {
                str += $"|{User.Name}";
            }
            if (!string.IsNullOrEmpty(User.Email))
            {
                str += $"|{User.Email}";
            }
            if (!string.IsNullOrEmpty(User.Organization))
            {
                str += $"|{User.Organization}";
            }
            str += $"|{CreatedAt.ToString("yyyy-MM-dd HH:mm:ss")}";
            str += $"|{ExpireAt.ToString("yyyy-MM-dd HH:mm:ss")}";
            str += $"|{RemoteIP}";
            return(str);
        }
Esempio n. 3
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = EqualityComparer <TObject> .Default.GetHashCode(Item);

                hashCode = (hashCode * 397) ^ ExpireAt.GetHashCode();
                hashCode = (hashCode * 397) ^ Index.GetHashCode();
                return(hashCode);
            }
        }
Esempio n. 4
0
 public bool Equals(ExpirableItem <TObject, TKey> other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(EqualityComparer <TKey> .Default.Equals(Key, other.Key) && ExpireAt.Equals(other.ExpireAt));
 }
Esempio n. 5
0
 public bool Equals(ExpirableItem <TObject> other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(EqualityComparer <TObject> .Default.Equals(Item, other.Item) && ExpireAt.Equals(other.ExpireAt) && Index == other.Index);
 }
Esempio n. 6
0
        private Access_Token GetAccess_token()
        {
            Access_Token token = new Access_Token();
            //请求获取 access_token。access_token有效期为一个月,所以可以缓存
            //2018-05-22 读取缓存的access_token
            var resp = Auth.OpenApiFetchToken(ApiKey, SecretKey, true);

            ExpireAt           = DateTime.Now.AddSeconds((int)resp["expires_in"] - 60 * 60);
            IsDev              = true;
            Token              = (string)resp["access_token"];
            token.access_token = Token;
            token.expires_in   = ExpireAt.ToString();
            return(token);
        }
Esempio n. 7
0
        public override dynamic ToObject()
        {
            dynamic payment = new ExpandoObject();

            payment.payment = new ExpandoObject();
            payment.payment.banking_billet           = new ExpandoObject();
            payment.payment.banking_billet.customer  = Customer.ToObject();
            payment.payment.banking_billet.expire_at = ExpireAt.ToStringDate();
            if (Discount != null)
            {
                payment.payment.banking_billet.discount = Discount.ToObject();
            }
            if (ConditionalDiscount != null)
            {
                payment.payment.banking_billet.conditional_discount = ConditionalDiscount.ToObject();
            }
            if (Configurations != null)
            {
                payment.payment.banking_billet.configurations = Configurations.ToObject();
            }
            payment.payment.banking_billet.message = Message;
            return((object)payment);
        }
Esempio n. 8
0
 /// <inheritdoc />
 public bool Equals(ExpirableItem <TObject, TKey> other)
 {
     return(EqualityComparer <TKey> .Default.Equals(Key, other.Key) && ExpireAt.Equals(other.ExpireAt));
 }