|
- using System;
- using System.Collections.Generic;
- using SUISS.Cloud.Extensions;
- using SUISS.Storage;
-
- namespace SUISS.Cloud
- {
- public class Gift : IGift, IStorable
- {
- public Gift(string id, string senderName, string type, long amount)
- {
- this.GiftId = id;
- this.SenderName = senderName;
- this.Type = type;
- this.Amount = amount;
- }
-
- public string GiftId { get; private set; }
-
- public string SenderName { get; private set; }
-
- public string Type { get; private set; }
-
- public long Amount { get; private set; }
-
- public void FromStorage(IDictionary<string, object> dict)
- {
- this.GiftId = dict.GetString("id", string.Empty);
- this.SenderName = dict.GetString("senderName", string.Empty);
- this.Type = dict.GetString("type", string.Empty);
- this.Amount = dict.GetLong("amount", 0L);
- }
-
- public IDictionary<string, object> ToStorage()
- {
- return new Dictionary<string, object>
- {
- {
- "id",
- this.GiftId
- },
- {
- "senderName",
- this.SenderName
- },
- {
- "type",
- this.Type
- },
- {
- "amount",
- this.Amount
- }
- };
- }
-
- private const string IdKey = "id";
-
- private const string SenderNameKey = "senderName";
-
- private const string TypeKey = "type";
-
- private const string AmountKey = "amount";
- }
- }
|