Lisov N.A LabWork1 #1
@ -64,7 +64,7 @@ namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. ProductName:{ProductName}.ID:{ ID}", model.ProductName, model.ID);
|
||||
_logger.LogInformation("ReadElement. ProductName:{ProductName}.ID:{ ID}", model.DressName, model.ID);
|
||||
|
||||
var element = _productStorage.GetElement(model);
|
||||
|
||||
@ -80,7 +80,7 @@ namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
|
||||
public List<DressViewModel>? ReadList(DressSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ProductName:{ProductName}. ID:{ ID}", model?.ProductName, model?.ID);
|
||||
_logger.LogInformation("ReadList. ProductName:{ProductName}. ID:{ ID}", model?.DressName, model?.ID);
|
||||
|
||||
var list = model == null ? _productStorage.GetFullList() : _productStorage.GetFilteredList(model);
|
||||
|
||||
@ -103,19 +103,19 @@ namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.ProductName))
|
||||
if (string.IsNullOrEmpty(model.DressName))
|
||||
{
|
||||
throw new ArgumentNullException("Invalid name of product",nameof(model.ProductName));
|
||||
throw new ArgumentNullException("Invalid name of product",nameof(model.DressName));
|
||||
}
|
||||
if (model.Price <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Price of product should be higher than 0", nameof(model.Price));
|
||||
}
|
||||
_logger.LogInformation("Product. ProductName:{ProductName}. Cost:{Cost}. ID: {ID}", model.ProductName, model.Price, model.ID);
|
||||
_logger.LogInformation("Product. ProductName:{ProductName}. Cost:{Cost}. ID: {ID}", model.DressName, model.Price, model.ID);
|
||||
|
||||
var element = _productStorage.GetElement(new DressSearchModel
|
||||
{
|
||||
ProductName = model.ProductName,
|
||||
DressName = model.DressName,
|
||||
});
|
||||
|
||||
if (element != null && element.ID != model.ID)
|
||||
|
@ -12,12 +12,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class MaterialComponentsLogic : IMaterialLogic
|
||||
public class MaterialLogic : IMaterialLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IMaterialStorage _componentStorage;
|
||||
public MaterialComponentsLogic(ILogger<MaterialComponentsLogic> logger, IMaterialStorage componentStorage)
|
||||
public MaterialLogic(ILogger<MaterialLogic> logger, IMaterialStorage componentStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_componentStorage = componentStorage;
|
@ -19,7 +19,7 @@ namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
public OrderLogic(ILogger logger, IOrderStorage orderStorage)
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
@ -87,7 +87,7 @@ namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. OrderID:{ID}",model.ID);
|
||||
_logger.LogInformation("ReadList. OrderID:{ID}",model?.ID);
|
||||
|
||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||
|
||||
@ -113,7 +113,7 @@ namespace DressAtelierBusinessLogic.BusinessLogic
|
||||
ID = model.ID
|
||||
});
|
||||
|
||||
if (element == null)
|
||||
if (element != null && element.ID == model.ID)
|
||||
{
|
||||
throw new InvalidOperationException("Order with such name already exists.");
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ namespace DressAtelierContracts.BindingModels
|
||||
public class DressBindingModel : IDressModel
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string ProductName { get; set; } = string.Empty;
|
||||
public string DressName { get; set; } = string.Empty;
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IMaterialModel, int)> ProductComponents { get; set; } = new();
|
||||
public Dictionary<int, (IMaterialModel, int)> DressComponents { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace DressAtelierContracts.BindingModels
|
||||
{
|
||||
public class OrderBindingModel : IOrderModel
|
||||
{
|
||||
public int ProductID { get; set; }
|
||||
public int DressID { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
|
@ -9,6 +9,6 @@ namespace DressAtelierContracts.SearchModels
|
||||
public class DressSearchModel
|
||||
{
|
||||
public int? ID { get; set; }
|
||||
public string? ProductName { get; set; }
|
||||
public string? DressName { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class DressViewModel : IDressModel
|
||||
{
|
||||
[DisplayName("Name of product")]
|
||||
public string ProductName { get; set; } = string.Empty;
|
||||
[DisplayName("Name of dress")]
|
||||
public string DressName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Cost")]
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IMaterialModel, int)> ProductComponents { get; set; } = new();
|
||||
public Dictionary<int, (IMaterialModel, int)> DressComponents { get; set; } = new();
|
||||
|
||||
public int ID { get; set; }
|
||||
}
|
||||
|
@ -11,7 +11,12 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
public int ProductID { get; set; }
|
||||
[DisplayName("ID")]
|
||||
public int ID { get; set; }
|
||||
public int DressID { get; set; }
|
||||
|
||||
[DisplayName("DressName")]
|
||||
public string DressName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Quantity")]
|
||||
public int Count { get; set; }
|
||||
@ -28,7 +33,6 @@ namespace DressAtelierContracts.ViewModels
|
||||
[DisplayName("Date of implementation")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
|
||||
[DisplayName("ID")]
|
||||
public int ID { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace DressAtelierDataModels.Models
|
||||
{
|
||||
public interface IDressModel : IID
|
||||
{
|
||||
string ProductName { get; }
|
||||
string DressName { get; }
|
||||
double Price { get; }
|
||||
Dictionary<int,(IMaterialModel,int)> ProductComponents { get; }
|
||||
Dictionary<int,(IMaterialModel,int)> DressComponents { get; }
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace DressAtelierDataModels.Models
|
||||
{
|
||||
public interface IOrderModel :IID
|
||||
{
|
||||
int ProductID { get;}
|
||||
int DressID { get;}
|
||||
int Count { get; }
|
||||
double Sum { get; }
|
||||
OrderStatus Status { get; }
|
||||
|
113
DressAtelierListImplement/Implements/DressStorage.cs
Normal file
113
DressAtelierListImplement/Implements/DressStorage.cs
Normal file
@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using DressAtelierContracts.StorageContracts;
|
||||
using DressAtelierContracts.ViewModels;
|
||||
using DressAtelierListImplement.Models;
|
||||
|
||||
namespace DressAtelierListImplement.Implements
|
||||
{
|
||||
public class DressStorage : IDressStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public DressStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<DressViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<DressViewModel>();
|
||||
foreach (var material in _source.Products)
|
||||
{
|
||||
result.Add(material.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DressViewModel> GetFilteredList(DressSearchModel model)
|
||||
{
|
||||
var result = new List<DressViewModel>();
|
||||
if (string.IsNullOrEmpty(model.DressName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var product in _source.Products)
|
||||
{
|
||||
if (product.DressName.Contains(model.DressName))
|
||||
{
|
||||
result.Add(product.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public DressViewModel? GetElement(DressSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.DressName) && !model.ID.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (var product in _source.Products)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.DressName) && product.DressName == model.DressName) || (model.ID.HasValue && product.ID == model.ID))
|
||||
{
|
||||
return product.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DressViewModel? Insert(DressBindingModel model)
|
||||
{
|
||||
model.ID = 1;
|
||||
foreach (var component in _source.Products)
|
||||
{
|
||||
if (model.ID <= component.ID)
|
||||
{
|
||||
model.ID = component.ID + 1;
|
||||
}
|
||||
}
|
||||
var newComponent = Dress.Create(model);
|
||||
if (newComponent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Products.Add(newComponent);
|
||||
return newComponent.GetViewModel;
|
||||
}
|
||||
|
||||
public DressViewModel? Update(DressBindingModel model)
|
||||
{
|
||||
foreach (var component in _source.Products)
|
||||
{
|
||||
if (component.ID == model.ID)
|
||||
{
|
||||
component.Update(model);
|
||||
return component.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DressViewModel? Delete(DressBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Products.Count; ++i)
|
||||
{
|
||||
if (_source.Products[i].ID == model.ID)
|
||||
{
|
||||
var element = _source.Products[i];
|
||||
_source.Products.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
114
DressAtelierListImplement/Implements/MaterialStorage.cs
Normal file
114
DressAtelierListImplement/Implements/MaterialStorage.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using DressAtelierContracts.StorageContracts;
|
||||
using DressAtelierContracts.ViewModels;
|
||||
using DressAtelierListImplement.Models;
|
||||
|
||||
namespace DressAtelierListImplement.Implements
|
||||
{
|
||||
public class MaterialStorage : IMaterialStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public MaterialStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<MaterialViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<MaterialViewModel>();
|
||||
foreach (var material in _source.Components)
|
||||
{
|
||||
result.Add(material.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public List<MaterialViewModel> GetFilteredList(MaterialSearchModel model)
|
||||
{
|
||||
var result = new List<MaterialViewModel>();
|
||||
if (string.IsNullOrEmpty(model.ComponentName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var component in _source.Components)
|
||||
{
|
||||
if (component.ComponentName.Contains(model.ComponentName))
|
||||
{
|
||||
result.Add(component.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public MaterialViewModel? GetElement(MaterialSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ComponentName) && !model.ID.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (var component in _source.Components)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.ComponentName) &&
|
||||
component.ComponentName == model.ComponentName) || (model.ID.HasValue && component.ID == model.ID))
|
||||
{
|
||||
return component.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MaterialViewModel? Insert(MaterialBindingModel model)
|
||||
{
|
||||
model.ID = 1;
|
||||
foreach (var component in _source.Components)
|
||||
{
|
||||
if (model.ID <= component.ID)
|
||||
{
|
||||
model.ID = component.ID + 1;
|
||||
}
|
||||
}
|
||||
var newComponent = Material.Create(model);
|
||||
if (newComponent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Components.Add(newComponent);
|
||||
return newComponent.GetViewModel;
|
||||
}
|
||||
|
||||
public MaterialViewModel? Update(MaterialBindingModel model)
|
||||
{
|
||||
foreach (var component in _source.Components)
|
||||
{
|
||||
if (component.ID == model.ID)
|
||||
{
|
||||
component.Update(model);
|
||||
return component.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MaterialViewModel? Delete(MaterialBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Components.Count; ++i)
|
||||
{
|
||||
if (_source.Components[i].ID == model.ID)
|
||||
{
|
||||
var element = _source.Components[i];
|
||||
_source.Components.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
112
DressAtelierListImplement/Implements/OrderStorage.cs
Normal file
112
DressAtelierListImplement/Implements/OrderStorage.cs
Normal file
@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using DressAtelierContracts.StorageContracts;
|
||||
using DressAtelierContracts.ViewModels;
|
||||
using DressAtelierListImplement.Models;
|
||||
|
||||
namespace DressAtelierListImplement.Implements
|
||||
{
|
||||
public class OrderStorage : IOrderStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public OrderStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<OrderViewModel>();
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
result.Add(order.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
var result = new List<OrderViewModel>();
|
||||
if (!model.ID.HasValue)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var component in _source.Orders)
|
||||
{
|
||||
if (component.ID == model.ID)
|
||||
{
|
||||
result.Add(component.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
if (!model.ID.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (var component in _source.Orders)
|
||||
{
|
||||
if (model.ID.HasValue && component.ID == model.ID)
|
||||
{
|
||||
return component.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
{
|
||||
model.ID = 1;
|
||||
foreach (var component in _source.Orders)
|
||||
{
|
||||
if (model.ID <= component.ID)
|
||||
{
|
||||
model.ID = component.ID + 1;
|
||||
}
|
||||
}
|
||||
var newComponent = Order.Create(model);
|
||||
if (newComponent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Orders.Add(newComponent);
|
||||
return newComponent.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
{
|
||||
foreach (var component in _source.Orders)
|
||||
{
|
||||
if (component.ID == model.ID)
|
||||
{
|
||||
component.Update(model);
|
||||
return component.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Orders.Count; ++i)
|
||||
{
|
||||
if (_source.Orders[i].ID == model.ID)
|
||||
{
|
||||
var element = _source.Orders[i];
|
||||
_source.Orders.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,11 +14,11 @@ namespace DressAtelierListImplement.Models
|
||||
public class Dress : IDressModel
|
||||
{
|
||||
public int ID { get; private set; }
|
||||
public string ProductName { get; private set; } = string.Empty;
|
||||
public string DressName { get; private set; } = string.Empty;
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
public Dictionary<int, (IMaterialModel, int)> ProductComponents { get; private set; } = new Dictionary<int, (IMaterialModel, int)>();
|
||||
public Dictionary<int, (IMaterialModel, int)> DressComponents { get; private set; } = new Dictionary<int, (IMaterialModel, int)>();
|
||||
|
||||
public static Dress? Create(DressBindingModel? model)
|
||||
{
|
||||
@ -29,9 +29,9 @@ namespace DressAtelierListImplement.Models
|
||||
return new Dress()
|
||||
{
|
||||
ID = model.ID,
|
||||
ProductName = model.ProductName,
|
||||
DressName = model.DressName,
|
||||
Price = model.Price,
|
||||
ProductComponents = model.ProductComponents
|
||||
DressComponents = model.DressComponents
|
||||
};
|
||||
|
||||
}
|
||||
@ -42,16 +42,16 @@ namespace DressAtelierListImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
ProductName = model.ProductName;
|
||||
DressName = model.DressName;
|
||||
Price = model.Price;
|
||||
ProductComponents = model.ProductComponents;
|
||||
DressComponents = model.DressComponents;
|
||||
}
|
||||
public DressViewModel GetViewModel => new()
|
||||
{
|
||||
ID = ID,
|
||||
ProductName = ProductName,
|
||||
DressName = DressName,
|
||||
Price = Price,
|
||||
ProductComponents = ProductComponents
|
||||
DressComponents = DressComponents
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace DressAtelierListImplement.Models
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
public int ID { get; private set; }
|
||||
public int ProductID { get; private set; }
|
||||
public int DressID { get; private set; }
|
||||
|
||||
public int Count {get; private set; }
|
||||
|
||||
@ -35,7 +35,7 @@ namespace DressAtelierListImplement.Models
|
||||
return new Order()
|
||||
{
|
||||
ID = model.ID,
|
||||
ProductID = model.ProductID,
|
||||
DressID = model.DressID,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -52,7 +52,7 @@ namespace DressAtelierListImplement.Models
|
||||
return;
|
||||
}
|
||||
|
||||
ProductID = model.ProductID;
|
||||
DressID = model.DressID;
|
||||
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
@ -62,7 +62,7 @@ namespace DressAtelierListImplement.Models
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
ID = ID,
|
||||
ProductID = ProductID,
|
||||
DressID = DressID,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
|
39
SewingDresses/Form1.Designer.cs
generated
39
SewingDresses/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
230
SewingDresses/FormDress.Designer.cs
generated
Normal file
230
SewingDresses/FormDress.Designer.cs
generated
Normal file
@ -0,0 +1,230 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormDress
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.nameDressLabel = new System.Windows.Forms.Label();
|
||||
this.priceDressLabel = new System.Windows.Forms.Label();
|
||||
this.nameDressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.priceDressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.materialsGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.RefreshButton = new System.Windows.Forms.Button();
|
||||
this.deleteButton = new System.Windows.Forms.Button();
|
||||
this.changeButton = new System.Windows.Forms.Button();
|
||||
this.AddButton = new System.Windows.Forms.Button();
|
||||
this.dressGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnMaterial = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnQuantity = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.saveButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.materialsGroupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dressGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameDressLabel
|
||||
//
|
||||
this.nameDressLabel.AutoSize = true;
|
||||
this.nameDressLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.nameDressLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.nameDressLabel.Name = "nameDressLabel";
|
||||
this.nameDressLabel.Size = new System.Drawing.Size(66, 25);
|
||||
this.nameDressLabel.TabIndex = 0;
|
||||
this.nameDressLabel.Text = "Name:";
|
||||
//
|
||||
// priceDressLabel
|
||||
//
|
||||
this.priceDressLabel.AutoSize = true;
|
||||
this.priceDressLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.priceDressLabel.Location = new System.Drawing.Point(12, 46);
|
||||
this.priceDressLabel.Name = "priceDressLabel";
|
||||
this.priceDressLabel.Size = new System.Drawing.Size(58, 25);
|
||||
this.priceDressLabel.TabIndex = 1;
|
||||
this.priceDressLabel.Text = "Price:";
|
||||
//
|
||||
// nameDressTextBox
|
||||
//
|
||||
this.nameDressTextBox.Location = new System.Drawing.Point(84, 11);
|
||||
this.nameDressTextBox.Name = "nameDressTextBox";
|
||||
this.nameDressTextBox.Size = new System.Drawing.Size(287, 23);
|
||||
this.nameDressTextBox.TabIndex = 2;
|
||||
//
|
||||
// priceDressTextBox
|
||||
//
|
||||
this.priceDressTextBox.Location = new System.Drawing.Point(84, 48);
|
||||
this.priceDressTextBox.Name = "priceDressTextBox";
|
||||
this.priceDressTextBox.ReadOnly = true;
|
||||
this.priceDressTextBox.Size = new System.Drawing.Size(178, 23);
|
||||
this.priceDressTextBox.TabIndex = 3;
|
||||
//
|
||||
// materialsGroupBox
|
||||
//
|
||||
this.materialsGroupBox.Controls.Add(this.RefreshButton);
|
||||
this.materialsGroupBox.Controls.Add(this.deleteButton);
|
||||
this.materialsGroupBox.Controls.Add(this.changeButton);
|
||||
this.materialsGroupBox.Controls.Add(this.AddButton);
|
||||
this.materialsGroupBox.Controls.Add(this.dressGridView);
|
||||
this.materialsGroupBox.Location = new System.Drawing.Point(16, 89);
|
||||
this.materialsGroupBox.Name = "materialsGroupBox";
|
||||
this.materialsGroupBox.Size = new System.Drawing.Size(770, 301);
|
||||
this.materialsGroupBox.TabIndex = 4;
|
||||
this.materialsGroupBox.TabStop = false;
|
||||
this.materialsGroupBox.Text = "Materials";
|
||||
//
|
||||
// RefreshButton
|
||||
//
|
||||
this.RefreshButton.Location = new System.Drawing.Point(638, 225);
|
||||
this.RefreshButton.Name = "RefreshButton";
|
||||
this.RefreshButton.Size = new System.Drawing.Size(103, 36);
|
||||
this.RefreshButton.TabIndex = 4;
|
||||
this.RefreshButton.Text = "Refresh";
|
||||
this.RefreshButton.UseVisualStyleBackColor = true;
|
||||
this.RefreshButton.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
||||
//
|
||||
// deleteButton
|
||||
//
|
||||
this.deleteButton.Location = new System.Drawing.Point(638, 168);
|
||||
this.deleteButton.Name = "deleteButton";
|
||||
this.deleteButton.Size = new System.Drawing.Size(103, 36);
|
||||
this.deleteButton.TabIndex = 3;
|
||||
this.deleteButton.Text = "Delete";
|
||||
this.deleteButton.UseVisualStyleBackColor = true;
|
||||
this.deleteButton.Click += new System.EventHandler(this.ButtonDelete_Click);
|
||||
//
|
||||
// changeButton
|
||||
//
|
||||
this.changeButton.Location = new System.Drawing.Point(638, 110);
|
||||
this.changeButton.Name = "changeButton";
|
||||
this.changeButton.Size = new System.Drawing.Size(103, 36);
|
||||
this.changeButton.TabIndex = 2;
|
||||
this.changeButton.Text = "Change";
|
||||
this.changeButton.UseVisualStyleBackColor = true;
|
||||
this.changeButton.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.Location = new System.Drawing.Point(638, 56);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(103, 36);
|
||||
this.AddButton.TabIndex = 1;
|
||||
this.AddButton.Text = "Add";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
//
|
||||
// dressGridView
|
||||
//
|
||||
this.dressGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dressGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ColumnID,
|
||||
this.ColumnMaterial,
|
||||
this.ColumnQuantity});
|
||||
this.dressGridView.Location = new System.Drawing.Point(6, 22);
|
||||
this.dressGridView.Name = "dressGridView";
|
||||
this.dressGridView.RowTemplate.Height = 25;
|
||||
this.dressGridView.Size = new System.Drawing.Size(588, 273);
|
||||
this.dressGridView.TabIndex = 0;
|
||||
//
|
||||
// ColumnID
|
||||
//
|
||||
this.ColumnID.HeaderText = "ID";
|
||||
this.ColumnID.Name = "ColumnID";
|
||||
this.ColumnID.Visible = false;
|
||||
//
|
||||
// ColumnMaterial
|
||||
//
|
||||
this.ColumnMaterial.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.ColumnMaterial.HeaderText = "Material";
|
||||
this.ColumnMaterial.Name = "ColumnMaterial";
|
||||
//
|
||||
// ColumnQuantity
|
||||
//
|
||||
this.ColumnQuantity.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.ColumnQuantity.HeaderText = "Quantity";
|
||||
this.ColumnQuantity.Name = "ColumnQuantity";
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
this.saveButton.Location = new System.Drawing.Point(562, 407);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Size = new System.Drawing.Size(89, 31);
|
||||
this.saveButton.TabIndex = 5;
|
||||
this.saveButton.Text = "Save";
|
||||
this.saveButton.UseVisualStyleBackColor = true;
|
||||
this.saveButton.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Location = new System.Drawing.Point(657, 407);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(89, 31);
|
||||
this.cancelButton.TabIndex = 6;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormDress
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.Controls.Add(this.materialsGroupBox);
|
||||
this.Controls.Add(this.priceDressTextBox);
|
||||
this.Controls.Add(this.nameDressTextBox);
|
||||
this.Controls.Add(this.priceDressLabel);
|
||||
this.Controls.Add(this.nameDressLabel);
|
||||
this.Name = "FormDress";
|
||||
this.Text = "FormDress";
|
||||
eegov
commented
Заголовок формы оформлен неверно Заголовок формы оформлен неверно
|
||||
this.Load += new System.EventHandler(this.FormDress_Load);
|
||||
this.materialsGroupBox.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dressGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label nameDressLabel;
|
||||
private Label priceDressLabel;
|
||||
private TextBox nameDressTextBox;
|
||||
private TextBox priceDressTextBox;
|
||||
private GroupBox materialsGroupBox;
|
||||
private Button RefreshButton;
|
||||
private Button deleteButton;
|
||||
private Button changeButton;
|
||||
private Button AddButton;
|
||||
private DataGridView dressGridView;
|
||||
private DataGridViewTextBoxColumn ColumnID;
|
||||
private DataGridViewTextBoxColumn ColumnMaterial;
|
||||
private DataGridViewTextBoxColumn ColumnQuantity;
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
}
|
||||
}
|
229
SewingDresses/FormDress.cs
Normal file
229
SewingDresses/FormDress.cs
Normal file
@ -0,0 +1,229 @@
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using DressAtelierDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormDress : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IDressLogic _logic;
|
||||
|
||||
private int? _id;
|
||||
|
||||
private Dictionary<int, (IMaterialModel, int)> _dressComponents;
|
||||
|
||||
public int ID { set { _id = value; } }
|
||||
|
||||
public FormDress(ILogger<FormDress> logger, IDressLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_dressComponents = new Dictionary<int, (IMaterialModel, int)>();
|
||||
|
||||
}
|
||||
|
||||
private void FormDress_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Downloading dresses");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new DressSearchModel
|
||||
{
|
||||
ID = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
nameDressTextBox.Text = view.DressName;
|
||||
priceDressTextBox.Text = view.Price.ToString();
|
||||
_dressComponents = view.DressComponents ?? new Dictionary<int, (IMaterialModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Downloading dress error");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Downloading material for dress");
|
||||
try
|
||||
{
|
||||
if (_dressComponents != null)
|
||||
{
|
||||
dressGridView.Rows.Clear();
|
||||
foreach (var pc in _dressComponents)
|
||||
{
|
||||
dressGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 });
|
||||
}
|
||||
priceDressTextBox.Text = CalcPrice().ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error downloading material for dress");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDressMaterial));
|
||||
if (service is FormDressMaterial form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.MaterialModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Adding new material: { ComponentName}- { Count}", form.MaterialModel.ComponentName, form.Count);
|
||||
|
||||
if (_dressComponents.ContainsKey(form.ID))
|
||||
{
|
||||
_dressComponents[form.ID] = (form.MaterialModel, form.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_dressComponents.Add(form.ID, (form.MaterialModel, form.Count));
|
||||
}
|
||||
LoadData();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dressGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDressMaterial));
|
||||
if (service is FormDressMaterial form)
|
||||
{
|
||||
int id = Convert.ToInt32(dressGridView.SelectedRows[0].Cells[0].Value);
|
||||
form.ID = id;
|
||||
form.Count = _dressComponents[id].Item2;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.MaterialModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Changing material:{ ComponentName}- { Count}", form.MaterialModel.ComponentName, form.Count);
|
||||
_dressComponents[form.ID] = (form.MaterialModel,form.Count);
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dressGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Delete record?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Deletion material:{ ComponentName} - { Count}", dressGridView.SelectedRows[0].Cells[1].Value);
|
||||
_dressComponents?.Remove(Convert.ToInt32(dressGridView.SelectedRows[0].Cells[0].Value));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(nameDressTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Fill field name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(priceDressTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Fill field price", "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (_dressComponents == null || _dressComponents.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Fill materials", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Saving dress");
|
||||
try
|
||||
{
|
||||
var model = new DressBindingModel
|
||||
{
|
||||
ID = _id ?? 0,
|
||||
DressName = nameDressTextBox.Text,
|
||||
Price = Convert.ToDouble(priceDressTextBox.Text),
|
||||
DressComponents = _dressComponents
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
||||
_logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Saving error. Extra information in logs.");
|
||||
}
|
||||
MessageBox.Show("Saving was succesfull", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Saving dress error");
|
||||
MessageBox.Show(ex.Message, "Error", 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 _dressComponents)
|
||||
{
|
||||
price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
|
||||
}
|
||||
return Math.Round(price * 1.1, 2);
|
||||
}
|
||||
}
|
||||
}
|
69
SewingDresses/FormDress.resx
Normal file
69
SewingDresses/FormDress.resx
Normal file
@ -0,0 +1,69 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnMaterial.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnQuantity.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
121
SewingDresses/FormDressMaterial.Designer.cs
generated
Normal file
121
SewingDresses/FormDressMaterial.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormDressMaterial
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.materialNameLabel = new System.Windows.Forms.Label();
|
||||
this.materialQuantityLabel = new System.Windows.Forms.Label();
|
||||
this.materialComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.quantityTextBox = new System.Windows.Forms.TextBox();
|
||||
this.saveButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// materialNameLabel
|
||||
//
|
||||
this.materialNameLabel.AutoSize = true;
|
||||
this.materialNameLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.materialNameLabel.Location = new System.Drawing.Point(12, 19);
|
||||
this.materialNameLabel.Name = "materialNameLabel";
|
||||
this.materialNameLabel.Size = new System.Drawing.Size(86, 25);
|
||||
this.materialNameLabel.TabIndex = 0;
|
||||
this.materialNameLabel.Text = "Material:";
|
||||
//
|
||||
// materialQuantityLabel
|
||||
//
|
||||
this.materialQuantityLabel.AutoSize = true;
|
||||
this.materialQuantityLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.materialQuantityLabel.Location = new System.Drawing.Point(12, 63);
|
||||
this.materialQuantityLabel.Name = "materialQuantityLabel";
|
||||
this.materialQuantityLabel.Size = new System.Drawing.Size(88, 25);
|
||||
this.materialQuantityLabel.TabIndex = 1;
|
||||
this.materialQuantityLabel.Text = "Quantity:";
|
||||
//
|
||||
// materialComboBox
|
||||
//
|
||||
this.materialComboBox.FormattingEnabled = true;
|
||||
this.materialComboBox.Location = new System.Drawing.Point(123, 19);
|
||||
this.materialComboBox.Name = "materialComboBox";
|
||||
this.materialComboBox.Size = new System.Drawing.Size(342, 23);
|
||||
this.materialComboBox.TabIndex = 2;
|
||||
//
|
||||
// quantityTextBox
|
||||
//
|
||||
this.quantityTextBox.Location = new System.Drawing.Point(123, 63);
|
||||
this.quantityTextBox.Name = "quantityTextBox";
|
||||
this.quantityTextBox.Size = new System.Drawing.Size(342, 23);
|
||||
this.quantityTextBox.TabIndex = 3;
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
this.saveButton.Location = new System.Drawing.Point(275, 104);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Size = new System.Drawing.Size(92, 23);
|
||||
this.saveButton.TabIndex = 4;
|
||||
this.saveButton.Text = "Save";
|
||||
this.saveButton.UseVisualStyleBackColor = true;
|
||||
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Location = new System.Drawing.Point(373, 104);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(92, 23);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// FormDressMaterial
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(477, 129);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.Controls.Add(this.quantityTextBox);
|
||||
this.Controls.Add(this.materialComboBox);
|
||||
this.Controls.Add(this.materialQuantityLabel);
|
||||
this.Controls.Add(this.materialNameLabel);
|
||||
this.Name = "FormDressMaterial";
|
||||
this.Text = "FormDressMaterial";
|
||||
this.ResumeLayout(false);
|
||||
eegov
commented
Заголовок формы оформлен неверно Заголовок формы оформлен неверно
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label materialNameLabel;
|
||||
private Label materialQuantityLabel;
|
||||
private ComboBox materialComboBox;
|
||||
private TextBox quantityTextBox;
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
}
|
||||
}
|
105
SewingDresses/FormDressMaterial.cs
Normal file
105
SewingDresses/FormDressMaterial.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using DressAtelierContracts.ViewModels;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
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 DressAtelierDataModels.Models;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormDressMaterial : Form
|
||||
{
|
||||
private readonly List<MaterialViewModel>? _list;
|
||||
|
||||
public int ID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToInt32(materialComboBox.SelectedValue);
|
||||
}
|
||||
set
|
||||
{
|
||||
materialComboBox.SelectedValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IMaterialModel? MaterialModel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var elem in _list)
|
||||
{
|
||||
if (elem.ID == ID)
|
||||
{
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToInt32(quantityTextBox.Text);
|
||||
}
|
||||
set
|
||||
{
|
||||
quantityTextBox.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FormDressMaterial(IMaterialLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_list = logic.ReadList(null);
|
||||
|
||||
if (_list != null)
|
||||
{
|
||||
materialComboBox.DisplayMember = "ComponentName";
|
||||
materialComboBox.ValueMember = "ID";
|
||||
materialComboBox.DataSource = _list;
|
||||
materialComboBox.SelectedItem = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(quantityTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Fill quantity field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (materialComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Choose material", "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
60
SewingDresses/FormDressMaterial.resx
Normal file
60
SewingDresses/FormDressMaterial.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
115
SewingDresses/FormDresses.Designer.cs
generated
Normal file
115
SewingDresses/FormDresses.Designer.cs
generated
Normal file
@ -0,0 +1,115 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormDresses
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.dressGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ButtonAdd = new System.Windows.Forms.Button();
|
||||
this.ButtonChange = new System.Windows.Forms.Button();
|
||||
this.ButtonDelete = new System.Windows.Forms.Button();
|
||||
this.ButtonRefresh = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dressGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dressGridView
|
||||
//
|
||||
this.dressGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.dressGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dressGridView.Location = new System.Drawing.Point(2, 2);
|
||||
this.dressGridView.Name = "dressGridView";
|
||||
this.dressGridView.RowTemplate.Height = 25;
|
||||
this.dressGridView.Size = new System.Drawing.Size(605, 447);
|
||||
this.dressGridView.TabIndex = 0;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
this.ButtonAdd.Location = new System.Drawing.Point(661, 30);
|
||||
this.ButtonAdd.Name = "ButtonAdd";
|
||||
this.ButtonAdd.Size = new System.Drawing.Size(92, 35);
|
||||
this.ButtonAdd.TabIndex = 1;
|
||||
this.ButtonAdd.Text = "Add";
|
||||
this.ButtonAdd.UseVisualStyleBackColor = true;
|
||||
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
//
|
||||
// ButtonChange
|
||||
//
|
||||
this.ButtonChange.Location = new System.Drawing.Point(661, 85);
|
||||
this.ButtonChange.Name = "ButtonChange";
|
||||
this.ButtonChange.Size = new System.Drawing.Size(92, 35);
|
||||
this.ButtonChange.TabIndex = 2;
|
||||
this.ButtonChange.Text = "Change";
|
||||
this.ButtonChange.UseVisualStyleBackColor = true;
|
||||
this.ButtonChange.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
||||
//
|
||||
// ButtonDelete
|
||||
//
|
||||
this.ButtonDelete.Location = new System.Drawing.Point(661, 142);
|
||||
this.ButtonDelete.Name = "ButtonDelete";
|
||||
this.ButtonDelete.Size = new System.Drawing.Size(92, 35);
|
||||
this.ButtonDelete.TabIndex = 3;
|
||||
this.ButtonDelete.Text = "Delete";
|
||||
this.ButtonDelete.UseVisualStyleBackColor = true;
|
||||
this.ButtonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
|
||||
//
|
||||
// ButtonRefresh
|
||||
//
|
||||
this.ButtonRefresh.Location = new System.Drawing.Point(661, 204);
|
||||
this.ButtonRefresh.Name = "ButtonRefresh";
|
||||
this.ButtonRefresh.Size = new System.Drawing.Size(92, 35);
|
||||
this.ButtonRefresh.TabIndex = 4;
|
||||
this.ButtonRefresh.Text = "Refresh";
|
||||
this.ButtonRefresh.UseVisualStyleBackColor = true;
|
||||
this.ButtonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
||||
//
|
||||
// FormDresses
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.ButtonRefresh);
|
||||
this.Controls.Add(this.ButtonDelete);
|
||||
this.Controls.Add(this.ButtonChange);
|
||||
this.Controls.Add(this.ButtonAdd);
|
||||
this.Controls.Add(this.dressGridView);
|
||||
this.Name = "FormDresses";
|
||||
this.Text = "FormDresses";
|
||||
eegov
commented
Заголовок формы оформлен неверно Заголовок формы оформлен неверно
|
||||
this.Load += new System.EventHandler(this.FormDresses_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dressGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dressGridView;
|
||||
private Button ButtonAdd;
|
||||
private Button ButtonChange;
|
||||
private Button ButtonDelete;
|
||||
private Button ButtonRefresh;
|
||||
}
|
||||
}
|
119
SewingDresses/FormDresses.cs
Normal file
119
SewingDresses/FormDresses.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormDresses : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDressLogic _logic;
|
||||
|
||||
public FormDresses(ILogger<FormDresses> logger, IDressLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormDresses_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dressGridView.DataSource = list;
|
||||
dressGridView.Columns["ID"].Visible = false;
|
||||
dressGridView.Columns["DressName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dressGridView.Columns["DressComponents"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Loading dresses");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error loading dresses");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDress));
|
||||
if (service is FormDress form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dressGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDress));
|
||||
if (service is FormDress form)
|
||||
{
|
||||
form.ID = Convert.ToInt32(dressGridView.SelectedRows[0].Cells["ID"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dressGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Delete record?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dressGridView.SelectedRows[0].Cells["ID"].Value);
|
||||
_logger.LogInformation("Dress deletion");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new DressBindingModel
|
||||
{
|
||||
ID = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Deletion error. Extra information in logs.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Dress deletion error");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
60
SewingDresses/FormDresses.resx
Normal file
60
SewingDresses/FormDresses.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
175
SewingDresses/FormMain.Designer.cs
generated
Normal file
175
SewingDresses/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,175 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.directoriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.createOrderButton = new System.Windows.Forms.Button();
|
||||
this.processOrderButton = new System.Windows.Forms.Button();
|
||||
this.readyOrderButton = new System.Windows.Forms.Button();
|
||||
this.givenOrderButton = new System.Windows.Forms.Button();
|
||||
this.refreshOrdersButton = new System.Windows.Forms.Button();
|
||||
this.materialsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dressesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.directoriesToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(800, 24);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// directoriesToolStripMenuItem
|
||||
//
|
||||
this.directoriesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.materialsToolStripMenuItem,
|
||||
this.dressesToolStripMenuItem});
|
||||
this.directoriesToolStripMenuItem.Name = "directoriesToolStripMenuItem";
|
||||
this.directoriesToolStripMenuItem.Size = new System.Drawing.Size(75, 20);
|
||||
this.directoriesToolStripMenuItem.Text = "Directories";
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(2, 27);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowTemplate.Height = 25;
|
||||
this.dataGridView.Size = new System.Drawing.Size(631, 420);
|
||||
this.dataGridView.TabIndex = 1;
|
||||
//
|
||||
// createOrderButton
|
||||
//
|
||||
this.createOrderButton.Location = new System.Drawing.Point(652, 89);
|
||||
this.createOrderButton.Name = "createOrderButton";
|
||||
this.createOrderButton.Size = new System.Drawing.Size(117, 34);
|
||||
this.createOrderButton.TabIndex = 2;
|
||||
this.createOrderButton.Text = "Create order";
|
||||
this.createOrderButton.UseVisualStyleBackColor = true;
|
||||
this.createOrderButton.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
||||
//
|
||||
// processOrderButton
|
||||
//
|
||||
this.processOrderButton.Location = new System.Drawing.Point(652, 145);
|
||||
this.processOrderButton.Name = "processOrderButton";
|
||||
this.processOrderButton.Size = new System.Drawing.Size(117, 34);
|
||||
this.processOrderButton.TabIndex = 3;
|
||||
this.processOrderButton.Text = "Order\'s in process";
|
||||
this.processOrderButton.UseVisualStyleBackColor = true;
|
||||
this.processOrderButton.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
|
||||
//
|
||||
// readyOrderButton
|
||||
//
|
||||
this.readyOrderButton.Location = new System.Drawing.Point(652, 203);
|
||||
this.readyOrderButton.Name = "readyOrderButton";
|
||||
this.readyOrderButton.Size = new System.Drawing.Size(117, 34);
|
||||
this.readyOrderButton.TabIndex = 4;
|
||||
this.readyOrderButton.Text = "Order\'s ready";
|
||||
this.readyOrderButton.UseVisualStyleBackColor = true;
|
||||
this.readyOrderButton.Click += new System.EventHandler(this.ButtonOrderReady_Click);
|
||||
//
|
||||
// givenOrderButton
|
||||
//
|
||||
this.givenOrderButton.Location = new System.Drawing.Point(652, 259);
|
||||
this.givenOrderButton.Name = "givenOrderButton";
|
||||
this.givenOrderButton.Size = new System.Drawing.Size(117, 34);
|
||||
this.givenOrderButton.TabIndex = 5;
|
||||
this.givenOrderButton.Text = "Order\'s given";
|
||||
this.givenOrderButton.UseVisualStyleBackColor = true;
|
||||
this.givenOrderButton.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
||||
//
|
||||
// refreshOrdersButton
|
||||
//
|
||||
this.refreshOrdersButton.Location = new System.Drawing.Point(652, 321);
|
||||
this.refreshOrdersButton.Name = "refreshOrdersButton";
|
||||
this.refreshOrdersButton.Size = new System.Drawing.Size(117, 34);
|
||||
this.refreshOrdersButton.TabIndex = 6;
|
||||
this.refreshOrdersButton.Text = "Refresh list";
|
||||
this.refreshOrdersButton.UseVisualStyleBackColor = true;
|
||||
this.refreshOrdersButton.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||
//
|
||||
// materialsToolStripMenuItem
|
||||
//
|
||||
this.materialsToolStripMenuItem.Name = "materialsToolStripMenuItem";
|
||||
this.materialsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.materialsToolStripMenuItem.Text = "Materials";
|
||||
this.materialsToolStripMenuItem.Click += new System.EventHandler(this.materialsToolStripMenuItem_Click);
|
||||
//
|
||||
// dressesToolStripMenuItem
|
||||
//
|
||||
this.dressesToolStripMenuItem.Name = "dressesToolStripMenuItem";
|
||||
this.dressesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.dressesToolStripMenuItem.Text = "Dresses";
|
||||
this.dressesToolStripMenuItem.Click += new System.EventHandler(this.dressesToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.refreshOrdersButton);
|
||||
this.Controls.Add(this.givenOrderButton);
|
||||
this.Controls.Add(this.readyOrderButton);
|
||||
this.Controls.Add(this.processOrderButton);
|
||||
this.Controls.Add(this.createOrderButton);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
this.Name = "FormMain";
|
||||
this.Text = "FormMain";
|
||||
eegov
commented
Заголовок формы оформлен неверно Заголовок формы оформлен неверно
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem directoriesToolStripMenuItem;
|
||||
private DataGridView dataGridView;
|
||||
private Button createOrderButton;
|
||||
private Button processOrderButton;
|
||||
private Button readyOrderButton;
|
||||
private Button givenOrderButton;
|
||||
private Button refreshOrdersButton;
|
||||
private ToolStripMenuItem materialsToolStripMenuItem;
|
||||
private ToolStripMenuItem dressesToolStripMenuItem;
|
||||
}
|
||||
}
|
174
SewingDresses/FormMain.cs
Normal file
174
SewingDresses/FormMain.cs
Normal file
@ -0,0 +1,174 @@
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Downloading orders");
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["DressID"].Visible = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error downloading orders");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void materialsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormMaterials));
|
||||
if (service is FormMaterials form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void dressesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDresses));
|
||||
if (service is FormDresses form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormOrderCreation));
|
||||
if (service is FormOrderCreation form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DressID"].Value);
|
||||
_logger.LogInformation("Order №{id}. Changing status to 'In process'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
//TODO
|
||||
ID = id
|
||||
});
|
||||
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Saving Error. Extra information in logs.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error transferring order into process");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DressID"].Value);
|
||||
_logger.LogInformation("Order №{id}. Changing status to 'Ready'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.ReadyOrder(new OrderBindingModel
|
||||
{
|
||||
//TODO
|
||||
ID = id
|
||||
});
|
||||
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Saving error. Extra information in logs.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in giving ready status to order");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DressID"].Value);
|
||||
_logger.LogInformation("Order №{id}. Changing status to 'Given'",id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.GivenOrder(new OrderBindingModel
|
||||
{
|
||||
//TODO
|
||||
ID = id
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Saving error. Extra information in logs.");
|
||||
}
|
||||
_logger.LogInformation("Order №{id} is given", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in giving 'Is given' status to order");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
63
SewingDresses/FormMain.resx
Normal file
63
SewingDresses/FormMain.resx
Normal file
@ -0,0 +1,63 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
121
SewingDresses/FormMaterial.Designer.cs
generated
Normal file
121
SewingDresses/FormMaterial.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormMaterial
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.componentNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.componentPriceTextBox = new System.Windows.Forms.TextBox();
|
||||
this.componentNameLabel = new System.Windows.Forms.Label();
|
||||
this.priceComponentLabel = new System.Windows.Forms.Label();
|
||||
this.saveComponentButton = new System.Windows.Forms.Button();
|
||||
this.cancelComponentButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// componentNameTextBox
|
||||
//
|
||||
this.componentNameTextBox.Location = new System.Drawing.Point(120, 26);
|
||||
this.componentNameTextBox.Name = "componentNameTextBox";
|
||||
this.componentNameTextBox.Size = new System.Drawing.Size(300, 23);
|
||||
this.componentNameTextBox.TabIndex = 0;
|
||||
//
|
||||
// componentPriceTextBox
|
||||
//
|
||||
this.componentPriceTextBox.Location = new System.Drawing.Point(120, 68);
|
||||
this.componentPriceTextBox.Name = "componentPriceTextBox";
|
||||
this.componentPriceTextBox.Size = new System.Drawing.Size(158, 23);
|
||||
this.componentPriceTextBox.TabIndex = 1;
|
||||
//
|
||||
// componentNameLabel
|
||||
//
|
||||
this.componentNameLabel.AutoSize = true;
|
||||
this.componentNameLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.componentNameLabel.Location = new System.Drawing.Point(31, 24);
|
||||
this.componentNameLabel.Name = "componentNameLabel";
|
||||
this.componentNameLabel.Size = new System.Drawing.Size(66, 25);
|
||||
this.componentNameLabel.TabIndex = 2;
|
||||
this.componentNameLabel.Text = "Name:";
|
||||
//
|
||||
// priceComponentLabel
|
||||
//
|
||||
this.priceComponentLabel.AutoSize = true;
|
||||
this.priceComponentLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.priceComponentLabel.Location = new System.Drawing.Point(31, 66);
|
||||
this.priceComponentLabel.Name = "priceComponentLabel";
|
||||
this.priceComponentLabel.Size = new System.Drawing.Size(58, 25);
|
||||
this.priceComponentLabel.TabIndex = 3;
|
||||
this.priceComponentLabel.Text = "Price:";
|
||||
//
|
||||
// saveComponentButton
|
||||
//
|
||||
this.saveComponentButton.Location = new System.Drawing.Point(289, 117);
|
||||
this.saveComponentButton.Name = "saveComponentButton";
|
||||
this.saveComponentButton.Size = new System.Drawing.Size(80, 25);
|
||||
this.saveComponentButton.TabIndex = 4;
|
||||
this.saveComponentButton.Text = "Save";
|
||||
this.saveComponentButton.UseVisualStyleBackColor = true;
|
||||
this.saveComponentButton.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// cancelComponentButton
|
||||
//
|
||||
this.cancelComponentButton.Location = new System.Drawing.Point(375, 117);
|
||||
this.cancelComponentButton.Name = "cancelComponentButton";
|
||||
this.cancelComponentButton.Size = new System.Drawing.Size(80, 25);
|
||||
this.cancelComponentButton.TabIndex = 5;
|
||||
this.cancelComponentButton.Text = "Cancel";
|
||||
this.cancelComponentButton.UseVisualStyleBackColor = true;
|
||||
this.cancelComponentButton.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormMaterial
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(466, 154);
|
||||
this.Controls.Add(this.cancelComponentButton);
|
||||
this.Controls.Add(this.saveComponentButton);
|
||||
this.Controls.Add(this.priceComponentLabel);
|
||||
this.Controls.Add(this.componentNameLabel);
|
||||
this.Controls.Add(this.componentPriceTextBox);
|
||||
this.Controls.Add(this.componentNameTextBox);
|
||||
this.Name = "FormMaterial";
|
||||
this.Text = "Material";
|
||||
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox componentNameTextBox;
|
||||
private TextBox componentPriceTextBox;
|
||||
private Label componentNameLabel;
|
||||
private Label priceComponentLabel;
|
||||
private Button saveComponentButton;
|
||||
private Button cancelComponentButton;
|
||||
}
|
||||
}
|
97
SewingDresses/FormMaterial.cs
Normal file
97
SewingDresses/FormMaterial.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormMaterial : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IMaterialLogic _logic;
|
||||
private int? _id;
|
||||
public int ID { set { _id = value; } }
|
||||
|
||||
public FormMaterial(ILogger<FormMaterial> logger, IMaterialLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormComponent_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Receiving component");
|
||||
var view = _logic.ReadElement(new MaterialSearchModel
|
||||
{
|
||||
ID = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
componentNameTextBox.Text = view.ComponentName;
|
||||
componentPriceTextBox.Text = view.Cost.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error receiving component");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(componentNameTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Fill name field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Saving component");
|
||||
try
|
||||
{
|
||||
var model = new MaterialBindingModel
|
||||
{
|
||||
ID = _id ?? 0,
|
||||
ComponentName = componentNameTextBox.Text,
|
||||
Cost = Convert.ToDouble(componentPriceTextBox.Text)
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
||||
_logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Error during saving. Extra info in logs.");
|
||||
}
|
||||
MessageBox.Show("Saving was succesful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error saving component");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
60
SewingDresses/FormMaterial.resx
Normal file
60
SewingDresses/FormMaterial.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
115
SewingDresses/FormMaterials.Designer.cs
generated
Normal file
115
SewingDresses/FormMaterials.Designer.cs
generated
Normal file
@ -0,0 +1,115 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormMaterials
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.materialGridView = new System.Windows.Forms.DataGridView();
|
||||
this.addMaterialButton = new System.Windows.Forms.Button();
|
||||
this.changeMaterialButton = new System.Windows.Forms.Button();
|
||||
this.deleteMaterialButton = new System.Windows.Forms.Button();
|
||||
this.refreshMaterialsButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.materialGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// materialGridView
|
||||
//
|
||||
this.materialGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.materialGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.materialGridView.Location = new System.Drawing.Point(1, 2);
|
||||
this.materialGridView.Name = "materialGridView";
|
||||
this.materialGridView.RowTemplate.Height = 25;
|
||||
this.materialGridView.Size = new System.Drawing.Size(608, 449);
|
||||
this.materialGridView.TabIndex = 0;
|
||||
//
|
||||
// addMaterialButton
|
||||
//
|
||||
this.addMaterialButton.Location = new System.Drawing.Point(659, 12);
|
||||
this.addMaterialButton.Name = "addMaterialButton";
|
||||
this.addMaterialButton.Size = new System.Drawing.Size(105, 23);
|
||||
this.addMaterialButton.TabIndex = 1;
|
||||
this.addMaterialButton.Text = "Add";
|
||||
this.addMaterialButton.UseVisualStyleBackColor = true;
|
||||
this.addMaterialButton.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
//
|
||||
// changeMaterialButton
|
||||
//
|
||||
this.changeMaterialButton.Location = new System.Drawing.Point(659, 51);
|
||||
this.changeMaterialButton.Name = "changeMaterialButton";
|
||||
this.changeMaterialButton.Size = new System.Drawing.Size(105, 23);
|
||||
this.changeMaterialButton.TabIndex = 2;
|
||||
this.changeMaterialButton.Text = "Change";
|
||||
this.changeMaterialButton.UseVisualStyleBackColor = true;
|
||||
this.changeMaterialButton.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
||||
//
|
||||
// deleteMaterialButton
|
||||
//
|
||||
this.deleteMaterialButton.Location = new System.Drawing.Point(659, 94);
|
||||
this.deleteMaterialButton.Name = "deleteMaterialButton";
|
||||
this.deleteMaterialButton.Size = new System.Drawing.Size(105, 23);
|
||||
this.deleteMaterialButton.TabIndex = 3;
|
||||
this.deleteMaterialButton.Text = "Delete";
|
||||
this.deleteMaterialButton.UseVisualStyleBackColor = true;
|
||||
this.deleteMaterialButton.Click += new System.EventHandler(this.ButtonDelete_Click);
|
||||
//
|
||||
// refreshMaterialsButton
|
||||
//
|
||||
this.refreshMaterialsButton.Location = new System.Drawing.Point(659, 132);
|
||||
this.refreshMaterialsButton.Name = "refreshMaterialsButton";
|
||||
this.refreshMaterialsButton.Size = new System.Drawing.Size(105, 23);
|
||||
this.refreshMaterialsButton.TabIndex = 4;
|
||||
this.refreshMaterialsButton.Text = "Refresh";
|
||||
this.refreshMaterialsButton.UseVisualStyleBackColor = true;
|
||||
this.refreshMaterialsButton.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
||||
//
|
||||
// FormMaterials
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.refreshMaterialsButton);
|
||||
this.Controls.Add(this.deleteMaterialButton);
|
||||
this.Controls.Add(this.changeMaterialButton);
|
||||
this.Controls.Add(this.addMaterialButton);
|
||||
this.Controls.Add(this.materialGridView);
|
||||
this.Name = "FormMaterials";
|
||||
this.Text = "Materials";
|
||||
this.Load += new System.EventHandler(this.FormMaterials_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.materialGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView materialGridView;
|
||||
private Button addMaterialButton;
|
||||
private Button changeMaterialButton;
|
||||
private Button deleteMaterialButton;
|
||||
private Button refreshMaterialsButton;
|
||||
}
|
||||
}
|
119
SewingDresses/FormMaterials.cs
Normal file
119
SewingDresses/FormMaterials.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormMaterials : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IMaterialLogic _logic;
|
||||
|
||||
public FormMaterials(ILogger<FormMaterials> logger, IMaterialLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormMaterials_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
materialGridView.DataSource = list;
|
||||
materialGridView.Columns["ID"].Visible = false;
|
||||
materialGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Loading materials");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error loading materials");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormMaterial));
|
||||
if (service is FormMaterial form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (materialGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormMaterial));
|
||||
if (service is FormMaterial form)
|
||||
{
|
||||
form.ID = Convert.ToInt32(materialGridView.SelectedRows[0].Cells["ID"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (materialGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Delete record?", "Question",MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(materialGridView.SelectedRows[0].Cells["ID"].Value);
|
||||
_logger.LogInformation("Material deletion");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new MaterialBindingModel
|
||||
{
|
||||
ID = id
|
||||
|
||||
}))
|
||||
{
|
||||
throw new Exception("Deletion error. Extra information in logs.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Material deletion error");
|
||||
MessageBox.Show(ex.Message, "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
60
SewingDresses/FormMaterials.resx
Normal file
60
SewingDresses/FormMaterials.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
148
SewingDresses/FormOrderCreation.Designer.cs
generated
Normal file
148
SewingDresses/FormOrderCreation.Designer.cs
generated
Normal file
@ -0,0 +1,148 @@
|
||||
namespace SewingDresses
|
||||
{
|
||||
partial class FormOrderCreation
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.dressLabel = new System.Windows.Forms.Label();
|
||||
this.quantityLabel = new System.Windows.Forms.Label();
|
||||
this.priceLabel = new System.Windows.Forms.Label();
|
||||
this.dressComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.quantityTextBox = new System.Windows.Forms.TextBox();
|
||||
this.priceTextBox = new System.Windows.Forms.TextBox();
|
||||
this.ButtonSave = new System.Windows.Forms.Button();
|
||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dressLabel
|
||||
//
|
||||
this.dressLabel.AutoSize = true;
|
||||
this.dressLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.dressLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.dressLabel.Name = "dressLabel";
|
||||
this.dressLabel.Size = new System.Drawing.Size(82, 25);
|
||||
this.dressLabel.TabIndex = 0;
|
||||
this.dressLabel.Text = "Product:";
|
||||
//
|
||||
// quantityLabel
|
||||
//
|
||||
this.quantityLabel.AutoSize = true;
|
||||
this.quantityLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.quantityLabel.Location = new System.Drawing.Point(12, 50);
|
||||
this.quantityLabel.Name = "quantityLabel";
|
||||
this.quantityLabel.Size = new System.Drawing.Size(88, 25);
|
||||
this.quantityLabel.TabIndex = 1;
|
||||
this.quantityLabel.Text = "Quantity:";
|
||||
//
|
||||
// priceLabel
|
||||
//
|
||||
this.priceLabel.AutoSize = true;
|
||||
this.priceLabel.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.priceLabel.Location = new System.Drawing.Point(12, 90);
|
||||
this.priceLabel.Name = "priceLabel";
|
||||
this.priceLabel.Size = new System.Drawing.Size(56, 25);
|
||||
this.priceLabel.TabIndex = 2;
|
||||
this.priceLabel.Text = "Total:";
|
||||
//
|
||||
// dressComboBox
|
||||
//
|
||||
this.dressComboBox.FormattingEnabled = true;
|
||||
this.dressComboBox.Location = new System.Drawing.Point(114, 12);
|
||||
this.dressComboBox.Name = "dressComboBox";
|
||||
this.dressComboBox.Size = new System.Drawing.Size(320, 23);
|
||||
this.dressComboBox.TabIndex = 3;
|
||||
this.dressComboBox.SelectedIndexChanged += new System.EventHandler(this.DressComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// quantityTextBox
|
||||
//
|
||||
this.quantityTextBox.Location = new System.Drawing.Point(114, 52);
|
||||
this.quantityTextBox.Name = "quantityTextBox";
|
||||
this.quantityTextBox.Size = new System.Drawing.Size(320, 23);
|
||||
this.quantityTextBox.TabIndex = 4;
|
||||
this.quantityTextBox.TextChanged += new System.EventHandler(this.QuantityTextBox_TextChanged);
|
||||
//
|
||||
// priceTextBox
|
||||
//
|
||||
this.priceTextBox.Location = new System.Drawing.Point(114, 90);
|
||||
this.priceTextBox.Name = "priceTextBox";
|
||||
this.priceTextBox.ReadOnly = true;
|
||||
this.priceTextBox.Size = new System.Drawing.Size(320, 23);
|
||||
this.priceTextBox.TabIndex = 5;
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
this.ButtonSave.Location = new System.Drawing.Point(220, 138);
|
||||
this.ButtonSave.Name = "ButtonSave";
|
||||
this.ButtonSave.Size = new System.Drawing.Size(100, 32);
|
||||
this.ButtonSave.TabIndex = 6;
|
||||
this.ButtonSave.Text = "Save";
|
||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
this.ButtonCancel.Location = new System.Drawing.Point(334, 138);
|
||||
this.ButtonCancel.Name = "ButtonCancel";
|
||||
this.ButtonCancel.Size = new System.Drawing.Size(100, 32);
|
||||
this.ButtonCancel.TabIndex = 7;
|
||||
this.ButtonCancel.Text = "Cancel";
|
||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormOrderCreation
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(446, 181);
|
||||
this.Controls.Add(this.ButtonCancel);
|
||||
this.Controls.Add(this.ButtonSave);
|
||||
this.Controls.Add(this.priceTextBox);
|
||||
this.Controls.Add(this.quantityTextBox);
|
||||
this.Controls.Add(this.dressComboBox);
|
||||
this.Controls.Add(this.priceLabel);
|
||||
this.Controls.Add(this.quantityLabel);
|
||||
this.Controls.Add(this.dressLabel);
|
||||
this.Name = "FormOrderCreation";
|
||||
this.Text = "FormOrderCreation";
|
||||
this.Load += new System.EventHandler(this.FormOrderCreation_Load);
|
||||
eegov
commented
Заголовок формы оформлен неверно Заголовок формы оформлен неверно
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label dressLabel;
|
||||
private Label quantityLabel;
|
||||
private Label priceLabel;
|
||||
private ComboBox dressComboBox;
|
||||
private TextBox quantityTextBox;
|
||||
private TextBox priceTextBox;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
}
|
||||
}
|
131
SewingDresses/FormOrderCreation.cs
Normal file
131
SewingDresses/FormOrderCreation.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
public partial class FormOrderCreation : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IDressLogic _logicDress;
|
||||
|
||||
private readonly IOrderLogic _logicOrder;
|
||||
public FormOrderCreation(ILogger<FormOrderCreation> logger, IDressLogic logicP, IOrderLogic logicO)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicDress = logicP;
|
||||
_logicOrder = logicO;
|
||||
}
|
||||
|
||||
private void FormOrderCreation_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Downloading dresses for order");
|
||||
try
|
||||
{
|
||||
var _list = _logicDress.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
dressComboBox.DisplayMember = "DressName";
|
||||
dressComboBox.ValueMember = "ID";
|
||||
dressComboBox.DataSource = _list;
|
||||
dressComboBox.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Downloading dresses for order error");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CalcSum()
|
||||
{
|
||||
if (dressComboBox.SelectedValue != null &&
|
||||
!string.IsNullOrEmpty(quantityTextBox.Text))
|
||||
{
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(dressComboBox.SelectedValue);
|
||||
var product = _logicDress.ReadElement(new DressSearchModel
|
||||
{
|
||||
ID = id
|
||||
});
|
||||
int count = Convert.ToInt32(quantityTextBox.Text);
|
||||
priceTextBox.Text = Math.Round(count * (product?.Price ?? 0),
|
||||
2).ToString();
|
||||
_logger.LogInformation("Calculating total of order");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Calculation total of order error");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void QuantityTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void DressComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(quantityTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Fill quantity field", "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (dressComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Choose dress", "Error",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Creation of order");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicOrder.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
DressID = Convert.ToInt32(dressComboBox.SelectedValue),
|
||||
Count = Convert.ToInt32(quantityTextBox.Text),
|
||||
Sum = Convert.ToDouble(priceTextBox.Text)
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Creating of order error.Extra information in logs.");
|
||||
}
|
||||
MessageBox.Show("Saving was succesfull", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Creation of order error");
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
60
SewingDresses/FormOrderCreation.resx
Normal file
60
SewingDresses/FormOrderCreation.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,7 +1,19 @@
|
||||
using DressAtelierBusinessLogic.BusinessLogic;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.StorageContracts;
|
||||
using DressAtelierListImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace SewingDresses
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
@ -11,7 +23,33 @@ namespace SewingDresses
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
services.AddTransient<IMaterialStorage, MaterialStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IDressStorage, DressStorage>();
|
||||
services.AddTransient<IMaterialLogic, MaterialLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IDressLogic, DressLogic>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormMaterial>();
|
||||
services.AddTransient<FormMaterials>();
|
||||
services.AddTransient<FormOrderCreation>();
|
||||
services.AddTransient<FormDress>();
|
||||
services.AddTransient<FormDressMaterial>();
|
||||
services.AddTransient<FormDresses>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
63
SewingDresses/Properties/Resources.Designer.cs
generated
Normal file
63
SewingDresses/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SewingDresses.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SewingDresses.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,38 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="BusinessLogic\**" />
|
||||
<EmbeddedResource Remove="BusinessLogic\**" />
|
||||
<None Remove="BusinessLogic\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DressAtelierBusinessLogic\DressAtelierBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierContracts\DressAtelierContracts.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierDataModels\DressAtelierDataModels.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierListImplement\DressAtelierListImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
13
SewingDresses/nlog.config
Normal file
13
SewingDresses/nlog.config
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
autoReload="true" internalLogLevel="Info">
|
||||
<targets>
|
||||
<target xsi:type="File" name="tofile" fileName="log-${shortdate}.log" />
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="tofile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user
Не требуется обновлять все данные, только статус и дату выполнения