final
This commit is contained in:
parent
5aeb4bbc37
commit
2da63ac071
@ -7,6 +7,7 @@ using BlacksmithWorkshopContracts.BindingModels;
|
||||
using BlacksmithWorkshopContracts.SearchModels;
|
||||
using BlacksmithWorkshopContracts.StorageContracts;
|
||||
using BlacksmithWorkshopContracts.ViewModels;
|
||||
using BlacksmithWorkshopDataModels.Models;
|
||||
using BlacksmithWorkshopListImplement.Models;
|
||||
|
||||
namespace BlacksmithWorkshopListImplement.Implements
|
||||
@ -103,5 +104,9 @@ namespace BlacksmithWorkshopListImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public bool SellManufactures(IManufactureModel model, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace BlacksmithWorkshopListImplement.Models
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
public string Address { get; private set; } = string.Empty;
|
||||
public DateTime DateOpening { get; private set; }
|
||||
public int Capacity { get; private set; }
|
||||
public Dictionary<int, (IManufactureModel, int)> ListManufacture
|
||||
{
|
||||
get;
|
||||
|
@ -146,5 +146,55 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
|
||||
});
|
||||
return true;
|
||||
}
|
||||
public bool AddManufactures(IManufactureModel model, int count)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (count <= 0)
|
||||
{
|
||||
throw new ArgumentException("Количество поездок должно быть больше 0", nameof(count));
|
||||
}
|
||||
_logger.LogInformation("AddManufactures. ShopName:{ShopName}. Id:{Id}", model.ManufactureName, model.Id);
|
||||
var allFreeQuantity = _shopStorage.GetFullList().Select(x => x.Capacity - x.ListManufacture.Select(x => x.Value.Item2).Sum()).Sum();
|
||||
if (allFreeQuantity < count)
|
||||
{
|
||||
_logger.LogWarning("AddManufactures operation failed.");
|
||||
return false;
|
||||
}
|
||||
foreach (var shop in _shopStorage.GetFullList())
|
||||
{
|
||||
int freeQuantity = shop.Capacity - shop.ListManufacture.Select(x => x.Value.Item2).Sum();
|
||||
if (freeQuantity < count)
|
||||
{
|
||||
if (!AddManufactureInShop(new() { Id = shop.Id }, model, freeQuantity))
|
||||
{
|
||||
_logger.LogWarning("AddManufactures operation failed.");
|
||||
return false;
|
||||
}
|
||||
count -= freeQuantity;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AddManufactureInShop(new() { Id = shop.Id }, model, count))
|
||||
{
|
||||
_logger.LogWarning("AddManufactures operation failed.");
|
||||
return false;
|
||||
}
|
||||
count = 0;
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_logger.LogWarning("AddManufactures operation failed.");
|
||||
return false;
|
||||
}
|
||||
public bool SellManufactures(IManufactureModel model, int count)
|
||||
{
|
||||
return _shopStorage.SellManufactures(model, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace BlacksmithWorkshopContracts.BindingModels
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
public string Address { get; set; } = string.Empty;
|
||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
||||
public int Capacity { get; set; }
|
||||
public Dictionary<int, (IManufactureModel, int)> ListManufacture
|
||||
{
|
||||
get;
|
||||
|
@ -18,5 +18,7 @@ namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
|
||||
bool Update(ShopBindingModel model);
|
||||
bool Delete(ShopBindingModel model);
|
||||
bool AddManufactureInShop(ShopSearchModel model, IManufactureModel manufacture, int count);
|
||||
bool AddManufactures(IManufactureModel model, int count);
|
||||
bool SellManufactures(IManufactureModel model, int count);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using BlacksmithWorkshopContracts.BindingModels;
|
||||
using BlacksmithWorkshopContracts.SearchModels;
|
||||
using BlacksmithWorkshopContracts.ViewModels;
|
||||
using BlacksmithWorkshopDataModels.Models;
|
||||
|
||||
namespace BlacksmithWorkshopContracts.StorageContracts
|
||||
{
|
||||
@ -17,5 +18,6 @@ namespace BlacksmithWorkshopContracts.StorageContracts
|
||||
ShopViewModel? Insert(ShopBindingModel model);
|
||||
ShopViewModel? Update(ShopBindingModel model);
|
||||
ShopViewModel? Delete(ShopBindingModel model);
|
||||
bool SellManufactures(IManufactureModel model, int count);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ namespace BlacksmithWorkshopContracts.ViewModels
|
||||
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Вместимость магазина")]
|
||||
public int Capacity { get; set; }
|
||||
public Dictionary<int, (IManufactureModel, int)> ListManufacture
|
||||
{
|
||||
get;
|
||||
|
@ -15,9 +15,11 @@ namespace BlacksmithWorkshopFileImplement
|
||||
private readonly string ComponentFileName = "Component.xml";
|
||||
private readonly string OrderFileName = "Order.xml";
|
||||
private readonly string ManufactureFileName = "Manufacture.xml";
|
||||
private readonly string ShopFileName = "Shop.xml";
|
||||
public List<Component> Components { get; private set; }
|
||||
public List<Order> Orders { get; private set; }
|
||||
public List<Manufacture> Manufactures { get; private set; }
|
||||
public List<Shop> Shops { get; private set; }
|
||||
public static DataFileSingleton GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
@ -29,11 +31,13 @@ namespace BlacksmithWorkshopFileImplement
|
||||
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
|
||||
public void SaveManufactures() => SaveData(Manufactures, ManufactureFileName, "Manufactures", x => x.GetXElement);
|
||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
||||
private DataFileSingleton()
|
||||
{
|
||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||
Manufactures = LoadData(ManufactureFileName, "Manufacture", x => Manufacture.Create(x)!)!;
|
||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
||||
}
|
||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||
{
|
||||
|
@ -0,0 +1,124 @@
|
||||
using BlacksmithWorkshopContracts.BindingModels;
|
||||
using BlacksmithWorkshopContracts.SearchModels;
|
||||
using BlacksmithWorkshopContracts.StorageContracts;
|
||||
using BlacksmithWorkshopContracts.ViewModels;
|
||||
using BlacksmithWorkshopDataModels.Models;
|
||||
using BlacksmithWorkshopFileImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BlacksmithWorkshopFileImplement.Implements
|
||||
{
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
private readonly DataFileSingleton source;
|
||||
|
||||
public ShopStorage()
|
||||
{
|
||||
source = DataFileSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return source.Shops
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ShopName) && x.ShopName == model.ShopName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
return source.Shops
|
||||
.Where(x => x.ShopName.Contains(model.ShopName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFullList()
|
||||
{
|
||||
return source.Shops.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ShopViewModel? Insert(ShopBindingModel model)
|
||||
{
|
||||
model.Id = source.Shops.Count > 0 ? source.Shops.Max(x => x.Id) + 1 : 1;
|
||||
var newShop = Shop.Create(model);
|
||||
if (newShop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
source.Shops.Add(newShop);
|
||||
source.SaveShops();
|
||||
return newShop.GetViewModel;
|
||||
}
|
||||
|
||||
public ShopViewModel? Update(ShopBindingModel model)
|
||||
{
|
||||
var shop = source.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
shop.Update(model);
|
||||
source.SaveShops();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
public ShopViewModel? Delete(ShopBindingModel model)
|
||||
{
|
||||
var element = source.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
source.Shops.Remove(element);
|
||||
source.SaveShops();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public bool SellManufactures(IManufactureModel model, int count)
|
||||
{
|
||||
int availableQuantity = source.Shops.Select(x => x.ListManufacture.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum();
|
||||
if (availableQuantity < count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var shops = source.Shops.Where(x => x.ListManufacture.ContainsKey(model.Id));
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
int countInCurrentShop = shop.ListManufacture[model.Id].Item2;
|
||||
if (countInCurrentShop <= count)
|
||||
{
|
||||
shop.ListManufacture[model.Id] = (shop.ListManufacture[model.Id].Item1, 0);
|
||||
count -= countInCurrentShop;
|
||||
}
|
||||
else
|
||||
{
|
||||
shop.ListManufacture[model.Id] = (shop.ListManufacture[model.Id].Item1, countInCurrentShop - count);
|
||||
count = 0;
|
||||
}
|
||||
Update(new ShopBindingModel
|
||||
{
|
||||
Id = shop.Id,
|
||||
ShopName = shop.ShopName,
|
||||
Address = shop.Address,
|
||||
DateOpening = shop.DateOpening,
|
||||
ListManufacture = shop.ListManufacture,
|
||||
Capacity = shop.Capacity
|
||||
});
|
||||
if (count == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ namespace BlacksmithWorkshopFileImplement.Models
|
||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -41,7 +40,6 @@ namespace BlacksmithWorkshopFileImplement.Models
|
||||
DateImplement = model.DateImplement
|
||||
};
|
||||
}
|
||||
|
||||
public static Order? Create(XElement element)
|
||||
{
|
||||
if (element == null)
|
||||
@ -60,7 +58,6 @@ namespace BlacksmithWorkshopFileImplement.Models
|
||||
DateImplement = string.IsNullOrEmpty(element.Element("DateImplement")!.Value) ? null : Convert.ToDateTime(element.Element("DateImplement")!.Value)
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -70,7 +67,6 @@ namespace BlacksmithWorkshopFileImplement.Models
|
||||
Status = model.Status;
|
||||
DateImplement = model.DateImplement;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
@ -82,7 +78,6 @@ namespace BlacksmithWorkshopFileImplement.Models
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement
|
||||
};
|
||||
|
||||
public XElement GetXElement => new(
|
||||
"Order",
|
||||
new XAttribute("Id", Id),
|
||||
|
@ -0,0 +1,109 @@
|
||||
using BlacksmithWorkshopContracts.BindingModels;
|
||||
using BlacksmithWorkshopContracts.ViewModels;
|
||||
using BlacksmithWorkshopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace BlacksmithWorkshopFileImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
public string Address { get; private set; } = string.Empty;
|
||||
public DateTime DateOpening { get; private set; }
|
||||
public int Capacity { get; private set; }
|
||||
public Dictionary<int, int> ManufacturesCount = new();
|
||||
public Dictionary<int, (IManufactureModel, int)>? _manufactures = null;
|
||||
public Dictionary<int, (IManufactureModel, int)> ListManufacture
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_manufactures == null)
|
||||
{
|
||||
var source = DataFileSingleton.GetInstance();
|
||||
_manufactures = ManufacturesCount.ToDictionary(
|
||||
x => x.Key,
|
||||
y => ((source.Manufactures.FirstOrDefault(z => z.Id == y.Key) as IManufactureModel)!,
|
||||
y.Value)
|
||||
);
|
||||
}
|
||||
return _manufactures;
|
||||
}
|
||||
}
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
Address = model.Address,
|
||||
DateOpening = model.DateOpening,
|
||||
Capacity = model.Capacity,
|
||||
ManufacturesCount = model.ListManufacture.ToDictionary(x => x.Key, x => x.Value.Item2)
|
||||
};
|
||||
}
|
||||
public static Shop? Create(XElement element)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Shop()
|
||||
{
|
||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||
ShopName = element.Element("ShopName")!.Value,
|
||||
Address = element.Element("Address")!.Value,
|
||||
DateOpening = Convert.ToDateTime(element.Element("DateOpening")!.Value),
|
||||
Capacity = Convert.ToInt32(element.Element("Capacity")!.Value),
|
||||
ManufacturesCount = element.Element("Manufactures")!.Elements("Manufacture")
|
||||
.ToDictionary(
|
||||
x => Convert.ToInt32(x.Element("Key")?.Value),
|
||||
x => Convert.ToInt32(x.Element("Value")?.Value))
|
||||
};
|
||||
}
|
||||
public void Update(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ShopName = model.ShopName;
|
||||
Address = model.Address;
|
||||
DateOpening = model.DateOpening;
|
||||
Capacity = model.Capacity;
|
||||
ManufacturesCount = model.ListManufacture.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||
_manufactures = null;
|
||||
|
||||
}
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
Address = Address,
|
||||
DateOpening = DateOpening,
|
||||
Capacity = Capacity,
|
||||
ListManufacture = ListManufacture
|
||||
};
|
||||
public XElement GetXElement => new("Shop",
|
||||
new XAttribute("Id", Id),
|
||||
new XElement("ShopName", ShopName),
|
||||
new XElement("Address", Address),
|
||||
new XElement("DateOpening", DateOpening.ToString()),
|
||||
new XElement("Capacity", Capacity.ToString()),
|
||||
new XElement("Manufactures", ManufacturesCount.Select(x =>
|
||||
new XElement("Manufacture",
|
||||
new XElement("Key", x.Key),
|
||||
new XElement("Value", x.Value)))
|
||||
.ToArray()));
|
||||
}
|
||||
}
|
@ -28,168 +28,175 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.guideToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.goodsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ShopsToolStripMenuItem = 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.buttonAddManufactureInShop = new System.Windows.Forms.Button();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
menuStrip1 = new MenuStrip();
|
||||
guideToolStripMenuItem = new ToolStripMenuItem();
|
||||
componentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
goodsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ShopsToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonTakeOrderInWork = new Button();
|
||||
buttonOrderReady = new Button();
|
||||
buttonIssuedOrder = new Button();
|
||||
buttonRef = new Button();
|
||||
buttonAddManufactureInShop = new Button();
|
||||
buttonSellManufacture = new Button();
|
||||
menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.guideToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1149, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { guideToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Padding = new Padding(5, 2, 0, 2);
|
||||
menuStrip1.Size = new Size(1149, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// guideToolStripMenuItem
|
||||
//
|
||||
this.guideToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.componentsToolStripMenuItem,
|
||||
this.goodsToolStripMenuItem,
|
||||
this.ShopsToolStripMenuItem});
|
||||
this.guideToolStripMenuItem.Name = "guideToolStripMenuItem";
|
||||
this.guideToolStripMenuItem.Size = new System.Drawing.Size(87, 20);
|
||||
this.guideToolStripMenuItem.Text = "Справочник";
|
||||
guideToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, goodsToolStripMenuItem, ShopsToolStripMenuItem });
|
||||
guideToolStripMenuItem.Name = "guideToolStripMenuItem";
|
||||
guideToolStripMenuItem.Size = new Size(87, 20);
|
||||
guideToolStripMenuItem.Text = "Справочник";
|
||||
//
|
||||
// componentsToolStripMenuItem
|
||||
//
|
||||
this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
||||
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.componentsToolStripMenuItem.Text = "Компоненты";
|
||||
this.componentsToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
||||
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
||||
componentsToolStripMenuItem.Size = new Size(145, 22);
|
||||
componentsToolStripMenuItem.Text = "Компоненты";
|
||||
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||
//
|
||||
// goodsToolStripMenuItem
|
||||
//
|
||||
this.goodsToolStripMenuItem.Name = "goodsToolStripMenuItem";
|
||||
this.goodsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.goodsToolStripMenuItem.Text = "Изделия";
|
||||
this.goodsToolStripMenuItem.Click += new System.EventHandler(this.GoodsToolStripMenuItem_Click);
|
||||
goodsToolStripMenuItem.Name = "goodsToolStripMenuItem";
|
||||
goodsToolStripMenuItem.Size = new Size(145, 22);
|
||||
goodsToolStripMenuItem.Text = "Изделия";
|
||||
goodsToolStripMenuItem.Click += GoodsToolStripMenuItem_Click;
|
||||
//
|
||||
// ShopsToolStripMenuItem
|
||||
//
|
||||
this.ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
|
||||
this.ShopsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.ShopsToolStripMenuItem.Text = "Магазины";
|
||||
this.ShopsToolStripMenuItem.Click += new System.EventHandler(this.ShopsToolStripMenuItem_Click);
|
||||
ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
|
||||
ShopsToolStripMenuItem.Size = new Size(145, 22);
|
||||
ShopsToolStripMenuItem.Text = "Магазины";
|
||||
ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(10, 23);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(855, 286);
|
||||
this.dataGridView.TabIndex = 1;
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(10, 23);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(855, 286);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
this.buttonCreateOrder.Location = new System.Drawing.Point(898, 53);
|
||||
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
this.buttonCreateOrder.Size = new System.Drawing.Size(216, 22);
|
||||
this.buttonCreateOrder.TabIndex = 2;
|
||||
this.buttonCreateOrder.Text = "Создать заказ";
|
||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
||||
buttonCreateOrder.Location = new Point(904, 77);
|
||||
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(216, 22);
|
||||
buttonCreateOrder.TabIndex = 2;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||
//
|
||||
// buttonTakeOrderInWork
|
||||
//
|
||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(898, 92);
|
||||
this.buttonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(216, 22);
|
||||
this.buttonTakeOrderInWork.TabIndex = 3;
|
||||
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
|
||||
buttonTakeOrderInWork.Location = new Point(904, 103);
|
||||
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
buttonTakeOrderInWork.Size = new Size(216, 22);
|
||||
buttonTakeOrderInWork.TabIndex = 3;
|
||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
this.buttonOrderReady.Location = new System.Drawing.Point(898, 129);
|
||||
this.buttonOrderReady.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonOrderReady.Name = "buttonOrderReady";
|
||||
this.buttonOrderReady.Size = new System.Drawing.Size(216, 22);
|
||||
this.buttonOrderReady.TabIndex = 4;
|
||||
this.buttonOrderReady.Text = "Заказ готов";
|
||||
this.buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
|
||||
buttonOrderReady.Location = new Point(904, 129);
|
||||
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(216, 22);
|
||||
buttonOrderReady.TabIndex = 4;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(898, 169);
|
||||
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(216, 22);
|
||||
this.buttonIssuedOrder.TabIndex = 5;
|
||||
this.buttonIssuedOrder.Text = "Заказ выдан";
|
||||
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
||||
buttonIssuedOrder.Location = new Point(904, 155);
|
||||
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
buttonIssuedOrder.Size = new Size(216, 22);
|
||||
buttonIssuedOrder.TabIndex = 5;
|
||||
buttonIssuedOrder.Text = "Заказ выдан";
|
||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(898, 210);
|
||||
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(216, 22);
|
||||
this.buttonRef.TabIndex = 6;
|
||||
this.buttonRef.Text = "Обновить список";
|
||||
this.buttonRef.UseVisualStyleBackColor = true;
|
||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||
buttonRef.Location = new Point(904, 181);
|
||||
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(216, 22);
|
||||
buttonRef.TabIndex = 6;
|
||||
buttonRef.Text = "Обновить список";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// buttonAddManufactureInShop
|
||||
//
|
||||
this.buttonAddManufactureInShop.Location = new System.Drawing.Point(898, 249);
|
||||
this.buttonAddManufactureInShop.Name = "buttonAddManufactureInShop";
|
||||
this.buttonAddManufactureInShop.Size = new System.Drawing.Size(216, 22);
|
||||
this.buttonAddManufactureInShop.TabIndex = 7;
|
||||
this.buttonAddManufactureInShop.Text = "Пополнение магазина";
|
||||
this.buttonAddManufactureInShop.UseVisualStyleBackColor = true;
|
||||
this.buttonAddManufactureInShop.Click += new System.EventHandler(this.buttonAddManufactureInShop_Click);
|
||||
buttonAddManufactureInShop.Location = new Point(904, 208);
|
||||
buttonAddManufactureInShop.Name = "buttonAddManufactureInShop";
|
||||
buttonAddManufactureInShop.Size = new Size(216, 22);
|
||||
buttonAddManufactureInShop.TabIndex = 7;
|
||||
buttonAddManufactureInShop.Text = "Пополнение магазина";
|
||||
buttonAddManufactureInShop.UseVisualStyleBackColor = true;
|
||||
buttonAddManufactureInShop.Click += buttonAddManufactureInShop_Click;
|
||||
//
|
||||
// buttonSellManufacture
|
||||
//
|
||||
buttonSellManufacture.Location = new Point(904, 236);
|
||||
buttonSellManufacture.Name = "buttonSellManufacture";
|
||||
buttonSellManufacture.Size = new Size(216, 23);
|
||||
buttonSellManufacture.TabIndex = 8;
|
||||
buttonSellManufacture.Text = "Продать изделие";
|
||||
buttonSellManufacture.UseVisualStyleBackColor = true;
|
||||
buttonSellManufacture.Click += ButtonSellManufacture_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1149, 319);
|
||||
this.Controls.Add(this.buttonAddManufactureInShop);
|
||||
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.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Кузнечная мастерская";
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1149, 319);
|
||||
Controls.Add(buttonSellManufacture);
|
||||
Controls.Add(buttonAddManufactureInShop);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonIssuedOrder);
|
||||
Controls.Add(buttonOrderReady);
|
||||
Controls.Add(buttonTakeOrderInWork);
|
||||
Controls.Add(buttonCreateOrder);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormMain";
|
||||
Text = "Кузнечная мастерская";
|
||||
Load += FormMain_Load;
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -206,5 +213,6 @@
|
||||
private Button buttonRef;
|
||||
private ToolStripMenuItem ShopsToolStripMenuItem;
|
||||
private Button buttonAddManufactureInShop;
|
||||
private Button buttonSellManufacture;
|
||||
}
|
||||
}
|
@ -82,8 +82,8 @@ namespace BlacksmithWorkshopView
|
||||
_logger.LogInformation("Заказ No {id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
ManufactureId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ManufactureId"].Value),
|
||||
ManufactureName = dataGridView.SelectedRows[0].Cells["ManufactureName"].Value.ToString(),
|
||||
@ -113,8 +113,8 @@ namespace BlacksmithWorkshopView
|
||||
_logger.LogInformation("Заказ No {id}. Меняется статус на 'Готов'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
ManufactureId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ManufactureId"].Value),
|
||||
ManufactureName = dataGridView.SelectedRows[0].Cells["ManufactureName"].Value.ToString(),
|
||||
@ -146,7 +146,7 @@ namespace BlacksmithWorkshopView
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
||||
{
|
||||
{
|
||||
Id = id,
|
||||
ManufactureId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ManufactureId"].Value),
|
||||
ManufactureName = dataGridView.SelectedRows[0].Cells["ManufactureName"].Value.ToString(),
|
||||
@ -190,5 +190,14 @@ namespace BlacksmithWorkshopView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ButtonSellManufacture_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormSellManufacture));
|
||||
if (service is FormSellManufacture form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
121
BlacksmithWorkshop/BlacksmithWorkshopView/FormSellManufacture.Designer.cs
generated
Normal file
121
BlacksmithWorkshop/BlacksmithWorkshopView/FormSellManufacture.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
||||
namespace BlacksmithWorkshopView
|
||||
{
|
||||
partial class FormSellManufacture
|
||||
{
|
||||
/// <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.labelManufacture = new System.Windows.Forms.Label();
|
||||
this.comboBoxManufacture = new System.Windows.Forms.ComboBox();
|
||||
this.labelCount = new System.Windows.Forms.Label();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelManufacture
|
||||
//
|
||||
this.labelManufacture.AutoSize = true;
|
||||
this.labelManufacture.Location = new System.Drawing.Point(38, 15);
|
||||
this.labelManufacture.Name = "labelManufacture";
|
||||
this.labelManufacture.Size = new System.Drawing.Size(81, 25);
|
||||
this.labelManufacture.TabIndex = 1;
|
||||
this.labelManufacture.Text = "Изделие";
|
||||
//
|
||||
// comboBoxManufacture
|
||||
//
|
||||
this.comboBoxManufacture.FormattingEnabled = true;
|
||||
this.comboBoxManufacture.Location = new System.Drawing.Point(125, 12);
|
||||
this.comboBoxManufacture.Name = "comboBoxManufacture";
|
||||
this.comboBoxManufacture.Size = new System.Drawing.Size(277, 33);
|
||||
this.comboBoxManufacture.TabIndex = 2;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
this.labelCount.AutoSize = true;
|
||||
this.labelCount.Location = new System.Drawing.Point(12, 69);
|
||||
this.labelCount.Name = "labelCount";
|
||||
this.labelCount.Size = new System.Drawing.Size(107, 25);
|
||||
this.labelCount.TabIndex = 3;
|
||||
this.labelCount.Text = "Количество";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(290, 129);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(112, 34);
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(172, 129);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(112, 34);
|
||||
this.buttonSave.TabIndex = 5;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// numericUpDownCount
|
||||
//
|
||||
this.numericUpDownCount.Location = new System.Drawing.Point(125, 67);
|
||||
this.numericUpDownCount.Name = "numericUpDownCount";
|
||||
this.numericUpDownCount.Size = new System.Drawing.Size(277, 31);
|
||||
this.numericUpDownCount.TabIndex = 6;
|
||||
//
|
||||
// FormSellManufacture
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(418, 175);
|
||||
this.Controls.Add(this.numericUpDownCount);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.labelCount);
|
||||
this.Controls.Add(this.comboBoxManufacture);
|
||||
this.Controls.Add(this.labelManufacture);
|
||||
this.Name = "FormSellManufacture";
|
||||
this.Text = "Продажа изделий";
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private Label labelManufacture;
|
||||
private ComboBox comboBoxManufacture;
|
||||
private Label labelCount;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private NumericUpDown numericUpDownCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
|
||||
using BlacksmithWorkshopContracts.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 BlacksmithWorkshopView
|
||||
{
|
||||
public partial class FormSellManufacture : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _shopLogic;
|
||||
private readonly IManufactureLogic _manufactureLogic;
|
||||
private readonly List<ManufactureViewModel>? _listManufacture;
|
||||
public FormSellManufacture(ILogger<FormSellManufacture> logger, IShopLogic shopLogic, IManufactureLogic manufactureLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_shopLogic = shopLogic;
|
||||
_manufactureLogic = manufactureLogic;
|
||||
_listManufacture = manufactureLogic.ReadList(null);
|
||||
if (_listManufacture != null)
|
||||
{
|
||||
comboBoxManufacture.DisplayMember = "ManufactureName";
|
||||
comboBoxManufacture.ValueMember = "Id";
|
||||
comboBoxManufacture.DataSource = _listManufacture;
|
||||
comboBoxManufacture.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxManufacture.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите поездку", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(numericUpDownCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Продажа поездок");
|
||||
try
|
||||
{
|
||||
var manufacture = _manufactureLogic.ReadElement(new()
|
||||
{
|
||||
Id = (int)comboBoxManufacture.SelectedValue
|
||||
});
|
||||
if (manufacture == null)
|
||||
{
|
||||
throw new Exception("Поездка не найдена. Дополнительная информация в логах.");
|
||||
}
|
||||
var operationResult = _shopLogic.SellManufactures(
|
||||
model: manufacture,
|
||||
count: (int)numericUpDownCount.Value
|
||||
);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -28,162 +28,168 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.textBoxAddress = new System.Windows.Forms.TextBox();
|
||||
this.labelTime = new System.Windows.Forms.Label();
|
||||
this.labelAddress = new System.Windows.Forms.Label();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnManufactureName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.labelShop = new System.Windows.Forms.Label();
|
||||
this.textBoxShop = new System.Windows.Forms.TextBox();
|
||||
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
textBoxAddress = new TextBox();
|
||||
labelTime = new Label();
|
||||
labelAddress = new Label();
|
||||
dataGridView = new DataGridView();
|
||||
ColumnID = new DataGridViewTextBoxColumn();
|
||||
ColumnManufactureName = new DataGridViewTextBoxColumn();
|
||||
ColumnCount = new DataGridViewTextBoxColumn();
|
||||
labelShop = new Label();
|
||||
textBoxShop = new TextBox();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
numericUpDownCapacity = new NumericUpDown();
|
||||
label1 = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonSave.Location = new System.Drawing.Point(521, 503);
|
||||
this.buttonSave.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(171, 37);
|
||||
this.buttonSave.TabIndex = 17;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(578, 302);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(120, 22);
|
||||
buttonSave.TabIndex = 17;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonCancel.Location = new System.Drawing.Point(700, 503);
|
||||
this.buttonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(147, 38);
|
||||
this.buttonCancel.TabIndex = 16;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(703, 302);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(103, 23);
|
||||
buttonCancel.TabIndex = 16;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// textBoxAddress
|
||||
//
|
||||
this.textBoxAddress.Location = new System.Drawing.Point(227, 45);
|
||||
this.textBoxAddress.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.textBoxAddress.Name = "textBoxAddress";
|
||||
this.textBoxAddress.Size = new System.Drawing.Size(314, 31);
|
||||
this.textBoxAddress.TabIndex = 14;
|
||||
textBoxAddress.Location = new Point(159, 27);
|
||||
textBoxAddress.Name = "textBoxAddress";
|
||||
textBoxAddress.Size = new Size(221, 23);
|
||||
textBoxAddress.TabIndex = 14;
|
||||
//
|
||||
// labelTime
|
||||
//
|
||||
this.labelTime.AutoSize = true;
|
||||
this.labelTime.Location = new System.Drawing.Point(551, 15);
|
||||
this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.labelTime.Name = "labelTime";
|
||||
this.labelTime.Size = new System.Drawing.Size(131, 25);
|
||||
this.labelTime.TabIndex = 13;
|
||||
this.labelTime.Text = "Дата открытия";
|
||||
labelTime.AutoSize = true;
|
||||
labelTime.Location = new Point(386, 9);
|
||||
labelTime.Name = "labelTime";
|
||||
labelTime.Size = new Size(87, 15);
|
||||
labelTime.TabIndex = 13;
|
||||
labelTime.Text = "Дата открытия";
|
||||
//
|
||||
// labelAddress
|
||||
//
|
||||
this.labelAddress.AutoSize = true;
|
||||
this.labelAddress.Location = new System.Drawing.Point(227, 15);
|
||||
this.labelAddress.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.labelAddress.Name = "labelAddress";
|
||||
this.labelAddress.Size = new System.Drawing.Size(62, 25);
|
||||
this.labelAddress.TabIndex = 12;
|
||||
this.labelAddress.Text = "Адрес";
|
||||
labelAddress.AutoSize = true;
|
||||
labelAddress.Location = new Point(159, 9);
|
||||
labelAddress.Name = "labelAddress";
|
||||
labelAddress.Size = new Size(40, 15);
|
||||
labelAddress.TabIndex = 12;
|
||||
labelAddress.Text = "Адрес";
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ColumnID,
|
||||
this.ColumnManufactureName,
|
||||
this.ColumnCount});
|
||||
this.dataGridView.Location = new System.Drawing.Point(17, 93);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 62;
|
||||
this.dataGridView.RowTemplate.Height = 25;
|
||||
this.dataGridView.Size = new System.Drawing.Size(830, 400);
|
||||
this.dataGridView.TabIndex = 11;
|
||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnID, ColumnManufactureName, ColumnCount });
|
||||
dataGridView.Location = new Point(12, 56);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(794, 240);
|
||||
dataGridView.TabIndex = 11;
|
||||
//
|
||||
// ColumnID
|
||||
//
|
||||
this.ColumnID.HeaderText = "ID";
|
||||
this.ColumnID.MinimumWidth = 8;
|
||||
this.ColumnID.Name = "ColumnID";
|
||||
this.ColumnID.Visible = false;
|
||||
this.ColumnID.Width = 150;
|
||||
ColumnID.HeaderText = "ID";
|
||||
ColumnID.MinimumWidth = 8;
|
||||
ColumnID.Name = "ColumnID";
|
||||
ColumnID.Visible = false;
|
||||
ColumnID.Width = 150;
|
||||
//
|
||||
// ColumnManufactureName
|
||||
//
|
||||
this.ColumnManufactureName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.ColumnManufactureName.HeaderText = "Поездка";
|
||||
this.ColumnManufactureName.MinimumWidth = 8;
|
||||
this.ColumnManufactureName.Name = "ColumnManufactureName";
|
||||
ColumnManufactureName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
ColumnManufactureName.HeaderText = "Поездка";
|
||||
ColumnManufactureName.MinimumWidth = 8;
|
||||
ColumnManufactureName.Name = "ColumnManufactureName";
|
||||
//
|
||||
// ColumnCount
|
||||
//
|
||||
this.ColumnCount.HeaderText = "Количество";
|
||||
this.ColumnCount.MinimumWidth = 8;
|
||||
this.ColumnCount.Name = "ColumnCount";
|
||||
this.ColumnCount.Width = 150;
|
||||
ColumnCount.HeaderText = "Количество";
|
||||
ColumnCount.MinimumWidth = 8;
|
||||
ColumnCount.Name = "ColumnCount";
|
||||
ColumnCount.Width = 150;
|
||||
//
|
||||
// labelShop
|
||||
//
|
||||
this.labelShop.AutoSize = true;
|
||||
this.labelShop.Location = new System.Drawing.Point(17, 15);
|
||||
this.labelShop.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.labelShop.Name = "labelShop";
|
||||
this.labelShop.Size = new System.Drawing.Size(81, 25);
|
||||
this.labelShop.TabIndex = 9;
|
||||
this.labelShop.Text = "Магазин";
|
||||
labelShop.AutoSize = true;
|
||||
labelShop.Location = new Point(12, 9);
|
||||
labelShop.Name = "labelShop";
|
||||
labelShop.Size = new Size(54, 15);
|
||||
labelShop.TabIndex = 9;
|
||||
labelShop.Text = "Магазин";
|
||||
//
|
||||
// textBoxShop
|
||||
//
|
||||
this.textBoxShop.Location = new System.Drawing.Point(17, 45);
|
||||
this.textBoxShop.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.textBoxShop.Name = "textBoxShop";
|
||||
this.textBoxShop.Size = new System.Drawing.Size(200, 31);
|
||||
this.textBoxShop.TabIndex = 18;
|
||||
textBoxShop.Location = new Point(12, 27);
|
||||
textBoxShop.Name = "textBoxShop";
|
||||
textBoxShop.Size = new Size(141, 23);
|
||||
textBoxShop.TabIndex = 18;
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
this.dateTimePicker.Location = new System.Drawing.Point(551, 45);
|
||||
this.dateTimePicker.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.dateTimePicker.Name = "dateTimePicker";
|
||||
this.dateTimePicker.Size = new System.Drawing.Size(294, 31);
|
||||
this.dateTimePicker.TabIndex = 19;
|
||||
dateTimePicker.Location = new Point(386, 27);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(207, 23);
|
||||
dateTimePicker.TabIndex = 19;
|
||||
//
|
||||
// numericUpDownCapacity
|
||||
//
|
||||
numericUpDownCapacity.Location = new Point(599, 27);
|
||||
numericUpDownCapacity.Name = "numericUpDownCapacity";
|
||||
numericUpDownCapacity.Size = new Size(207, 23);
|
||||
numericUpDownCapacity.TabIndex = 20;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(599, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(80, 15);
|
||||
label1.TabIndex = 21;
|
||||
label1.Text = "Вместимость";
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(864, 562);
|
||||
this.Controls.Add(this.dateTimePicker);
|
||||
this.Controls.Add(this.textBoxShop);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.textBoxAddress);
|
||||
this.Controls.Add(this.labelTime);
|
||||
this.Controls.Add(this.labelAddress);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.labelShop);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "FormShop";
|
||||
this.Text = "Магазин";
|
||||
this.Load += new System.EventHandler(this.FormShop_Load);
|
||||
this.Click += new System.EventHandler(this.FormShop_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(818, 337);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(numericUpDownCapacity);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(textBoxShop);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxAddress);
|
||||
Controls.Add(labelTime);
|
||||
Controls.Add(labelAddress);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(labelShop);
|
||||
Name = "FormShop";
|
||||
Text = "Магазин";
|
||||
Load += FormShop_Load;
|
||||
Click += FormShop_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -200,5 +206,7 @@
|
||||
private DataGridViewTextBoxColumn ColumnID;
|
||||
private DataGridViewTextBoxColumn ColumnManufactureName;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
private NumericUpDown numericUpDownCapacity;
|
||||
private Label label1;
|
||||
}
|
||||
}
|
@ -46,6 +46,7 @@ namespace BlacksmithWorkshopView
|
||||
textBoxShop.Text = view.ShopName;
|
||||
textBoxAddress.Text = view.Address;
|
||||
dateTimePicker.Text = view.DateOpening.ToString();
|
||||
numericUpDownCapacity.Value = view.Capacity;
|
||||
_shopListManufacture = view.ListManufacture ?? new Dictionary<int, (IManufactureModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
@ -91,6 +92,11 @@ namespace BlacksmithWorkshopView
|
||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (numericUpDownCapacity.Value <= 0)
|
||||
{
|
||||
MessageBox.Show("Вместимость должна быть больше нуля", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение магазина");
|
||||
try
|
||||
{
|
||||
@ -99,7 +105,9 @@ namespace BlacksmithWorkshopView
|
||||
Id = _id ?? 0,
|
||||
ShopName = textBoxShop.Text,
|
||||
Address = textBoxAddress.Text,
|
||||
DateOpening = dateTimePicker.Value.Date
|
||||
DateOpening = dateTimePicker.Value.Date,
|
||||
Capacity = (int)numericUpDownCapacity.Value,
|
||||
ListManufacture = _shopListManufacture
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
|
@ -1,64 +1,4 @@
|
||||
<?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.
|
||||
-->
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
@ -53,6 +53,7 @@ namespace BlacksmithWorkshopView
|
||||
services.AddTransient<FormShopManufacture>();
|
||||
services.AddTransient<FormShops>();
|
||||
services.AddTransient<FormShop>();
|
||||
services.AddTransient<FormSellManufacture>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user