res 1 hard
This commit is contained in:
parent
f31982e59f
commit
9828b2673a
180
GiftShop/GiftShopBusinessLogic/BusinessLogics/ShopLogic.cs
Normal file
180
GiftShop/GiftShopBusinessLogic/BusinessLogics/ShopLogic.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.BusinessLogicsContracts;
|
||||
using GiftShopContracts.SearchModels;
|
||||
using GiftShopContracts.StoragesContracts;
|
||||
using GiftShopContracts.ViewModels;
|
||||
using GiftShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ShopLogic: IShopLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopStorage _ShopStorage;
|
||||
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage ShopStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_ShopStorage = ShopStorage;
|
||||
}
|
||||
public bool AddGift(ShopSearchModel model, IGiftModel gift, int quantity)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (quantity <= 0)
|
||||
{
|
||||
throw new ArgumentException("Количество добавляемого изделия должно быть больше 0", nameof(quantity));
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddGiftInShop. ShopName:{ShopName}.Id:{Id}", model.ShopName, model.Id);
|
||||
var element = _ShopStorage.GetElement(model);
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("AddGiftInShop element not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddGiftInShop find. Id:{Id}", element.Id);
|
||||
|
||||
if (element.Gifts.TryGetValue(gift.Id, out var pair))
|
||||
{
|
||||
element.Gifts[gift.Id] = (gift, quantity + pair.Item2);
|
||||
_logger.LogInformation("AddGiftInShop. Has been added {quantity} {gift} in {ShopName}", quantity, gift.GiftName, element.ShopName);
|
||||
}
|
||||
else
|
||||
{
|
||||
element.Gifts[gift.Id] = (gift, quantity);
|
||||
_logger.LogInformation("AddGiftInShop. Has been added {quantity} new gift {gift} in {ShopName}", quantity, gift.GiftName, element.ShopName);
|
||||
}
|
||||
|
||||
_ShopStorage.Update(new()
|
||||
{
|
||||
Id = element.Id,
|
||||
ShopAddress = element.ShopAddress,
|
||||
ShopName = element.ShopName,
|
||||
OpeningDate = element.OpeningDate,
|
||||
Gifts = element.Gifts
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Create(ShopBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
model.Gifts = new();
|
||||
|
||||
if (_ShopStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(ShopBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
if (_ShopStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ShopViewModel? ReadElement(ShopSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", model.ShopName, model.Id);
|
||||
var element = _ShopStorage.GetElement(model);
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<ShopViewModel>? ReadList(ShopSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ShopName:{ShopName}.Id:{ Id} ", model?.ShopName, model?.Id);
|
||||
|
||||
var list = (model == null) ? _ShopStorage.GetFullList() : _ShopStorage.GetFilteredList(model);
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(ShopBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия магазина", nameof(model.ShopName));
|
||||
}
|
||||
|
||||
if (_ShopStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(ShopBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия магазина", nameof(model.ShopName));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Shop. ShopName:{0}.ShopAddress:{1}. Id: {2}", model.ShopName, model.ShopAddress, model.Id);
|
||||
var element = _ShopStorage.GetElement(new ShopSearchModel
|
||||
{
|
||||
ShopName = model.ShopName
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id && element.ShopName == model.ShopName)
|
||||
{
|
||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
GiftShop/GiftShopContracts/BindingModels/ShopBindingModel.cs
Normal file
18
GiftShop/GiftShopContracts/BindingModels/ShopBindingModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using GiftShopDataModels.Models;
|
||||
|
||||
namespace GiftShopContracts.BindingModels
|
||||
{
|
||||
public class ShopBindingModel : IShopModel
|
||||
{
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
public string ShopAddress { get; set; } = string.Empty;
|
||||
public DateTime OpeningDate { get; set; } = DateTime.Now;
|
||||
public Dictionary<int, (IGiftModel, int)> Gifts { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.ViewModels;
|
||||
using GiftShopContracts.SearchModels;
|
||||
using GiftShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IShopLogic
|
||||
{
|
||||
List<ShopViewModel>? ReadList(ShopSearchModel? model);
|
||||
ShopViewModel? ReadElement(ShopSearchModel model);
|
||||
bool Create(ShopBindingModel model);
|
||||
bool Update(ShopBindingModel model);
|
||||
bool Delete(ShopBindingModel model);
|
||||
bool AddGift(ShopSearchModel model, IGiftModel gift, int quantity);
|
||||
}
|
||||
}
|
14
GiftShop/GiftShopContracts/SearchModels/ShopSearchModel.cs
Normal file
14
GiftShop/GiftShopContracts/SearchModels/ShopSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopContracts.SearchModels
|
||||
{
|
||||
public class ShopSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ShopName { get; set; }
|
||||
}
|
||||
}
|
21
GiftShop/GiftShopContracts/StoragesContracts/IShopStorage.cs
Normal file
21
GiftShop/GiftShopContracts/StoragesContracts/IShopStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.SearchModels;
|
||||
using GiftShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopContracts.StoragesContracts
|
||||
{
|
||||
public interface IShopStorage
|
||||
{
|
||||
List<ShopViewModel> GetFullList();
|
||||
List<ShopViewModel> GetFilteredList(ShopSearchModel model);
|
||||
ShopViewModel? GetElement(ShopSearchModel model);
|
||||
ShopViewModel? Insert(ShopBindingModel model);
|
||||
ShopViewModel? Update(ShopBindingModel model);
|
||||
ShopViewModel? Delete(ShopBindingModel model);
|
||||
}
|
||||
}
|
23
GiftShop/GiftShopContracts/ViewModels/ShopViewModel.cs
Normal file
23
GiftShop/GiftShopContracts/ViewModels/ShopViewModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using GiftShopDataModels.Models;
|
||||
|
||||
namespace GiftShopContracts.ViewModels
|
||||
{
|
||||
public class ShopViewModel : IShopModel
|
||||
{
|
||||
public Dictionary<int, (IGiftModel, int)> Gifts { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название магазина")]
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
[DisplayName("Адрес магазина")]
|
||||
public string ShopAddress { get; set; } = string.Empty;
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateTime OpeningDate { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
16
GiftShop/GiftShopDataModels/Models/IShopModel.cs
Normal file
16
GiftShop/GiftShopDataModels/Models/IShopModel.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopDataModels.Models
|
||||
{
|
||||
public interface IShopModel : IId
|
||||
{
|
||||
public string ShopName { get; }
|
||||
public string ShopAddress { get; }
|
||||
DateTime OpeningDate { get; }
|
||||
Dictionary<int, (IGiftModel, int)> Gifts { get; }
|
||||
}
|
||||
}
|
@ -9,11 +9,13 @@ namespace GiftShopListImplement
|
||||
public List<Order> Orders { get; set; }
|
||||
public List<Gift> Gifts { get; set; }
|
||||
|
||||
public List<Shop> Shops { get; set; }
|
||||
private DataListSingleton()
|
||||
{
|
||||
Components = new List<Component>();
|
||||
Orders = new List<Order>();
|
||||
Gifts = new List<Gift>();
|
||||
Shops = new List<Shop>();
|
||||
}
|
||||
public static DataListSingleton GetInstance()
|
||||
{
|
||||
|
123
GiftShop/GiftShopListImplement/Implements/ShopStorage.cs
Normal file
123
GiftShop/GiftShopListImplement/Implements/ShopStorage.cs
Normal file
@ -0,0 +1,123 @@
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.SearchModels;
|
||||
using GiftShopContracts.StoragesContracts;
|
||||
using GiftShopContracts.ViewModels;
|
||||
using GiftShopListImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopListImplement.Implements
|
||||
{
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
public ShopStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
public ShopViewModel? Delete(ShopBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Shops.Count; ++i)
|
||||
{
|
||||
if (_source.Shops[i].Id == model.Id)
|
||||
{
|
||||
var element = _source.Shops[i];
|
||||
_source.Shops.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.ShopName) && shop.ShopName == model.ShopName) || (model.Id.HasValue && shop.Id == model.Id))
|
||||
{
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||
{
|
||||
var result = new List<ShopViewModel>();
|
||||
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (shop.ShopName.Contains(model.ShopName))
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<ShopViewModel>();
|
||||
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public ShopViewModel? Insert(ShopBindingModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (model.Id <= shop.Id)
|
||||
{
|
||||
model.Id = shop.Id + 1;
|
||||
}
|
||||
}
|
||||
|
||||
var newShop = Shop.Create(model);
|
||||
|
||||
if (newShop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
_source.Shops.Add(newShop);
|
||||
|
||||
return newShop.GetViewModel;
|
||||
}
|
||||
|
||||
public ShopViewModel? Update(ShopBindingModel model)
|
||||
{
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (shop.Id == model.Id)
|
||||
{
|
||||
shop.Update(model);
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
60
GiftShop/GiftShopListImplement/Models/Shop.cs
Normal file
60
GiftShop/GiftShopListImplement/Models/Shop.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.ViewModels;
|
||||
using GiftShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GiftShopListImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
public string ShopAddress { get; private set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
|
||||
public Dictionary<int, (IGiftModel, int)> Gifts { get; private set; } = new();
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
ShopAddress = model.ShopAddress,
|
||||
OpeningDate = model.OpeningDate,
|
||||
Gifts = new()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ShopName = model.ShopName;
|
||||
ShopAddress = model.ShopAddress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
Gifts = model.Gifts;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
ShopAddress = ShopAddress,
|
||||
OpeningDate = OpeningDate,
|
||||
Gifts = Gifts
|
||||
};
|
||||
}
|
||||
}
|
222
GiftShop/GiftShopView/FormMain.Designer.cs
generated
222
GiftShop/GiftShopView/FormMain.Designer.cs
generated
@ -28,136 +28,162 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
||||
this.buttonOrderReady = new System.Windows.Forms.Button();
|
||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
||||
this.buttonRef = new System.Windows.Forms.Button();
|
||||
this.menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
menuStrip = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
изделияToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonTakeOrderInWork = new Button();
|
||||
buttonOrderReady = new Button();
|
||||
buttonIssuedOrder = new Button();
|
||||
buttonRef = new Button();
|
||||
shopReplenishment = new Button();
|
||||
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.справочникиToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip1";
|
||||
this.menuStrip.Size = new System.Drawing.Size(1367, 28);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "menuStrip1";
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(8, 2, 0, 2);
|
||||
menuStrip.Size = new Size(1709, 33);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.компонентыToolStripMenuItem,
|
||||
this.изделияToolStripMenuItem});
|
||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, магазиныToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(139, 29);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// компонентыToolStripMenuItem
|
||||
//
|
||||
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
|
||||
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
компонентыToolStripMenuItem.Size = new Size(270, 34);
|
||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
||||
//
|
||||
// изделияToolStripMenuItem
|
||||
//
|
||||
this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||
this.изделияToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
|
||||
this.изделияToolStripMenuItem.Text = "Изделия";
|
||||
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
|
||||
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||
изделияToolStripMenuItem.Size = new Size(270, 34);
|
||||
изделияToolStripMenuItem.Text = "Изделия";
|
||||
изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 41);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(1123, 423);
|
||||
this.dataGridView.TabIndex = 1;
|
||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(15, 51);
|
||||
dataGridView.Margin = new Padding(4);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(1404, 529);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
this.buttonCreateOrder.Location = new System.Drawing.Point(1155, 67);
|
||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
this.buttonCreateOrder.Size = new System.Drawing.Size(189, 41);
|
||||
this.buttonCreateOrder.TabIndex = 2;
|
||||
this.buttonCreateOrder.Text = "Создать заказ";
|
||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
||||
buttonCreateOrder.Location = new Point(1444, 84);
|
||||
buttonCreateOrder.Margin = new Padding(4);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(236, 51);
|
||||
buttonCreateOrder.TabIndex = 2;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||
//
|
||||
// buttonTakeOrderInWork
|
||||
//
|
||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(1155, 136);
|
||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(189, 41);
|
||||
this.buttonTakeOrderInWork.TabIndex = 3;
|
||||
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
|
||||
buttonTakeOrderInWork.Location = new Point(1444, 170);
|
||||
buttonTakeOrderInWork.Margin = new Padding(4);
|
||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
buttonTakeOrderInWork.Size = new Size(236, 51);
|
||||
buttonTakeOrderInWork.TabIndex = 3;
|
||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
this.buttonOrderReady.Location = new System.Drawing.Point(1155, 211);
|
||||
this.buttonOrderReady.Name = "buttonOrderReady";
|
||||
this.buttonOrderReady.Size = new System.Drawing.Size(189, 41);
|
||||
this.buttonOrderReady.TabIndex = 4;
|
||||
this.buttonOrderReady.Text = "Заказ готов";
|
||||
this.buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
|
||||
buttonOrderReady.Location = new Point(1444, 264);
|
||||
buttonOrderReady.Margin = new Padding(4);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(236, 51);
|
||||
buttonOrderReady.TabIndex = 4;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(1155, 290);
|
||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(189, 41);
|
||||
this.buttonIssuedOrder.TabIndex = 5;
|
||||
this.buttonIssuedOrder.Text = "Заказ выдан";
|
||||
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
||||
buttonIssuedOrder.Location = new Point(1444, 362);
|
||||
buttonIssuedOrder.Margin = new Padding(4);
|
||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
buttonIssuedOrder.Size = new Size(236, 51);
|
||||
buttonIssuedOrder.TabIndex = 5;
|
||||
buttonIssuedOrder.Text = "Заказ выдан";
|
||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(1155, 356);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(189, 41);
|
||||
this.buttonRef.TabIndex = 6;
|
||||
this.buttonRef.Text = "Обновить список";
|
||||
this.buttonRef.UseVisualStyleBackColor = true;
|
||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||
buttonRef.Location = new Point(1444, 445);
|
||||
buttonRef.Margin = new Padding(4);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(236, 51);
|
||||
buttonRef.TabIndex = 6;
|
||||
buttonRef.Text = "Обновить список";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// shopReplenishment
|
||||
//
|
||||
shopReplenishment.Location = new Point(1444, 525);
|
||||
shopReplenishment.Margin = new Padding(4);
|
||||
shopReplenishment.Name = "shopReplenishment";
|
||||
shopReplenishment.Size = new Size(236, 51);
|
||||
shopReplenishment.TabIndex = 7;
|
||||
shopReplenishment.Text = "Пополнение магазина";
|
||||
shopReplenishment.UseVisualStyleBackColor = true;
|
||||
shopReplenishment.Click += ShopReplenishment_Click;
|
||||
//
|
||||
// магазиныToolStripMenuItem
|
||||
//
|
||||
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||
магазиныToolStripMenuItem.Size = new Size(270, 34);
|
||||
магазиныToolStripMenuItem.Text = "Магазины";
|
||||
магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1367, 471);
|
||||
this.Controls.Add(this.buttonRef);
|
||||
this.Controls.Add(this.buttonIssuedOrder);
|
||||
this.Controls.Add(this.buttonOrderReady);
|
||||
this.Controls.Add(this.buttonTakeOrderInWork);
|
||||
this.Controls.Add(this.buttonCreateOrder);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Магазин подарков";
|
||||
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();
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1709, 589);
|
||||
Controls.Add(shopReplenishment);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonIssuedOrder);
|
||||
Controls.Add(buttonOrderReady);
|
||||
Controls.Add(buttonTakeOrderInWork);
|
||||
Controls.Add(buttonCreateOrder);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(4);
|
||||
Name = "FormMain";
|
||||
Text = "Магазин подарков";
|
||||
Load += FormMain_Load;
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -166,11 +192,13 @@
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem изделияToolStripMenuItem;
|
||||
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCreateOrder;
|
||||
private Button buttonTakeOrderInWork;
|
||||
private Button buttonOrderReady;
|
||||
private Button buttonIssuedOrder;
|
||||
private Button buttonRef;
|
||||
private Button shopReplenishment;
|
||||
}
|
||||
}
|
@ -63,7 +63,15 @@ namespace GiftShopView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||
|
||||
if (service is FormShops form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||
@ -91,7 +99,7 @@ namespace GiftShopView
|
||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||
});
|
||||
}) ;
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
@ -171,7 +179,15 @@ namespace GiftShopView
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ShopReplenishment_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment));
|
||||
|
||||
if (service is FormShopReplenishment form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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">
|
||||
|
198
GiftShop/GiftShopView/FormShop.Designer.cs
generated
Normal file
198
GiftShop/GiftShopView/FormShop.Designer.cs
generated
Normal file
@ -0,0 +1,198 @@
|
||||
namespace GiftShopView
|
||||
{
|
||||
partial class FormShop
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
shopNameLabel = new Label();
|
||||
shopAddressLabel = new Label();
|
||||
openingDateLabel = new Label();
|
||||
addressTextBox = new TextBox();
|
||||
openingDatePicker = new DateTimePicker();
|
||||
dataGridView = new DataGridView();
|
||||
PackageName = new DataGridViewTextBoxColumn();
|
||||
PackagePrice = new DataGridViewTextBoxColumn();
|
||||
PackageCount = new DataGridViewTextBoxColumn();
|
||||
SaveButton = new Button();
|
||||
ButtonCancel = new Button();
|
||||
nameTextBox = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// shopNameLabel
|
||||
//
|
||||
shopNameLabel.AutoSize = true;
|
||||
shopNameLabel.Location = new Point(18, 15);
|
||||
shopNameLabel.Margin = new Padding(4, 0, 4, 0);
|
||||
shopNameLabel.Name = "shopNameLabel";
|
||||
shopNameLabel.Size = new Size(179, 25);
|
||||
shopNameLabel.TabIndex = 0;
|
||||
shopNameLabel.Text = "Название магазина: ";
|
||||
//
|
||||
// shopAddressLabel
|
||||
//
|
||||
shopAddressLabel.AutoSize = true;
|
||||
shopAddressLabel.Location = new Point(18, 66);
|
||||
shopAddressLabel.Margin = new Padding(4, 0, 4, 0);
|
||||
shopAddressLabel.Name = "shopAddressLabel";
|
||||
shopAddressLabel.Size = new Size(151, 25);
|
||||
shopAddressLabel.TabIndex = 1;
|
||||
shopAddressLabel.Text = "Адрес магазина: ";
|
||||
//
|
||||
// openingDateLabel
|
||||
//
|
||||
openingDateLabel.AutoSize = true;
|
||||
openingDateLabel.Location = new Point(18, 120);
|
||||
openingDateLabel.Margin = new Padding(4, 0, 4, 0);
|
||||
openingDateLabel.Name = "openingDateLabel";
|
||||
openingDateLabel.Size = new Size(140, 25);
|
||||
openingDateLabel.TabIndex = 2;
|
||||
openingDateLabel.Text = "Дата открытия: ";
|
||||
//
|
||||
// addressTextBox
|
||||
//
|
||||
addressTextBox.Location = new Point(204, 62);
|
||||
addressTextBox.Margin = new Padding(4, 5, 4, 5);
|
||||
addressTextBox.Name = "addressTextBox";
|
||||
addressTextBox.Size = new Size(246, 31);
|
||||
addressTextBox.TabIndex = 4;
|
||||
//
|
||||
// openingDatePicker
|
||||
//
|
||||
openingDatePicker.Location = new Point(204, 114);
|
||||
openingDatePicker.Margin = new Padding(4, 4, 4, 4);
|
||||
openingDatePicker.Name = "openingDatePicker";
|
||||
openingDatePicker.Size = new Size(246, 31);
|
||||
openingDatePicker.TabIndex = 9;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.BackgroundColor = SystemColors.Window;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { PackageName, PackagePrice, PackageCount });
|
||||
dataGridView.Location = new Point(18, 181);
|
||||
dataGridView.Margin = new Padding(4, 5, 4, 5);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(1109, 480);
|
||||
dataGridView.TabIndex = 6;
|
||||
//
|
||||
// PackageName
|
||||
//
|
||||
PackageName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
PackageName.HeaderText = "Название изделия";
|
||||
PackageName.MinimumWidth = 6;
|
||||
PackageName.Name = "PackageName";
|
||||
//
|
||||
// PackagePrice
|
||||
//
|
||||
PackagePrice.HeaderText = "Цена";
|
||||
PackagePrice.MinimumWidth = 6;
|
||||
PackagePrice.Name = "PackagePrice";
|
||||
PackagePrice.Width = 125;
|
||||
//
|
||||
// PackageCount
|
||||
//
|
||||
PackageCount.HeaderText = "Количество";
|
||||
PackageCount.MinimumWidth = 6;
|
||||
PackageCount.Name = "PackageCount";
|
||||
PackageCount.Width = 125;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(789, 671);
|
||||
SaveButton.Margin = new Padding(4, 5, 4, 5);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(164, 59);
|
||||
SaveButton.TabIndex = 7;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
SaveButton.Click += SaveButton_Click;
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(961, 671);
|
||||
ButtonCancel.Margin = new Padding(4, 5, 4, 5);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(164, 59);
|
||||
ButtonCancel.TabIndex = 8;
|
||||
ButtonCancel.Text = "Отменить";
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
nameTextBox.Location = new Point(204, 11);
|
||||
nameTextBox.Margin = new Padding(4, 4, 4, 4);
|
||||
nameTextBox.Name = "nameTextBox";
|
||||
nameTextBox.Size = new Size(246, 31);
|
||||
nameTextBox.TabIndex = 10;
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1142, 750);
|
||||
Controls.Add(nameTextBox);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(openingDatePicker);
|
||||
Controls.Add(addressTextBox);
|
||||
Controls.Add(openingDateLabel);
|
||||
Controls.Add(shopAddressLabel);
|
||||
Controls.Add(shopNameLabel);
|
||||
Margin = new Padding(4, 5, 4, 5);
|
||||
Name = "FormShop";
|
||||
Text = "Магазин";
|
||||
Load += FormShop_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label shopNameLabel;
|
||||
private Label shopAddressLabel;
|
||||
private Label openingDateLabel;
|
||||
private TextBox addressTextBox;
|
||||
private DateTimePicker openingDatePicker;
|
||||
private DataGridView dataGridView;
|
||||
private Button SaveButton;
|
||||
private Button ButtonCancel;
|
||||
private DataGridViewTextBoxColumn PackageName;
|
||||
private DataGridViewTextBoxColumn PackagePrice;
|
||||
private DataGridViewTextBoxColumn PackageCount;
|
||||
private TextBox nameTextBox;
|
||||
}
|
||||
}
|
143
GiftShop/GiftShopView/FormShop.cs
Normal file
143
GiftShop/GiftShopView/FormShop.cs
Normal file
@ -0,0 +1,143 @@
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.BusinessLogicsContracts;
|
||||
using GiftShopContracts.ViewModels;
|
||||
using GiftShopDataModels.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 GiftShopView
|
||||
{
|
||||
public partial class FormShop : Form
|
||||
{
|
||||
private readonly List<ShopViewModel>? _listShops;
|
||||
private readonly IShopLogic _logic;
|
||||
private readonly ILogger _logger;
|
||||
public int Id { get; set; }
|
||||
|
||||
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_listShops = logic.ReadList(null);
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private IShopModel? GetShop(int id)
|
||||
{
|
||||
if (_listShops == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var elem in _listShops)
|
||||
{
|
||||
if (elem.Id == id)
|
||||
{
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(nameTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(addressTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Сохранение изделия");
|
||||
|
||||
try
|
||||
{
|
||||
DateTime.TryParse(openingDatePicker.Text, out var dateTime);
|
||||
ShopBindingModel model = new()
|
||||
{
|
||||
ShopName = nameTextBox.Text,
|
||||
ShopAddress = addressTextBox.Text,
|
||||
OpeningDate = dateTime
|
||||
};
|
||||
var vmodel = GetShop(Id);
|
||||
bool operationResult = false;
|
||||
|
||||
if (vmodel != null)
|
||||
{
|
||||
model.Id = vmodel.Id;
|
||||
model.Gifts = vmodel.Gifts;
|
||||
operationResult = _logic.Update(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
operationResult = _logic.Create(model);
|
||||
}
|
||||
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void FormShop_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData(bool extendDate = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = GetShop(extendDate ? Id : Convert.ToInt32(nameTextBox.Text));
|
||||
if (model != null)
|
||||
{
|
||||
nameTextBox.Text = model.ShopName;
|
||||
addressTextBox.Text = model.ShopAddress;
|
||||
openingDatePicker.Text = Convert.ToString(model.OpeningDate);
|
||||
dataGridView.Rows.Clear();
|
||||
// ne zahel
|
||||
foreach (var el in model.Gifts.Values)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { el.Item1.GiftName, el.Item1.Price, el.Item2 });
|
||||
}
|
||||
|
||||
}
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
GiftShop/GiftShopView/FormShop.resx
Normal file
120
GiftShop/GiftShopView/FormShop.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
152
GiftShop/GiftShopView/FormShopReplenishment.Designer.cs
generated
Normal file
152
GiftShop/GiftShopView/FormShopReplenishment.Designer.cs
generated
Normal file
@ -0,0 +1,152 @@
|
||||
namespace GiftShopView
|
||||
{
|
||||
partial class FormShopReplenishment
|
||||
{
|
||||
/// <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 = "FormShopReplenishment";
|
||||
|
||||
shopNameLabel = new Label();
|
||||
packageNameLabel = new Label();
|
||||
countLabel = new Label();
|
||||
shopNameComboBox = new ComboBox();
|
||||
giftNameComboBox = new ComboBox();
|
||||
countTextBox = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// shopNameLabel
|
||||
//
|
||||
shopNameLabel.AutoSize = true;
|
||||
shopNameLabel.Location = new Point(14, 12);
|
||||
shopNameLabel.Name = "shopNameLabel";
|
||||
shopNameLabel.Size = new Size(154, 20);
|
||||
shopNameLabel.TabIndex = 0;
|
||||
shopNameLabel.Text = "Название магазина: ";
|
||||
//
|
||||
// packageNameLabel
|
||||
//
|
||||
packageNameLabel.AutoSize = true;
|
||||
packageNameLabel.Location = new Point(14, 49);
|
||||
packageNameLabel.Name = "packageNameLabel";
|
||||
packageNameLabel.Size = new Size(145, 20);
|
||||
packageNameLabel.TabIndex = 1;
|
||||
packageNameLabel.Text = "Название изделия: ";
|
||||
//
|
||||
// countLabel
|
||||
//
|
||||
countLabel.AutoSize = true;
|
||||
countLabel.Location = new Point(14, 88);
|
||||
countLabel.Name = "countLabel";
|
||||
countLabel.Size = new Size(97, 20);
|
||||
countLabel.TabIndex = 2;
|
||||
countLabel.Text = "Количество: ";
|
||||
//
|
||||
// shopNameComboBox
|
||||
//
|
||||
shopNameComboBox.FormattingEnabled = true;
|
||||
shopNameComboBox.Location = new Point(171, 9);
|
||||
shopNameComboBox.Margin = new Padding(3, 4, 3, 4);
|
||||
shopNameComboBox.Name = "shopNameComboBox";
|
||||
shopNameComboBox.Size = new Size(170, 28);
|
||||
shopNameComboBox.TabIndex = 3;
|
||||
//
|
||||
// giftNameComboBox
|
||||
//
|
||||
giftNameComboBox.FormattingEnabled = true;
|
||||
giftNameComboBox.Location = new Point(171, 49);
|
||||
giftNameComboBox.Margin = new Padding(3, 4, 3, 4);
|
||||
giftNameComboBox.Name = "giftNameComboBox";
|
||||
giftNameComboBox.Size = new Size(170, 28);
|
||||
giftNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// countTextBox
|
||||
//
|
||||
countTextBox.Location = new Point(171, 87);
|
||||
countTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
countTextBox.Name = "countTextBox";
|
||||
countTextBox.Size = new Size(170, 27);
|
||||
countTextBox.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(151, 144);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(98, 31);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += SaveButton_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(255, 144);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormShopReplenishment
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(353, 200);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(countTextBox);
|
||||
Controls.Add(giftNameComboBox);
|
||||
Controls.Add(shopNameComboBox);
|
||||
Controls.Add(countLabel);
|
||||
Controls.Add(packageNameLabel);
|
||||
Controls.Add(shopNameLabel);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormShopReplenishment";
|
||||
Text = "Пополнение магазина";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label shopNameLabel;
|
||||
private Label packageNameLabel;
|
||||
private Label countLabel;
|
||||
private ComboBox shopNameComboBox;
|
||||
private ComboBox giftNameComboBox;
|
||||
private TextBox countTextBox;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
104
GiftShop/GiftShopView/FormShopReplenishment.cs
Normal file
104
GiftShop/GiftShopView/FormShopReplenishment.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using GiftShopContracts.BusinessLogicsContracts;
|
||||
using GiftShopContracts.ViewModels;
|
||||
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 GiftShopView
|
||||
{
|
||||
public partial class FormShopReplenishment : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _ShopLogic;
|
||||
private readonly IGiftLogic _giftLogic;
|
||||
private readonly List<ShopViewModel>? _listShops;
|
||||
private readonly List<GiftViewModel>? _listGifts;
|
||||
public FormShopReplenishment(ILogger<FormShopReplenishment> logger, IShopLogic ShopLogic, IGiftLogic giftLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_ShopLogic = ShopLogic;
|
||||
_giftLogic = giftLogic;
|
||||
_logger = logger;
|
||||
_listShops = ShopLogic.ReadList(null);
|
||||
if (_listShops != null)
|
||||
{
|
||||
shopNameComboBox.DisplayMember = "ShopName";
|
||||
shopNameComboBox.ValueMember = "Id";
|
||||
shopNameComboBox.DataSource = _listShops;
|
||||
shopNameComboBox.SelectedItem = null;
|
||||
}
|
||||
|
||||
_listGifts = giftLogic.ReadList(null);
|
||||
if (_listGifts != null)
|
||||
{
|
||||
giftNameComboBox.DisplayMember = "GiftName";
|
||||
giftNameComboBox.ValueMember = "Id";
|
||||
giftNameComboBox.DataSource = _listGifts;
|
||||
giftNameComboBox.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (shopNameComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (giftNameComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Добавление изделия в магазин");
|
||||
|
||||
try
|
||||
{
|
||||
var gift = _giftLogic.ReadElement(new()
|
||||
{
|
||||
Id = (int)giftNameComboBox.SelectedValue
|
||||
});
|
||||
|
||||
if (gift == null)
|
||||
{
|
||||
throw new Exception("Не найдено изделие. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
var resultOperation = _ShopLogic.AddGift(
|
||||
model: new() { Id = (int)shopNameComboBox.SelectedValue },
|
||||
gift: gift,
|
||||
quantity: Convert.ToInt32(countTextBox.Text)
|
||||
);
|
||||
|
||||
if (!resultOperation)
|
||||
{
|
||||
throw new Exception("Ошибка при добавлении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
GiftShop/GiftShopView/FormShopReplenishment.resx
Normal file
120
GiftShop/GiftShopView/FormShopReplenishment.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
126
GiftShop/GiftShopView/FormShops.Designer.cs
generated
Normal file
126
GiftShop/GiftShopView/FormShops.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace GiftShopView
|
||||
{
|
||||
partial class FormShops
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonRefresh = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.BackgroundColor = SystemColors.Window;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(1, 1);
|
||||
dataGridView.Margin = new Padding(4, 5, 4, 5);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(786, 745);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(836, 20);
|
||||
buttonAdd.Margin = new Padding(4, 5, 4, 5);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(172, 66);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += AddButton_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(836, 111);
|
||||
buttonUpdate.Margin = new Padding(4, 5, 4, 5);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(172, 66);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.Text = "Изменить";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += UpdateButton_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(836, 204);
|
||||
buttonDelete.Margin = new Padding(4, 5, 4, 5);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(172, 66);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.Text = "Удалить";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += DeleteButton_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(836, 299);
|
||||
buttonRefresh.Margin = new Padding(4, 5, 4, 5);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(172, 66);
|
||||
buttonRefresh.TabIndex = 4;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += RefreshButton_Click;
|
||||
//
|
||||
// FormShops
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1026, 750);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Margin = new Padding(4, 5, 4, 5);
|
||||
Name = "FormShops";
|
||||
Text = "Магазины";
|
||||
Load += FormShops_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonAdd;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonRefresh;
|
||||
}
|
||||
}
|
124
GiftShop/GiftShopView/FormShops.cs
Normal file
124
GiftShop/GiftShopView/FormShops.cs
Normal file
@ -0,0 +1,124 @@
|
||||
using GiftShopContracts.BindingModels;
|
||||
using GiftShopContracts.BusinessLogicsContracts;
|
||||
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 GiftShopView
|
||||
{
|
||||
public partial class FormShops : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _logic;
|
||||
public FormShops(ILogger<FormShops> logger, IShopLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormShops_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ShopAddress"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["OpeningDate"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["Gifts"].Visible = false;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление магазина");
|
||||
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new ShopBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
|
||||
if (service is FormShop form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
|
||||
if (service is FormShop form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
GiftShop/GiftShopView/FormShops.resx
Normal file
120
GiftShop/GiftShopView/FormShops.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
@ -32,9 +32,11 @@ namespace GiftShopView
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IGiftStorage, GiftStorage>();
|
||||
services.AddTransient<IShopStorage, ShopStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IGiftLogic, GiftLogic>();
|
||||
services.AddTransient<IShopLogic, ShopLogic>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormComponent>();
|
||||
services.AddTransient<FormComponents>();
|
||||
@ -42,6 +44,9 @@ namespace GiftShopView
|
||||
services.AddTransient<FormGift>();
|
||||
services.AddTransient<FormGiftComponent>();
|
||||
services.AddTransient<FormGifts>();
|
||||
services.AddTransient<FormShops>();
|
||||
services.AddTransient<FormShop>();
|
||||
services.AddTransient<FormShopReplenishment>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user