Fungerande version av skiktad lösning Winforms App med SQlite och entity framework

This commit is contained in:
2023-08-23 21:25:09 +02:00
parent 1f39c39d96
commit 40632aa92c
17 changed files with 485 additions and 6 deletions

View File

@ -0,0 +1,26 @@
namespace WinFormDiApp.BL.Helpers;
public static class Extensions
{
public static bool IsNumeric(this string value)
{
if (!string.IsNullOrEmpty(value))
{
if (value.All(char.IsDigit)) return true;
else return false;
}
else return false;
}
public static bool IsDate(this string value) {
if (!string.IsNullOrEmpty(value) && value.Length<20)
{
if (DateTime.TryParse(value, out DateTime date))
{
return true;
}
else return false;
}
else return false;
}
}

View File

@ -0,0 +1,19 @@
using WinFormDiApp.BL.Models.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WinFormDiApp.BL.Models
{
public class AccountRecord : BaseEntity
{
public DateTime BetalDatum { get; set; } = DateTime.MinValue;
public string Mottagare { get; set; } = string.Empty;
public string Konto { get; set; } = string.Empty;
public double Belopp { get; set; }
public string Avisering { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
namespace WinFormDiApp.BL.Models.Common
{
public abstract class BaseEntity
{
[Key]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using WinFormDiApp.BL.Models.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WinFormDiApp.BL.Models;
public class Member : BaseEntity
{
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string NickName { get; set; } = string.Empty;
public string PersonType { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\Enums\" />
</ItemGroup>
</Project>