96 lines
2.3 KiB
C#
96 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
|
|
|
|
using META_ID = System.UInt32;
|
|
using OWNER_GUID = System.String;
|
|
using BUILDING_GUID = System.String;
|
|
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public class BuildingAttrib : AttribBase
|
|
{
|
|
[JsonProperty("building_guid")]
|
|
public BUILDING_GUID BuildingGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("building_meta_id")]
|
|
public META_ID BuildingMetaId { get; set; } = 0;
|
|
|
|
[JsonProperty("building_name")]
|
|
public string BuildingName { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("description")]
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("owner_user_guid")]
|
|
public string OwnerUserGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty]
|
|
public CurrencyType RentalCurrencyType { get; set; } = CurrencyType.None;
|
|
|
|
[JsonProperty]
|
|
[JsonConverter(typeof(StringToDoubleEpsilonRoundConverter))]
|
|
public double RentalCurrencyAmount { get; set; } = 0;
|
|
|
|
[JsonProperty]
|
|
public bool IsRentalOpen { get; set; } = false;
|
|
|
|
|
|
public BuildingAttrib()
|
|
: base(typeof(BuildingAttrib).Name)
|
|
{ }
|
|
}
|
|
|
|
//=============================================================================================
|
|
// PK(Partition Key) : "building#building_meta_id"
|
|
// SK(Sort Key) : ""
|
|
// DocType : BuildingDoc
|
|
// BuildingAttrib : {}
|
|
// ...
|
|
//=============================================================================================
|
|
public class BuildingDoc : DynamoDbDocBase
|
|
{
|
|
private static string getPrefixOfPK() { return "building#"; }
|
|
private static string getPrefixOfSK() { return ""; }
|
|
|
|
public BuildingDoc()
|
|
: base(typeof(BuildingDoc).Name)
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public BuildingDoc(META_ID buildingMetaId)
|
|
: base(typeof(BuildingDoc).Name)
|
|
{
|
|
setCombinationKeyForPK(buildingMetaId.ToString());
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<BuildingAttrib>());
|
|
}
|
|
|
|
protected override string onGetPrefixOfPK()
|
|
{
|
|
return getPrefixOfPK();
|
|
}
|
|
}
|