using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.CompilerServices; using Newtonsoft.Json; using Amazon.DynamoDBv2; using Amazon.DynamoDBv2.Model; using Amazon.DynamoDBv2.DocumentModel; using Google.Protobuf.WellKnownTypes; using ServerCore; using ServerBase; using SESSION_ID = System.Int32; using WORLD_ID = System.UInt32; using META_ID = System.UInt32; using ENTITY_GUID = System.String; using ACCOUNT_ID = System.String; using OWNER_GUID = System.String; using USER_GUID = System.String; using CHARACTER_GUID = System.String; using ITEM_GUID = System.String; namespace ServerCommon; public class LandAuctionRefundBidPriceAttrib : AttribBase { [JsonProperty("land_meta_id")] public META_ID LandMetaId { get; set; } = 0; [JsonProperty("auction_number")] public Int32 AuctionNumber { get; set; } = 0; [JsonProperty("bid_user_guid")] public USER_GUID BidUserGuid { get; set; } = string.Empty; [JsonProperty("last_bid_type")] public LandAuctionBidType LastBidType { get; set; } = LandAuctionBidType.None; // 마지막 입찰의 종류 [JsonProperty("bid_currency_type")] public CurrencyType BidCurrencyType { get; set; } = CurrencyType.None; [JsonProperty("last_bid_price")] public double LastBidPrice { get; set; } = 0; // 마지막 입찰금 [JsonProperty("refundable_normal_bid_price")] public double RefundableNormalBidPrice { get; set; } = 0; // 본인의 일반 환급 가능한 입찰금 [JsonProperty("refundable_blind_bid_price")] public double RefundableBlindBidPrice { get; set; } = 0; // 본인의 블라인드 환급 가능한 입찰금 public LandAuctionRefundBidPriceAttrib() : base(typeof(LandAuctionRefundBidPriceAttrib).Name, false) { } } //============================================================================================= // Desc : 랜드 경매별 환급 입찰 비용 // Primary Key // PK(Partition Key) : "land_auction_refund_bid_price#{user_guid}" // SK(Sort Key) : "{land_meta_id}#{auction_number}" // UserBaseAttrib : {} // ... //============================================================================================= public class LandAuctionRefundBidPriceDoc : DynamoDbDocBase, ICopyDocFromEntityAttribute { private static string getPrefixOfPK() { return "land_auction_refund_bid_price#"; } private static string getPrefixOfSK() { return ""; } public LandAuctionRefundBidPriceDoc() : base(typeof(LandAuctionRefundBidPriceDoc).Name) { appendAttribWrapperAll(); } public LandAuctionRefundBidPriceDoc( USER_GUID bidUserGuid, META_ID landMetaId, Int32 auctionNumber ) : base(typeof(LandAuctionRefundBidPriceDoc).Name) { setCombinationKeyForPK(bidUserGuid); setCombinationKeyForSK(makeCombinationKeyForSK(landMetaId, auctionNumber)); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); var refund_bid_price_attrib = getAttrib(); NullReferenceCheckHelper.throwIfNull(refund_bid_price_attrib, () => $"refund_bid_price_attrib is null !!!"); refund_bid_price_attrib.BidUserGuid = bidUserGuid; refund_bid_price_attrib.LandMetaId = landMetaId; refund_bid_price_attrib.AuctionNumber = auctionNumber; } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return getPrefixOfPK(); } protected override ServerErrorCode onCheckAndSetSK(string sortKey) { getPrimaryKey().fillUpSK(sortKey); return ServerErrorCode.Success; } // override ICopyDocFromEntityAttribute public bool copyDocFromEntityAttribute(EntityAttributeBase entityAttributeBase) { var refund_bid_price_attribute = entityAttributeBase as LandAuctionRefundBidPriceAttribute; if (null == refund_bid_price_attribute) { return false; } var refund_bid_price_attrib = getAttrib(); NullReferenceCheckHelper.throwIfNull(refund_bid_price_attrib, () => $"refund_bid_price_attrib is null !!! - {toBasicString()}"); refund_bid_price_attrib.BidUserGuid = refund_bid_price_attribute.BidUserGuid; refund_bid_price_attrib.LandMetaId = refund_bid_price_attribute.LandMetaId; refund_bid_price_attrib.AuctionNumber = refund_bid_price_attribute.AuctionNumber; refund_bid_price_attrib.LastBidType = refund_bid_price_attribute.LastBidType; refund_bid_price_attrib.BidCurrencyType = refund_bid_price_attribute.BidCurrencyType; refund_bid_price_attrib.LastBidPrice = refund_bid_price_attribute.LastBidPrice; refund_bid_price_attrib.RefundableNormalBidPrice = refund_bid_price_attribute.RefundableNormalBidPrice; refund_bid_price_attrib.RefundableBlindBidPrice = refund_bid_price_attribute.RefundableBlindBidPrice; return true; } public static string makeCombinationKeyForSK(META_ID landMetaId, Int32 auctionNumber) { return $"{landMetaId}#{auctionNumber}"; } }