mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-05-18 19:48:23 +00:00
Migrated projects to dotnet8
migrated all projects over to .net8 incomplete feature for gui shipments
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public class Journal : IValidatableObject
|
||||
{
|
||||
internal Journal(uint journalId, Core.Model.Account.JournalType type, List<Post> posts, DateTime entryDate, DateTime postDate, DateTime lastModifed, bool isLocked)
|
||||
{
|
||||
JournalId = journalId;
|
||||
Type = type;
|
||||
Posts = posts;
|
||||
EntryDate = entryDate;
|
||||
PostDate = postDate;
|
||||
LastModified = lastModifed;
|
||||
IsLocked = isLocked;
|
||||
}
|
||||
|
||||
public uint JournalId { get; private set; }
|
||||
public Core.Model.Account.JournalType Type { get; private set; }
|
||||
public List<Post> Posts { get; private set; } = new List<Post>();
|
||||
public DateTime EntryDate { get; private set; }
|
||||
public DateTime PostDate { get; private set; }
|
||||
public DateTime LastModified { get;private set; }
|
||||
public bool IsLocked { get; private set; }
|
||||
|
||||
public class Post
|
||||
{
|
||||
internal Post(uint postId, Core.Model.Account.Account account, decimal amountGbp)
|
||||
{
|
||||
PostId = postId;
|
||||
Account = account;
|
||||
AmountGbp = amountGbp;
|
||||
}
|
||||
|
||||
public uint PostId { get; private set; }
|
||||
public Core.Model.Account.Account Account { get; private set; }
|
||||
public decimal AmountGbp { get; private set; }
|
||||
}
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
var result = new List<ValidationResult>();
|
||||
|
||||
// get total of posts
|
||||
decimal postTotal = 0;
|
||||
foreach (var post in Posts)
|
||||
{
|
||||
postTotal = postTotal + post.AmountGbp;
|
||||
}
|
||||
if (postTotal != 0)
|
||||
{
|
||||
result.Add(new ValidationResult("Account journal posts do not equal zero"));
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user