крякнул, плюнул и надежно склеил скотчем
This commit is contained in:
parent
50958317dd
commit
49c8023f82
@ -4,6 +4,7 @@ using JewelryStoreContracts.SearchModels;
|
|||||||
using JewelryStoreContracts.StoragesContracts;
|
using JewelryStoreContracts.StoragesContracts;
|
||||||
using JewelryStoreContracts.ViewModels;
|
using JewelryStoreContracts.ViewModels;
|
||||||
using JewerlyStoreDataModels.Enums;
|
using JewerlyStoreDataModels.Enums;
|
||||||
|
using JewerlyStoreDataModels.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -18,11 +19,17 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
private readonly IShopStorage _shopStorage;
|
||||||
|
private readonly IShopLogic _shopLogic;
|
||||||
|
private readonly IJewelStorage _jewelStorage;
|
||||||
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IJewelStorage jewelStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
|
_shopStorage = shopStorage;
|
||||||
|
_shopLogic = shopLogic;
|
||||||
|
_jewelStorage = jewelStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
public bool CreateOrder(OrderBindingModel model)
|
||||||
@ -87,6 +94,17 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
|||||||
throw new InvalidOperationException("Заказ должен быть переведен в статус выполнения перед готовностью!");
|
throw new InvalidOperationException("Заказ должен быть переведен в статус выполнения перед готовностью!");
|
||||||
}
|
}
|
||||||
model.Status = OrderStatus.Готов;
|
model.Status = OrderStatus.Готов;
|
||||||
|
var jewel = _jewelStorage.GetElement(new JewelSearchModel() { Id = model.JewelId });
|
||||||
|
if (jewel == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Status change error. Jewel not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!CheckSupply(jewel, model.Count))
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Status change error. Shop doesnt have jeweles");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_orderStorage.Update(model);
|
_orderStorage.Update(model);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -132,5 +150,65 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
|||||||
throw new InvalidOperationException("Заказ с таким ID уже существует");
|
throw new InvalidOperationException("Заказ с таким ID уже существует");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CheckSupply(IJewelModel jewel, int count)
|
||||||
|
{
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Check supply operation error. Jewel count < 0");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int Capacity = _shopStorage.GetFullList().Select(x => x.MaxCountJewels).Sum();
|
||||||
|
int currentCount = _shopStorage.GetFullList().Select(x => x.ShopJewels.Select(y => y.Value.Item2).Sum()).Sum();
|
||||||
|
int freeSpace = Capacity - currentCount;
|
||||||
|
|
||||||
|
if (freeSpace < count)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Check supply error. No place for new Jewels");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
foreach (var shop in _shopStorage.GetFullList())
|
||||||
|
{
|
||||||
|
freeSpace = shop.MaxCountJewels;
|
||||||
|
foreach (var doc in shop.ShopJewels)
|
||||||
|
{
|
||||||
|
freeSpace -= doc.Value.Item2;
|
||||||
|
}
|
||||||
|
if (freeSpace == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (freeSpace >= count)
|
||||||
|
{
|
||||||
|
if (_shopLogic.AddJewel(new()
|
||||||
|
{
|
||||||
|
Id = shop.Id
|
||||||
|
}, jewel, count))
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Supply error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_shopLogic.AddJewel(new() { Id = shop.Id }, jewel, freeSpace))
|
||||||
|
count -= freeSpace;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Supply error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,9 +144,15 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
|||||||
Address = element.Address,
|
Address = element.Address,
|
||||||
ShopName = element.ShopName,
|
ShopName = element.ShopName,
|
||||||
DateOpen = element.DateOpen,
|
DateOpen = element.DateOpen,
|
||||||
|
MaxCountJewels = element.MaxCountJewels,
|
||||||
ShopJewels = element.ShopJewels
|
ShopJewels = element.ShopJewels
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SellJewels(IJewelModel jewel, int count)
|
||||||
|
{
|
||||||
|
return _shopStorage.SellJewels(jewel, count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace JewelryStoreContracts.BindingModels
|
|||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
public DateTime DateOpen { get; set; } = DateTime.Now;
|
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||||
public Dictionary<int, (IJewelModel, int)> ShopJewels { get; set; } = new();
|
public Dictionary<int, (IJewelModel, int)> ShopJewels { get; set; } = new();
|
||||||
|
public int MaxCountJewels { get; set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace JewelryStoreContracts.BusinessLogicsContracts
|
|||||||
bool Update(ShopBindingModel model);
|
bool Update(ShopBindingModel model);
|
||||||
bool Delete(ShopBindingModel model);
|
bool Delete(ShopBindingModel model);
|
||||||
bool AddJewel(ShopSearchModel model, IJewelModel Jewel, int count);
|
bool AddJewel(ShopSearchModel model, IJewelModel Jewel, int count);
|
||||||
|
bool SellJewels(IJewelModel model, int count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
using JewelryStoreContracts.BindingModels;
|
||||||
using JewelryStoreContracts.SearchModels;
|
using JewelryStoreContracts.SearchModels;
|
||||||
using JewelryStoreContracts.ViewModels;
|
using JewelryStoreContracts.ViewModels;
|
||||||
|
using JewerlyStoreDataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -17,5 +18,6 @@ namespace JewelryStoreContracts.StoragesContracts
|
|||||||
ShopViewModel? Insert(ShopBindingModel model);
|
ShopViewModel? Insert(ShopBindingModel model);
|
||||||
ShopViewModel? Update(ShopBindingModel model);
|
ShopViewModel? Update(ShopBindingModel model);
|
||||||
ShopViewModel? Delete(ShopBindingModel model);
|
ShopViewModel? Delete(ShopBindingModel model);
|
||||||
|
bool SellJewels(IJewelModel model, int count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ namespace JewelryStoreContracts.ViewModels
|
|||||||
|
|
||||||
[DisplayName("Дата открытия")]
|
[DisplayName("Дата открытия")]
|
||||||
public DateTime DateOpen { get; set; } = DateTime.Now;
|
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||||
|
[DisplayName("Макс. кол-во изделий")]
|
||||||
|
public int MaxCountJewels { get; set; }
|
||||||
public Dictionary<int, (IJewelModel, int)> ShopJewels { get; set; } = new();
|
public Dictionary<int, (IJewelModel, int)> ShopJewels { get; set; } = new();
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using JewelryStoreContracts.SearchModels;
|
|||||||
using JewelryStoreContracts.StoragesContracts;
|
using JewelryStoreContracts.StoragesContracts;
|
||||||
using JewelryStoreContracts.ViewModels;
|
using JewelryStoreContracts.ViewModels;
|
||||||
using JewelryStoreListImplement.Models;
|
using JewelryStoreListImplement.Models;
|
||||||
|
using JewerlyStoreDataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -108,5 +109,10 @@ namespace JewelryStoreListImplement.Implements
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SellJewels (IJewelModel jewel, int count)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ namespace JewelryStoreListImplement.Models
|
|||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
public DateTime DateOpen { get; set; }
|
public DateTime DateOpen { get; set; }
|
||||||
|
public int MaxCountJewels { get; private set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Dictionary<int, (IJewelModel, int)> ShopJewels { get; private set; } = new Dictionary<int, (IJewelModel, int)>();
|
public Dictionary<int, (IJewelModel, int)> ShopJewels { get; private set; } = new Dictionary<int, (IJewelModel, int)>();
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ namespace JewelryStoreListImplement.Models
|
|||||||
ShopName = model.ShopName,
|
ShopName = model.ShopName,
|
||||||
Address = model.Address,
|
Address = model.Address,
|
||||||
DateOpen = model.DateOpen,
|
DateOpen = model.DateOpen,
|
||||||
|
MaxCountJewels = model.MaxCountJewels,
|
||||||
ShopJewels = model.ShopJewels
|
ShopJewels = model.ShopJewels
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -44,6 +46,7 @@ namespace JewelryStoreListImplement.Models
|
|||||||
ShopName = model.ShopName;
|
ShopName = model.ShopName;
|
||||||
Address = model.Address;
|
Address = model.Address;
|
||||||
DateOpen = model.DateOpen;
|
DateOpen = model.DateOpen;
|
||||||
|
MaxCountJewels = model.MaxCountJewels;
|
||||||
ShopJewels = model.ShopJewels;
|
ShopJewels = model.ShopJewels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +56,8 @@ namespace JewelryStoreListImplement.Models
|
|||||||
ShopName = ShopName,
|
ShopName = ShopName,
|
||||||
Address = Address,
|
Address = Address,
|
||||||
DateOpen = DateOpen,
|
DateOpen = DateOpen,
|
||||||
ShopJewels = ShopJewels
|
ShopJewels = ShopJewels,
|
||||||
|
MaxCountJewels = MaxCountJewels
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ namespace JewerlyStoreDataModels.Models
|
|||||||
string ShopName { get; }
|
string ShopName { get; }
|
||||||
string Address { get; }
|
string Address { get; }
|
||||||
DateTime DateOpen { get; }
|
DateTime DateOpen { get; }
|
||||||
|
int MaxCountJewels { get; }
|
||||||
Dictionary<int, (IJewelModel, int)> ShopJewels { get; }
|
Dictionary<int, (IJewelModel, int)> ShopJewels { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,11 @@ namespace JewerlyStoreFileImplement
|
|||||||
private readonly string ComponentFileName = "Component.xml";
|
private readonly string ComponentFileName = "Component.xml";
|
||||||
private readonly string OrderFileName = "Order.xml";
|
private readonly string OrderFileName = "Order.xml";
|
||||||
private readonly string JewelFileName = "Jewel.xml";
|
private readonly string JewelFileName = "Jewel.xml";
|
||||||
|
private readonly string ShopFileName = "Shop.xml";
|
||||||
public List<Component> Components { get; private set; }
|
public List<Component> Components { get; private set; }
|
||||||
public List<Order> Orders { get; private set; }
|
public List<Order> Orders { get; private set; }
|
||||||
public List<Jewel> Jewels { get; private set; }
|
public List<Jewel> Jewels { get; private set; }
|
||||||
|
public List<Shop> Shops { get; private set; }
|
||||||
|
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
@ -34,11 +36,14 @@ namespace JewerlyStoreFileImplement
|
|||||||
|
|
||||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||||
|
|
||||||
|
public void SaveShops() => SaveData(Shops, OrderFileName, "Shops", x => x.GetXElement);
|
||||||
|
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||||
Jewels = LoadData(JewelFileName, "Jewel", x => Jewel.Create(x)!)!;
|
Jewels = LoadData(JewelFileName, "Jewel", x => Jewel.Create(x)!)!;
|
||||||
Orders = LoadData(OrderFileName, "Order", x => Order.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)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
|
134
JewelryStore/JewerlyStoreFileImplement/Implements/ShopStorage.cs
Normal file
134
JewelryStore/JewerlyStoreFileImplement/Implements/ShopStorage.cs
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
using JewelryStoreContracts.BindingModels;
|
||||||
|
using JewelryStoreContracts.SearchModels;
|
||||||
|
using JewelryStoreContracts.StoragesContracts;
|
||||||
|
using JewelryStoreContracts.ViewModels;
|
||||||
|
using JewerlyStoreDataModels.Models;
|
||||||
|
using JewerlyStoreFileImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JewerlyStoreFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class ShopStorage : IShopStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
public ShopStorage()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return source.Shops.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return source.Shops
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.Where(x => x.ShopName.Contains(model.ShopName ?? string.Empty))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ShopViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return source.Shops.Select(shop => shop.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 shop = source.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (shop == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
source.Shops.Remove(shop);
|
||||||
|
source.SaveShops();
|
||||||
|
return shop.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SellJewels(IJewelModel model, int count)
|
||||||
|
{
|
||||||
|
var jewel = source.Jewels.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
|
||||||
|
if (jewel == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int countStore = source.Shops
|
||||||
|
.SelectMany(x => x.ShopJewels)
|
||||||
|
.Where(y => y.Key == model.Id)
|
||||||
|
.Sum(y => y.Value.Item2);
|
||||||
|
|
||||||
|
if (count > countStore)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
foreach (var shop in source.Shops)
|
||||||
|
{
|
||||||
|
var jewels = shop.ShopJewels;
|
||||||
|
|
||||||
|
foreach (var c in jewels.Where(x => x.Value.Item1.Id == jewel.Id))
|
||||||
|
{
|
||||||
|
int min = Math.Min(c.Value.Item2, count);
|
||||||
|
jewels[c.Value.Item1.Id] = (c.Value.Item1, c.Value.Item2 - min);
|
||||||
|
count -= min;
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
shop.Update(new ShopBindingModel
|
||||||
|
{
|
||||||
|
Id = shop.Id,
|
||||||
|
ShopName = shop.ShopName,
|
||||||
|
Address = shop.Address,
|
||||||
|
MaxCountJewels = shop.MaxCountJewels,
|
||||||
|
DateOpen = shop.DateOpen,
|
||||||
|
ShopJewels = jewels
|
||||||
|
});
|
||||||
|
|
||||||
|
source.SaveShops();
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
116
JewelryStore/JewerlyStoreFileImplement/Models/Shop.cs
Normal file
116
JewelryStore/JewerlyStoreFileImplement/Models/Shop.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using JewelryStoreContracts.BindingModels;
|
||||||
|
using JewelryStoreContracts.ViewModels;
|
||||||
|
using JewerlyStoreDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace JewerlyStoreFileImplement.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 int MaxCountJewels { get; private set; }
|
||||||
|
public DateTime DateOpen { get; private set; }
|
||||||
|
public Dictionary<int, int> Jewels { get; private set; } = new();
|
||||||
|
private Dictionary<int, (IJewelModel, int)>? _shopJewels = null;
|
||||||
|
|
||||||
|
public Dictionary<int, (IJewelModel, int)> ShopJewels
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_shopJewels == null)
|
||||||
|
{
|
||||||
|
var source = DataFileSingleton.GetInstance();
|
||||||
|
_shopJewels = Jewels.ToDictionary(
|
||||||
|
x => x.Key,
|
||||||
|
y => ((source.Jewels.FirstOrDefault(z => z.Id == y.Key) as IJewelModel)!, y.Value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return _shopJewels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Shop? Create(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ShopName = model.ShopName,
|
||||||
|
Address = model.Address,
|
||||||
|
MaxCountJewels = model.MaxCountJewels,
|
||||||
|
DateOpen = model.DateOpen,
|
||||||
|
Jewels = model.ShopJewels.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,
|
||||||
|
MaxCountJewels = Convert.ToInt32(element.Element("MaxCountJewels")!.Value),
|
||||||
|
DateOpen = Convert.ToDateTime(element.Element("DateOpen")!.Value),
|
||||||
|
Jewels = element.Element("ShopJewels")!.Elements("ShopJewel").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;
|
||||||
|
MaxCountJewels = model.MaxCountJewels;
|
||||||
|
DateOpen = model.DateOpen;
|
||||||
|
if (model.ShopJewels.Count > 0)
|
||||||
|
{
|
||||||
|
Jewels = model.ShopJewels.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||||
|
_shopJewels = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ShopViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ShopName = ShopName,
|
||||||
|
Address = Address,
|
||||||
|
MaxCountJewels = MaxCountJewels,
|
||||||
|
DateOpen = DateOpen,
|
||||||
|
ShopJewels = ShopJewels,
|
||||||
|
};
|
||||||
|
|
||||||
|
public XElement GetXElement => new(
|
||||||
|
"Shop",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("ShopName", ShopName),
|
||||||
|
new XElement("Address", Address),
|
||||||
|
new XElement("MaxCountJewels", MaxCountJewels),
|
||||||
|
new XElement("DateOpening", DateOpen.ToString()),
|
||||||
|
new XElement("ShopJewels", Jewels.Select(x =>
|
||||||
|
new XElement("ShopJewel",
|
||||||
|
new XElement("Key", x.Key),
|
||||||
|
new XElement("Value", x.Value)))
|
||||||
|
.ToArray()));
|
||||||
|
}
|
||||||
|
}
|
183
JewelryStore/JewerlyStoreView/FormMain.Designer.cs
generated
183
JewelryStore/JewerlyStoreView/FormMain.Designer.cs
generated
@ -1,4 +1,4 @@
|
|||||||
namespace JewelryStoreView
|
namespace JewerlyStoreView
|
||||||
{
|
{
|
||||||
partial class FormMain
|
partial class FormMain
|
||||||
{
|
{
|
||||||
@ -28,44 +28,37 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
dataGridView = new DataGridView();
|
menuStrip = new MenuStrip();
|
||||||
menuStripMain = new MenuStrip();
|
|
||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
изделияToolStripMenuItem = new ToolStripMenuItem();
|
изделиеToolStripMenuItem = new ToolStripMenuItem();
|
||||||
магазинToolStripMenuItem = new ToolStripMenuItem();
|
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
пополнениеМагазинаToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
продажаИзделийToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
buttonCreateOrder = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonTakeOrderInWork = new Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
buttonOrderReady = new Button();
|
buttonOrderReady = new Button();
|
||||||
buttonIssuedOrder = new Button();
|
buttonIssuedOrder = new Button();
|
||||||
buttonRefresh = new Button();
|
buttonUpd = new Button();
|
||||||
buttonAddJewel = new Button();
|
menuStrip.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
menuStripMain.SuspendLayout();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// dataGridView
|
// menuStrip
|
||||||
//
|
//
|
||||||
dataGridView.BackgroundColor = SystemColors.Control;
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, пополнениеМагазинаToolStripMenuItem, продажаИзделийToolStripMenuItem });
|
||||||
dataGridView.Location = new Point(12, 31);
|
menuStrip.Location = new Point(0, 0);
|
||||||
dataGridView.Name = "dataGridView";
|
menuStrip.Name = "menuStrip";
|
||||||
dataGridView.RowTemplate.Height = 25;
|
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||||
dataGridView.Size = new Size(762, 407);
|
menuStrip.Size = new Size(1003, 24);
|
||||||
dataGridView.TabIndex = 0;
|
menuStrip.TabIndex = 0;
|
||||||
//
|
menuStrip.Text = "menuStrip1";
|
||||||
// menuStripMain
|
|
||||||
//
|
|
||||||
menuStripMain.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
|
|
||||||
menuStripMain.Location = new Point(0, 0);
|
|
||||||
menuStripMain.Name = "menuStripMain";
|
|
||||||
menuStripMain.Size = new Size(1021, 24);
|
|
||||||
menuStripMain.TabIndex = 2;
|
|
||||||
menuStripMain.Text = "menuStripMain";
|
|
||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, магазинToolStripMenuItem });
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделиеToolStripMenuItem, магазиныToolStripMenuItem });
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
@ -75,124 +68,142 @@
|
|||||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
компонентыToolStripMenuItem.Size = new Size(145, 22);
|
компонентыToolStripMenuItem.Size = new Size(145, 22);
|
||||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click_1;
|
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// изделияToolStripMenuItem
|
// изделиеToolStripMenuItem
|
||||||
//
|
//
|
||||||
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
изделиеToolStripMenuItem.Name = "изделиеToolStripMenuItem";
|
||||||
изделияToolStripMenuItem.Size = new Size(145, 22);
|
изделиеToolStripMenuItem.Size = new Size(145, 22);
|
||||||
изделияToolStripMenuItem.Text = "Изделия";
|
изделиеToolStripMenuItem.Text = "Изделие";
|
||||||
изделияToolStripMenuItem.Click += изделияToolStripMenuItem_Click;
|
изделиеToolStripMenuItem.Click += ЗакускаToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// магазинToolStripMenuItem
|
// магазиныToolStripMenuItem
|
||||||
//
|
//
|
||||||
магазинToolStripMenuItem.Name = "магазинToolStripMenuItem";
|
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
магазинToolStripMenuItem.Size = new Size(145, 22);
|
магазиныToolStripMenuItem.Size = new Size(145, 22);
|
||||||
магазинToolStripMenuItem.Text = "Магазины";
|
магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
магазинToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// пополнениеМагазинаToolStripMenuItem
|
||||||
|
//
|
||||||
|
пополнениеМагазинаToolStripMenuItem.Name = "пополнениеМагазинаToolStripMenuItem";
|
||||||
|
пополнениеМагазинаToolStripMenuItem.Size = new Size(143, 20);
|
||||||
|
пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина";
|
||||||
|
пополнениеМагазинаToolStripMenuItem.Click += ПополнениеМагазиныToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// продажаИзделийToolStripMenuItem
|
||||||
|
//
|
||||||
|
продажаИзделийToolStripMenuItem.Name = "продажаИзделийToolStripMenuItem";
|
||||||
|
продажаИзделийToolStripMenuItem.Size = new Size(117, 20);
|
||||||
|
продажаИзделийToolStripMenuItem.Text = "Продажа изделий";
|
||||||
|
продажаИзделийToolStripMenuItem.Click += sellJewelsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(10, 23);
|
||||||
|
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(802, 305);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
buttonCreateOrder.Location = new Point(836, 31);
|
buttonCreateOrder.Location = new Point(817, 44);
|
||||||
buttonCreateOrder.Margin = new Padding(2);
|
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonCreateOrder.Size = new Size(147, 34);
|
buttonCreateOrder.Size = new Size(175, 28);
|
||||||
buttonCreateOrder.TabIndex = 3;
|
buttonCreateOrder.TabIndex = 2;
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||||
//
|
//
|
||||||
// buttonTakeOrderInWork
|
// buttonTakeOrderInWork
|
||||||
//
|
//
|
||||||
buttonTakeOrderInWork.Location = new Point(836, 81);
|
buttonTakeOrderInWork.Location = new Point(817, 84);
|
||||||
buttonTakeOrderInWork.Margin = new Padding(2);
|
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
buttonTakeOrderInWork.Size = new Size(147, 36);
|
buttonTakeOrderInWork.Size = new Size(175, 28);
|
||||||
buttonTakeOrderInWork.TabIndex = 4;
|
buttonTakeOrderInWork.TabIndex = 3;
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||||
//
|
//
|
||||||
// buttonOrderReady
|
// buttonOrderReady
|
||||||
//
|
//
|
||||||
buttonOrderReady.Location = new Point(836, 132);
|
buttonOrderReady.Location = new Point(817, 124);
|
||||||
buttonOrderReady.Margin = new Padding(2);
|
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
buttonOrderReady.Size = new Size(147, 34);
|
buttonOrderReady.Size = new Size(175, 28);
|
||||||
buttonOrderReady.TabIndex = 5;
|
buttonOrderReady.TabIndex = 4;
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
buttonOrderReady.Text = "Заказ готов";
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||||
//
|
//
|
||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
buttonIssuedOrder.Location = new Point(836, 183);
|
buttonIssuedOrder.Location = new Point(817, 166);
|
||||||
buttonIssuedOrder.Margin = new Padding(2);
|
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonIssuedOrder.Size = new Size(147, 35);
|
buttonIssuedOrder.Size = new Size(175, 28);
|
||||||
buttonIssuedOrder.TabIndex = 6;
|
buttonIssuedOrder.TabIndex = 5;
|
||||||
buttonIssuedOrder.Text = "Заказ выдан";
|
buttonIssuedOrder.Text = "Заказ выдан";
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||||
//
|
//
|
||||||
// buttonRefresh
|
// buttonUpd
|
||||||
//
|
//
|
||||||
buttonRefresh.Location = new Point(836, 234);
|
buttonUpd.Location = new Point(817, 208);
|
||||||
buttonRefresh.Margin = new Padding(2);
|
buttonUpd.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonUpd.Name = "buttonUpd";
|
||||||
buttonRefresh.Size = new Size(147, 39);
|
buttonUpd.Size = new Size(175, 28);
|
||||||
buttonRefresh.TabIndex = 7;
|
buttonUpd.TabIndex = 6;
|
||||||
buttonRefresh.Text = "Обновить список";
|
buttonUpd.Text = "Обновить список";
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
buttonRefresh.Click += ButtonRefresh_Click;
|
buttonUpd.Click += ButtonUpd_Click;
|
||||||
//
|
|
||||||
// buttonAddJewel
|
|
||||||
//
|
|
||||||
buttonAddJewel.Location = new Point(836, 287);
|
|
||||||
buttonAddJewel.Name = "buttonAddJewel";
|
|
||||||
buttonAddJewel.Size = new Size(147, 35);
|
|
||||||
buttonAddJewel.TabIndex = 8;
|
|
||||||
buttonAddJewel.Text = "Добавить украшение";
|
|
||||||
buttonAddJewel.UseVisualStyleBackColor = true;
|
|
||||||
buttonAddJewel.Click += ButtonAddJewel_Click;
|
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1021, 450);
|
ClientSize = new Size(1003, 338);
|
||||||
Controls.Add(buttonAddJewel);
|
Controls.Add(buttonUpd);
|
||||||
Controls.Add(buttonRefresh);
|
|
||||||
Controls.Add(buttonIssuedOrder);
|
Controls.Add(buttonIssuedOrder);
|
||||||
Controls.Add(buttonOrderReady);
|
Controls.Add(buttonOrderReady);
|
||||||
Controls.Add(buttonTakeOrderInWork);
|
Controls.Add(buttonTakeOrderInWork);
|
||||||
Controls.Add(buttonCreateOrder);
|
Controls.Add(buttonCreateOrder);
|
||||||
Controls.Add(menuStripMain);
|
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
MainMenuStrip = menuStripMain;
|
Controls.Add(menuStrip);
|
||||||
|
MainMenuStrip = menuStrip;
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Ювелирный";
|
Text = "Ювелирный";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
|
menuStrip.ResumeLayout(false);
|
||||||
|
menuStrip.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
menuStripMain.ResumeLayout(false);
|
|
||||||
menuStripMain.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
private MenuStrip menuStrip;
|
||||||
private MenuStrip menuStripMain;
|
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
private DataGridView dataGridView;
|
||||||
private ToolStripMenuItem изделияToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem магазинToolStripMenuItem;
|
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private Button buttonTakeOrderInWork;
|
private Button buttonTakeOrderInWork;
|
||||||
private Button buttonOrderReady;
|
private Button buttonOrderReady;
|
||||||
private Button buttonIssuedOrder;
|
private Button buttonIssuedOrder;
|
||||||
private Button buttonRefresh;
|
private Button buttonUpd;
|
||||||
private Button buttonAddJewel;
|
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem изделиеToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem пополнениеМагазинаToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem продажаИзделийToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
using JewelryStoreContracts.BindingModels;
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||||
|
using JewelryStoreView;
|
||||||
using JewerlyStoreDataModels.Enums;
|
using JewerlyStoreDataModels.Enums;
|
||||||
using JewerlyStoreView;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -13,11 +13,12 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace JewelryStoreView
|
namespace JewerlyStoreView
|
||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||||
@ -41,15 +42,59 @@ namespace JewelryStoreView
|
|||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["JewelId"].Visible = false;
|
dataGridView.Columns["JewelId"].Visible = false;
|
||||||
|
dataGridView.Columns["JewelName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Orders loading");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки заказов");
|
_logger.LogError(ex, "Orders loading error");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void sellJewelsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShopSell));
|
||||||
|
if (service is FormShopSell form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
||||||
|
if (service is FormComponents form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ЗакускаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormJewels));
|
||||||
|
if (service is FormJewels form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||||
|
if (service is FormShops form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ПополнениеМагазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormAddJewel));
|
||||||
|
if (service is FormAddJewel form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -66,18 +111,10 @@ namespace JewelryStoreView
|
|||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
_logger.LogInformation("Order №{id}. Status changes to 'В работе'", id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
var operationResult = _orderLogic.TakeOrderInWork(CreateBindingModel(id));
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
|
||||||
JewelId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["JewelId"].Value),
|
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
@ -86,7 +123,7 @@ namespace JewelryStoreView
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
_logger.LogError(ex, "Error taking an order to work");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,18 +134,10 @@ namespace JewelryStoreView
|
|||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
_logger.LogInformation("Order №{id}. Status changes to 'Готов'", id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
var operationResult = _orderLogic.FinishOrder(CreateBindingModel(id));
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
|
||||||
JewelId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["JewelId"].Value),
|
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
@ -117,8 +146,7 @@ namespace JewelryStoreView
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
_logger.LogError(ex, "Order readiness marking error");
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,72 +157,40 @@ namespace JewelryStoreView
|
|||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
_logger.LogInformation("Order №{id}. Status changes to 'Выдан'", id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
var operationResult = _orderLogic.DeliveryOrder(CreateBindingModel(id));
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
|
||||||
JewelId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["JewelId"].Value),
|
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
_logger.LogInformation("Order №{id} issued", id);
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
_logger.LogError(ex, "Order issue marking error");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
|
||||||
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
private OrderBindingModel CreateBindingModel(int id)
|
||||||
private void компонентыToolStripMenuItem_Click_1(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
return new OrderBindingModel
|
||||||
if (service is FormComponents form)
|
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
Id = id,
|
||||||
}
|
JewelId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["JewelId"].Value),
|
||||||
}
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
private void изделияToolStripMenuItem_Click(object sender, EventArgs e)
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
{
|
DateCreate = (System.DateTime)dataGridView.SelectedRows[0].Cells["DateCreate"].Value,
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormJewels));
|
};
|
||||||
if (service is FormJewels form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
|
||||||
if (service is FormShops form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAddJewel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormAddJewel));
|
|
||||||
if (service is FormAddJewel form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,10 +117,7 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="menuStripMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>40, 22</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>64</value>
|
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
240
JewelryStore/JewerlyStoreView/FormShop.Designer.cs
generated
240
JewelryStore/JewerlyStoreView/FormShop.Designer.cs
generated
@ -28,146 +28,169 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.labelShop = new System.Windows.Forms.Label();
|
labelShop = new Label();
|
||||||
this.labelAddress = new System.Windows.Forms.Label();
|
labelAddress = new Label();
|
||||||
this.labelDate = new System.Windows.Forms.Label();
|
labelDate = new Label();
|
||||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
textBoxName = new TextBox();
|
||||||
this.textBoxAddress = new System.Windows.Forms.TextBox();
|
textBoxAddress = new TextBox();
|
||||||
this.dateTimePickerDateOpen = new System.Windows.Forms.DateTimePicker();
|
dateTimePickerDateOpen = new DateTimePicker();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
dataGridView = new DataGridView();
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
ID = new DataGridViewTextBoxColumn();
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
JewelName = new DataGridViewTextBoxColumn();
|
||||||
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
Count = new DataGridViewTextBoxColumn();
|
||||||
this.JewelName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
ButtonSave = new Button();
|
||||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
ButtonCancel = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
labelMaxCountPrinteds = new Label();
|
||||||
this.SuspendLayout();
|
textBoxMaxCount = new TextBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelShop
|
// labelShop
|
||||||
//
|
//
|
||||||
this.labelShop.AutoSize = true;
|
labelShop.AutoSize = true;
|
||||||
this.labelShop.Location = new System.Drawing.Point(12, 21);
|
labelShop.Location = new Point(10, 16);
|
||||||
this.labelShop.Name = "labelShop";
|
labelShop.Name = "labelShop";
|
||||||
this.labelShop.Size = new System.Drawing.Size(69, 20);
|
labelShop.Size = new Size(54, 15);
|
||||||
this.labelShop.TabIndex = 0;
|
labelShop.TabIndex = 0;
|
||||||
this.labelShop.Text = "Магазин";
|
labelShop.Text = "Магазин";
|
||||||
//
|
//
|
||||||
// labelAddress
|
// labelAddress
|
||||||
//
|
//
|
||||||
this.labelAddress.AutoSize = true;
|
labelAddress.AutoSize = true;
|
||||||
this.labelAddress.Location = new System.Drawing.Point(195, 21);
|
labelAddress.Location = new Point(171, 16);
|
||||||
this.labelAddress.Name = "labelAddress";
|
labelAddress.Name = "labelAddress";
|
||||||
this.labelAddress.Size = new System.Drawing.Size(51, 20);
|
labelAddress.Size = new Size(40, 15);
|
||||||
this.labelAddress.TabIndex = 1;
|
labelAddress.TabIndex = 1;
|
||||||
this.labelAddress.Text = "Адрес";
|
labelAddress.Text = "Адрес";
|
||||||
//
|
//
|
||||||
// labelDate
|
// labelDate
|
||||||
//
|
//
|
||||||
this.labelDate.AutoSize = true;
|
labelDate.AutoSize = true;
|
||||||
this.labelDate.Location = new System.Drawing.Point(474, 21);
|
labelDate.Location = new Point(415, 16);
|
||||||
this.labelDate.Name = "labelDate";
|
labelDate.Name = "labelDate";
|
||||||
this.labelDate.Size = new System.Drawing.Size(110, 20);
|
labelDate.Size = new Size(87, 15);
|
||||||
this.labelDate.TabIndex = 2;
|
labelDate.TabIndex = 2;
|
||||||
this.labelDate.Text = "Дата открытия";
|
labelDate.Text = "Дата открытия";
|
||||||
//
|
//
|
||||||
// textBoxName
|
// textBoxName
|
||||||
//
|
//
|
||||||
this.textBoxName.Location = new System.Drawing.Point(12, 44);
|
textBoxName.Location = new Point(10, 33);
|
||||||
this.textBoxName.Name = "textBoxName";
|
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.textBoxName.Size = new System.Drawing.Size(160, 27);
|
textBoxName.Name = "textBoxName";
|
||||||
this.textBoxName.TabIndex = 3;
|
textBoxName.Size = new Size(140, 23);
|
||||||
|
textBoxName.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// textBoxAddress
|
// textBoxAddress
|
||||||
//
|
//
|
||||||
this.textBoxAddress.Location = new System.Drawing.Point(195, 44);
|
textBoxAddress.Location = new Point(171, 33);
|
||||||
this.textBoxAddress.Name = "textBoxAddress";
|
textBoxAddress.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.textBoxAddress.Size = new System.Drawing.Size(246, 27);
|
textBoxAddress.Name = "textBoxAddress";
|
||||||
this.textBoxAddress.TabIndex = 4;
|
textBoxAddress.Size = new Size(216, 23);
|
||||||
|
textBoxAddress.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// dateTimePickerDateOpen
|
// dateTimePickerDateOpen
|
||||||
//
|
//
|
||||||
this.dateTimePickerDateOpen.Location = new System.Drawing.Point(474, 44);
|
dateTimePickerDateOpen.Location = new Point(415, 33);
|
||||||
this.dateTimePickerDateOpen.Name = "dateTimePickerDateOpen";
|
dateTimePickerDateOpen.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.dateTimePickerDateOpen.Size = new System.Drawing.Size(250, 27);
|
dateTimePickerDateOpen.Name = "dateTimePickerDateOpen";
|
||||||
this.dateTimePickerDateOpen.TabIndex = 5;
|
dateTimePickerDateOpen.Size = new Size(219, 23);
|
||||||
|
dateTimePickerDateOpen.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, JewelName, Count });
|
||||||
this.ID,
|
dataGridView.Location = new Point(10, 105);
|
||||||
this.JewelName,
|
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.Count});
|
dataGridView.Name = "dataGridView";
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 77);
|
dataGridView.RowHeadersWidth = 51;
|
||||||
this.dataGridView.Name = "dataGridView";
|
dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
dataGridView.Size = new Size(623, 248);
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
dataGridView.TabIndex = 6;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(712, 330);
|
|
||||||
this.dataGridView.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(490, 413);
|
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(111, 29);
|
|
||||||
this.ButtonSave.TabIndex = 7;
|
|
||||||
this.ButtonSave.Text = "Сохранить";
|
|
||||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(630, 413);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
|
|
||||||
this.ButtonCancel.TabIndex = 8;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
//
|
||||||
// ID
|
// ID
|
||||||
//
|
//
|
||||||
this.ID.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
ID.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.ID.HeaderText = "ID";
|
ID.HeaderText = "ID";
|
||||||
this.ID.MinimumWidth = 6;
|
ID.MinimumWidth = 6;
|
||||||
this.ID.Name = "ID";
|
ID.Name = "ID";
|
||||||
this.ID.Visible = false;
|
ID.Visible = false;
|
||||||
//
|
//
|
||||||
// JewelName
|
// JewelName
|
||||||
//
|
//
|
||||||
this.JewelName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
JewelName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.JewelName.HeaderText = "JewelName";
|
JewelName.HeaderText = "JewelName";
|
||||||
this.JewelName.MinimumWidth = 6;
|
JewelName.MinimumWidth = 6;
|
||||||
this.JewelName.Name = "JewelName";
|
JewelName.Name = "JewelName";
|
||||||
//
|
//
|
||||||
// Count
|
// Count
|
||||||
//
|
//
|
||||||
this.Count.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
Count.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.Count.HeaderText = "Count";
|
Count.HeaderText = "Count";
|
||||||
this.Count.MinimumWidth = 6;
|
Count.MinimumWidth = 6;
|
||||||
this.Count.Name = "Count";
|
Count.Name = "Count";
|
||||||
|
//
|
||||||
|
// ButtonSave
|
||||||
|
//
|
||||||
|
ButtonSave.Location = new Point(448, 357);
|
||||||
|
ButtonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
ButtonSave.Name = "ButtonSave";
|
||||||
|
ButtonSave.Size = new Size(97, 22);
|
||||||
|
ButtonSave.TabIndex = 7;
|
||||||
|
ButtonSave.Text = "Сохранить";
|
||||||
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
ButtonCancel.Location = new Point(551, 357);
|
||||||
|
ButtonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
|
ButtonCancel.Size = new Size(82, 22);
|
||||||
|
ButtonCancel.TabIndex = 8;
|
||||||
|
ButtonCancel.Text = "Отмена";
|
||||||
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// labelMaxCountPrinteds
|
||||||
|
//
|
||||||
|
labelMaxCountPrinteds.Location = new Point(10, 68);
|
||||||
|
labelMaxCountPrinteds.Name = "labelMaxCountPrinteds";
|
||||||
|
labelMaxCountPrinteds.Size = new Size(140, 30);
|
||||||
|
labelMaxCountPrinteds.TabIndex = 10;
|
||||||
|
labelMaxCountPrinteds.Text = "Максимальное количество изделий :";
|
||||||
|
//
|
||||||
|
// textBoxMaxCount
|
||||||
|
//
|
||||||
|
textBoxMaxCount.Location = new Point(155, 78);
|
||||||
|
textBoxMaxCount.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxMaxCount.Name = "textBoxMaxCount";
|
||||||
|
textBoxMaxCount.Size = new Size(219, 23);
|
||||||
|
textBoxMaxCount.TabIndex = 11;
|
||||||
//
|
//
|
||||||
// FormShop
|
// FormShop
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(740, 450);
|
ClientSize = new Size(659, 426);
|
||||||
this.Controls.Add(this.ButtonCancel);
|
Controls.Add(ButtonCancel);
|
||||||
this.Controls.Add(this.ButtonSave);
|
Controls.Add(ButtonSave);
|
||||||
this.Controls.Add(this.dataGridView);
|
Controls.Add(dataGridView);
|
||||||
this.Controls.Add(this.dateTimePickerDateOpen);
|
Controls.Add(dateTimePickerDateOpen);
|
||||||
this.Controls.Add(this.textBoxAddress);
|
Controls.Add(textBoxAddress);
|
||||||
this.Controls.Add(this.textBoxName);
|
Controls.Add(textBoxName);
|
||||||
this.Controls.Add(this.labelDate);
|
Controls.Add(labelDate);
|
||||||
this.Controls.Add(this.labelAddress);
|
Controls.Add(labelAddress);
|
||||||
this.Controls.Add(this.labelShop);
|
Controls.Add(labelShop);
|
||||||
this.Name = "FormShop";
|
Controls.Add(textBoxMaxCount);
|
||||||
this.Text = "Магазин";
|
Controls.Add(labelMaxCountPrinteds);
|
||||||
this.Load += new System.EventHandler(this.FormShop_Load);
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
Name = "FormShop";
|
||||||
this.ResumeLayout(false);
|
Text = "Магазин";
|
||||||
this.PerformLayout();
|
Load += FormShop_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -175,6 +198,8 @@
|
|||||||
private Label labelShop;
|
private Label labelShop;
|
||||||
private Label labelAddress;
|
private Label labelAddress;
|
||||||
private Label labelDate;
|
private Label labelDate;
|
||||||
|
private Label labelMaxCountPrinteds;
|
||||||
|
private TextBox textBoxMaxCount;
|
||||||
private TextBox textBoxName;
|
private TextBox textBoxName;
|
||||||
private TextBox textBoxAddress;
|
private TextBox textBoxAddress;
|
||||||
private DateTimePicker dateTimePickerDateOpen;
|
private DateTimePicker dateTimePickerDateOpen;
|
||||||
@ -184,5 +209,6 @@
|
|||||||
private DataGridViewTextBoxColumn ID;
|
private DataGridViewTextBoxColumn ID;
|
||||||
private DataGridViewTextBoxColumn JewelName;
|
private DataGridViewTextBoxColumn JewelName;
|
||||||
private DataGridViewTextBoxColumn Count;
|
private DataGridViewTextBoxColumn Count;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,6 +46,7 @@ namespace JewerlyStoreView
|
|||||||
textBoxName.Text = view.ShopName;
|
textBoxName.Text = view.ShopName;
|
||||||
textBoxAddress.Text = view.Address.ToString();
|
textBoxAddress.Text = view.Address.ToString();
|
||||||
dateTimePickerDateOpen.Text = view.DateOpen.ToString();
|
dateTimePickerDateOpen.Text = view.DateOpen.ToString();
|
||||||
|
textBoxMaxCount.Text = view.MaxCountJewels.ToString();
|
||||||
_shopJewels = view.ShopJewels ?? new Dictionary<int, (IJewelModel, int)>();
|
_shopJewels = view.ShopJewels ?? new Dictionary<int, (IJewelModel, int)>();
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
@ -95,6 +96,11 @@ namespace JewerlyStoreView
|
|||||||
MessageBox.Show("Заполните дату", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Заполните дату", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxMaxCount.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните макс. количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_logger.LogInformation("Сохранение магазина");
|
_logger.LogInformation("Сохранение магазина");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -104,6 +110,7 @@ namespace JewerlyStoreView
|
|||||||
ShopName = textBoxName.Text,
|
ShopName = textBoxName.Text,
|
||||||
Address = textBoxAddress.Text,
|
Address = textBoxAddress.Text,
|
||||||
DateOpen = DateTime.Parse(dateTimePickerDateOpen.Text),
|
DateOpen = DateTime.Parse(dateTimePickerDateOpen.Text),
|
||||||
|
MaxCountJewels = Convert.ToInt32(textBoxMaxCount.Text),
|
||||||
ShopJewels = _shopJewels
|
ShopJewels = _shopJewels
|
||||||
};
|
};
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
119
JewelryStore/JewerlyStoreView/FormShopSell.Designer.cs
generated
Normal file
119
JewelryStore/JewerlyStoreView/FormShopSell.Designer.cs
generated
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
namespace JewerlyStoreView
|
||||||
|
{
|
||||||
|
partial class FormShopSell
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
labelJewel = new Label();
|
||||||
|
labelCount = new Label();
|
||||||
|
comboBoxJewel = new ComboBox();
|
||||||
|
textBoxCount = new TextBox();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSell = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelJewel
|
||||||
|
//
|
||||||
|
labelJewel.AutoSize = true;
|
||||||
|
labelJewel.Location = new Point(12, 9);
|
||||||
|
labelJewel.Name = "labelJewel";
|
||||||
|
labelJewel.Size = new Size(56, 15);
|
||||||
|
labelJewel.TabIndex = 0;
|
||||||
|
labelJewel.Text = "Изделие:";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
labelCount.AutoSize = true;
|
||||||
|
labelCount.Location = new Point(12, 38);
|
||||||
|
labelCount.Name = "labelCount";
|
||||||
|
labelCount.Size = new Size(75, 15);
|
||||||
|
labelCount.TabIndex = 1;
|
||||||
|
labelCount.Text = "Количество:";
|
||||||
|
//
|
||||||
|
// comboBoxJewel
|
||||||
|
//
|
||||||
|
comboBoxJewel.FormattingEnabled = true;
|
||||||
|
comboBoxJewel.Location = new Point(88, 6);
|
||||||
|
comboBoxJewel.Name = "comboBoxJewel";
|
||||||
|
comboBoxJewel.Size = new Size(297, 23);
|
||||||
|
comboBoxJewel.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxCount
|
||||||
|
//
|
||||||
|
textBoxCount.Location = new Point(88, 35);
|
||||||
|
textBoxCount.Name = "textBoxCount";
|
||||||
|
textBoxCount.Size = new Size(297, 23);
|
||||||
|
textBoxCount.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(310, 64);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(75, 23);
|
||||||
|
buttonCancel.TabIndex = 4;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSell
|
||||||
|
//
|
||||||
|
buttonSell.Location = new Point(229, 64);
|
||||||
|
buttonSell.Name = "buttonSell";
|
||||||
|
buttonSell.Size = new Size(75, 23);
|
||||||
|
buttonSell.TabIndex = 5;
|
||||||
|
buttonSell.Text = "Продать";
|
||||||
|
buttonSell.UseVisualStyleBackColor = true;
|
||||||
|
buttonSell.Click += buttonSell_Click;
|
||||||
|
//
|
||||||
|
// FormShopSell
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(397, 93);
|
||||||
|
Controls.Add(buttonSell);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(textBoxCount);
|
||||||
|
Controls.Add(comboBoxJewel);
|
||||||
|
Controls.Add(labelCount);
|
||||||
|
Controls.Add(labelJewel);
|
||||||
|
Name = "FormShopSell";
|
||||||
|
Text = "Продажа";
|
||||||
|
Load += FormShopSell_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelJewel;
|
||||||
|
private Label labelCount;
|
||||||
|
private ComboBox comboBoxJewel;
|
||||||
|
private TextBox textBoxCount;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSell;
|
||||||
|
}
|
||||||
|
}
|
95
JewelryStore/JewerlyStoreView/FormShopSell.cs
Normal file
95
JewelryStore/JewerlyStoreView/FormShopSell.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using JewelryStoreContracts.BindingModels;
|
||||||
|
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace JewerlyStoreView
|
||||||
|
{
|
||||||
|
public partial class FormShopSell : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IJewelLogic _logicJewel;
|
||||||
|
private readonly IShopLogic _logicShop;
|
||||||
|
|
||||||
|
public FormShopSell(ILogger<FormShopSell> logger, IJewelLogic logicJewel, IShopLogic logicShop)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logicJewel = logicJewel;
|
||||||
|
_logicShop = logicShop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormShopSell_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка изделий для продажи");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicJewel.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxJewel.DisplayMember = "JewelName";
|
||||||
|
comboBoxJewel.ValueMember = "Id";
|
||||||
|
comboBoxJewel.DataSource = list;
|
||||||
|
comboBoxJewel.SelectedItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка изделий");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSell_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxJewel.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите изделий", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Создание продажи");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicShop.SellJewels(
|
||||||
|
new JewelBindingModel
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxJewel.SelectedValue)
|
||||||
|
},
|
||||||
|
Convert.ToInt32(textBoxCount.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
JewelryStore/JewerlyStoreView/FormShopSell.resx
Normal file
120
JewelryStore/JewerlyStoreView/FormShopSell.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>
|
@ -54,6 +54,7 @@ namespace JewelryStoreView
|
|||||||
services.AddTransient<FormAddJewel>();
|
services.AddTransient<FormAddJewel>();
|
||||||
services.AddTransient<FormShop>();
|
services.AddTransient<FormShop>();
|
||||||
services.AddTransient<FormShops>();
|
services.AddTransient<FormShops>();
|
||||||
|
services.AddTransient<FormShopSell>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user