first things
This commit is contained in:
34
Datamodels/BusinessModels/ResultModel.cs
Normal file
34
Datamodels/BusinessModels/ResultModel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.BusinessModels
|
||||
{
|
||||
public enum GeneralResults
|
||||
{
|
||||
Success = 0,
|
||||
DatabaseError = 1,
|
||||
GeneralError = 2,
|
||||
LogicWarning = 3,
|
||||
Created = 4,
|
||||
Updated = 5,
|
||||
Deleted = 6
|
||||
}
|
||||
|
||||
public class ResultObject
|
||||
{
|
||||
public GeneralResults GeneralResult { get; set; } = GeneralResults.Success;
|
||||
public string UserMessage { get; set; }
|
||||
public string ServerMessage { get; set; }
|
||||
public string StackTrace { get; set; }
|
||||
}
|
||||
|
||||
public class DataResult<T> : ResultObject
|
||||
{
|
||||
public T Data { get; set; }
|
||||
public long TotalCount { get; set; }
|
||||
public long Skip { get; set; }
|
||||
public long Take { get; set; }
|
||||
public TimeSpan Duration { get; set; }
|
||||
}
|
||||
}
|
||||
17
Datamodels/BusinessModels/SortModel.cs
Normal file
17
Datamodels/BusinessModels/SortModel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Datamodels.BusinessModels
|
||||
{
|
||||
|
||||
public enum SortDirections
|
||||
{
|
||||
Ascending,
|
||||
Descending
|
||||
}
|
||||
|
||||
public sealed class SortModel
|
||||
{
|
||||
public int SortFieldOrder { get; set; }
|
||||
public string SortFieldName { get; set; }
|
||||
public SortDirections SortDirection { get; set; } = SortDirections.Ascending;
|
||||
|
||||
}
|
||||
}
|
||||
18
Datamodels/DatabaseModels/Address.cs
Normal file
18
Datamodels/DatabaseModels/Address.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Datamodels.Lookups;
|
||||
|
||||
namespace Datamodels.DatabaseModels
|
||||
{
|
||||
public class Address: IEntityClass
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string StreetName { get; set; }
|
||||
public int StreetNumber { get; set; }
|
||||
public string Zip { get; set; }
|
||||
public string City { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime ChangedAt { get; set; }
|
||||
public LookupValue AddressType { get; set; } //something like "Job" or "Private"
|
||||
public Person Person { get; set; }
|
||||
}
|
||||
}
|
||||
15
Datamodels/DatabaseModels/Communication.cs
Normal file
15
Datamodels/DatabaseModels/Communication.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using Datamodels.Lookups;
|
||||
|
||||
namespace Datamodels.DatabaseModels
|
||||
{
|
||||
public class Communication
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string CommunicationValue { get; set; } //mobile phone, home phone, job mail, etc.
|
||||
public LookupValue CommunicationType { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime ChangedAt { get; set; }
|
||||
public Person Person { get; set; }
|
||||
}
|
||||
}
|
||||
10
Datamodels/DatabaseModels/IEntityClass.cs
Normal file
10
Datamodels/DatabaseModels/IEntityClass.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.DatabaseModels
|
||||
{
|
||||
public interface IEntityClass
|
||||
{
|
||||
}
|
||||
}
|
||||
20
Datamodels/DatabaseModels/Person.cs
Normal file
20
Datamodels/DatabaseModels/Person.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Datamodels.Lookups;
|
||||
|
||||
namespace Datamodels.DatabaseModels
|
||||
{
|
||||
public class Person
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public DateTime? Birthday { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime ChangedAt { get; set; }
|
||||
public LookupValue Gender { get; set; }
|
||||
public List<Address> Addresses { get; set; }
|
||||
public List<Communication> Communications { get; set; }
|
||||
}
|
||||
}
|
||||
11
Datamodels/Datamodels.csproj
Normal file
11
Datamodels/Datamodels.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
17
Datamodels/Enums/FieldTypes.cs
Normal file
17
Datamodels/Enums/FieldTypes.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.Enums
|
||||
{
|
||||
public enum FieldTypes
|
||||
{
|
||||
String,
|
||||
Integer,
|
||||
Double,
|
||||
Boolean,
|
||||
DateTime,
|
||||
Currency,
|
||||
Blob
|
||||
}
|
||||
}
|
||||
12
Datamodels/Enums/JoinTypes.cs
Normal file
12
Datamodels/Enums/JoinTypes.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.Enums
|
||||
{
|
||||
public enum JoinTypes
|
||||
{
|
||||
And,
|
||||
Or
|
||||
}
|
||||
}
|
||||
19
Datamodels/Enums/PhraseOperators.cs
Normal file
19
Datamodels/Enums/PhraseOperators.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.Enums
|
||||
{
|
||||
public enum PhraseOperators
|
||||
{
|
||||
Equal,
|
||||
NotEqual,
|
||||
LowerThan,
|
||||
LowerThanOrEqual,
|
||||
GreaterThan,
|
||||
GreaterThanOrEqual,
|
||||
StartsWith,
|
||||
Contains,
|
||||
EndsWith
|
||||
}
|
||||
}
|
||||
13
Datamodels/Enums/SearchTypes.cs
Normal file
13
Datamodels/Enums/SearchTypes.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.Enums
|
||||
{
|
||||
public enum SearchTypes
|
||||
{
|
||||
Phrase,
|
||||
Range,
|
||||
Terms
|
||||
}
|
||||
}
|
||||
12
Datamodels/Lookups/LookupCategory.cs
Normal file
12
Datamodels/Lookups/LookupCategory.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Datamodels.Lookups
|
||||
{
|
||||
public sealed class LookupCategory
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string CategoryName { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public List<LookupValue> LookupValues { get; set; }
|
||||
}
|
||||
}
|
||||
14
Datamodels/Lookups/LookupValue.cs
Normal file
14
Datamodels/Lookups/LookupValue.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Datamodels.Lookups
|
||||
{
|
||||
public sealed class LookupValue {
|
||||
|
||||
public long Id { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
[JsonIgnore]
|
||||
public LookupCategory LookupCategory { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
15
Datamodels/SearchModels/FieldModel.cs
Normal file
15
Datamodels/SearchModels/FieldModel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Datamodels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
|
||||
public sealed class FieldModel
|
||||
{
|
||||
public string FieldName { get; set; }
|
||||
public string FieldAlias { get; set; }
|
||||
public FieldTypes FieldType { get; set; }
|
||||
public List<SearchDescription> SearchDescriptions { get; set; }
|
||||
}
|
||||
}
|
||||
13
Datamodels/SearchModels/FilterModel.cs
Normal file
13
Datamodels/SearchModels/FilterModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
public class FilterModel
|
||||
{
|
||||
public List<TableModel> TableDescriptions { get; set; }
|
||||
public long Skip { get; set; }
|
||||
public long Take { get; set; }
|
||||
}
|
||||
}
|
||||
11
Datamodels/SearchModels/ResultDataModel.cs
Normal file
11
Datamodels/SearchModels/ResultDataModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
public class ResultDataModel
|
||||
{
|
||||
public List<ResultRowModel> ResultRows { get; set; }
|
||||
}
|
||||
}
|
||||
21
Datamodels/SearchModels/ResultFieldModel.cs
Normal file
21
Datamodels/SearchModels/ResultFieldModel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Datamodels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Field base query Result
|
||||
/// </summary>
|
||||
public class ResultFieldModel
|
||||
{
|
||||
public FieldTypes FieldType { get; set; }
|
||||
public string FieldContent { get; set; }
|
||||
public int FieldContentInt { get; set; }
|
||||
public DateTime FieldContentDate { get; set; }
|
||||
public Decimal FieldContentDecimal { get; set; }
|
||||
public float FieldContentFloat { get; set; }
|
||||
public string FieldContentString { get; set; }
|
||||
}
|
||||
}
|
||||
13
Datamodels/SearchModels/ResultModel.cs
Normal file
13
Datamodels/SearchModels/ResultModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
public class ResultModel
|
||||
{
|
||||
public FilterModel SearchModel { get; set; }
|
||||
public ResultDataModel ResultData { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
11
Datamodels/SearchModels/ResultRowModel.cs
Normal file
11
Datamodels/SearchModels/ResultRowModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
public class ResultRowModel
|
||||
{
|
||||
public List<ResultFieldModel> RowFields { get; set; }
|
||||
}
|
||||
}
|
||||
15
Datamodels/SearchModels/SearchDescription.cs
Normal file
15
Datamodels/SearchModels/SearchDescription.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Datamodels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
|
||||
public class SearchDescription
|
||||
{
|
||||
public SearchObject SearchData { get; set; }
|
||||
public JoinTypes JoinType { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
17
Datamodels/SearchModels/SearchObject.cs
Normal file
17
Datamodels/SearchModels/SearchObject.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Datamodels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
|
||||
public class SearchObject
|
||||
{
|
||||
public List<string> Values { get; set; }
|
||||
public SearchTypes SearchType { get; set; }
|
||||
public PhraseOperators PhraseOperator { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
12
Datamodels/SearchModels/TableModel.cs
Normal file
12
Datamodels/SearchModels/TableModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Datamodels.SearchModels
|
||||
{
|
||||
public sealed class TableModel
|
||||
{
|
||||
public string TableName { get; set; }
|
||||
public string TableAlias { get; set; }
|
||||
public List<FieldModel> Fields { get; set; } = new List<FieldModel>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user