Compare commits
3 Commits
22eda2809c
...
83143fffa4
Author | SHA1 | Date | |
---|---|---|---|
83143fffa4 | |||
|
926a9fa37e | ||
|
8820635bd5 |
147
Shipyard/ShipyardBusinessLogic/BusinessLogics/ShopLogic.cs
Normal file
147
Shipyard/ShipyardBusinessLogic/BusinessLogics/ShopLogic.cs
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.BusinessLogicsContracts;
|
||||||
|
using ShipyardContracts.SearchModels;
|
||||||
|
using ShipyardContracts.ViewModels;
|
||||||
|
using ShipyardContracts.StoragesContracts;
|
||||||
|
using ShipyardDataModels.Models;
|
||||||
|
|
||||||
|
namespace ShipyardBusinessLogic.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 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 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 bool Create(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_shopStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public bool Update(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_shopStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Update 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;
|
||||||
|
}
|
||||||
|
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}. Address:{1}. Id:{2}",
|
||||||
|
model.ShopName, model.Address, 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("Магазин с таким названием уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddShip(ShopSearchModel model, IShipModel ship, int count)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Количество кораблей должно быть больше 0", nameof(count));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("AddShip. ShopName:{ShopName}. Id:{Id}", model.ShopName, model.Id);
|
||||||
|
var element = _shopStorage.GetElement(model);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("AddShip element not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("AddShip find. Id:{Id}", element.Id);
|
||||||
|
|
||||||
|
if (element.ShopShips.TryGetValue(ship.Id, out var pair))
|
||||||
|
{
|
||||||
|
element.ShopShips[ship.Id] = (ship, count + pair.Item2);
|
||||||
|
_logger.LogInformation("AddShip. Added {count} {ship} to '{ShopName}' shop",
|
||||||
|
count, ship.ShipName, element.ShopName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element.ShopShips[ship.Id] = (ship, count);
|
||||||
|
_logger.LogInformation("AddShip. Added {count} new ship {ship} to '{ShopName}' shop",
|
||||||
|
count, ship.ShipName, element.ShopName);
|
||||||
|
}
|
||||||
|
_shopStorage.Update(new()
|
||||||
|
{
|
||||||
|
Id = element.Id,
|
||||||
|
Address = element.Address,
|
||||||
|
ShopName = element.ShopName,
|
||||||
|
DateOpen = element.DateOpen,
|
||||||
|
ShopShips = element.ShopShips
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
Shipyard/ShipyardContracts/BindingModels/ShopBindingModel.cs
Normal file
13
Shipyard/ShipyardContracts/BindingModels/ShopBindingModel.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using ShipyardDataModels.Models;
|
||||||
|
|
||||||
|
namespace ShipyardContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ShopBindingModel : IShopModel
|
||||||
|
{
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||||
|
public Dictionary<int, (IShipModel, int)> ShopShips { get; set; } = new();
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.SearchModels;
|
||||||
|
using ShipyardContracts.ViewModels;
|
||||||
|
using ShipyardDataModels.Models;
|
||||||
|
|
||||||
|
namespace ShipyardContracts.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 AddShip(ShopSearchModel model, IShipModel ship, int count);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace ShipyardContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class ShopSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
public string? ShopName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
16
Shipyard/ShipyardContracts/StoragesContracts/IShopStorage.cs
Normal file
16
Shipyard/ShipyardContracts/StoragesContracts/IShopStorage.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.SearchModels;
|
||||||
|
using ShipyardContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace ShipyardContracts.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);
|
||||||
|
}
|
||||||
|
}
|
19
Shipyard/ShipyardContracts/ViewModels/ShopViewModel.cs
Normal file
19
Shipyard/ShipyardContracts/ViewModels/ShopViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using ShipyardDataModels.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace ShipyardContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ShopViewModel : IShopModel
|
||||||
|
{
|
||||||
|
[DisplayName("Название магазина")]
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Адрес магазина")]
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Дата открытия")]
|
||||||
|
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||||
|
public Dictionary<int, (IShipModel, int)> ShopShips { get; set; } = new();
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
10
Shipyard/ShipyardDataModels/Models/IShopModel.cs
Normal file
10
Shipyard/ShipyardDataModels/Models/IShopModel.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ShipyardDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IShopModel : IId
|
||||||
|
{
|
||||||
|
string ShopName { get; }
|
||||||
|
string Address { get; }
|
||||||
|
DateTime DateOpen { get; }
|
||||||
|
Dictionary<int, (IShipModel, int)> ShopShips { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -8,13 +8,15 @@ namespace ShipyardListImplement
|
|||||||
public List<Detail> Details { get; set; }
|
public List<Detail> Details { get; set; }
|
||||||
public List<Order> Orders { get; set; }
|
public List<Order> Orders { get; set; }
|
||||||
public List<Ship> Ships { get; set; }
|
public List<Ship> Ships { get; set; }
|
||||||
private DataListSingleton()
|
public List<Shop> Shops { get; set; }
|
||||||
{
|
private DataListSingleton()
|
||||||
Details = new List<Detail>();
|
{
|
||||||
Orders = new List<Order>();
|
Details = new List<Detail>();
|
||||||
Ships = new List<Ship>();
|
Orders = new List<Order>();
|
||||||
}
|
Ships = new List<Ship>();
|
||||||
public static DataListSingleton GetInstance()
|
Shops = new List<Shop>();
|
||||||
|
}
|
||||||
|
public static DataListSingleton GetInstance()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
|
107
Shipyard/ShipyardListImplement/Implements/ShopStorage.cs
Normal file
107
Shipyard/ShipyardListImplement/Implements/ShopStorage.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.SearchModels;
|
||||||
|
using ShipyardContracts.StoragesContracts;
|
||||||
|
using ShipyardContracts.ViewModels;
|
||||||
|
using ShipyardListImplement.Models;
|
||||||
|
|
||||||
|
namespace ShipyardListImplement.Implements
|
||||||
|
{
|
||||||
|
public class ShopStorage : IShopStorage
|
||||||
|
{
|
||||||
|
private readonly DataListSingleton _source;
|
||||||
|
|
||||||
|
public ShopStorage()
|
||||||
|
{
|
||||||
|
_source = DataListSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
Shipyard/ShipyardListImplement/Models/Shop.cs
Normal file
54
Shipyard/ShipyardListImplement/Models/Shop.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.ViewModels;
|
||||||
|
using ShipyardDataModels.Models;
|
||||||
|
|
||||||
|
namespace ShipyardListImplement.Models
|
||||||
|
{
|
||||||
|
public class Shop : IShopModel
|
||||||
|
{
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateOpen { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
|
public Dictionary<int, (IShipModel, int)> ShopShips { get; private set; } = new Dictionary<int, (IShipModel, int)>();
|
||||||
|
|
||||||
|
public static Shop? Create(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ShopName = model.ShopName,
|
||||||
|
Address = model.Address,
|
||||||
|
DateOpen = model.DateOpen,
|
||||||
|
ShopShips = model.ShopShips
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ShopName = model.ShopName;
|
||||||
|
Address = model.Address;
|
||||||
|
DateOpen = model.DateOpen;
|
||||||
|
ShopShips = model.ShopShips;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ShopName = ShopName,
|
||||||
|
Address = Address,
|
||||||
|
DateOpen = DateOpen,
|
||||||
|
ShopShips = ShopShips
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
145
Shipyard/ShipyardView/FormAddShip.Designer.cs
generated
Normal file
145
Shipyard/ShipyardView/FormAddShip.Designer.cs
generated
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
namespace ShipyardView
|
||||||
|
{
|
||||||
|
partial class FormAddShip
|
||||||
|
{
|
||||||
|
/// <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.labelShop = new System.Windows.Forms.Label();
|
||||||
|
this.labelShip = new System.Windows.Forms.Label();
|
||||||
|
this.labelCount = new System.Windows.Forms.Label();
|
||||||
|
this.comboBoxShop = new System.Windows.Forms.ComboBox();
|
||||||
|
this.comboBoxShip = new System.Windows.Forms.ComboBox();
|
||||||
|
this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.ButtonSave = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelShop
|
||||||
|
//
|
||||||
|
this.labelShop.AutoSize = true;
|
||||||
|
this.labelShop.Location = new System.Drawing.Point(12, 31);
|
||||||
|
this.labelShop.Name = "labelShop";
|
||||||
|
this.labelShop.Size = new System.Drawing.Size(69, 20);
|
||||||
|
this.labelShop.TabIndex = 0;
|
||||||
|
this.labelShop.Text = "Магазин";
|
||||||
|
//
|
||||||
|
// labelShip
|
||||||
|
//
|
||||||
|
this.labelShip.AutoSize = true;
|
||||||
|
this.labelShip.Location = new System.Drawing.Point(12, 76);
|
||||||
|
this.labelShip.Name = "labelShip";
|
||||||
|
this.labelShip.Size = new System.Drawing.Size(69, 20);
|
||||||
|
this.labelShip.TabIndex = 1;
|
||||||
|
this.labelShip.Text = "Корабль";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
this.labelCount.AutoSize = true;
|
||||||
|
this.labelCount.Location = new System.Drawing.Point(12, 127);
|
||||||
|
this.labelCount.Name = "labelCount";
|
||||||
|
this.labelCount.Size = new System.Drawing.Size(90, 20);
|
||||||
|
this.labelCount.TabIndex = 2;
|
||||||
|
this.labelCount.Text = "Количество";
|
||||||
|
//
|
||||||
|
// comboBoxShop
|
||||||
|
//
|
||||||
|
this.comboBoxShop.FormattingEnabled = true;
|
||||||
|
this.comboBoxShop.Location = new System.Drawing.Point(111, 31);
|
||||||
|
this.comboBoxShop.Name = "comboBoxShop";
|
||||||
|
this.comboBoxShop.Size = new System.Drawing.Size(369, 28);
|
||||||
|
this.comboBoxShop.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// comboBoxShip
|
||||||
|
//
|
||||||
|
this.comboBoxShip.FormattingEnabled = true;
|
||||||
|
this.comboBoxShip.Location = new System.Drawing.Point(111, 76);
|
||||||
|
this.comboBoxShip.Name = "comboBoxShip";
|
||||||
|
this.comboBoxShip.Size = new System.Drawing.Size(369, 28);
|
||||||
|
this.comboBoxShip.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// numericUpDownCount
|
||||||
|
//
|
||||||
|
this.numericUpDownCount.Location = new System.Drawing.Point(111, 120);
|
||||||
|
this.numericUpDownCount.Name = "numericUpDownCount";
|
||||||
|
this.numericUpDownCount.Size = new System.Drawing.Size(369, 27);
|
||||||
|
this.numericUpDownCount.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// ButtonSave
|
||||||
|
//
|
||||||
|
this.ButtonSave.Location = new System.Drawing.Point(279, 167);
|
||||||
|
this.ButtonSave.Name = "ButtonSave";
|
||||||
|
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.ButtonSave.TabIndex = 6;
|
||||||
|
this.ButtonSave.Text = "Сохранить";
|
||||||
|
this.ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(386, 167);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.ButtonCancel.TabIndex = 7;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// FormAddShip
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(492, 207);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.ButtonSave);
|
||||||
|
this.Controls.Add(this.numericUpDownCount);
|
||||||
|
this.Controls.Add(this.comboBoxShip);
|
||||||
|
this.Controls.Add(this.comboBoxShop);
|
||||||
|
this.Controls.Add(this.labelCount);
|
||||||
|
this.Controls.Add(this.labelShip);
|
||||||
|
this.Controls.Add(this.labelShop);
|
||||||
|
this.Name = "FormAddShip";
|
||||||
|
this.Text = "Добавление корабля в магазин";
|
||||||
|
this.Load += new System.EventHandler(this.FormAddShip_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelShop;
|
||||||
|
private Label labelShip;
|
||||||
|
private Label labelCount;
|
||||||
|
private ComboBox comboBoxShop;
|
||||||
|
private ComboBox comboBoxShip;
|
||||||
|
private NumericUpDown numericUpDownCount;
|
||||||
|
private Button ButtonSave;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
}
|
||||||
|
}
|
108
Shipyard/ShipyardView/FormAddShip.cs
Normal file
108
Shipyard/ShipyardView/FormAddShip.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ShipyardContracts.BusinessLogicsContracts;
|
||||||
|
using ShipyardContracts.SearchModels;
|
||||||
|
|
||||||
|
namespace ShipyardView
|
||||||
|
{
|
||||||
|
public partial class FormAddShip : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IShipLogic _logicShip;
|
||||||
|
private readonly IShopLogic _logicShop;
|
||||||
|
public FormAddShip(ILogger<FormAddShip> logger, IShipLogic logicShip, IShopLogic logicShop)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logicShip = logicShip;
|
||||||
|
_logicShop = logicShop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormAddShip_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка списка кораблей для пополнения");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicShip.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxShip.DisplayMember = "ShipName";
|
||||||
|
comboBoxShip.ValueMember = "Id";
|
||||||
|
comboBoxShip.DataSource = list;
|
||||||
|
comboBoxShip.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка кораблей");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка списка магазинов для пополнения");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicShop.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxShop.DisplayMember = "ShopName";
|
||||||
|
comboBoxShop.ValueMember = "Id";
|
||||||
|
comboBoxShop.DataSource = list;
|
||||||
|
comboBoxShop.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка магазинов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(numericUpDownCount.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxShip.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите корабль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxShop.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Пополнение магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicShop.AddShip(new ShopSearchModel
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxShop.SelectedValue)
|
||||||
|
},
|
||||||
|
_logicShip.ReadElement(new ShipSearchModel()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxShip.SelectedValue)
|
||||||
|
})!, Convert.ToInt32(numericUpDownCount.Text));
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Shipyard/ShipyardView/FormAddShip.resx
Normal file
120
Shipyard/ShipyardView/FormAddShip.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>
|
314
Shipyard/ShipyardView/FormMain.Designer.cs
generated
314
Shipyard/ShipyardView/FormMain.Designer.cs
generated
@ -20,154 +20,174 @@
|
|||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Required method for Designer support - do not modify
|
||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||||
toolStrip = new ToolStrip();
|
toolStrip = new ToolStrip();
|
||||||
toolStripMenu = new ToolStripDropDownButton();
|
toolStripMenu = new ToolStripDropDownButton();
|
||||||
деталиToolStripMenuItem = new ToolStripMenuItem();
|
деталиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
кораблиToolStripMenuItem = new ToolStripMenuItem();
|
кораблиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
dataGridView = new DataGridView();
|
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonCreateOrder = new Button();
|
dataGridView = new DataGridView();
|
||||||
buttonTakeInWork = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonReady = new Button();
|
buttonTakeInWork = new Button();
|
||||||
buttonIssue = new Button();
|
buttonReady = new Button();
|
||||||
buttonRefresh = new Button();
|
buttonIssue = new Button();
|
||||||
toolStrip.SuspendLayout();
|
buttonRefresh = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
buttonAddShip = new Button();
|
||||||
SuspendLayout();
|
toolStrip.SuspendLayout();
|
||||||
//
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
// toolStrip
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
toolStrip.ImageScalingSize = new Size(20, 20);
|
// toolStrip
|
||||||
toolStrip.Items.AddRange(new ToolStripItem[] { toolStripMenu });
|
//
|
||||||
toolStrip.Location = new Point(0, 0);
|
toolStrip.ImageScalingSize = new Size(20, 20);
|
||||||
toolStrip.Name = "toolStrip";
|
toolStrip.Items.AddRange(new ToolStripItem[] { toolStripMenu });
|
||||||
toolStrip.Size = new Size(1251, 27);
|
toolStrip.Location = new Point(0, 0);
|
||||||
toolStrip.TabIndex = 0;
|
toolStrip.Name = "toolStrip";
|
||||||
toolStrip.Text = "Справочники";
|
toolStrip.Size = new Size(1251, 27);
|
||||||
//
|
toolStrip.TabIndex = 0;
|
||||||
// toolStripMenu
|
toolStrip.Text = "Справочники";
|
||||||
//
|
//
|
||||||
toolStripMenu.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
// toolStripMenu
|
||||||
toolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { деталиToolStripMenuItem, кораблиToolStripMenuItem });
|
//
|
||||||
toolStripMenu.Image = (Image)resources.GetObject("toolStripMenu.Image");
|
toolStripMenu.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||||
toolStripMenu.ImageTransparentColor = Color.Magenta;
|
toolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { деталиToolStripMenuItem, кораблиToolStripMenuItem, магазиныToolStripMenuItem });
|
||||||
toolStripMenu.Name = "toolStripMenu";
|
toolStripMenu.Image = (Image)resources.GetObject("toolStripMenu.Image");
|
||||||
toolStripMenu.Size = new Size(117, 24);
|
toolStripMenu.ImageTransparentColor = Color.Magenta;
|
||||||
toolStripMenu.Text = "Справочники";
|
toolStripMenu.Name = "toolStripMenu";
|
||||||
//
|
toolStripMenu.Size = new Size(117, 24);
|
||||||
// деталиToolStripMenuItem
|
toolStripMenu.Text = "Справочники";
|
||||||
//
|
//
|
||||||
деталиToolStripMenuItem.Name = "деталиToolStripMenuItem";
|
// деталиToolStripMenuItem
|
||||||
деталиToolStripMenuItem.Size = new Size(153, 26);
|
//
|
||||||
деталиToolStripMenuItem.Text = "Детали";
|
деталиToolStripMenuItem.Name = "деталиToolStripMenuItem";
|
||||||
деталиToolStripMenuItem.Click += ДеталиToolStripMenuItem_Click;
|
деталиToolStripMenuItem.Size = new Size(163, 26);
|
||||||
//
|
деталиToolStripMenuItem.Text = "Детали";
|
||||||
// кораблиToolStripMenuItem
|
деталиToolStripMenuItem.Click += ДеталиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
кораблиToolStripMenuItem.Name = "кораблиToolStripMenuItem";
|
// кораблиToolStripMenuItem
|
||||||
кораблиToolStripMenuItem.Size = new Size(153, 26);
|
//
|
||||||
кораблиToolStripMenuItem.Text = "Корабли";
|
кораблиToolStripMenuItem.Name = "кораблиToolStripMenuItem";
|
||||||
кораблиToolStripMenuItem.Click += КораблиToolStripMenuItem_Click;
|
кораблиToolStripMenuItem.Size = new Size(163, 26);
|
||||||
//
|
кораблиToolStripMenuItem.Text = "Корабли";
|
||||||
// dataGridView
|
кораблиToolStripMenuItem.Click += КораблиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
dataGridView.AllowUserToAddRows = false;
|
// магазиныToolStripMenuItem
|
||||||
dataGridView.AllowUserToDeleteRows = false;
|
//
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
магазиныToolStripMenuItem.Size = new Size(163, 26);
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
dataGridView.Location = new Point(0, 28);
|
магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
||||||
dataGridView.Name = "dataGridView";
|
//
|
||||||
dataGridView.RowHeadersVisible = false;
|
// dataGridView
|
||||||
dataGridView.RowHeadersWidth = 51;
|
//
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.AllowUserToAddRows = false;
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
dataGridView.Size = new Size(984, 366);
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
dataGridView.TabIndex = 1;
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
//
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
// buttonCreateOrder
|
dataGridView.Location = new Point(0, 28);
|
||||||
//
|
dataGridView.Name = "dataGridView";
|
||||||
buttonCreateOrder.Location = new Point(1032, 51);
|
dataGridView.RowHeadersVisible = false;
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
dataGridView.RowHeadersWidth = 51;
|
||||||
buttonCreateOrder.Size = new Size(178, 29);
|
dataGridView.RowTemplate.Height = 29;
|
||||||
buttonCreateOrder.TabIndex = 2;
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
dataGridView.Size = new Size(984, 366);
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
dataGridView.TabIndex = 1;
|
||||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
//
|
||||||
//
|
// buttonCreateOrder
|
||||||
// buttonTakeInWork
|
//
|
||||||
//
|
buttonCreateOrder.Location = new Point(1032, 51);
|
||||||
buttonTakeInWork.Location = new Point(1032, 110);
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonTakeInWork.Name = "buttonTakeInWork";
|
buttonCreateOrder.Size = new Size(178, 29);
|
||||||
buttonTakeInWork.Size = new Size(178, 29);
|
buttonCreateOrder.TabIndex = 2;
|
||||||
buttonTakeInWork.TabIndex = 3;
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonTakeInWork.Text = "Отдать на выполнение";
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
buttonTakeInWork.UseVisualStyleBackColor = true;
|
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||||
buttonTakeInWork.Click += ButtonTakeOrderInWork_Click;
|
//
|
||||||
//
|
// buttonTakeInWork
|
||||||
// buttonReady
|
//
|
||||||
//
|
buttonTakeInWork.Location = new Point(1032, 110);
|
||||||
buttonReady.Location = new Point(1032, 171);
|
buttonTakeInWork.Name = "buttonTakeInWork";
|
||||||
buttonReady.Name = "buttonReady";
|
buttonTakeInWork.Size = new Size(178, 29);
|
||||||
buttonReady.Size = new Size(178, 29);
|
buttonTakeInWork.TabIndex = 3;
|
||||||
buttonReady.TabIndex = 4;
|
buttonTakeInWork.Text = "Отдать на выполнение";
|
||||||
buttonReady.Text = "Заказ готов";
|
buttonTakeInWork.UseVisualStyleBackColor = true;
|
||||||
buttonReady.UseVisualStyleBackColor = true;
|
buttonTakeInWork.Click += ButtonTakeOrderInWork_Click;
|
||||||
buttonReady.Click += ButtonOrderReady_Click;
|
//
|
||||||
//
|
// buttonReady
|
||||||
// buttonIssue
|
//
|
||||||
//
|
buttonReady.Location = new Point(1032, 171);
|
||||||
buttonIssue.Location = new Point(1032, 236);
|
buttonReady.Name = "buttonReady";
|
||||||
buttonIssue.Name = "buttonIssue";
|
buttonReady.Size = new Size(178, 29);
|
||||||
buttonIssue.Size = new Size(178, 29);
|
buttonReady.TabIndex = 4;
|
||||||
buttonIssue.TabIndex = 5;
|
buttonReady.Text = "Заказ готов";
|
||||||
buttonIssue.Text = "Заказ выдан";
|
buttonReady.UseVisualStyleBackColor = true;
|
||||||
buttonIssue.UseVisualStyleBackColor = true;
|
buttonReady.Click += ButtonOrderReady_Click;
|
||||||
buttonIssue.Click += ButtonIssuedOrder_Click;
|
//
|
||||||
//
|
// buttonIssue
|
||||||
// buttonRefresh
|
//
|
||||||
//
|
buttonIssue.Location = new Point(1032, 236);
|
||||||
buttonRefresh.Location = new Point(1032, 303);
|
buttonIssue.Name = "buttonIssue";
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonIssue.Size = new Size(178, 29);
|
||||||
buttonRefresh.Size = new Size(178, 29);
|
buttonIssue.TabIndex = 5;
|
||||||
buttonRefresh.TabIndex = 6;
|
buttonIssue.Text = "Заказ выдан";
|
||||||
buttonRefresh.Text = "Обновить список";
|
buttonIssue.UseVisualStyleBackColor = true;
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonIssue.Click += ButtonIssuedOrder_Click;
|
||||||
buttonRefresh.Click += ButtonRef_Click;
|
//
|
||||||
//
|
// buttonRefresh
|
||||||
// FormMain
|
//
|
||||||
//
|
buttonRefresh.Location = new Point(1032, 350);
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
buttonRefresh.Size = new Size(178, 29);
|
||||||
ClientSize = new Size(1251, 391);
|
buttonRefresh.TabIndex = 6;
|
||||||
Controls.Add(buttonRefresh);
|
buttonRefresh.Text = "Обновить список";
|
||||||
Controls.Add(buttonIssue);
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
Controls.Add(buttonReady);
|
buttonRefresh.Click += ButtonRef_Click;
|
||||||
Controls.Add(buttonTakeInWork);
|
//
|
||||||
Controls.Add(buttonCreateOrder);
|
// buttonAddShip
|
||||||
Controls.Add(dataGridView);
|
//
|
||||||
Controls.Add(toolStrip);
|
buttonAddShip.Location = new Point(1032, 293);
|
||||||
Name = "FormMain";
|
buttonAddShip.Name = "buttonAddShip";
|
||||||
Text = "FormMain";
|
buttonAddShip.Size = new Size(178, 29);
|
||||||
Load += FormMain_Load;
|
buttonAddShip.TabIndex = 7;
|
||||||
toolStrip.ResumeLayout(false);
|
buttonAddShip.Text = "Добавить корабль";
|
||||||
toolStrip.PerformLayout();
|
buttonAddShip.UseVisualStyleBackColor = true;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
buttonAddShip.Click += ButtonAddShip_Click;
|
||||||
ResumeLayout(false);
|
//
|
||||||
PerformLayout();
|
// FormMain
|
||||||
}
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1251, 391);
|
||||||
|
Controls.Add(buttonAddShip);
|
||||||
|
Controls.Add(buttonRefresh);
|
||||||
|
Controls.Add(buttonIssue);
|
||||||
|
Controls.Add(buttonReady);
|
||||||
|
Controls.Add(buttonTakeInWork);
|
||||||
|
Controls.Add(buttonCreateOrder);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(toolStrip);
|
||||||
|
Name = "FormMain";
|
||||||
|
Text = "FormMain";
|
||||||
|
Load += FormMain_Load;
|
||||||
|
toolStrip.ResumeLayout(false);
|
||||||
|
toolStrip.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private ToolStrip toolStrip;
|
private ToolStrip toolStrip;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private Button buttonTakeInWork;
|
private Button buttonTakeInWork;
|
||||||
@ -177,5 +197,7 @@
|
|||||||
private ToolStripDropDownButton toolStripMenu;
|
private ToolStripDropDownButton toolStripMenu;
|
||||||
private ToolStripMenuItem деталиToolStripMenuItem;
|
private ToolStripMenuItem деталиToolStripMenuItem;
|
||||||
private ToolStripMenuItem кораблиToolStripMenuItem;
|
private ToolStripMenuItem кораблиToolStripMenuItem;
|
||||||
}
|
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||||
|
private Button buttonAddShip;
|
||||||
|
}
|
||||||
}
|
}
|
@ -133,7 +133,25 @@ namespace ShipyardView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||||
|
if (service is FormShops form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAddShip_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormAddShip));
|
||||||
|
if (service is FormAddShip form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
189
Shipyard/ShipyardView/FormShop.Designer.cs
generated
Normal file
189
Shipyard/ShipyardView/FormShop.Designer.cs
generated
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
namespace ShipyardView
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
labelShop = new Label();
|
||||||
|
labelAddress = new Label();
|
||||||
|
labelDate = new Label();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
textBoxAddress = new TextBox();
|
||||||
|
dateTimePickerDateOpen = new DateTimePicker();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
ButtonSave = new Button();
|
||||||
|
ButtonCancel = new Button();
|
||||||
|
ID = new DataGridViewTextBoxColumn();
|
||||||
|
ShipName = new DataGridViewTextBoxColumn();
|
||||||
|
Count = new DataGridViewTextBoxColumn();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelShop
|
||||||
|
//
|
||||||
|
labelShop.AutoSize = true;
|
||||||
|
labelShop.Location = new Point(12, 21);
|
||||||
|
labelShop.Name = "labelShop";
|
||||||
|
labelShop.Size = new Size(69, 20);
|
||||||
|
labelShop.TabIndex = 0;
|
||||||
|
labelShop.Text = "Магазин";
|
||||||
|
//
|
||||||
|
// labelAddress
|
||||||
|
//
|
||||||
|
labelAddress.AutoSize = true;
|
||||||
|
labelAddress.Location = new Point(195, 21);
|
||||||
|
labelAddress.Name = "labelAddress";
|
||||||
|
labelAddress.Size = new Size(51, 20);
|
||||||
|
labelAddress.TabIndex = 1;
|
||||||
|
labelAddress.Text = "Адрес";
|
||||||
|
//
|
||||||
|
// labelDate
|
||||||
|
//
|
||||||
|
labelDate.AutoSize = true;
|
||||||
|
labelDate.Location = new Point(474, 21);
|
||||||
|
labelDate.Name = "labelDate";
|
||||||
|
labelDate.Size = new Size(110, 20);
|
||||||
|
labelDate.TabIndex = 2;
|
||||||
|
labelDate.Text = "Дата открытия";
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(12, 44);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(160, 27);
|
||||||
|
textBoxName.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// textBoxAddress
|
||||||
|
//
|
||||||
|
textBoxAddress.Location = new Point(195, 44);
|
||||||
|
textBoxAddress.Name = "textBoxAddress";
|
||||||
|
textBoxAddress.Size = new Size(246, 27);
|
||||||
|
textBoxAddress.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// dateTimePickerDateOpen
|
||||||
|
//
|
||||||
|
dateTimePickerDateOpen.Location = new Point(474, 44);
|
||||||
|
dateTimePickerDateOpen.Name = "dateTimePickerDateOpen";
|
||||||
|
dateTimePickerDateOpen.Size = new Size(250, 27);
|
||||||
|
dateTimePickerDateOpen.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ShipName, Count });
|
||||||
|
dataGridView.Location = new Point(12, 77);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new Size(712, 330);
|
||||||
|
dataGridView.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// ButtonSave
|
||||||
|
//
|
||||||
|
ButtonSave.Location = new Point(490, 413);
|
||||||
|
ButtonSave.Name = "ButtonSave";
|
||||||
|
ButtonSave.Size = new Size(111, 29);
|
||||||
|
ButtonSave.TabIndex = 7;
|
||||||
|
ButtonSave.Text = "Сохранить";
|
||||||
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
ButtonCancel.Location = new Point(630, 413);
|
||||||
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
|
ButtonCancel.Size = new Size(94, 29);
|
||||||
|
ButtonCancel.TabIndex = 8;
|
||||||
|
ButtonCancel.Text = "Отмена";
|
||||||
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// ID
|
||||||
|
//
|
||||||
|
ID.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
ID.HeaderText = "ID";
|
||||||
|
ID.MinimumWidth = 6;
|
||||||
|
ID.Name = "ID";
|
||||||
|
ID.Visible = false;
|
||||||
|
//
|
||||||
|
// ShipName
|
||||||
|
//
|
||||||
|
ShipName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
ShipName.HeaderText = "Название корабля";
|
||||||
|
ShipName.MinimumWidth = 6;
|
||||||
|
ShipName.Name = "ShipName";
|
||||||
|
//
|
||||||
|
// Count
|
||||||
|
//
|
||||||
|
Count.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
Count.HeaderText = "Количество";
|
||||||
|
Count.MinimumWidth = 6;
|
||||||
|
Count.Name = "Count";
|
||||||
|
//
|
||||||
|
// FormShop
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(740, 450);
|
||||||
|
Controls.Add(ButtonCancel);
|
||||||
|
Controls.Add(ButtonSave);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(dateTimePickerDateOpen);
|
||||||
|
Controls.Add(textBoxAddress);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Controls.Add(labelDate);
|
||||||
|
Controls.Add(labelAddress);
|
||||||
|
Controls.Add(labelShop);
|
||||||
|
Name = "FormShop";
|
||||||
|
Text = "Магазин";
|
||||||
|
Load += FormShop_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelShop;
|
||||||
|
private Label labelAddress;
|
||||||
|
private Label labelDate;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxAddress;
|
||||||
|
private DateTimePicker dateTimePickerDateOpen;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button ButtonSave;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private DataGridViewTextBoxColumn ID;
|
||||||
|
private DataGridViewTextBoxColumn ShipName;
|
||||||
|
private DataGridViewTextBoxColumn Count;
|
||||||
|
}
|
||||||
|
}
|
122
Shipyard/ShipyardView/FormShop.cs
Normal file
122
Shipyard/ShipyardView/FormShop.cs
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.BusinessLogicsContracts;
|
||||||
|
using ShipyardContracts.SearchModels;
|
||||||
|
using ShipyardDataModels.Models;
|
||||||
|
|
||||||
|
namespace ShipyardView
|
||||||
|
{
|
||||||
|
public partial class FormShop : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IShopLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
private Dictionary<int, (IShipModel, int)> _shopShips;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_shopShips = new Dictionary<int, (IShipModel, int)>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormShop_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var view = _logic.ReadElement(new ShopSearchModel
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
textBoxName.Text = view.ShopName;
|
||||||
|
textBoxAddress.Text = view.Address.ToString();
|
||||||
|
dateTimePickerDateOpen.Text = view.DateOpen.ToString();
|
||||||
|
_shopShips = view.ShopShips ?? new Dictionary<int, (IShipModel, int)>();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка кораблей магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_shopShips != null)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
foreach (var element in _shopShips)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[] { element.Key, element.Value.Item1.ShipName, element.Value.Item2 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки кораблей магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxAddress.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(dateTimePickerDateOpen.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните дату", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Сохранение магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new ShopBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
ShopName = textBoxName.Text,
|
||||||
|
Address = textBoxAddress.Text,
|
||||||
|
DateOpen = DateTime.Parse(dateTimePickerDateOpen.Text),
|
||||||
|
ShopShips = _shopShips
|
||||||
|
};
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Shipyard/ShipyardView/FormShop.resx
Normal file
120
Shipyard/ShipyardView/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>
|
117
Shipyard/ShipyardView/FormShops.Designer.cs
generated
Normal file
117
Shipyard/ShipyardView/FormShops.Designer.cs
generated
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
namespace ShipyardView
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
ButtonUpd = new Button();
|
||||||
|
ButtonDel = new Button();
|
||||||
|
ButtonRef = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Left;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(631, 450);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ButtonAdd
|
||||||
|
//
|
||||||
|
ButtonAdd.Location = new Point(670, 33);
|
||||||
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
|
ButtonAdd.Size = new Size(106, 48);
|
||||||
|
ButtonAdd.TabIndex = 1;
|
||||||
|
ButtonAdd.Text = "Создать";
|
||||||
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// ButtonUpd
|
||||||
|
//
|
||||||
|
ButtonUpd.Location = new Point(670, 102);
|
||||||
|
ButtonUpd.Name = "ButtonUpd";
|
||||||
|
ButtonUpd.Size = new Size(106, 48);
|
||||||
|
ButtonUpd.TabIndex = 2;
|
||||||
|
ButtonUpd.Text = "Изменить";
|
||||||
|
ButtonUpd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonUpd.Click += ButtonUpd_Click;
|
||||||
|
//
|
||||||
|
// ButtonDel
|
||||||
|
//
|
||||||
|
ButtonDel.Location = new Point(670, 165);
|
||||||
|
ButtonDel.Name = "ButtonDel";
|
||||||
|
ButtonDel.Size = new Size(106, 48);
|
||||||
|
ButtonDel.TabIndex = 3;
|
||||||
|
ButtonDel.Text = "Удалить";
|
||||||
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonDel.Click += ButtonDel_Click;
|
||||||
|
//
|
||||||
|
// ButtonRef
|
||||||
|
//
|
||||||
|
ButtonRef.Location = new Point(670, 229);
|
||||||
|
ButtonRef.Name = "ButtonRef";
|
||||||
|
ButtonRef.Size = new Size(106, 48);
|
||||||
|
ButtonRef.TabIndex = 4;
|
||||||
|
ButtonRef.Text = "Обновить";
|
||||||
|
ButtonRef.UseVisualStyleBackColor = true;
|
||||||
|
ButtonRef.Click += ButtonRef_Click;
|
||||||
|
//
|
||||||
|
// FormShops
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(ButtonRef);
|
||||||
|
Controls.Add(ButtonDel);
|
||||||
|
Controls.Add(ButtonUpd);
|
||||||
|
Controls.Add(ButtonAdd);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormShops";
|
||||||
|
Text = "Магазины";
|
||||||
|
Load += FormShops_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button ButtonAdd;
|
||||||
|
private Button ButtonUpd;
|
||||||
|
private Button ButtonDel;
|
||||||
|
private Button ButtonRef;
|
||||||
|
}
|
||||||
|
}
|
105
Shipyard/ShipyardView/FormShops.cs
Normal file
105
Shipyard/ShipyardView/FormShops.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
using ShipyardContracts.BusinessLogicsContracts;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ShipyardView
|
||||||
|
{
|
||||||
|
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["ShopShips"].Visible = false;
|
||||||
|
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка магазинов");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||||
|
if (service is FormShop form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonUpd_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 ButtonDel_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 ButtonRef_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Shipyard/ShipyardView/FormShops.resx
Normal file
120
Shipyard/ShipyardView/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>
|
@ -34,15 +34,20 @@ namespace ShipyardView
|
|||||||
services.AddTransient<IShipStorage, ShipStorage>();
|
services.AddTransient<IShipStorage, ShipStorage>();
|
||||||
services.AddTransient<IDetailLogic, DetailLogic>();
|
services.AddTransient<IDetailLogic, DetailLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IShipLogic, ShipLogic>();
|
services.AddTransient<IShopStorage, ShopStorage>();
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<IShipLogic, ShipLogic>();
|
||||||
|
services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormDetail>();
|
services.AddTransient<FormDetail>();
|
||||||
services.AddTransient<FormDetails>();
|
services.AddTransient<FormDetails>();
|
||||||
services.AddTransient<FormCreateOrder>();
|
services.AddTransient<FormCreateOrder>();
|
||||||
services.AddTransient<FormShip>();
|
services.AddTransient<FormShip>();
|
||||||
services.AddTransient<FormShipDetail>();
|
services.AddTransient<FormShipDetail>();
|
||||||
services.AddTransient<FormShips>();
|
services.AddTransient<FormShips>();
|
||||||
}
|
services.AddTransient<FormShop>();
|
||||||
|
services.AddTransient<FormShops>();
|
||||||
|
services.AddTransient<FormAddShip>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user