Eliseev E.E. LabWork08_Hard #18

Closed
ElEgEv wants to merge 12 commits from LabWork08_Hard into LabWork07_Hard
16 changed files with 49 additions and 12 deletions
Showing only changes of commit ebed3c5c1d - Show all commits

2
.gitignore vendored
View File

@ -14,6 +14,8 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
ImplementationExtensions
# Mono auto generated files
mono_crash.*

View File

@ -17,9 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlacksmithWorkshopFileImple
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlacksmithWorkshopDatabaseImplement", "BlacksmithWorkshopDatabaseImplement\BlacksmithWorkshopDatabaseImplement.csproj", "{EE03BAE3-52EE-4E3B-8992-382D89E61E1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlacksmithWorkshopRestApi", "BlackmithWorkshopRestApi\BlacksmithWorkshopRestApi.csproj", "{23DBD9A3-2107-44AB-8B87-6982BFD2E69A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlacksmithWorkshopRestApi", "BlackmithWorkshopRestApi\BlacksmithWorkshopRestApi.csproj", "{23DBD9A3-2107-44AB-8B87-6982BFD2E69A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlacksmithWorkshopClientApp", "BlacksmithWorkshopClientApp\BlacksmithWorkshopClientApp.csproj", "{FCA95914-11AF-494A-8116-BB7B3253D925}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlacksmithWorkshopClientApp", "BlacksmithWorkshopClientApp\BlacksmithWorkshopClientApp.csproj", "{FCA95914-11AF-494A-8116-BB7B3253D925}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -18,8 +18,10 @@ namespace BlacksmithWorkshop
grid.DataSource = data;
//получаем тип
var type = typeof(T);
//получаем свойства
var properties = type.GetProperties();
foreach (DataGridViewColumn column in grid.Columns)

View File

@ -19,6 +19,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic
private readonly ILogger _logger;
private readonly IBackUpInfo _backUpInfo;
public BackUpLogic(ILogger<BackUpLogic> logger, IBackUpInfo backUpInfo)
{
_logger = logger;
@ -40,6 +41,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic
if (dirInfo.Exists)
{
//НЕ ВЫБИРАЕМ РАБОЧИЙ СТОЛ, ИНАЧЕ ВСЁ С НЕГО УДАЛИТСЯ
foreach (var file in dirInfo.GetFiles())
{
file.Delete();
@ -73,6 +75,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic
foreach (var type in types)
{
//проверка на то, является ли тип интерфейсом и унаследован ли он от IId
if (type.IsInterface && type.GetInterface(typeIId.Name) != null)
{
var modelType = _backUpInfo.GetTypeByModelInterface(type.Name);
@ -114,6 +117,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic
return;
}
//три строчки ниже - сериализация файлов в json
var jsonFormatter = new DataContractJsonSerializer(typeof(List<T>));
using var fs = new FileStream(string.Format("{0}/{1}.json", folderName, typeof(T).Name), FileMode.OpenOrCreate);

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.Attributes
{
//указываем, что данный атрибут можно прописать только в Property
[AttributeUsage(AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{

View File

@ -9,7 +9,9 @@ namespace BlacksmithWorkshopContracts.BindingModels
{
public class MessageInfoBindingModel : IMessageInfoModel
{
public string MessageId { get; set; } = string.Empty;
public int Id { get; set; }
public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; }
@ -20,5 +22,5 @@ namespace BlacksmithWorkshopContracts.BindingModels
public string Subject { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty;
}
}
}

View File

@ -10,6 +10,7 @@ namespace BlacksmithWorkshopContracts.DI
//Интерфейс для регистрации зависимостей в модулях
public interface IImplementationExtension
{
//для установления приоритета
public int Priority { get; }
//Регистрация сервисов

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopDataModels.Models;
using BlacksmithWorkshopContracts.Attributes;
using BlacksmithWorkshopDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,12 +11,16 @@ namespace BlacksmithWorkshopContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
[Column(visible: false)]
public int Id { get; set; }
[Column(title: "ФИО клиента", width: 150)]
public string ClientFIO { get; set; } = string.Empty;
[Column(title: "Логие (эл. почта)", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Email { get; set; } = string.Empty;
[Column(title: "Пароль", width: 150)]
public string Password { get; set; } = string.Empty;
}

View File

@ -10,7 +10,9 @@ namespace BlacksmithWorkshopContracts.ViewModels
{
public class MessageInfoViewModel : IMessageInfoModel
{
public string MessageId { get; set; } = string.Empty;
public int Id { get; set; }
public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; }

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopDataModels.Models
{
public interface IMessageInfoModel
public interface IMessageInfoModel : IId
{
string MessageId { get; }

View File

@ -20,4 +20,8 @@
<ProjectReference Include="..\BlacksmithWorkshopDataModels\BlacksmithWorkshopDataModels.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project>

View File

@ -12,7 +12,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Models
{
public class MessageInfo : IMessageInfoModel
{
[Key]
public int Id { get; set; }
[Key]
public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; }

View File

@ -11,4 +11,8 @@
<ProjectReference Include="..\BlacksmithWorkshopDataModels\BlacksmithWorkshopDataModels.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project>

View File

@ -14,7 +14,9 @@ namespace BlacksmithWorkshopFileImplement.Models
{
public class MessageInfo : IMessageInfoModel
{
public string MessageId { get; private set; } = string.Empty;
public int Id { get; private set; }
public string MessageId { get; private set; } = string.Empty;
public int? ClientId { get; private set; }
@ -94,5 +96,5 @@ namespace BlacksmithWorkshopFileImplement.Models
new XElement("Body", Body),
new XElement("Subject", Subject),
new XElement("DateDelivery", DateDelivery.ToString()));
}
}
}

View File

@ -11,4 +11,8 @@
<ProjectReference Include="..\BlacksmithWorkshopDataModels\BlacksmithWorkshopDataModels.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project>

View File

@ -12,7 +12,9 @@ namespace BlacksmithWorkshopListImplement.Models
{
public class MessageInfo : IMessageInfoModel
{
public string MessageId { get; private set; } = string.Empty;
public int Id { get; private set; }
public string MessageId { get; private set; } = string.Empty;
public int? ClientId { get; private set; }
@ -69,5 +71,5 @@ namespace BlacksmithWorkshopListImplement.Models
Subject = Subject,
Body = Body
};
}
}
}