доделал x2
This commit is contained in:
parent
9d88e30f10
commit
0b7cbc388f
@ -15,15 +15,34 @@ namespace ConfectioneryBusinessLogic
|
|||||||
public class MessageInfoLogic : IMessageInfoLogic
|
public class MessageInfoLogic : IMessageInfoLogic
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IMessageInfoStorage _messageInfoStorage;
|
private readonly IMessageInfoStorage _messageInfoStorage;
|
||||||
public MessageInfoLogic(ILogger<MessageInfoLogic> logger, IMessageInfoStorage MessageInfoStorage)
|
|
||||||
|
private readonly IClientStorage _clientStorage;
|
||||||
|
|
||||||
|
public MessageInfoLogic(ILogger<MessageInfoLogic> logger, IMessageInfoStorage messageInfoStorage, IClientStorage clientStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_messageInfoStorage = MessageInfoStorage;
|
_messageInfoStorage = messageInfoStorage;
|
||||||
|
_clientStorage = clientStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. MessageId: {MessageId}. ClientId: {ClientId}", model?.MessageId, model?.ClientId);
|
||||||
|
var list = model == null ? _messageInfoStorage.GetFullList() : _messageInfoStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Create(MessageInfoBindingModel model)
|
public bool Create(MessageInfoBindingModel model)
|
||||||
{
|
{
|
||||||
|
CheckModel(model);
|
||||||
if (_messageInfoStorage.Insert(model) == null)
|
if (_messageInfoStorage.Insert(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
@ -32,17 +51,45 @@ namespace ConfectioneryBusinessLogic
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model)
|
private void CheckModel(MessageInfoBindingModel model, bool withParams = true)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. MessageId:{MessageId}.ClientId:{ClientId} ", model?.MessageId, model?.ClientId);
|
if (model == null)
|
||||||
var list = (model == null) ? _messageInfoStorage.GetFullList() : _messageInfoStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
throw new ArgumentNullException(nameof(model));
|
||||||
return null;
|
}
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.MessageId))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Не указан id сообщения", nameof(model.MessageId));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.SenderName))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Не указана почта отправителя", nameof(model.SenderName));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.Subject))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Не указан заголовок", nameof(model.Subject));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.Body))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Не указан текст сообщения", nameof(model.Subject));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("MessageInfo. MessageId: {MessageId}. SenderName: {SenderName}. DateDelivery: {DateDelivery} Subject: {Subject}. Body: {Body}", model.MessageId, model.SenderName, model.DateDelivery, model.Subject, model.Body);
|
||||||
|
var element = _clientStorage.GetElement(new ClientSearchModel
|
||||||
|
{
|
||||||
|
Email = model.SenderName
|
||||||
|
});
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Не удалось найти клиента, отправившего письмо с адреса Email: {Email}", model.SenderName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model.ClientId = element.Id;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ namespace ConfectioneryDatabaseImplement.Implements
|
|||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
return context.Clients.FirstOrDefault(x =>
|
return context.Clients.FirstOrDefault(x =>
|
||||||
(!string.IsNullOrEmpty(model.Email) && x.Email == model.Email && !string.IsNullOrEmpty(model.Password) && x.Password == model.Password)
|
(!string.IsNullOrEmpty(model.Email) && x.Email == model.Email && !string.IsNullOrEmpty(model.Password) && x.Password == model.Password)
|
||||||
|
|| (!string.IsNullOrEmpty(model.Email) && x.Email == model.Email && string.IsNullOrEmpty(model.Password))
|
||||||
|| (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
|| (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ namespace ConfectioneryDatabaseImplement.Models
|
|||||||
|
|
||||||
[ForeignKey("ClientId")]
|
[ForeignKey("ClientId")]
|
||||||
public virtual List<Order> Orders { get; set; } = new();
|
public virtual List<Order> Orders { get; set; } = new();
|
||||||
|
[ForeignKey("ClientId")]
|
||||||
|
public virtual List<MessageInfo> ClientMessages { get; set; } = new();
|
||||||
|
|
||||||
public static Client? Create(ClientBindingModel model)
|
public static Client? Create(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,8 @@ namespace ConfectioneryFileImplement
|
|||||||
|
|
||||||
private readonly string ImplementerFileName = "Implementer.xml";
|
private readonly string ImplementerFileName = "Implementer.xml";
|
||||||
|
|
||||||
|
private readonly string MessageInfoFileName = "MessageInfo.xml";
|
||||||
|
|
||||||
public List<Component> Components { get; private set; }
|
public List<Component> Components { get; private set; }
|
||||||
|
|
||||||
public List<Order> Orders { get; private set; }
|
public List<Order> Orders { get; private set; }
|
||||||
@ -32,6 +34,8 @@ namespace ConfectioneryFileImplement
|
|||||||
|
|
||||||
public List<Implementer> Implementers { get; private set; }
|
public List<Implementer> Implementers { get; private set; }
|
||||||
|
|
||||||
|
public List<MessageInfo> Messages { get; private set; }
|
||||||
|
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
@ -51,6 +55,8 @@ namespace ConfectioneryFileImplement
|
|||||||
|
|
||||||
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);
|
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);
|
||||||
|
|
||||||
|
public void SaveMessages() => SaveData(Orders, ImplementerFileName, "Messages", x => x.GetXElement);
|
||||||
|
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||||
@ -58,6 +64,7 @@ namespace ConfectioneryFileImplement
|
|||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
||||||
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
||||||
|
Messages = LoadData(MessageInfoFileName, "MessageInfo", x => MessageInfo.Create(x)!)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.SearchModels;
|
||||||
|
using ConfectioneryContracts.StoragesContracts;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryFileImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ConfectioneryFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class MessageInfoStorage : IMessageInfoStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton _source;
|
||||||
|
|
||||||
|
public MessageInfoStorage()
|
||||||
|
{
|
||||||
|
_source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return _source.Messages
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.ClientId.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return _source.Messages
|
||||||
|
.Where(x => x.ClientId.HasValue && x.ClientId == model.ClientId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel? GetElement(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.MessageId))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _source.Messages.FirstOrDefault(x => model.MessageId.Equals(x.MessageId))?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
var newMessage = MessageInfo.Create(model);
|
||||||
|
if (newMessage == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_source.Messages.Add(newMessage);
|
||||||
|
_source.SaveMessages();
|
||||||
|
return newMessage.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryDataModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace ConfectioneryFileImplement.Models
|
||||||
|
{
|
||||||
|
public class MessageInfo : IMessageInfoModel
|
||||||
|
{
|
||||||
|
public string MessageId { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public int? ClientId { get; private set; }
|
||||||
|
|
||||||
|
public string SenderName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateDelivery { get; private set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public string Subject { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Body { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
MessageId = model.MessageId,
|
||||||
|
ClientId = model.ClientId,
|
||||||
|
SenderName = model.SenderName,
|
||||||
|
DateDelivery = model.DateDelivery,
|
||||||
|
Subject = model.Subject,
|
||||||
|
Body = model.Body
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MessageInfo? Create(XElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
MessageId = element.Attribute("MessageId")!.Value,
|
||||||
|
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
||||||
|
SenderName = element.Element("SenderName")!.Value,
|
||||||
|
DateDelivery = Convert.ToDateTime(element.Element("DateDelivery")!.Value),
|
||||||
|
Subject = element.Element("Subject")!.Value,
|
||||||
|
Body = element.Element("Body")!.Value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
MessageId = MessageId,
|
||||||
|
ClientId = ClientId,
|
||||||
|
SenderName = SenderName,
|
||||||
|
DateDelivery = DateDelivery,
|
||||||
|
Subject = Subject,
|
||||||
|
Body = Body
|
||||||
|
};
|
||||||
|
|
||||||
|
public XElement GetXElement => new("MessageInfo",
|
||||||
|
new XAttribute("MessageId", MessageId),
|
||||||
|
new XElement("ClientId", ClientId),
|
||||||
|
new XElement("SenderName", SenderName),
|
||||||
|
new XElement("DateDelivery", DateDelivery),
|
||||||
|
new XElement("Subject", Subject),
|
||||||
|
new XElement("Body", Body)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ namespace ConfectioneryListImplement
|
|||||||
public List<Pastry> Pastries { get; set; }
|
public List<Pastry> Pastries { get; set; }
|
||||||
public List<Client> Clients { get; set; }
|
public List<Client> Clients { get; set; }
|
||||||
public List<Implementer> Implementers { get; set; }
|
public List<Implementer> Implementers { get; set; }
|
||||||
|
public List<MessageInfo> Messages { get; set; }
|
||||||
private DataListSingleton()
|
private DataListSingleton()
|
||||||
{
|
{
|
||||||
Components = new List<Component>();
|
Components = new List<Component>();
|
||||||
@ -22,6 +23,7 @@ namespace ConfectioneryListImplement
|
|||||||
Pastries = new List<Pastry>();
|
Pastries = new List<Pastry>();
|
||||||
Clients = new List<Client>();
|
Clients = new List<Client>();
|
||||||
Implementers = new List<Implementer>();
|
Implementers = new List<Implementer>();
|
||||||
|
Messages = new List<MessageInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.SearchModels;
|
||||||
|
using ConfectioneryContracts.StoragesContracts;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryListImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ConfectioneryListImplement.Implements
|
||||||
|
{
|
||||||
|
public class MessageInfoStorage : IMessageInfoStorage
|
||||||
|
{
|
||||||
|
private readonly DataListSingleton _source;
|
||||||
|
|
||||||
|
public MessageInfoStorage()
|
||||||
|
{
|
||||||
|
_source = DataListSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
var result = new List<MessageInfoViewModel>();
|
||||||
|
foreach (var message in _source.Messages)
|
||||||
|
{
|
||||||
|
result.Add(message.GetViewModel);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
var result = new List<MessageInfoViewModel>();
|
||||||
|
if (!model.ClientId.HasValue)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
foreach (var message in _source.Messages)
|
||||||
|
{
|
||||||
|
if (message.ClientId.HasValue && message.ClientId == model.ClientId)
|
||||||
|
{
|
||||||
|
result.Add(message.GetViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel? GetElement(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.MessageId))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
foreach (var message in _source.Messages)
|
||||||
|
{
|
||||||
|
if (model.MessageId.Equals(message.MessageId))
|
||||||
|
{
|
||||||
|
return message.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
var newMessage = MessageInfo.Create(model);
|
||||||
|
if (newMessage == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_source.Messages.Add(newMessage);
|
||||||
|
return newMessage.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryDataModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ConfectioneryListImplement.Models
|
||||||
|
{
|
||||||
|
public class MessageInfo : IMessageInfoModel
|
||||||
|
{
|
||||||
|
public string MessageId { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public int? ClientId { get; private set; }
|
||||||
|
|
||||||
|
public string SenderName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateDelivery { get; private set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public string Subject { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Body { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
MessageId = model.MessageId,
|
||||||
|
ClientId = model.ClientId,
|
||||||
|
SenderName = model.SenderName,
|
||||||
|
DateDelivery = model.DateDelivery,
|
||||||
|
Subject = model.Subject,
|
||||||
|
Body = model.Body
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
MessageId = MessageId,
|
||||||
|
ClientId = ClientId,
|
||||||
|
SenderName = SenderName,
|
||||||
|
DateDelivery = DateDelivery,
|
||||||
|
Subject = Subject,
|
||||||
|
Body = Body
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
62
Confectionery/ConfectioneryView/FormMail.Designer.cs
generated
Normal file
62
Confectionery/ConfectioneryView/FormMail.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
namespace ConfectioneryView
|
||||||
|
{
|
||||||
|
partial class FormMail
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(12, 12);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new Size(776, 426);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// FormMail
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormMail";
|
||||||
|
Text = "FormMail";
|
||||||
|
Load += FormMail_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
@ -12,18 +12,18 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace ConfectioneryView
|
namespace ConfectioneryView
|
||||||
{
|
{
|
||||||
public partial class FormViewMail : Form
|
public partial class FormMail : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IMessageInfoLogic _logic;
|
private readonly IMessageInfoLogic _logic;
|
||||||
public FormViewMail(ILogger<FormViewMail> logger, IMessageInfoLogic logic)
|
public FormMail(ILogger<FormMail> logger, IMessageInfoLogic logic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ViewMailForm_Load(object sender, EventArgs e)
|
private void FormMail_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
@ -166,8 +166,8 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void ПочтаToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ПочтаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormViewMail));
|
var service = Program.ServiceProvider?.GetService(typeof(FormMail));
|
||||||
if (service is FormViewMail form)
|
if (service is FormMail form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
namespace ConfectioneryView
|
|
||||||
{
|
|
||||||
partial class FormViewMail
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(12, 12);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.Size = new Size(776, 426);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ViewMailForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Name = "ViewMailForm";
|
|
||||||
Text = "ViewMailForm";
|
|
||||||
Load += ViewMailForm_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -102,7 +102,7 @@ namespace ConfectioneryView
|
|||||||
services.AddTransient<FormImplementers>();
|
services.AddTransient<FormImplementers>();
|
||||||
services.AddTransient<FormReportPastryComponents>();
|
services.AddTransient<FormReportPastryComponents>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormViewMail>();
|
services.AddTransient<FormMail>();
|
||||||
}
|
}
|
||||||
private static void MailCheck(object obj) =>
|
private static void MailCheck(object obj) =>
|
||||||
ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
||||||
|
Loading…
Reference in New Issue
Block a user