всё кроме форм
This commit is contained in:
parent
3e46daf0d5
commit
1b0705081f
@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.BusinessLogicsContracts;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.StorageContracts;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace UchetLabBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
public class CheckerLogic : ICheckerLogic
|
||||||
|
{
|
||||||
|
ICheckerStorage _checkerStorage;
|
||||||
|
|
||||||
|
public CheckerLogic(ICheckerStorage checkerStorage)
|
||||||
|
{
|
||||||
|
_checkerStorage = checkerStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_checkerStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
if (_checkerStorage.Delete(model) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckerViewModel? ReadElement(CheckerSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
var element = _checkerStorage.GetElement(model);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CheckerViewModel>? ReadList(CheckerSearchModel? model)
|
||||||
|
{
|
||||||
|
var list = model == null ? _checkerStorage.GetFullList() : _checkerStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_checkerStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private void CheckModel(CheckerBindingModel model, bool withParams = true)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.FIO))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("проверяющий не указан", nameof(model.FIO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
101
WinFormUchetLab/UchetLabBusinessLogic/BusinessLogic/LabLogic.cs
Normal file
101
WinFormUchetLab/UchetLabBusinessLogic/BusinessLogic/LabLogic.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.BusinessLogicsContracts;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.StorageContracts;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace UchetLabBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
public class LabLogic : ILabLogic
|
||||||
|
{
|
||||||
|
ILabStorage _labStorage;
|
||||||
|
|
||||||
|
public LabLogic(ILabStorage labStorage)
|
||||||
|
{
|
||||||
|
_labStorage = labStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(LabBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_labStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(LabBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
if (_labStorage.Delete(model) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabViewModel? ReadElement(LabSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
var element = _labStorage.GetElement(model);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabViewModel>? ReadList(LabSearchModel? model)
|
||||||
|
{
|
||||||
|
var list = model == null ? _labStorage.GetFullList() : _labStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(LabBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_labStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckModel(LabBindingModel model, bool withParams = true)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.LabTask))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет задания лабораторной", nameof(model.LabTask));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.Checker))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет проверяющего лабораторной", nameof(model.Checker));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.TaskImage))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет картинки для лабораторной", nameof(model.TaskImage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\UchetLabContracts\UchetLabContracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabDataModels.Models;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class CheckerBindingModel : ICheckerModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabDataModels.Models;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class LabBindingModel : IlabModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string LabTask { get; set; } = string.Empty;
|
||||||
|
public string TaskImage { get; set; } = string.Empty;
|
||||||
|
public string Checker { get; set; } = string.Empty;
|
||||||
|
public DateTime CheckDate { get; set; } = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface ICheckerLogic
|
||||||
|
{
|
||||||
|
List<CheckerViewModel>? ReadList(CheckerSearchModel? model);
|
||||||
|
CheckerViewModel? ReadElement(CheckerSearchModel model);
|
||||||
|
bool Create(CheckerBindingModel model);
|
||||||
|
bool Update(CheckerBindingModel model);
|
||||||
|
bool Delete(CheckerBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface ILabLogic
|
||||||
|
{
|
||||||
|
List<LabViewModel>? ReadList(LabSearchModel? model);
|
||||||
|
LabViewModel? ReadElement(LabSearchModel model);
|
||||||
|
bool Create(LabBindingModel model);
|
||||||
|
bool Update(LabBindingModel model);
|
||||||
|
bool Delete(LabBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class CheckerSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class LabSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.StorageContracts
|
||||||
|
{
|
||||||
|
public interface ICheckerStorage
|
||||||
|
{
|
||||||
|
List<CheckerViewModel> GetFullList();
|
||||||
|
List<CheckerViewModel> GetFilteredList(CheckerSearchModel model);
|
||||||
|
CheckerViewModel? GetElement(CheckerSearchModel model);
|
||||||
|
CheckerViewModel? Insert(CheckerBindingModel model);
|
||||||
|
CheckerViewModel? Update(CheckerBindingModel model);
|
||||||
|
CheckerViewModel? Delete(CheckerBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.StorageContracts
|
||||||
|
{
|
||||||
|
public interface ILabStorage
|
||||||
|
{
|
||||||
|
List<LabViewModel> GetFullList();
|
||||||
|
List<LabViewModel> GetFilteredList(LabSearchModel model);
|
||||||
|
LabViewModel? GetElement(LabSearchModel model);
|
||||||
|
LabViewModel? Insert(LabBindingModel model);
|
||||||
|
LabViewModel? Update(LabBindingModel model);
|
||||||
|
LabViewModel? Delete(LabBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
13
WinFormUchetLab/UchetLabContracts/UchetLabContracts.csproj
Normal file
13
WinFormUchetLab/UchetLabContracts/UchetLabContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\UchetLabDataModels\UchetLabDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabDataModels.Models;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class CheckerViewModel : ICheckerModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
18
WinFormUchetLab/UchetLabContracts/ViewModels/LabViewModel.cs
Normal file
18
WinFormUchetLab/UchetLabContracts/ViewModels/LabViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabDataModels.Models;
|
||||||
|
|
||||||
|
namespace UchetLabContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class LabViewModel : IlabModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string LabTask { get; set; } = string.Empty;
|
||||||
|
public string TaskImage { get; set; } = string.Empty;
|
||||||
|
public string Checker { get; set; } = string.Empty;
|
||||||
|
public DateTime CheckDate { get; set; } = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
13
WinFormUchetLab/UchetLabDataModels/Models/ICheckerModel.cs
Normal file
13
WinFormUchetLab/UchetLabDataModels/Models/ICheckerModel.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace UchetLabDataModels.Models
|
||||||
|
{
|
||||||
|
public interface ICheckerModel
|
||||||
|
{
|
||||||
|
public string FIO { get;}
|
||||||
|
}
|
||||||
|
}
|
16
WinFormUchetLab/UchetLabDataModels/Models/IlabModel.cs
Normal file
16
WinFormUchetLab/UchetLabDataModels/Models/IlabModel.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace UchetLabDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IlabModel
|
||||||
|
{
|
||||||
|
public string LabTask { get; }
|
||||||
|
public string TaskImage { get; }
|
||||||
|
public string Checker { get; }
|
||||||
|
public DateTime CheckDate { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,111 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.StorageContracts;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
using UchetLabDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class CheckerStorage : ICheckerStorage
|
||||||
|
{
|
||||||
|
public CheckerViewModel? Delete(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
var element = context.Checkers.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Checkers.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckerViewModel? GetElement(CheckerSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
return context.Checkers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CheckerViewModel> GetFilteredList(CheckerSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
return context.Checkers
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CheckerViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
return context.Checkers
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckerViewModel? Insert(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var newEl = Checker.Create(model);
|
||||||
|
if (newEl == null)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Checkers.Add(newEl);
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
context.Database.CommitTransaction();
|
||||||
|
|
||||||
|
return newEl.GetViewModel;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckerViewModel? Update(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var el = context.Checkers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (el == null)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
el.Update(model);
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
context.Database.CommitTransaction();
|
||||||
|
|
||||||
|
return el.GetViewModel;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.SearchModels;
|
||||||
|
using UchetLabContracts.StorageContracts;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
using UchetLabDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class LabStorage : ILabStorage
|
||||||
|
{
|
||||||
|
public LabViewModel? Delete(LabBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
var element = context.Labs.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Labs.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabViewModel? GetElement(LabSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
return context.Labs.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabViewModel> GetFilteredList(LabSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
return context.Labs
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
return context.Labs
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabViewModel? Insert(LabBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var newEl = Lab.Create(model);
|
||||||
|
if (newEl == null)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Labs.Add(newEl);
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
context.Database.CommitTransaction();
|
||||||
|
|
||||||
|
return newEl.GetViewModel;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabViewModel? Update(LabBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new UchetLabDataBase();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var el = context.Labs.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (el == null)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
el.Update(model);
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
context.Database.CommitTransaction();
|
||||||
|
|
||||||
|
return el.GetViewModel;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
75
WinFormUchetLab/UchetLabDatabaseImplement/Migrations/20241006183154_InitialCreate.Designer.cs
generated
Normal file
75
WinFormUchetLab/UchetLabDatabaseImplement/Migrations/20241006183154_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using UchetLabDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(UchetLabDataBase))]
|
||||||
|
[Migration("20241006183154_InitialCreate")]
|
||||||
|
partial class InitialCreate
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.16")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("UchetLabDatabaseImplement.Models.Checker", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Checker");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("UchetLabDatabaseImplement.Models.Lab", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CheckDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Checker")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("LabTask")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("TaskImage")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Labs");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialCreate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Checker",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Checker", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Labs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
LabTask = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
TaskImage = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Checker = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
CheckDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Labs", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Checker");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Labs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using UchetLabDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(UchetLabDataBase))]
|
||||||
|
partial class UchetLabDataBaseModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.16")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("UchetLabDatabaseImplement.Models.Checker", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Checker");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("UchetLabDatabaseImplement.Models.Lab", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CheckDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Checker")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("LabTask")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("TaskImage")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Labs");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
WinFormUchetLab/UchetLabDatabaseImplement/Models/Checker.cs
Normal file
37
WinFormUchetLab/UchetLabDatabaseImplement/Models/Checker.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
using UchetLabDataModels.Models;
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Checker : ICheckerModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
[Required]
|
||||||
|
public string FIO { get; private set; } = string.Empty;
|
||||||
|
public static Checker? Create(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
return new Checker()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
FIO = model.FIO,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(CheckerBindingModel model)
|
||||||
|
{
|
||||||
|
FIO = model.FIO;
|
||||||
|
}
|
||||||
|
public CheckerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
FIO = FIO,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
51
WinFormUchetLab/UchetLabDatabaseImplement/Models/Lab.cs
Normal file
51
WinFormUchetLab/UchetLabDatabaseImplement/Models/Lab.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.StorageContracts;
|
||||||
|
using UchetLabContracts.ViewModels;
|
||||||
|
using UchetLabDataModels.Models;
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Lab : IlabModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
[Required]
|
||||||
|
public string LabTask { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string TaskImage { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Checker { get; private set; } = string.Empty;
|
||||||
|
public DateTime CheckDate { get; private set; } = DateTime.Now;
|
||||||
|
public static Lab? Create(LabBindingModel model)
|
||||||
|
{
|
||||||
|
return new Lab()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
LabTask = model.LabTask,
|
||||||
|
TaskImage = model.TaskImage,
|
||||||
|
Checker = model.Checker,
|
||||||
|
CheckDate = model.CheckDate,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(LabBindingModel model)
|
||||||
|
{
|
||||||
|
LabTask = model.LabTask;
|
||||||
|
TaskImage = model.TaskImage;
|
||||||
|
Checker = model.Checker;
|
||||||
|
CheckDate = model.CheckDate;
|
||||||
|
}
|
||||||
|
public LabViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
LabTask = LabTask,
|
||||||
|
TaskImage = TaskImage,
|
||||||
|
Checker = Checker,
|
||||||
|
CheckDate = CheckDate,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UchetLabDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace UchetLabDatabaseImplement
|
||||||
|
{
|
||||||
|
public class UchetLabDataBase : DbContext
|
||||||
|
{
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
if (optionsBuilder.IsConfigured == false)
|
||||||
|
{
|
||||||
|
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=UchetLabDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
||||||
|
}
|
||||||
|
base.OnConfiguring(optionsBuilder);
|
||||||
|
}
|
||||||
|
public virtual DbSet<Lab> Labs { set; get; }
|
||||||
|
public virtual DbSet<Checker> Checkers { set; get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\UchetLabContracts\UchetLabContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\UchetLabDataModels\UchetLabDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
49
WinFormUchetLab/WinFormUchetLab.sln
Normal file
49
WinFormUchetLab/WinFormUchetLab.sln
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.11.35208.52
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormUchetLab", "WinFormUchetLab\WinFormUchetLab.csproj", "{C8C620EA-CCC9-4031-8753-57647F65440E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabDataModels", "UchetLabDataModels\UchetLabDataModels.csproj", "{AC162555-3770-4CB5-A5DF-7F85135D49B4}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabContracts", "UchetLabContracts\UchetLabContracts.csproj", "{4DF262DD-81DF-4B26-8978-5334DE8E9F67}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabBusinessLogic", "UchetLabBusinessLogic\UchetLabBusinessLogic.csproj", "{D7D2300F-78BE-49A4-9733-1A2B52192864}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabDatabaseImplement", "UchetLabDatabaseImplement\UchetLabDatabaseImplement.csproj", "{F6CB8BDD-E2B3-4449-B150-7D67FA013611}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C8C620EA-CCC9-4031-8753-57647F65440E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C8C620EA-CCC9-4031-8753-57647F65440E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C8C620EA-CCC9-4031-8753-57647F65440E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C8C620EA-CCC9-4031-8753-57647F65440E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AC162555-3770-4CB5-A5DF-7F85135D49B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AC162555-3770-4CB5-A5DF-7F85135D49B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AC162555-3770-4CB5-A5DF-7F85135D49B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AC162555-3770-4CB5-A5DF-7F85135D49B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4DF262DD-81DF-4B26-8978-5334DE8E9F67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DF262DD-81DF-4B26-8978-5334DE8E9F67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4DF262DD-81DF-4B26-8978-5334DE8E9F67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4DF262DD-81DF-4B26-8978-5334DE8E9F67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D7D2300F-78BE-49A4-9733-1A2B52192864}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D7D2300F-78BE-49A4-9733-1A2B52192864}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D7D2300F-78BE-49A4-9733-1A2B52192864}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D7D2300F-78BE-49A4-9733-1A2B52192864}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {8146D85F-915C-4290-A88E-599819ADEFDD}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
58
WinFormUchetLab/WinFormUchetLab/Form1.Designer.cs
generated
Normal file
58
WinFormUchetLab/WinFormUchetLab/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
namespace WinFormUchetLab
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
controlDataTableTable1 = new ControlsLibraryNet60.Data.ControlDataTableTable();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// controlDataTableTable1
|
||||||
|
//
|
||||||
|
controlDataTableTable1.Location = new Point(0, 0);
|
||||||
|
controlDataTableTable1.Margin = new Padding(4, 5, 4, 5);
|
||||||
|
controlDataTableTable1.Name = "controlDataTableTable1";
|
||||||
|
controlDataTableTable1.SelectedRowIndex = -1;
|
||||||
|
controlDataTableTable1.Size = new Size(799, 447);
|
||||||
|
controlDataTableTable1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(controlDataTableTable1);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ControlsLibraryNet60.Data.ControlDataTableTable controlDataTableTable1;
|
||||||
|
}
|
||||||
|
}
|
15
WinFormUchetLab/WinFormUchetLab/Form1.cs
Normal file
15
WinFormUchetLab/WinFormUchetLab/Form1.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
using UchetLabContracts.BindingModels;
|
||||||
|
using UchetLabContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
|
namespace WinFormUchetLab
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
WinFormUchetLab/WinFormUchetLab/Form1.resx
Normal file
120
WinFormUchetLab/WinFormUchetLab/Form1.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
17
WinFormUchetLab/WinFormUchetLab/Program.cs
Normal file
17
WinFormUchetLab/WinFormUchetLab/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace WinFormUchetLab
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
WinFormUchetLab/WinFormUchetLab/WinFormUchetLab.csproj
Normal file
29
WinFormUchetLab/WinFormUchetLab/WinFormUchetLab.csproj
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
|
||||||
|
<PackageReference Include="ControlsLibraryNet60" Version="1.0.0" />
|
||||||
|
<PackageReference Include="CustomComponents" Version="1.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Non_visual_components_Kouvshinoff" Version="1.0.0" />
|
||||||
|
<PackageReference Include="Visual_components_Kouvshinoff" Version="1.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\UchetLabBusinessLogic\UchetLabBusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\UchetLabContracts\UchetLabContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\UchetLabDatabaseImplement\UchetLabDatabaseImplement.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user