fixed ViewModels
This commit is contained in:
parent
e827e57c6b
commit
d509fd016f
@ -0,0 +1,7 @@
|
||||
namespace AutoWorkshopContracts.BindingModels
|
||||
{
|
||||
public class BackUpSaveBinidngModel
|
||||
{
|
||||
public string FolderName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using AutoWorkshopContracts.BindingModels;
|
||||
|
||||
namespace AutoWorkshopContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IBackUpLogic
|
||||
{
|
||||
void CreateBackUp(BackUpSaveBinidngModel model);
|
||||
}
|
||||
}
|
9
AutoWorkshopContracts/StoragesContracts/IBackUpInfo.cs
Normal file
9
AutoWorkshopContracts/StoragesContracts/IBackUpInfo.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace AutoWorkshopContracts.StoragesContracts
|
||||
{
|
||||
public interface IBackUpInfo
|
||||
{
|
||||
List<T>? GetList<T>() where T : class, new();
|
||||
|
||||
Type? GetTypeByModelInterface(string modelInterfaceName);
|
||||
}
|
||||
}
|
@ -5,7 +5,8 @@ namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Column(Visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Title: "ФИО клиента", Width: 150)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
@ -5,7 +5,8 @@ namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class ComponentViewModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Column(Visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Title: "Название компонента", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
@ -5,18 +5,19 @@ namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class ImplementerViewModel : IImplementerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Column(Visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Title: "ФИО исполнителя", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
[Column(Title: "ФИО исполнителя", GridViewAutoSize: GridViewAutoSize.AllCells, IsUseAutoSize: true)]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(Title: "Пароль", Width: 100)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[Column(Title: "Стаж работы", Width: 60)]
|
||||
[Column(Title: "Стаж работы", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public int WorkExperience { get; set; }
|
||||
|
||||
[Column(Title: "Квалификация", Width: 60)]
|
||||
[Column(Title: "Квалификация", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,19 +6,19 @@ namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[Column(Title: "Номер", Width: 90)]
|
||||
[Column(Title: "Номер", GridViewAutoSize: GridViewAutoSize.AllCells, IsUseAutoSize: true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Visible: false)]
|
||||
public int RepairId { get; set; }
|
||||
|
||||
[Column(Title: "Ремонт", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
[Column(Title: "Ремонт", GridViewAutoSize: GridViewAutoSize.AllCells, IsUseAutoSize: true)]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
|
||||
[Column(Visible: false)]
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[Column(Title: "Клиент", Width: 190)]
|
||||
[Column(Title: "Клиент", Width: 120)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(Title: "Почта клиента", Width: 190)]
|
||||
@ -27,13 +27,13 @@ namespace AutoWorkshopContracts.ViewModels
|
||||
[Column(Visible: false)]
|
||||
public int? ImplementerId { get; set; }
|
||||
|
||||
[Column(Title: "Исполнитель", Width: 150)]
|
||||
[Column(Title: "Исполнитель", Width: 120)]
|
||||
public string? ImplementerFIO { get; set; }
|
||||
|
||||
[Column(Title: "Количество", Width: 100)]
|
||||
public int Count { get; set; }
|
||||
|
||||
[Column(Title: "Сумма", Width: 120)]
|
||||
[Column(Title: "Сумма", Width: 75)]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[Column(Title: "Статус", Width: 70)]
|
||||
|
32
AutoWorkshopDatabaseImplement/Implements/BackUpInfo.cs
Normal file
32
AutoWorkshopDatabaseImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using AutoWorkshopContracts.StoragesContracts;
|
||||
|
||||
namespace AutoWorkshopDatabaseImplement.Implements
|
||||
{
|
||||
public class BackUpInfo : IBackUpInfo
|
||||
{
|
||||
public List<T>? GetList<T>() where T : class, new()
|
||||
{
|
||||
using var Context = new AutoWorkshopDatabase();
|
||||
|
||||
return Context
|
||||
.Set<T>()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public Type? GetTypeByModelInterface(string ModelInterfaceName)
|
||||
{
|
||||
var Assembly = typeof(BackUpInfo).Assembly;
|
||||
var Types = Assembly.GetTypes();
|
||||
|
||||
foreach (var Type in Types)
|
||||
{
|
||||
if (Type.IsClass && Type.GetInterface(ModelInterfaceName) != null)
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,13 +7,13 @@ namespace AutoWorkshopView
|
||||
public static void FillAndConfigGrid<T>(this DataGridView Grid, List<T>? Data)
|
||||
{
|
||||
if (Data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Grid.DataSource = Data;
|
||||
|
||||
var Type = typeof(T);
|
||||
var Properties = Type.GetProperties();
|
||||
|
||||
foreach (DataGridViewColumn Column in Grid.Columns)
|
||||
{
|
||||
var Property = Properties.FirstOrDefault(x => x.Name == Column.Name);
|
||||
@ -28,7 +28,7 @@ namespace AutoWorkshopView
|
||||
{
|
||||
Column.HeaderText = СolumnAttr.Title;
|
||||
Column.Visible = СolumnAttr.Visible;
|
||||
|
||||
|
||||
if (СolumnAttr.IsUseAutoSize)
|
||||
{
|
||||
Column.AutoSizeMode = (DataGridViewAutoSizeColumnMode)Enum.Parse(typeof(DataGridViewAutoSizeColumnMode), СolumnAttr.GridViewAutoSize.ToString());
|
||||
|
Loading…
Reference in New Issue
Block a user