Compare commits
No commits in common. "cee98c8a702ac492293697039ad3e82100dd6249" and "aaa9b16759e274483dd8b052cae015298d44ded3" have entirely different histories.
cee98c8a70
...
aaa9b16759
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class BackUpSaveBinidngModel
|
|
||||||
{
|
|
||||||
public string FolderName { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ConfectioneryContracts.BindingModels;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IBackUpLogic
|
|
||||||
{
|
|
||||||
void CreateBackUp(BackUpSaveBinidngModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.StoragesContracts
|
|
||||||
{
|
|
||||||
public interface IBackUpInfo
|
|
||||||
{
|
|
||||||
List<T>? GetList<T>() where T : class, new();
|
|
||||||
|
|
||||||
Type? GetTypeByModelInterface(string modelInterfaceName);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,11 +10,10 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ComponentViewModel : IComponentModel
|
public class ComponentViewModel : IComponentModel
|
||||||
{
|
{
|
||||||
[Column(visible: false)]
|
public int Id { get; set; }
|
||||||
public int Id { get; set; }
|
[DisplayName("Название компонента")]
|
||||||
[Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
public string ComponentName { get; set; } = string.Empty;
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
[DisplayName("Цена")]
|
||||||
[Column(title: "Цена", width: 150)]
|
public double Cost { get; set; }
|
||||||
public double Cost { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,19 +10,18 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ImplementerViewModel : IImplementerModel
|
public class ImplementerViewModel : IImplementerModel
|
||||||
{
|
{
|
||||||
[Column(visible: false)]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
[DisplayName("ФИО исполнителя")]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(title: "Пароль", width: 100)]
|
[DisplayName("Пароль")]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(title: "Стаж работы", width: 60)]
|
[DisplayName("Стаж работы")]
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
|
|
||||||
[Column(title: "Квалификация", width: 60)]
|
[DisplayName("Квалификация")]
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,23 +10,20 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class MessageInfoViewModel : IMessageInfoModel
|
public class MessageInfoViewModel : IMessageInfoModel
|
||||||
{
|
{
|
||||||
[Column(visible: false)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[Column(visible: false)]
|
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
[Column(visible: false)]
|
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
[Column(title: "Отправитель", width: 150)]
|
[DisplayName("Отправитель")]
|
||||||
public string SenderName { get; set; } = string.Empty;
|
public string SenderName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(title: "Дата письма", width: 120)]
|
[DisplayName("Дата письма")]
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
|
|
||||||
[Column(title: "Заголовок", width: 120)]
|
[DisplayName("Заголовок")]
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
[DisplayName("Текст")]
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using ConfectioneryDataModels.Enums;
|
using ConfectioneryDataModels.Enums;
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -12,32 +11,28 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class OrderViewModel : IOrderModel
|
public class OrderViewModel : IOrderModel
|
||||||
{
|
{
|
||||||
[Column(title: "Номер", width: 90)]
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Column(visible: false)]
|
public int ClientId { get; set; }
|
||||||
public int ClientId { get; set; }
|
|
||||||
|
|
||||||
[Column(title: "ФИО клиента", width: 190)]
|
[DisplayName("ФИО клиента")]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
[Column(visible: false)]
|
|
||||||
public string ClientEmail { get; set; } = string.Empty;
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
[Column(visible: false)]
|
|
||||||
public int? ImplementerId { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
[Column(title: "Исполнитель", width: 150)]
|
[DisplayName("Исполнитель")]
|
||||||
public string? ImplementerFIO { get; set; } = null;
|
public string? ImplementerFIO { get; set; } = null;
|
||||||
[Column(visible: false)]
|
|
||||||
public int PastryId { get; set; }
|
public int PastryId { get; set; }
|
||||||
[Column(title: "Изделие", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
[DisplayName("Изделие")]
|
||||||
public string PastryName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
[Column(title: "Количество", width: 100)]
|
[DisplayName("Количество")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
[Column(title: "Сумма", width: 120)]
|
[DisplayName("Сумма")]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
[Column(title: "Статус", width: 70)]
|
[DisplayName("Статус")]
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
[Column(title: "Дата создания", width: 120)]
|
[DisplayName("Дата создания")]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[Column(title: "Дата выполнения", width: 120)]
|
[DisplayName("Дата выполнения")]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,13 +10,11 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class PastryViewModel : IPastryModel
|
public class PastryViewModel : IPastryModel
|
||||||
{
|
{
|
||||||
[Column(visible: false)]
|
public int Id { get; set; }
|
||||||
public int Id { get; set; }
|
[DisplayName("Название изделия")]
|
||||||
[Column(title: "Название изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
public string PastryName { get; set; } = string.Empty;
|
||||||
public string PastryName { get; set; } = string.Empty;
|
[DisplayName("Цена")]
|
||||||
[Column(title: "Цена", width: 70)]
|
public double Price { get; set; }
|
||||||
public double Price { get; set; }
|
public Dictionary<int, (IComponentModel, int)> PastryComponents { get; set; } = new();
|
||||||
[Column(visible: false)]
|
|
||||||
public Dictionary<int, (IComponentModel, int)> PastryComponents { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryDataModels.Models
|
namespace ConfectioneryDataModels.Models
|
||||||
{
|
{
|
||||||
public interface IClientModel : IId
|
public interface IClientModel
|
||||||
{
|
{
|
||||||
string ClientFIO { get; }
|
string ClientFIO { get; }
|
||||||
string Email { get; }
|
string Email { get; }
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryDatabaseImplement.Implements
|
|
||||||
{
|
|
||||||
public class BackUpInfo : IBackUpInfo
|
|
||||||
{
|
|
||||||
public List<T>? GetList<T>() where T : class, new()
|
|
||||||
{
|
|
||||||
using var context = new ConfectioneryDatabase();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
|
|
||||||
namespace ConfectioneryView
|
|
||||||
{
|
|
||||||
public static class DataGridViewExtension
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
if (property == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"В типе {type.Name} не найдено свойство с именем {column.Name}");
|
|
||||||
}
|
|
||||||
var attribute = property.GetCustomAttributes(typeof(ColumnAttribute), true)?.SingleOrDefault();
|
|
||||||
if (attribute == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"Не найден атрибут типа ColumnAttribute для свойства {property.Name}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attribute is ColumnAttribute columnAttr)
|
|
||||||
{
|
|
||||||
column.HeaderText = columnAttr.Title;
|
|
||||||
column.Visible = columnAttr.Visible;
|
|
||||||
if (columnAttr.IsUseAutoSize)
|
|
||||||
{
|
|
||||||
column.AutoSizeMode = (DataGridViewAutoSizeColumnMode)Enum.Parse(typeof(DataGridViewAutoSizeColumnMode), columnAttr.GridViewAutoSize.ToString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
column.Width = columnAttr.Width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -35,8 +35,14 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
_logger.LogInformation("Загрузка списка клиентов");
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка списка клиентов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -44,8 +44,15 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ComponentName"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка компонентов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,14 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerFIO"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка исполнителей");
|
_logger.LogInformation("Загрузка исполнителей");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -28,7 +28,15 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["MessageId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["Body"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка почтовых собщений");
|
_logger.LogInformation("Загрузка почтовых собщений");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -37,7 +37,17 @@ namespace ConfectioneryView
|
|||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_orderLogic.ReadList(null));
|
var list = _orderLogic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["PastryId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientEmail"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
|
dataGridView.Columns["PastryName"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -32,8 +32,16 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
_logger.LogInformation("Загрузка кондитерского изделия");
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["PastryComponents"].Visible = false;
|
||||||
|
dataGridView.Columns["PastryName"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка кондитерского изделия");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user