diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.Designer.cs index b4c6b8d..396a1c2 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.Designer.cs @@ -32,15 +32,16 @@ labelCost = new Label(); groupBoxManufacture = new GroupBox(); dataGridView = new DataGridView(); - ButtonAdd = new Button(); - ButtonUpd = new Button(); - ButtonDel = new Button(); + компоненты = new DataGridViewTextBoxColumn(); + колво = new DataGridViewTextBoxColumn(); ButtonRef = new Button(); + ButtonDel = new Button(); + ButtonUpd = new Button(); + ButtonAdd = new Button(); ButtonCancel = new Button(); ButtonSave = new Button(); textBoxName = new TextBox(); textBoxPrice = new TextBox(); - // Id = new DataGridViewTextBoxColumn(); Компонент = new DataGridViewTextBoxColumn(); Количество = new DataGridViewTextBoxColumn(); groupBoxManufacture.SuspendLayout(); @@ -67,11 +68,11 @@ // // groupBoxManufacture // + groupBoxManufacture.Controls.Add(dataGridView); groupBoxManufacture.Controls.Add(ButtonRef); groupBoxManufacture.Controls.Add(ButtonDel); groupBoxManufacture.Controls.Add(ButtonUpd); groupBoxManufacture.Controls.Add(ButtonAdd); - groupBoxManufacture.Controls.Add(dataGridView); groupBoxManufacture.Location = new Point(12, 112); groupBoxManufacture.Name = "groupBoxManufacture"; groupBoxManufacture.Size = new Size(856, 366); @@ -83,51 +84,69 @@ // dataGridView.BackgroundColor = SystemColors.ButtonHighlight; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - //dataGridView.Columns.AddRange(new DataGridViewColumn[] { Id, Компонент, Количество }); + dataGridView.Columns.AddRange(new DataGridViewColumn[] { компоненты, колво }); dataGridView.Enabled = false; - dataGridView.Location = new Point(6, 36); + dataGridView.Location = new Point(0, 41); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 62; dataGridView.RowTemplate.Height = 33; - dataGridView.Size = new Size(614, 330); - dataGridView.TabIndex = 0; - dataGridView.CellContentClick += dataGridView_CellContentClick; + dataGridView.Size = new Size(666, 319); + dataGridView.TabIndex = 5; + dataGridView.CellContentClick += dataGridView1_CellContentClick; // - // ButtonAdd + // компоненты // - ButtonAdd.Location = new Point(696, 30); - ButtonAdd.Name = "ButtonAdd"; - ButtonAdd.Size = new Size(112, 34); - ButtonAdd.TabIndex = 1; - ButtonAdd.Text = "Добавить"; - ButtonAdd.UseVisualStyleBackColor = true; + компоненты.HeaderText = "компоненты"; + компоненты.MinimumWidth = 8; + компоненты.Name = "компоненты"; + компоненты.Width = 400; // - // ButtonUpd + // колво // - ButtonUpd.Location = new Point(696, 85); - ButtonUpd.Name = "ButtonUpd"; - ButtonUpd.Size = new Size(112, 34); - ButtonUpd.TabIndex = 2; - ButtonUpd.Text = "Изменить"; - ButtonUpd.UseVisualStyleBackColor = true; - // - // ButtonDel - // - ButtonDel.Location = new Point(696, 148); - ButtonDel.Name = "ButtonDel"; - ButtonDel.Size = new Size(112, 34); - ButtonDel.TabIndex = 3; - ButtonDel.Text = "Удалить"; - ButtonDel.UseVisualStyleBackColor = true; + колво.HeaderText = "колво"; + колво.MinimumWidth = 8; + колво.Name = "колво"; + колво.Width = 150; // // ButtonRef // - ButtonRef.Location = new Point(696, 208); + ButtonRef.Location = new Point(696, 226); ButtonRef.Name = "ButtonRef"; ButtonRef.Size = new Size(112, 34); ButtonRef.TabIndex = 4; ButtonRef.Text = "Обновить"; ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // ButtonDel + // + ButtonDel.Location = new Point(696, 166); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(112, 34); + ButtonDel.TabIndex = 3; + ButtonDel.Text = "Удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonUpd + // + ButtonUpd.Location = new Point(696, 101); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(112, 34); + ButtonUpd.TabIndex = 2; + ButtonUpd.Text = "Изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; + // + // ButtonAdd + // + ButtonAdd.Location = new Point(696, 41); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(112, 34); + ButtonAdd.TabIndex = 1; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; // // ButtonCancel // @@ -137,6 +156,7 @@ ButtonCancel.TabIndex = 5; ButtonCancel.Text = "Отмена"; ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; // // ButtonSave // @@ -146,6 +166,7 @@ ButtonSave.TabIndex = 6; ButtonSave.Text = "Сохранить"; ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; // // textBoxName // @@ -161,27 +182,17 @@ textBoxPrice.Size = new Size(194, 31); textBoxPrice.TabIndex = 8; // - //// Id - //// - //Id.HeaderText = "Id"; - //Id.MinimumWidth = 8; - //Id.Name = "Id"; - //Id.Visible = false; - //Id.Width = 150; - // // Компонент // - Компонент.HeaderText = "Компонент"; Компонент.MinimumWidth = 8; Компонент.Name = "Компонент"; - Компонент.Width = 200; + Компонент.Width = 150; // // Количество // - Количество.HeaderText = "Количество"; Количество.MinimumWidth = 8; Количество.Name = "Количество"; - Количество.Width = 200; + Количество.Width = 150; // // FormManufacture // @@ -197,6 +208,7 @@ Controls.Add(labelName); Name = "FormManufacture"; Text = "FormManufacture"; + Load += FormManufacture_Load; groupBoxManufacture.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); @@ -208,7 +220,6 @@ private Label labelName; private Label labelCost; private GroupBox groupBoxManufacture; - private DataGridView dataGridView; private Button ButtonRef; private Button ButtonDel; private Button ButtonUpd; @@ -220,5 +231,8 @@ private DataGridViewTextBoxColumn Id; private DataGridViewTextBoxColumn Компонент; private DataGridViewTextBoxColumn Количество; + private DataGridView dataGridView; + private DataGridViewTextBoxColumn компоненты; + private DataGridViewTextBoxColumn колво; } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.cs index 1d265d7..8c5a45f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.cs @@ -1,4 +1,7 @@ -using BlacksmithWorkshopContracts.BusinessLogicsContracts; +using BlacksmithWorkshop; +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.BusinessLogicsContracts; +using BlacksmithWorkshopContracts.SearchModels; using BlacksmithWorkshopDataModels.Models; using Microsoft.Extensions.Logging; using Microsoft.VisualBasic.Logging; @@ -29,9 +32,198 @@ namespace BlacksmithWorkshopView _manufactureComponents = new Dictionary(); } - private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) + private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } + + private void FormManufacture_Load(object sender, EventArgs e) + { + if (_id.HasValue) + { + _logger.LogInformation("Загрузка кузнечного изделия"); + try + { + var view = _logic.ReadElement(new ManufactureSearchModel { Id = _id.Value }); + if (view != null) + { + textBoxName.Text = view.ManufactureName; + textBoxPrice.Text = view.Price.ToString(); + _manufactureComponents = view.ManufactureComponents ?? new + Dictionary(); + LoadData(); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки кузнечного изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + + private void LoadData() + { + _logger.LogInformation("Загрузка компонентов кузнечного изделия"); + try + { + if (_manufactureComponents != null) + { + dataGridView.Rows.Clear(); + foreach (var pc in _manufactureComponents) + { + dataGridView.Rows.Add(new object[] { pc.Key, + pc.Value.Item1.ComponentName, pc.Value.Item2 }); + } + textBoxPrice.Text = CalcPrice().ToString(); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки компонентов кузнечного изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormManufactureComponent)); + if (service is FormManufactureComponent form) + { + if (form.ShowDialog() == DialogResult.OK) + { + if (form.ComponentModel == null) + { + return; + } + _logger.LogInformation("Добавление нового компонента:{ ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count); + if (_manufactureComponents.ContainsKey(form.Id)) + { + _manufactureComponents[form.Id] = (form.ComponentModel, form.Count); + } + else + { + _manufactureComponents.Add(form.Id, (form.ComponentModel, form.Count)); + } + LoadData(); + } + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(FormManufactureComponent)); + if (service is FormManufactureComponent form) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); + form.Id = id; + form.Count = _manufactureComponents[id].Item2; + if (form.ShowDialog() == DialogResult.OK) + { + if (form.ComponentModel == null) + { + return; + } + _logger.LogInformation("Изменение компонента:{ ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count); + _manufactureComponents[form.Id] = (form.ComponentModel, form.Count); + LoadData(); + } + } + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + try + { + _logger.LogInformation("Удаление компонента:{ ComponentName}- { Count} ", dataGridView.SelectedRows[0].Cells[1].Value); + _manufactureComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + LoadData(); + } + } + } + + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxName.Text)) + { + MessageBox.Show("Заполните название", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (string.IsNullOrEmpty(textBoxPrice.Text)) + { + MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + return; + } + if (_manufactureComponents == null || _manufactureComponents.Count == 0) + { + MessageBox.Show("Заполните компоненты", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Сохранение кузнечного изделия"); + try + { + var model = new ManufactureBindingModel + { + Id = _id ?? 0, + ManufactureName = textBoxName.Text, + Price = Convert.ToDouble(textBoxPrice.Text), + ManufactureComponents = _manufactureComponents + }; + var operationResult = _id.HasValue ? _logic.Update(model) : + _logic.Create(model); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + MessageBox.Show("Сохранение прошло успешно", "Сообщение", + MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения кузнечного изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + private double CalcPrice() + { + double price = 0; + foreach (var elem in _manufactureComponents) + { + price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2); + } + return Math.Round(price * 1.1, 2); + } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.resx index 8e07bd1..fd7519b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.resx +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufacture.resx @@ -117,7 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + True + + True diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.Designer.cs new file mode 100644 index 0000000..7877eaa --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.Designer.cs @@ -0,0 +1,114 @@ +namespace BlacksmithWorkshopView +{ + partial class FormManufactures + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + AddButton = new Button(); + UpdateButton = new Button(); + DeleteButton = new Button(); + RefreshButton = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 62; + dataGridView.RowTemplate.Height = 33; + dataGridView.Size = new Size(431, 449); + dataGridView.TabIndex = 0; + // + // AddButton + // + AddButton.Location = new Point(481, 12); + AddButton.Name = "AddButton"; + AddButton.Size = new Size(112, 34); + AddButton.TabIndex = 1; + AddButton.Text = "Добавить"; + AddButton.UseVisualStyleBackColor = true; + AddButton.Click += AddButton_Click; + // + // UpdateButton + // + UpdateButton.Location = new Point(481, 73); + UpdateButton.Name = "UpdateButton"; + UpdateButton.Size = new Size(112, 34); + UpdateButton.TabIndex = 2; + UpdateButton.Text = "Изменить"; + UpdateButton.UseVisualStyleBackColor = true; + UpdateButton.Click += UpdateButton_Click; + // + // DeleteButton + // + DeleteButton.Location = new Point(481, 133); + DeleteButton.Name = "DeleteButton"; + DeleteButton.Size = new Size(112, 34); + DeleteButton.TabIndex = 3; + DeleteButton.Text = "Удалить"; + DeleteButton.UseVisualStyleBackColor = true; + DeleteButton.Click += DeleteButton_Click; + // + // RefreshButton + // + RefreshButton.Location = new Point(481, 198); + RefreshButton.Name = "RefreshButton"; + RefreshButton.Size = new Size(112, 34); + RefreshButton.TabIndex = 4; + RefreshButton.Text = "Обновить"; + RefreshButton.UseVisualStyleBackColor = true; + RefreshButton.Click += RefreshButton_Click; + // + // FormManufactures + // + AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(RefreshButton); + Controls.Add(DeleteButton); + Controls.Add(UpdateButton); + Controls.Add(AddButton); + Controls.Add(dataGridView); + Name = "FormManufactures"; + Text = "FormManufactures"; + Load += FormManufactures_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button AddButton; + private Button UpdateButton; + private Button DeleteButton; + private Button RefreshButton; + } +} \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.cs new file mode 100644 index 0000000..5bd115e --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using BlacksmithWorkshop; +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.BusinessLogicsContracts; +using BlacksmithWorkshopContracts.ViewModels; +using BlacksmithWorkshopDataModels.Models; +using Microsoft.Extensions.Logging; +using Microsoft.VisualBasic.Logging; + +namespace BlacksmithWorkshopView +{ + public partial class FormManufactures : Form + { + private readonly ILogger _logger; + private readonly IManufactureLogic _logic; + public FormManufactures(ILogger logger, IManufactureLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormManufactures_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + try + { + var list = _logic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["ManufactureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["ManufactureComponents"].Visible = false; + } + _logger.LogInformation("Загрузка кузнечных изделий"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки кузнечных изделий"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void AddButton_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormManufacture)); + if (service is FormManufacture form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + + private void UpdateButton_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(FormManufacture)); + if (service is FormManufacture form) + { + var tmp = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } + + private void DeleteButton_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Удаление кузнечного изделия"); + try + { + if (!_logic.Delete(new ManufactureBindingModel { Id = id })) + { + throw new Exception("Ошибка при удалении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка удаления кузнечного изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + } + + private void RefreshButton_Click(object sender, EventArgs e) + { + LoadData(); + } + } +} diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormManufactures.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index f58ca47..32ce57b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -5,6 +5,7 @@ using BlacksmithWorkshopView; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; +using BlacksmithWorkshopBusinessList.BusinessLogics; namespace BlacksmithWorkshop { @@ -26,29 +27,29 @@ namespace BlacksmithWorkshop ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); Application.Run(_serviceProvider.GetRequiredService()); - private static void ConfigureServices(ServiceCollection services) + } + private static void ConfigureServices(ServiceCollection services) + { + services.AddLogging(option => { - services.AddLogging(option => - { - option.SetMinimumLevel(LogLevel.Information); - option.AddNLog("nlog.config"); - }); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - } + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/nlog.config b/BlacksmithWorkshop/BlacksmithWorkshop/nlog.config index 49cc43e..85797a7 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/nlog.config +++ b/BlacksmithWorkshop/BlacksmithWorkshop/nlog.config @@ -1,3 +1,15 @@  + + + + + + + + + + \ No newline at end of file