This commit is contained in:
RavilGismatullin 2024-04-30 17:44:37 +03:00
parent 330fc031dc
commit e9db19f09b
12 changed files with 230 additions and 7 deletions

View File

@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.6.33717.318 VisualStudioVersion = 17.6.33717.318
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationContracts", "ServiceStationContracts\ServiceStationContracts.csproj", "{3EDBD45F-CA76-4AD6-BE55-17FF18507EB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationDataModels", "ServiceStationDataModels\ServiceStationDataModels.csproj", "{431172B6-C074-45F3-8064-4D8D7F3F9FD2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationDataModels", "ServiceStationDataModels\ServiceStationDataModels.csproj", "{431172B6-C074-45F3-8064-4D8D7F3F9FD2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStationsDataBaseImplement", "ServiceStationsDataBaseImplement\ServiceStationsDataBaseImplement.csproj", "{71AAE393-32B8-4E7C-8EC2-C0D98F5E3FCF}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3EDBD45F-CA76-4AD6-BE55-17FF18507EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EDBD45F-CA76-4AD6-BE55-17FF18507EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EDBD45F-CA76-4AD6-BE55-17FF18507EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EDBD45F-CA76-4AD6-BE55-17FF18507EB1}.Release|Any CPU.Build.0 = Release|Any CPU
{431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Debug|Any CPU.Build.0 = Debug|Any CPU {431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Release|Any CPU.ActiveCfg = Release|Any CPU {431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Release|Any CPU.Build.0 = Release|Any CPU {431172B6-C074-45F3-8064-4D8D7F3F9FD2}.Release|Any CPU.Build.0 = Release|Any CPU
{71AAE393-32B8-4E7C-8EC2-C0D98F5E3FCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71AAE393-32B8-4E7C-8EC2-C0D98F5E3FCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71AAE393-32B8-4E7C-8EC2-C0D98F5E3FCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71AAE393-32B8-4E7C-8EC2-C0D98F5E3FCF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -6,4 +6,8 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStationDataModels\ServiceStationDataModels.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface ICategoryWorkStorage
{
List<CategoryWorkViewModel> GetFullList();
List<CategoryWorkViewModel> GetFilteredList(CategoryWorkSearchModel model);
CategoryWorkViewModel? GetElement(CategoryWorkSearchModel model);
CategoryWorkViewModel? Insert(CategoryWorkBindingModel model);
CategoryWorkViewModel? Update(CategoryWorkBindingModel model);
CategoryWorkViewModel? Delete(CategoryWorkBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface IClientStorage
{
List<ClientViewModel> GetFullList();
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
ClientViewModel? GetElement(ClientSearchModel model);
ClientViewModel? Insert(ClientBindingModel model);
ClientViewModel? Update(ClientBindingModel model);
ClientViewModel? Delete(ClientBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface IClientWorkStorage
{
List<ClientWorkViewModel> GetFullList();
List<ClientWorkViewModel> GetFilteredList(ClientWorkSearchModel model);
ClientWorkViewModel? GetElement(ClientWorkSearchModel model);
ClientWorkViewModel? Insert(ClientWorkBindingModel model);
ClientWorkViewModel? Update(ClientWorkBindingModel model);
ClientWorkViewModel? Delete(ClientWorkBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface IExecutorStorage
{
List<ExecutorViewModel> GetFullList();
List<ExecutorViewModel> GetFilteredList(ExecutorSearchModel model);
ExecutorViewModel? GetElement(ExecutorSearchModel model);
ExecutorViewModel? Insert(ExecutorBindingModel model);
ExecutorViewModel? Update(ExecutorBindingModel model);
ExecutorViewModel? Delete(ExecutorBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface IReportStorage
{
List<ReportViewModel> GetFullList();
List<ReportViewModel> GetFilteredList(ReportSearchModel model);
ReportViewModel? GetElement(ReportSearchModel model);
ReportViewModel? Insert(ReportBindingModel model);
ReportViewModel? Update(ReportBindingModel model);
ReportViewModel? Delete(ReportBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface IWorkStorage
{
List<WorkViewModel> GetFullList();
List<WorkViewModel> GetFilteredList(WorkSearchModel model);
WorkViewModel? GetElement(WorkSearchModel model);
WorkViewModel? Insert(WorkBindingModel model);
WorkViewModel? Update(WorkBindingModel model);
WorkViewModel? Delete(WorkBindingModel model);
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace ServiceStationDataModels namespace ServiceStationDataModels
{ {
public interface IClientWorkModel public interface IClientStorage
{ {
int ClientId { get; } int ClientId { get; }
int WorkId { get; } int WorkId { get; }

View File

@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore;
using ServiceStationsDataBaseImplement.Models;
using System.Collections.Generic;
using System.Data;
namespace ServiceStationsDataBaseImplement
{
public class Database : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder
optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Client> Clients { set; get; }
}
}

View File

@ -0,0 +1,48 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using ServiceStationsContracts.StorageContracts;
namespace ServiceStationsDataBaseImplement.Implements
{
public class ClientStorage : IClientStorage
{
public ClientViewModel? Delete(ClientBindingModel model)
{
using var context = new Database();
var element = context.Clients.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
context.Clients.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
return null;
}
public ClientViewModel? GetElement(ClientSearchModel model)
{
throw new NotImplementedException();
}
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{
throw new NotImplementedException();
}
public List<ClientViewModel> GetFullList()
{
throw new NotImplementedException();
}
public ClientViewModel? Insert(ClientBindingModel model)
{
throw new NotImplementedException();
}
public ClientViewModel? Update(ClientBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.18">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStationDataModels\ServiceStationDataModels.csproj" />
</ItemGroup>
</Project>