фиксы + конфликты

This commit is contained in:
sardq 2024-05-16 17:37:12 +04:00
parent 3c7fd1b8f0
commit ecf2e10885
14 changed files with 83 additions and 343 deletions

View File

@ -14,11 +14,8 @@ namespace PlumbingRepairContracts.BindingModels
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
<<<<<<< HEAD
public bool IsRead { get; set; } = false; public bool IsRead { get; set; } = false;
public string? ReplyText { get; set; } = string.Empty; public string? ReplyText { get; set; } = string.Empty;
=======
public int Id => throw new NotImplementedException(); public int Id => throw new NotImplementedException();
>>>>>>> lab_8
} }
} }

View File

@ -6,23 +6,6 @@ namespace PlumbingRepairContracts.ViewModels
{ {
public class MessageInfoViewModel : IMessageInfoModel public class MessageInfoViewModel : IMessageInfoModel
{ {
<<<<<<< HEAD
public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; }
[DisplayName("Отправитель")]
public string SenderName { get; set; } = string.Empty;
[DisplayName("Дата отправления")]
public DateTime DateDelivery { get; set; }
[DisplayName("Заголовок")]
public string Subject { get; set; } = string.Empty;
[DisplayName("Текст")]
public string Body { get; set; } = string.Empty;
[DisplayName("Прочитано")]
public bool IsRead { get; set; } = false;
[DisplayName("Ответ")]
public string? ReplyText { get; set; }
=======
[Column(visible: false)] [Column(visible: false)]
public string MessageId { get; set; } = string.Empty; public string MessageId { get; set; } = string.Empty;
[Column(visible: false)] [Column(visible: false)]
@ -35,8 +18,11 @@ namespace PlumbingRepairContracts.ViewModels
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
[Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] [Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
[Column(title: "Прочитано", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public bool IsRead { get; set; } = false;
[Column(title: "Ответ", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string? ReplyText { get; set; }
[Column(visible: false)] [Column(visible: false)]
public int Id => throw new NotImplementedException(); public int Id => throw new NotImplementedException();
>>>>>>> lab_8
} }
} }

View File

@ -9,12 +9,7 @@ namespace PlumbingRepairDataModels.Models
DateTime DateDelivery { get; } DateTime DateDelivery { get; }
string Subject { get; } string Subject { get; }
string Body { get; } string Body { get; }
<<<<<<< HEAD
bool IsRead { get; } bool IsRead { get; }
string? ReplyText { get; } string? ReplyText { get; }
} }
=======
}
>>>>>>> lab_8
} }

View File

@ -15,6 +15,7 @@ namespace PlumbingRepairDatabaseImplement
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>(); DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>(); DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>(); DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>(); DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
} }
} }

View File

@ -25,16 +25,15 @@ namespace PlumbingRepairDatabaseImplement.Models
[DataMember] [DataMember]
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
[Required] [Required]
<<<<<<< HEAD
public string Body { get; set; } = string.Empty;
[Required]
public bool IsRead { get; private set; } = false;
public string? ReplyText { get; private set; }
=======
[DataMember] [DataMember]
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
[Required]
[DataMember]
public bool IsRead { get; private set; } = false;
[DataMember]
public string? ReplyText { get; private set; }
public virtual Client? Client { get; set; } public virtual Client? Client { get; set; }
>>>>>>> lab_8
public static MessageInfo? Create(MessageInfoBindingModel model) public static MessageInfo? Create(MessageInfoBindingModel model)
{ {
@ -65,14 +64,10 @@ namespace PlumbingRepairDatabaseImplement.Models
MessageId = MessageId, MessageId = MessageId,
SenderName = SenderName, SenderName = SenderName,
DateDelivery = DateDelivery, DateDelivery = DateDelivery,
<<<<<<< HEAD
IsRead = IsRead, IsRead = IsRead,
ReplyText = ReplyText ReplyText = ReplyText
}; };
}
=======
};
public int Id => throw new NotImplementedException(); public int Id => throw new NotImplementedException();
} }
>>>>>>> lab_8
} }

View File

@ -15,6 +15,7 @@ namespace BlacksmithWorkshopFileImplement
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>(); DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>(); DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>(); DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>(); DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
} }
} }

View File

@ -9,21 +9,7 @@ namespace PlumbingRepairFileImplement.Models
[DataContract] [DataContract]
internal class MessageInfo : IMessageInfoModel internal class MessageInfo : IMessageInfoModel
{ {
<<<<<<< HEAD
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 bool IsRead { get; private set; } = false;
public string? ReplyText { get; private set; }
=======
[DataMember] [DataMember]
public string MessageId { get; private set; } = string.Empty; public string MessageId { get; private set; } = string.Empty;
[DataMember] [DataMember]
@ -36,7 +22,12 @@ namespace PlumbingRepairFileImplement.Models
public string Subject { get; private set; } = string.Empty; public string Subject { get; private set; } = string.Empty;
[DataMember] [DataMember]
public string Body { get; private set; } = string.Empty; public string Body { get; private set; } = string.Empty;
>>>>>>> lab_8 [DataMember]
public bool IsRead { get; private set; } = false;
[DataMember]
public string? ReplyText { get; private set; }
public static MessageInfo? Create(MessageInfoBindingModel model) public static MessageInfo? Create(MessageInfoBindingModel model)
{ {

View File

@ -16,7 +16,8 @@ namespace PlumbingRepairListImplement
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>(); DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>(); DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>(); DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>(); DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
} }
} }
} }

View File

@ -10,20 +10,7 @@ namespace PlumbingRepairListImplement.Models
{ {
[DataMember] [DataMember]
public string MessageId { get; private set; } = string.Empty; public string MessageId { get; private set; } = string.Empty;
<<<<<<< HEAD
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 bool IsRead { get; private set; } = false;
public string? ReplyText { get; private set; }
=======
[DataMember] [DataMember]
public int? ClientId { get; private set; } public int? ClientId { get; private set; }
[DataMember] [DataMember]
@ -34,7 +21,11 @@ namespace PlumbingRepairListImplement.Models
public string Subject { get; private set; } = string.Empty; public string Subject { get; private set; } = string.Empty;
[DataMember] [DataMember]
public string Body { get; private set; } = string.Empty; public string Body { get; private set; } = string.Empty;
>>>>>>> lab_8 [DataMember]
public bool IsRead { get; private set; } = false;
[DataMember]
public string? ReplyText { get; private set; }
public static MessageInfo? Create(MessageInfoBindingModel model) public static MessageInfo? Create(MessageInfoBindingModel model)
{ {
@ -66,14 +57,9 @@ namespace PlumbingRepairListImplement.Models
MessageId = MessageId, MessageId = MessageId,
SenderName = SenderName, SenderName = SenderName,
DateDelivery = DateDelivery, DateDelivery = DateDelivery,
<<<<<<< HEAD
IsRead = IsRead, IsRead = IsRead,
ReplyText = ReplyText ReplyText = ReplyText
}; };
}
=======
};
public int Id => throw new NotImplementedException(); public int Id => throw new NotImplementedException();
} }
>>>>>>> lab_8
} }

View File

@ -1,5 +1,6 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PlumbingRepairContracts.BusinessLogicsContracts; using PlumbingRepairContracts.BusinessLogicsContracts;
using PlumbingRepairContracts.DI;
namespace PlumbingRepairView namespace PlumbingRepairView
{ {
@ -23,20 +24,8 @@ namespace PlumbingRepairView
{ {
try try
{ {
<<<<<<< HEAD
var list = _logic.ReadList(new() { Page = page, PageSize = pageSize });
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["MessageId"].Visible = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
}
_logger.LogInformation("Загрузка сообщений");
=======
dataGridView.FillAndConfigGrid(_logic.ReadList(null)); dataGridView.FillAndConfigGrid(_logic.ReadList(null));
_logger.LogInformation("Loading mails"); _logger.LogInformation("Загрузка сообщений");
>>>>>>> lab_8
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -61,13 +50,8 @@ namespace PlumbingRepairView
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormMail)); var form = DependencyManager.Instance.Resolve<FormMail>();
if (service is FormMail form) form.ShowDialog();
{
form.Id = dataGridView.SelectedRows[0].Cells["MessageId"].Value.ToString();
form.ShowDialog();
LoadData(0);
}
} }
} }

View File

@ -50,11 +50,7 @@
this.выполнениеРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.выполнениеРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокВсехЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.списокВсехЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
<<<<<<< HEAD
this.письмаToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
=======
this.созданиеБэкапаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.созданиеБэкапаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
>>>>>>> lab_8
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -122,12 +118,8 @@
this.справочникиToolStripMenuItem, this.справочникиToolStripMenuItem,
this.отчетыToolStripMenuItem, this.отчетыToolStripMenuItem,
this.выполнениеРаботToolStripMenuItem, this.выполнениеРаботToolStripMenuItem,
<<<<<<< HEAD
this.письмаToolStripMenuItem1});
=======
this.письмаToolStripMenuItem, this.письмаToolStripMenuItem,
this.созданиеБэкапаToolStripMenuItem}); this.созданиеБэкапаToolStripMenuItem});
>>>>>>> lab_8
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1377, 33); this.menuStrip1.Size = new System.Drawing.Size(1377, 33);
@ -151,22 +143,14 @@
// компонентыToolStripMenuItem // компонентыToolStripMenuItem
// //
this.компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem"; this.компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
<<<<<<< HEAD
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34); this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
=======
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
>>>>>>> lab_8
this.компонентыToolStripMenuItem.Text = "Компоненты"; this.компонентыToolStripMenuItem.Text = "Компоненты";
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click); this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
// //
// РаботыToolStripMenuItem // РаботыToolStripMenuItem
// //
this.РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem"; this.РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem";
<<<<<<< HEAD
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(296, 34); this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
=======
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
>>>>>>> lab_8
this.РаботыToolStripMenuItem.Text = "Работы"; this.РаботыToolStripMenuItem.Text = "Работы";
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click); this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
// //
@ -194,22 +178,14 @@
// клиентыToolStripMenuItem // клиентыToolStripMenuItem
// //
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
<<<<<<< HEAD
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34); this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
=======
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
>>>>>>> lab_8
this.клиентыToolStripMenuItem.Text = "Клиенты"; this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click); this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
// //
// исполнителиToolStripMenuItem // исполнителиToolStripMenuItem
// //
this.исполнителиToolStripMenuItem.Name = сполнителиToolStripMenuItem"; this.исполнителиToolStripMenuItem.Name = сполнителиToolStripMenuItem";
<<<<<<< HEAD
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(296, 34); this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
=======
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
>>>>>>> lab_8
this.исполнителиToolStripMenuItem.Text = "Исполнители"; this.исполнителиToolStripMenuItem.Text = "Исполнители";
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click); this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
// //
@ -281,21 +257,12 @@
this.письмаToolStripMenuItem.Text = "Письма"; this.письмаToolStripMenuItem.Text = "Письма";
this.письмаToolStripMenuItem.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click); this.письмаToolStripMenuItem.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click);
// //
<<<<<<< HEAD
// письмаToolStripMenuItem1
//
this.письмаToolStripMenuItem1.Name = "письмаToolStripMenuItem1";
this.письмаToolStripMenuItem1.Size = new System.Drawing.Size(90, 29);
this.письмаToolStripMenuItem1.Text = "Письма";
this.письмаToolStripMenuItem1.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click);
=======
// созданиеБэкапаToolStripMenuItem // созданиеБэкапаToolStripMenuItem
// //
this.созданиеБэкапаToolStripMenuItem.Name = "созданиеБэкапаToolStripMenuItem"; this.созданиеБэкапаToolStripMenuItem.Name = "созданиеБэкапаToolStripMenuItem";
this.созданиеБэкапаToolStripMenuItem.Size = new System.Drawing.Size(166, 29); this.созданиеБэкапаToolStripMenuItem.Size = new System.Drawing.Size(166, 29);
this.созданиеБэкапаToolStripMenuItem.Text = "Создание бэкапа"; this.созданиеБэкапаToolStripMenuItem.Text = "Создание бэкапа";
this.созданиеБэкапаToolStripMenuItem.Click += new System.EventHandler(this.backupToolStripMenuItem_Click); this.созданиеБэкапаToolStripMenuItem.Click += new System.EventHandler(this.backupToolStripMenuItem_Click);
>>>>>>> lab_8
// //
// FormMain // FormMain
// //
@ -343,10 +310,6 @@
private ToolStripMenuItem выполнениеРаботToolStripMenuItem; private ToolStripMenuItem выполнениеРаботToolStripMenuItem;
private ToolStripMenuItem исполнителиToolStripMenuItem; private ToolStripMenuItem исполнителиToolStripMenuItem;
private ToolStripMenuItem письмаToolStripMenuItem; private ToolStripMenuItem письмаToolStripMenuItem;
<<<<<<< HEAD
private ToolStripMenuItem письмаToolStripMenuItem1;
=======
private ToolStripMenuItem созданиеБэкапаToolStripMenuItem; private ToolStripMenuItem созданиеБэкапаToolStripMenuItem;
>>>>>>> lab_8
} }
} }

View File

@ -10,16 +10,11 @@ namespace PlumbingRepairView
public partial class FormMain : Form public partial class FormMain : Form
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic; private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic; private readonly IReportLogic _reportLogic;
private readonly IWorkProcess _workProcess; private readonly IWorkProcess _workProcess;
<<<<<<< HEAD
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
=======
private readonly IBackUpLogic _backUpLogic; private readonly IBackUpLogic _backUpLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic) public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic)
>>>>>>> lab_8
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
@ -38,19 +33,8 @@ namespace PlumbingRepairView
{ {
try try
{ {
<<<<<<< HEAD
var list = _orderLogic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ImplementerId"].Visible = false;
}
_logger.LogInformation("Загрузка заказов");
=======
dataGridView.FillAndConfigGrid(_orderLogic.ReadList(null)); dataGridView.FillAndConfigGrid(_orderLogic.ReadList(null));
_logger.LogInformation("Загрузка заказов"); _logger.LogInformation("Загрузка заказов");
>>>>>>> lab_8
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -68,39 +52,25 @@ namespace PlumbingRepairView
private void РаботыToolStripMenuItem_Click(object sender, EventArgs e) private void РаботыToolStripMenuItem_Click(object sender, EventArgs e)
{ {
<<<<<<< HEAD var form = DependencyManager.Instance.Resolve<FormWorks>();
var service = Program.ServiceProvider?.GetService(typeof(FormWorks)); form.ShowDialog();
if (service is FormWorks form) }
{
form.ShowDialog();
}
}
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e) private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormShops)); var form = DependencyManager.Instance.Resolve<FormShops>();
if (service is FormShops form) form.ShowDialog();
{ }
form.ShowDialog();
}
}
private void пополнениеToolStripMenuItem_Click(object sender, EventArgs e) private void пополнениеToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormStoreReplenishment)); var form = DependencyManager.Instance.Resolve<FormStoreReplenishment>();
if (service is FormStoreReplenishment form) form.ShowDialog();
{ }
form.ShowDialog();
}
}
private void ButtonCreateOrder_Click(object sender, EventArgs e) private void ButtonCreateOrder_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
if (service is FormCreateOrder form) form.ShowDialog();
{ }
form.ShowDialog();
LoadData();
}
}
private void ButtonIssuedOrder_Click(object sender, EventArgs e) private void ButtonIssuedOrder_Click(object sender, EventArgs e)
@ -134,25 +104,11 @@ namespace PlumbingRepairView
private void продажаРаботToolStripMenuItem_Click(object sender, EventArgs e) private void продажаРаботToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormSellWorks)); var form = DependencyManager.Instance.Resolve<FormSellWorks>();
if (service is FormSellWorks form)
{
form.ShowDialog();
}
}
private void списокКомпонентовToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
=======
var form = DependencyManager.Instance.Resolve<FormWorks>();
form.ShowDialog(); form.ShowDialog();
} }
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
e) private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
>>>>>>> lab_8
{ {
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
@ -165,22 +121,16 @@ e)
MessageBoxIcon.Information); MessageBoxIcon.Information);
} }
} }
private void ComponentWorksToolStripMenuItem_Click(object sender, private void ComponentWorksToolStripMenuItem_Click(object sender, EventArgs e)
EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormReportWorkComponents>(); var form = DependencyManager.Instance.Resolve<FormReportWorkComponents>();
form.ShowDialog(); form.ShowDialog();
} }
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e) private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{ {
<<<<<<< HEAD var form = DependencyManager.Instance.Resolve<FormReportOrders>();
var service = form.ShowDialog();
Program.ServiceProvider?.GetService(typeof(FormReportOrders)); }
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e) private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
@ -194,82 +144,35 @@ e)
MessageBoxIcon.Information); MessageBoxIcon.Information);
} }
} }
private void ShopWorksToolStripMenuItem_Click(object sender, private void ShopWorksToolStripMenuItem_Click(object sender, EventArgs e)
EventArgs e)
{ {
var service = var form = DependencyManager.Instance.Resolve<FormReportShopWorks>();
Program.ServiceProvider?.GetService(typeof(FormReportShopWorks)); form.ShowDialog();
if (service is FormReportShopWorks form) }
{
form.ShowDialog();
}
}
private void OrdersByDateToolStripMenuItem_Click(object sender, EventArgs e) private void OrdersByDateToolStripMenuItem_Click(object sender, EventArgs e)
======= {
var form = DependencyManager.Instance.Resolve<FormReportOrders>(); var form = DependencyManager.Instance.Resolve<FormReportOrdersByDate>();
form.ShowDialog(); form.ShowDialog();
} }
private void ButtonCreateOrder_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
form.ShowDialog();
LoadData();
}
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
>>>>>>> lab_8
{
var service =
Program.ServiceProvider?.GetService(typeof(FormReportOrdersByDate));
if (service is FormReportOrdersByDate form)
{
form.ShowDialog();
}
}
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e) private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
{ {
<<<<<<< HEAD
var service =
Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
private void выполнениеРаботToolStripMenuItem_Click(object sender, EventArgs e)
=======
var form = DependencyManager.Instance.Resolve<FormClients>(); var form = DependencyManager.Instance.Resolve<FormClients>();
form.ShowDialog(); form.ShowDialog();
} }
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e) private void выполнениеРаботToolStripMenuItem_Click(object sender, EventArgs e)
{
_workProcess.DoWork((DependencyManager.Instance.Resolve<IImplementerLogic>() as IImplementerLogic)!, _orderLogic);
MessageBox.Show("Процесс обработки запущен", "Сообщение",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormImplementers>(); var form = DependencyManager.Instance.Resolve<FormImplementers>();
form.ShowDialog(); form.ShowDialog();
} }
private void ЗапускРаботToolStripMenuItem_Click(object sender, EventArgs
e)
>>>>>>> lab_8
{
_workProcess.DoWork((DependencyManager.Instance.Resolve<IImplementerLogic>() as IImplementerLogic)!, _orderLogic);
MessageBox.Show("Процесс обработки запущен", "Сообщение",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormImplementers));
if (service is FormImplementers form)
{
form.ShowDialog();
}
}
private void письмаToolStripMenuItem_Click(object sender, EventArgs e) private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormMails>(); var form = DependencyManager.Instance.Resolve<FormMails>();

View File

@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PlumbingRepairContracts.BindingModels; using PlumbingRepairContracts.BindingModels;
using PlumbingRepairContracts.BusinessLogicsContracts; using PlumbingRepairContracts.BusinessLogicsContracts;
using PlumbingRepairContracts.DI;
namespace PlumbingRepairView namespace PlumbingRepairView
{ {
@ -46,31 +47,26 @@ namespace PlumbingRepairView
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormShop)); var form = DependencyManager.Instance.Resolve<FormShop>();
if (service is FormShop form) form.ShowDialog();
{ }
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
private void ButtonUpd_Click(object sender, EventArgs e) private void ButtonUpd_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1)
{ if (dataGridView.SelectedRows.Count == 1)
var service = Program.ServiceProvider?.GetService(typeof(FormShop)); {
if (service is FormShop form) var service = DependencyManager.Instance.Resolve<FormShop>();
{ if (service is FormShop form)
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); {
if (form.ShowDialog() == DialogResult.OK) form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
{ if (form.ShowDialog() == DialogResult.OK)
LoadData(); {
} LoadData();
} }
} }
} }
}
private void ButtonDel_Click(object sender, EventArgs e) private void ButtonDel_Click(object sender, EventArgs e)
{ {

View File

@ -46,67 +46,7 @@ namespace PlumbingRepairView
var logger = DependencyManager.Instance.Resolve<ILogger>(); var logger = DependencyManager.Instance.Resolve<ILogger>();
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé"); logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
} }
<<<<<<< HEAD
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IWorkStorage, WorkStorage>();
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IImplementerStorage, ImplementerStorage>();
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IWorkLogic, WorkLogic>();
services.AddTransient<IShopLogic, ShopLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<IWorkProcess, WorkModeling>();
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportWorkComponents>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormWork>();
services.AddTransient<FormWorks>();
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormWorkComponent>();
services.AddTransient<FormStoreReplenishment>();
services.AddTransient<FormSellWorks>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportOrdersByDate>();
services.AddTransient<FormReportWorkComponents>();
services.AddTransient<FormReportShopWorks>();
services.AddTransient<FormClients>();
services.AddTransient<FormImplementer>();
services.AddTransient<FormImplementers>();
services.AddTransient<FormMails>();
services.AddTransient<FormMail>();
=======
Application.Run(DependencyManager.Instance.Resolve<FormMain>()); Application.Run(DependencyManager.Instance.Resolve<FormMain>());
>>>>>>> lab_8
} }
private static void InitDependency() private static void InitDependency()
{ {
@ -123,6 +63,7 @@ namespace PlumbingRepairView
DependencyManager.Instance.RegisterType<IWorkLogic, WorkLogic>(); DependencyManager.Instance.RegisterType<IWorkLogic, WorkLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>(); DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>(); DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IShopLogic, ShopLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>(); DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>(); DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();