64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
|
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Transactions;
|
|||
|
using BlueWest.Collections;
|
|||
|
using MapTo;
|
|||
|
using MessagePack;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using BlueWest.Collections;
|
|||
|
|
|||
|
namespace BlueWest.Data
|
|||
|
{
|
|||
|
[MessagePackObject]
|
|||
|
[UseUpdate]
|
|||
|
[MapFrom(typeof(UserUpdateDto))]
|
|||
|
public partial class User
|
|||
|
{
|
|||
|
[Key(1)] public int Id { get; }
|
|||
|
[Key(2)] public string Name { get; set; }
|
|||
|
[Key(3)] public string Address { get; set; }
|
|||
|
|
|||
|
[Key(4)] public string BTCAddress { get; set; }
|
|||
|
[Key(5)] public string LTCAddress { get; set; }
|
|||
|
|
|||
|
[Key(6)] public double BTCAmount { get; set; }
|
|||
|
[Key(7)] public double LTCAmount { get; set; }
|
|||
|
|
|||
|
[Key(8)] public FastDictionary<FinanceTransaction> FinanceTransactions { get; set; }
|
|||
|
|
|||
|
public User(int id, string name, string address, string btcAddress, string ltcAddress, double btcAmount, double ltcAmount, FastList<FinanceTransaction> financeTransactions)
|
|||
|
{
|
|||
|
Id = id;
|
|||
|
Name = name;
|
|||
|
Address = address;
|
|||
|
BTCAddress = btcAddress;
|
|||
|
LTCAddress = ltcAddress;
|
|||
|
BTCAmount = btcAmount;
|
|||
|
LTCAmount = ltcAmount;
|
|||
|
FinanceTransactions = financeTransactions;
|
|||
|
}
|
|||
|
|
|||
|
public void AddTransaction(FinanceTransaction financeTransaction)
|
|||
|
{
|
|||
|
FinanceTransactions.Add(financeTransaction);
|
|||
|
}
|
|||
|
public void AddTransaction(FinanceTransactionInsertDto financeTransaction)
|
|||
|
{
|
|||
|
FinanceTransactions.Add(new FinanceTransaction(financeTransaction));
|
|||
|
}
|
|||
|
|
|||
|
internal bool HasTransaction(int transactionId)
|
|||
|
{
|
|||
|
return FinanceTransactions.Contains(transactionId);
|
|||
|
}
|
|||
|
|
|||
|
internal Transaction GetTransactionById(int transactionId)
|
|||
|
{
|
|||
|
return FinanceTransactions(transactionId);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|