123
This commit is contained in:
parent
eb0dc366bc
commit
7ac18ed69d
@ -10,6 +10,7 @@ using TypographyContracts.StoragesContracts;
|
|||||||
using TypographyContracts.ViewModels;
|
using TypographyContracts.ViewModels;
|
||||||
using TypographyDataModels.Enums;
|
using TypographyDataModels.Enums;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using TypographyDataModels.Models;
|
||||||
|
|
||||||
namespace TypographyBusinessLogic.BusinessLogics
|
namespace TypographyBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
@ -17,11 +18,17 @@ namespace TypographyBusinessLogic.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 IPrintedStorage _printedStorage;
|
||||||
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IPrintedStorage printedStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
|
_shopStorage = shopStorage;
|
||||||
|
_shopLogic = shopLogic;
|
||||||
|
_printedStorage = printedStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||||
@ -44,11 +51,74 @@ namespace TypographyBusinessLogic.BusinessLogics
|
|||||||
model.Status = OrderStatus.Принят;
|
model.Status = OrderStatus.Принят;
|
||||||
if (_orderStorage.Insert(model) == null)
|
if (_orderStorage.Insert(model) == null)
|
||||||
{
|
{
|
||||||
|
model.Status = OrderStatus.Неизвестен;
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
public bool CheckThenSupplyMany(IPrintedModel car, int count)
|
||||||
|
{
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Check then supply operation error. Printed count < 0.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int freeSpace = 0;
|
||||||
|
foreach (var shop in _shopStorage.GetFullList())
|
||||||
|
{
|
||||||
|
freeSpace += shop.MaxCountPrinteds;
|
||||||
|
foreach (var c in shop.ShopPrinteds)
|
||||||
|
{
|
||||||
|
freeSpace -= c.Value.Item2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (freeSpace < count)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Check then supply operation error. There's no place for new cars in shops.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var shop in _shopStorage.GetFullList())
|
||||||
|
{
|
||||||
|
freeSpace = shop.MaxCountPrinteds;
|
||||||
|
|
||||||
|
foreach (var c in shop.ShopPrinteds)
|
||||||
|
freeSpace -= c.Value.Item2;
|
||||||
|
|
||||||
|
if (freeSpace <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (freeSpace >= count)
|
||||||
|
{
|
||||||
|
if (_shopLogic.MakeShipment(new ShopSearchModel() { Id = shop.Id }, car, count))
|
||||||
|
count = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Supply error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (freeSpace < count)
|
||||||
|
{
|
||||||
|
if (_shopLogic.MakeShipment(new ShopSearchModel() { Id = shop.Id }, car, freeSpace))
|
||||||
|
count -= freeSpace;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Supply error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool ChangeStatus(OrderBindingModel model, OrderStatus status)
|
public bool ChangeStatus(OrderBindingModel model, OrderStatus status)
|
||||||
{
|
{
|
||||||
@ -104,11 +174,11 @@ namespace TypographyBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
if (model.PrintedId < 0)
|
if (model.PrintedId < 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Некорректный идентификатор закусок", nameof(model.PrintedId));
|
throw new ArgumentNullException("Некорректный идентификатор изделий", nameof(model.PrintedId));
|
||||||
}
|
}
|
||||||
if (model.Count <= 0)
|
if (model.Count <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Количество закусок в заказе должно быть больше 0", nameof(model.Count));
|
throw new ArgumentNullException("Количество изделий в заказе должно быть больше 0", nameof(model.Count));
|
||||||
}
|
}
|
||||||
if (model.Sum <= 0)
|
if (model.Sum <= 0)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,6 @@ namespace TypographyBusinessLogic
|
|||||||
public class ShopLogic : IShopLogic
|
public class ShopLogic : IShopLogic
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IShopStorage _shopStorage;
|
private readonly IShopStorage _shopStorage;
|
||||||
|
|
||||||
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage shopStorage)
|
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage shopStorage)
|
||||||
@ -25,117 +24,142 @@ namespace TypographyBusinessLogic
|
|||||||
_shopStorage = shopStorage;
|
_shopStorage = shopStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ShopViewModel>? ReadList(ShopSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ShopName: {ShopName}. Id: {Id}", model?.ShopName, model?.Id);
|
|
||||||
var list = model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? ReadElement(ShopSearchModel model)
|
public ShopViewModel? ReadElement(ShopSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadElement. ShopName: {ShopName}. Id: {Id}", model.ShopName, model.Id);
|
|
||||||
|
_logger.LogInformation("ReadElement. Shop Name:{0}, ID:{1}", model.ShopName, model.Id);
|
||||||
|
|
||||||
var element = _shopStorage.GetElement(model);
|
var element = _shopStorage.GetElement(model);
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadElement element not found");
|
_logger.LogWarning("ReadElement. element not found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadElement find. Id: {Id}", element.Id);
|
|
||||||
|
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ShopViewModel>? ReadList(ShopSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. Shop Name:{0}, ID:{1} ", model?.ShopName, model?.Id);
|
||||||
|
|
||||||
|
var list = (model == null) ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
||||||
|
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MakeShipment(ShopSearchModel model, IPrintedModel printed, int count)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (printed == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(printed));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Count of printeds in supply must be more than 0", nameof(count));
|
||||||
|
}
|
||||||
|
|
||||||
|
var shopElement = _shopStorage.GetElement(model);
|
||||||
|
if (shopElement == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Required shop element not found in storage");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Shop element found. ID: {0}, Name: {1}", shopElement.Id, shopElement.ShopName);
|
||||||
|
|
||||||
|
int countPrinteds = 0;
|
||||||
|
foreach (var c in shopElement.ShopPrinteds)
|
||||||
|
countPrinteds += c.Value.Item2;
|
||||||
|
|
||||||
|
if (count > shopElement.MaxCountPrinteds - countPrinteds)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Required shop will be overflowed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (shopElement.ShopPrinteds.TryGetValue(printed.Id, out var samePrinted))
|
||||||
|
{
|
||||||
|
shopElement.ShopPrinteds[printed.Id] = (printed, samePrinted.Item2 + count);
|
||||||
|
_logger.LogInformation("Same printed found by supply. Added {0} of {1} in {2} shop", count, printed.PrintedName, shopElement.ShopName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shopElement.ShopPrinteds[printed.Id] = (printed, count);
|
||||||
|
_logger.LogInformation("New printed added by supply. Added {0} of {1} in {2} shop", count, printed.PrintedName, shopElement.ShopName);
|
||||||
|
}
|
||||||
|
|
||||||
|
_shopStorage.Update(new()
|
||||||
|
{
|
||||||
|
Id = shopElement.Id,
|
||||||
|
ShopName = shopElement.ShopName,
|
||||||
|
Address = shopElement.Address,
|
||||||
|
MaxCountPrinteds = shopElement.MaxCountPrinteds,
|
||||||
|
DateOpening = shopElement.DateOpening,
|
||||||
|
ShopPrinteds = shopElement.ShopPrinteds
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Create(ShopBindingModel model)
|
public bool Create(ShopBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if (_shopStorage.Insert(model) == null)
|
if (_shopStorage.Insert(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Update(ShopBindingModel model)
|
public bool Update(ShopBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if (_shopStorage.Update(model) == null)
|
if (_shopStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Update operation failed");
|
_logger.LogWarning("Update operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(ShopBindingModel model)
|
public bool Delete(ShopBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
_logger.LogInformation("Delete. Id: {Id}", model.Id);
|
|
||||||
if (_shopStorage.Delete(model) == null)
|
if (_shopStorage.Delete(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Delete operation failed");
|
_logger.LogWarning("Delete operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MakeShipment(ShopSearchModel shopModel, IPrintedModel iceCream, int count)
|
|
||||||
{
|
|
||||||
if (shopModel == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(shopModel));
|
|
||||||
}
|
|
||||||
if (iceCream == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(iceCream));
|
|
||||||
}
|
|
||||||
if (count <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Количество товаров(мороженого) в магазине должно быть больше нуля", nameof(count));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("MakeShipment(GetElement). ShopName: {ShopName}. Id: {Id}", shopModel.ShopName, shopModel.Id);
|
|
||||||
var shop = _shopStorage.GetElement(shopModel);
|
|
||||||
if (shop == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("MakeShipment(GetElement). Element not found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (shop.ShopPrinteds.ContainsKey(iceCream.Id))
|
|
||||||
{
|
|
||||||
var shopIC = shop.ShopPrinteds[iceCream.Id];
|
|
||||||
shopIC.Item2 += count;
|
|
||||||
shop.ShopPrinteds[iceCream.Id] = shopIC;
|
|
||||||
_logger.LogInformation("MakeShipment. Added {count} '{iceCream}' to '{ShopName}' shop", count, iceCream.PrintedName,
|
|
||||||
shop.ShopName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shop.ShopPrinteds.Add(iceCream.Id, (iceCream, count));
|
|
||||||
_logger.LogInformation("MakeShipment. Added {count} new '{iceCream}' to '{ShopName}' shop", count, iceCream.PrintedName,
|
|
||||||
shop.ShopName);
|
|
||||||
}
|
|
||||||
if (_shopStorage.Update(new ShopBindingModel()
|
|
||||||
{
|
|
||||||
Id = shop.Id,
|
|
||||||
ShopName = shop.ShopName,
|
|
||||||
Address = shop.Address,
|
|
||||||
DateOpening = shop.DateOpening,
|
|
||||||
ShopPrinteds = shop.ShopPrinteds,
|
|
||||||
}) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("MakeShipment. Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,27 +169,38 @@ namespace TypographyBusinessLogic
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!withParams)
|
if (!withParams)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.ShopName))
|
if (string.IsNullOrEmpty(model.ShopName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет названия магазина", nameof(model.ShopName));
|
throw new ArgumentNullException("Нет названия магазина!", nameof(model.ShopName));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.Address))
|
|
||||||
|
if (model.MaxCountPrinteds < 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет адреса магазина", nameof(model.Address));
|
throw new InvalidOperationException("Отрицательное максимальное количество авто!");
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Shop. ShopName: {ShopName}. Address: {Address}. Id: {Id}", model.ShopName, model.Address, model.Id);
|
|
||||||
|
_logger.LogInformation("Shop. Name: {0}, Address: {1}, ID: {2}", model.ShopName, model.Address, model.Id);
|
||||||
|
|
||||||
var element = _shopStorage.GetElement(new ShopSearchModel
|
var element = _shopStorage.GetElement(new ShopSearchModel
|
||||||
{
|
{
|
||||||
ShopName = model.ShopName
|
ShopName = model.ShopName
|
||||||
});
|
});
|
||||||
|
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SellPrinted(IPrintedModel printed, int count)
|
||||||
|
{
|
||||||
|
return _shopStorage.SellPrinted(printed, count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ namespace TypographyContracts.BindingModels
|
|||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
public DateTime DateOpening { get; set; } = DateTime.Now;
|
||||||
|
public int MaxCountPrinteds { get; set; }
|
||||||
|
|
||||||
public Dictionary<int, (IPrintedModel, int)> ShopPrinteds { get; set; } = new();
|
public Dictionary<int, (IPrintedModel, int)> ShopPrinteds { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ namespace TypographyContracts.BusinessLogicsContracts
|
|||||||
|
|
||||||
bool Delete(ShopBindingModel model);
|
bool Delete(ShopBindingModel model);
|
||||||
|
|
||||||
bool MakeShipment(ShopSearchModel shopModel, IPrintedModel iceCream, int count);
|
bool MakeShipment(ShopSearchModel shopModel, IPrintedModel printed, int count);
|
||||||
|
bool SellPrinted(IPrintedModel printed, int count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using TypographyContracts.BindingModels;
|
using TypographyContracts.BindingModels;
|
||||||
using TypographyContracts.SearchModels;
|
using TypographyContracts.SearchModels;
|
||||||
using TypographyContracts.ViewModels;
|
using TypographyContracts.ViewModels;
|
||||||
|
using TypographyDataModels.Models;
|
||||||
|
|
||||||
namespace TypographyContracts.StoragesContracts
|
namespace TypographyContracts.StoragesContracts
|
||||||
{
|
{
|
||||||
@ -22,5 +23,6 @@ namespace TypographyContracts.StoragesContracts
|
|||||||
ShopViewModel? Update(ShopBindingModel model);
|
ShopViewModel? Update(ShopBindingModel model);
|
||||||
|
|
||||||
ShopViewModel? Delete(ShopBindingModel model);
|
ShopViewModel? Delete(ShopBindingModel model);
|
||||||
|
bool SellPrinted(IPrintedModel model, int count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ namespace TypographyContracts.ViewModels
|
|||||||
|
|
||||||
[DisplayName("Адрес")]
|
[DisplayName("Адрес")]
|
||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Максимальное количество изделий в магазине")]
|
||||||
|
public int MaxCountPrinteds { get; set; }
|
||||||
|
|
||||||
[DisplayName("Дата открытия")]
|
[DisplayName("Дата открытия")]
|
||||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
public DateTime DateOpening { get; set; } = DateTime.Now;
|
||||||
|
@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using TypographyDataModels.Enums;
|
||||||
|
|
||||||
namespace TypographyDataModels.Enums
|
namespace TypographyDataModels.Models
|
||||||
{
|
{
|
||||||
public interface IOrderModel : IId
|
public interface IOrderModel : IId
|
||||||
{
|
{
|
||||||
@ -13,6 +14,6 @@ namespace TypographyDataModels.Enums
|
|||||||
double Sum { get; }
|
double Sum { get; }
|
||||||
OrderStatus Status { get; }
|
OrderStatus Status { get; }
|
||||||
DateTime DateCreate { get; }
|
DateTime DateCreate { get; }
|
||||||
DateTime? DateImplement { get; }
|
DateTime? DateImplement { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,6 +13,7 @@ namespace TypographyDataModels.Models
|
|||||||
string Address { get; }
|
string Address { get; }
|
||||||
|
|
||||||
DateTime DateOpening { get; }
|
DateTime DateOpening { get; }
|
||||||
|
int MaxCountPrinteds { get; }
|
||||||
|
|
||||||
Dictionary<int, (IPrintedModel, int)> ShopPrinteds { get; }
|
Dictionary<int, (IPrintedModel, int)> ShopPrinteds { get; }
|
||||||
}
|
}
|
@ -18,10 +18,12 @@ namespace TypographyFileImplement
|
|||||||
private readonly string OrderFileName = "Order.xml";
|
private readonly string OrderFileName = "Order.xml";
|
||||||
|
|
||||||
private readonly string PrintedFileName = "Printed.xml";
|
private readonly string PrintedFileName = "Printed.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<Printed> Printeds { get; private set; }
|
public List<Printed> Printeds { get; private set; }
|
||||||
|
public List<Shop> Shops { get; private set; }
|
||||||
|
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
@ -35,12 +37,14 @@ namespace TypographyFileImplement
|
|||||||
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
|
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
|
||||||
public void SavePrinteds() => SaveData(Printeds, PrintedFileName, "Printeds", x => x.GetXElement);
|
public void SavePrinteds() => SaveData(Printeds, PrintedFileName, "Printeds", x => x.GetXElement);
|
||||||
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, ShopFileName, "Shops", x => x.GetXElement);
|
||||||
|
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||||
Printeds = LoadData(PrintedFileName, "Printed", x => Printed.Create(x)!)!;
|
Printeds = LoadData(PrintedFileName, "Printed", x => Printed.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)
|
||||||
|
137
TypographyFileImplement/Implements/ShopStorage.cs
Normal file
137
TypographyFileImplement/Implements/ShopStorage.cs
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TypographyContracts.BindingModels;
|
||||||
|
using TypographyContracts.SearchModels;
|
||||||
|
using TypographyContracts.StoragesContracts;
|
||||||
|
using TypographyContracts.ViewModels;
|
||||||
|
using TypographyDataModels.Models;
|
||||||
|
using TypographyFileImplement.Models;
|
||||||
|
|
||||||
|
namespace TypographyFileImplement.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 SellPrinted(IPrintedModel model, int count)
|
||||||
|
{
|
||||||
|
var printed = source.Printeds.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
|
||||||
|
if (printed == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var shopPrinteds = source.Shops.SelectMany(shop => shop.ShopPrinteds.Where(c => c.Value.Item1.Id == printed.Id));
|
||||||
|
|
||||||
|
int countStore = 0;
|
||||||
|
|
||||||
|
foreach (var it in shopPrinteds)
|
||||||
|
countStore += it.Value.Item2;
|
||||||
|
|
||||||
|
if (count > countStore)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
foreach (var shop in source.Shops)
|
||||||
|
{
|
||||||
|
var printeds = shop.ShopPrinteds;
|
||||||
|
|
||||||
|
foreach (var c in printeds.Where(x => x.Value.Item1.Id == printed.Id))
|
||||||
|
{
|
||||||
|
int min = Math.Min(c.Value.Item2, count);
|
||||||
|
printeds[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,
|
||||||
|
MaxCountPrinteds = shop.MaxCountPrinteds,
|
||||||
|
DateOpening = shop.DateOpening,
|
||||||
|
ShopPrinteds = printeds
|
||||||
|
});
|
||||||
|
|
||||||
|
source.SaveShops();
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
116
TypographyFileImplement/Models/Shop.cs
Normal file
116
TypographyFileImplement/Models/Shop.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using TypographyContracts.BindingModels;
|
||||||
|
using TypographyContracts.ViewModels;
|
||||||
|
using TypographyDataModels.Models;
|
||||||
|
|
||||||
|
namespace TypographyFileImplement.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 MaxCountPrinteds { get; private set; }
|
||||||
|
public DateTime DateOpening { get; private set; }
|
||||||
|
public Dictionary<int, int> Printeds { get; private set; } = new();
|
||||||
|
private Dictionary<int, (IPrintedModel, int)>? _shopPrinteds = null;
|
||||||
|
|
||||||
|
public Dictionary<int, (IPrintedModel, int)> ShopPrinteds
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_shopPrinteds == null)
|
||||||
|
{
|
||||||
|
var source = DataFileSingleton.GetInstance();
|
||||||
|
_shopPrinteds = Printeds.ToDictionary(
|
||||||
|
x => x.Key,
|
||||||
|
y => ((source.Printeds.FirstOrDefault(z => z.Id == y.Key) as IPrintedModel)!, y.Value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return _shopPrinteds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Shop? Create(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ShopName = model.ShopName,
|
||||||
|
Address = model.Address,
|
||||||
|
MaxCountPrinteds = model.MaxCountPrinteds,
|
||||||
|
DateOpening = model.DateOpening,
|
||||||
|
Printeds = model.ShopPrinteds.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,
|
||||||
|
MaxCountPrinteds = Convert.ToInt32(element.Element("MaxCountPrinteds")!.Value),
|
||||||
|
DateOpening = Convert.ToDateTime(element.Element("DateOpening")!.Value),
|
||||||
|
Printeds = element.Element("ShopPrinteds")!.Elements("ShopPrinted").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;
|
||||||
|
MaxCountPrinteds = model.MaxCountPrinteds;
|
||||||
|
DateOpening = model.DateOpening;
|
||||||
|
if (model.ShopPrinteds.Count > 0)
|
||||||
|
{
|
||||||
|
Printeds = model.ShopPrinteds.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||||
|
_shopPrinteds = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ShopViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ShopName = ShopName,
|
||||||
|
Address = Address,
|
||||||
|
MaxCountPrinteds = MaxCountPrinteds,
|
||||||
|
DateOpening = DateOpening,
|
||||||
|
ShopPrinteds = ShopPrinteds,
|
||||||
|
};
|
||||||
|
|
||||||
|
public XElement GetXElement => new(
|
||||||
|
"Shop",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("ShopName", ShopName),
|
||||||
|
new XElement("Address", Address),
|
||||||
|
new XElement("MaxCountPrinteds", MaxCountPrinteds),
|
||||||
|
new XElement("DateOpening", DateOpening.ToString()),
|
||||||
|
new XElement("ShopPrinteds", Printeds.Select(x =>
|
||||||
|
new XElement("ShopPrinted",
|
||||||
|
new XElement("Key", x.Key),
|
||||||
|
new XElement("Value", x.Value)))
|
||||||
|
.ToArray()));
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ using TypographyContracts.BindingModels;
|
|||||||
using TypographyContracts.SearchModels;
|
using TypographyContracts.SearchModels;
|
||||||
using TypographyContracts.StoragesContracts;
|
using TypographyContracts.StoragesContracts;
|
||||||
using TypographyContracts.ViewModels;
|
using TypographyContracts.ViewModels;
|
||||||
|
using TypographyDataModels.Models;
|
||||||
using TypographyListImplement.Models;
|
using TypographyListImplement.Models;
|
||||||
|
|
||||||
namespace TypographyListImplement.Implements
|
namespace TypographyListImplement.Implements
|
||||||
@ -110,5 +111,9 @@ namespace TypographyListImplement.Implements
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public bool SellPrinted(IPrintedModel car, int count)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TypographyContracts.BindingModels;
|
using TypographyContracts.BindingModels;
|
||||||
@ -16,6 +17,7 @@ namespace TypographyListImplement.Models
|
|||||||
public string ShopName { get; private set; } = string.Empty;
|
public string ShopName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public string Address { get; private set; } = string.Empty;
|
public string Address { get; private set; } = string.Empty;
|
||||||
|
public int MaxCountPrinteds { get; private set; }
|
||||||
|
|
||||||
public DateTime DateOpening { get; private set; }
|
public DateTime DateOpening { get; private set; }
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ namespace TypographyListImplement.Models
|
|||||||
ShopName = model.ShopName,
|
ShopName = model.ShopName,
|
||||||
Address = model.Address,
|
Address = model.Address,
|
||||||
DateOpening = model.DateOpening,
|
DateOpening = model.DateOpening,
|
||||||
|
MaxCountPrinteds = model.MaxCountPrinteds,
|
||||||
ShopPrinteds = model.ShopPrinteds
|
ShopPrinteds = model.ShopPrinteds
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -50,6 +53,7 @@ namespace TypographyListImplement.Models
|
|||||||
ShopName = model.ShopName;
|
ShopName = model.ShopName;
|
||||||
Address = model.Address;
|
Address = model.Address;
|
||||||
DateOpening = model.DateOpening;
|
DateOpening = model.DateOpening;
|
||||||
|
MaxCountPrinteds = model.MaxCountPrinteds;
|
||||||
ShopPrinteds = model.ShopPrinteds;
|
ShopPrinteds = model.ShopPrinteds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +63,7 @@ namespace TypographyListImplement.Models
|
|||||||
ShopName = ShopName,
|
ShopName = ShopName,
|
||||||
Address = Address,
|
Address = Address,
|
||||||
DateOpening = DateOpening,
|
DateOpening = DateOpening,
|
||||||
|
MaxCountPrinteds = MaxCountPrinteds,
|
||||||
ShopPrinteds = ShopPrinteds
|
ShopPrinteds = ShopPrinteds
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
17
TypographyView/FormMain.Designer.cs
generated
17
TypographyView/FormMain.Designer.cs
generated
@ -34,6 +34,7 @@
|
|||||||
изделиеToolStripMenuItem = new ToolStripMenuItem();
|
изделиеToolStripMenuItem = new ToolStripMenuItem();
|
||||||
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
||||||
пополнениеМагазинаToolStripMenuItem = new ToolStripMenuItem();
|
пополнениеМагазинаToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
продажаИзделийToolStripMenuItem = new ToolStripMenuItem();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
buttonCreateOrder = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonTakeOrderInWork = new Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
@ -47,7 +48,7 @@
|
|||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, пополнениеМагазинаToolStripMenuItem });
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, пополнениеМагазинаToolStripMenuItem, продажаИзделийToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Size = new Size(1146, 28);
|
menuStrip.Size = new Size(1146, 28);
|
||||||
@ -64,21 +65,21 @@
|
|||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
компонентыToolStripMenuItem.Size = new Size(224, 26);
|
компонентыToolStripMenuItem.Size = new Size(182, 26);
|
||||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// изделиеToolStripMenuItem
|
// изделиеToolStripMenuItem
|
||||||
//
|
//
|
||||||
изделиеToolStripMenuItem.Name = "изделиеToolStripMenuItem";
|
изделиеToolStripMenuItem.Name = "изделиеToolStripMenuItem";
|
||||||
изделиеToolStripMenuItem.Size = new Size(224, 26);
|
изделиеToolStripMenuItem.Size = new Size(182, 26);
|
||||||
изделиеToolStripMenuItem.Text = "Изделие";
|
изделиеToolStripMenuItem.Text = "Изделие";
|
||||||
изделиеToolStripMenuItem.Click += ЗакускаToolStripMenuItem_Click;
|
изделиеToolStripMenuItem.Click += ЗакускаToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// магазиныToolStripMenuItem
|
// магазиныToolStripMenuItem
|
||||||
//
|
//
|
||||||
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
магазиныToolStripMenuItem.Size = new Size(224, 26);
|
магазиныToolStripMenuItem.Size = new Size(182, 26);
|
||||||
магазиныToolStripMenuItem.Text = "Магазины";
|
магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
@ -89,6 +90,13 @@
|
|||||||
пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина";
|
пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина";
|
||||||
пополнениеМагазинаToolStripMenuItem.Click += ПополнениеМагазиныToolStripMenuItem_Click;
|
пополнениеМагазинаToolStripMenuItem.Click += ПополнениеМагазиныToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// продажаИзделийToolStripMenuItem
|
||||||
|
//
|
||||||
|
продажаИзделийToolStripMenuItem.Name = "продажаИзделийToolStripMenuItem";
|
||||||
|
продажаИзделийToolStripMenuItem.Size = new Size(149, 24);
|
||||||
|
продажаИзделийToolStripMenuItem.Text = "Продажа изделий";
|
||||||
|
продажаИзделийToolStripMenuItem.Click += sellPrintedsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
@ -188,5 +196,6 @@
|
|||||||
private ToolStripMenuItem изделиеToolStripMenuItem;
|
private ToolStripMenuItem изделиеToolStripMenuItem;
|
||||||
private ToolStripMenuItem магазиныToolStripMenuItem;
|
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||||
private ToolStripMenuItem пополнениеМагазинаToolStripMenuItem;
|
private ToolStripMenuItem пополнениеМагазинаToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem продажаИзделийToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ using TypographyContracts.BindingModels;
|
|||||||
using TypographyContracts.BusinessLogicsContracts;
|
using TypographyContracts.BusinessLogicsContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using TypographyDataModels.Enums;
|
using TypographyDataModels.Enums;
|
||||||
|
using AutomobilePlantView;
|
||||||
|
|
||||||
namespace TypographyView
|
namespace TypographyView
|
||||||
{
|
{
|
||||||
@ -51,6 +52,14 @@ namespace TypographyView
|
|||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void sellPrintedsToolStripMenuItem_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)
|
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
71
TypographyView/FormShop.Designer.cs
generated
71
TypographyView/FormShop.Designer.cs
generated
@ -36,11 +36,13 @@
|
|||||||
dateTimePicker = new DateTimePicker();
|
dateTimePicker = new DateTimePicker();
|
||||||
groupBoxPrinted = new GroupBox();
|
groupBoxPrinted = new GroupBox();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
buttonSave = new Button();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
Columnid = new DataGridViewTextBoxColumn();
|
Columnid = new DataGridViewTextBoxColumn();
|
||||||
ColumnPrinted = new DataGridViewTextBoxColumn();
|
ColumnPrinted = new DataGridViewTextBoxColumn();
|
||||||
ColumnCount = new DataGridViewTextBoxColumn();
|
ColumnCount = new DataGridViewTextBoxColumn();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
labelMaxCountPrinteds = new Label();
|
||||||
|
textBoxMaxCount = new TextBox();
|
||||||
groupBoxPrinted.SuspendLayout();
|
groupBoxPrinted.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -96,7 +98,7 @@
|
|||||||
// groupBoxPrinted
|
// groupBoxPrinted
|
||||||
//
|
//
|
||||||
groupBoxPrinted.Controls.Add(dataGridView);
|
groupBoxPrinted.Controls.Add(dataGridView);
|
||||||
groupBoxPrinted.Location = new Point(12, 129);
|
groupBoxPrinted.Location = new Point(8, 201);
|
||||||
groupBoxPrinted.Name = "groupBoxPrinted";
|
groupBoxPrinted.Name = "groupBoxPrinted";
|
||||||
groupBoxPrinted.Size = new Size(598, 292);
|
groupBoxPrinted.Size = new Size(598, 292);
|
||||||
groupBoxPrinted.TabIndex = 7;
|
groupBoxPrinted.TabIndex = 7;
|
||||||
@ -108,33 +110,13 @@
|
|||||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Columnid, ColumnPrinted, ColumnCount });
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Columnid, ColumnPrinted, ColumnCount });
|
||||||
dataGridView.Location = new Point(0, 26);
|
dataGridView.Location = new Point(6, 22);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
dataGridView.Size = new Size(592, 260);
|
dataGridView.Size = new Size(592, 260);
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(330, 431);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(95, 34);
|
|
||||||
buttonSave.TabIndex = 8;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(449, 431);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(95, 34);
|
|
||||||
buttonCancel.TabIndex = 9;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
buttonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// Columnid
|
// Columnid
|
||||||
//
|
//
|
||||||
Columnid.HeaderText = "Id";
|
Columnid.HeaderText = "Id";
|
||||||
@ -157,11 +139,48 @@
|
|||||||
ColumnCount.Name = "ColumnCount";
|
ColumnCount.Name = "ColumnCount";
|
||||||
ColumnCount.Width = 125;
|
ColumnCount.Width = 125;
|
||||||
//
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(343, 489);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(95, 34);
|
||||||
|
buttonSave.TabIndex = 8;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(459, 489);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(95, 34);
|
||||||
|
buttonCancel.TabIndex = 9;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// labelMaxCountPrinteds
|
||||||
|
//
|
||||||
|
labelMaxCountPrinteds.Location = new Point(8, 136);
|
||||||
|
labelMaxCountPrinteds.Name = "labelMaxCountPrinteds";
|
||||||
|
labelMaxCountPrinteds.Size = new Size(160, 40);
|
||||||
|
labelMaxCountPrinteds.TabIndex = 10;
|
||||||
|
labelMaxCountPrinteds.Text = "Максимальное количество изделий :";
|
||||||
|
//
|
||||||
|
// textBoxMaxCount
|
||||||
|
//
|
||||||
|
textBoxMaxCount.Location = new Point(174, 149);
|
||||||
|
textBoxMaxCount.Name = "textBoxMaxCount";
|
||||||
|
textBoxMaxCount.Size = new Size(250, 27);
|
||||||
|
textBoxMaxCount.TabIndex = 11;
|
||||||
|
//
|
||||||
// FormShop
|
// FormShop
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(618, 477);
|
ClientSize = new Size(618, 535);
|
||||||
|
Controls.Add(textBoxMaxCount);
|
||||||
|
Controls.Add(labelMaxCountPrinteds);
|
||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(groupBoxPrinted);
|
Controls.Add(groupBoxPrinted);
|
||||||
@ -195,5 +214,7 @@
|
|||||||
private DataGridViewTextBoxColumn Columnid;
|
private DataGridViewTextBoxColumn Columnid;
|
||||||
private DataGridViewTextBoxColumn ColumnPrinted;
|
private DataGridViewTextBoxColumn ColumnPrinted;
|
||||||
private DataGridViewTextBoxColumn ColumnCount;
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
|
private Label labelMaxCountPrinteds;
|
||||||
|
private TextBox textBoxMaxCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -123,5 +123,7 @@ namespace TypographyView
|
|||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
124
TypographyView/FormShopSell.Designer.cs
generated
Normal file
124
TypographyView/FormShopSell.Designer.cs
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
namespace AutomobilePlantView
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
labelPrinted = new Label();
|
||||||
|
labelCount = new Label();
|
||||||
|
comboBoxPrinted = new ComboBox();
|
||||||
|
textBoxCount = new TextBox();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSell = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelPrinted
|
||||||
|
//
|
||||||
|
labelPrinted.AutoSize = true;
|
||||||
|
labelPrinted.Location = new Point(14, 12);
|
||||||
|
labelPrinted.Name = "labelPrinted";
|
||||||
|
labelPrinted.Size = new Size(59, 20);
|
||||||
|
labelPrinted.TabIndex = 0;
|
||||||
|
labelPrinted.Text = "Printed:";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
labelCount.AutoSize = true;
|
||||||
|
labelCount.Location = new Point(14, 51);
|
||||||
|
labelCount.Name = "labelCount";
|
||||||
|
labelCount.Size = new Size(51, 20);
|
||||||
|
labelCount.TabIndex = 1;
|
||||||
|
labelCount.Text = "Count:";
|
||||||
|
//
|
||||||
|
// comboBoxPrinted
|
||||||
|
//
|
||||||
|
comboBoxPrinted.FormattingEnabled = true;
|
||||||
|
comboBoxPrinted.Location = new Point(70, 8);
|
||||||
|
comboBoxPrinted.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
comboBoxPrinted.Name = "comboBoxPrinted";
|
||||||
|
comboBoxPrinted.Size = new Size(370, 28);
|
||||||
|
comboBoxPrinted.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxCount
|
||||||
|
//
|
||||||
|
textBoxCount.Location = new Point(70, 47);
|
||||||
|
textBoxCount.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
textBoxCount.Name = "textBoxCount";
|
||||||
|
textBoxCount.Size = new Size(370, 27);
|
||||||
|
textBoxCount.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(262, 85);
|
||||||
|
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(86, 31);
|
||||||
|
buttonCancel.TabIndex = 4;
|
||||||
|
buttonCancel.Text = "Cancel";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSell
|
||||||
|
//
|
||||||
|
buttonSell.Location = new Point(354, 85);
|
||||||
|
buttonSell.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonSell.Name = "buttonSell";
|
||||||
|
buttonSell.Size = new Size(86, 31);
|
||||||
|
buttonSell.TabIndex = 5;
|
||||||
|
buttonSell.Text = "Sell";
|
||||||
|
buttonSell.UseVisualStyleBackColor = true;
|
||||||
|
buttonSell.Click += buttonSell_Click;
|
||||||
|
//
|
||||||
|
// FormShopSell
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(454, 124);
|
||||||
|
Controls.Add(buttonSell);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(textBoxCount);
|
||||||
|
Controls.Add(comboBoxPrinted);
|
||||||
|
Controls.Add(labelCount);
|
||||||
|
Controls.Add(labelPrinted);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
|
Name = "FormShopSell";
|
||||||
|
Text = "Sell";
|
||||||
|
Load += FormShopSell_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelPrinted;
|
||||||
|
private Label labelCount;
|
||||||
|
private ComboBox comboBoxPrinted;
|
||||||
|
private TextBox textBoxCount;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSell;
|
||||||
|
}
|
||||||
|
}
|
95
TypographyView/FormShopSell.cs
Normal file
95
TypographyView/FormShopSell.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using TypographyContracts.BindingModels;
|
||||||
|
using TypographyContracts.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 AutomobilePlantView
|
||||||
|
{
|
||||||
|
public partial class FormShopSell : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IPrintedLogic _logicPrinted;
|
||||||
|
private readonly IShopLogic _logicShop;
|
||||||
|
|
||||||
|
public FormShopSell(ILogger<FormShopSell> logger, IPrintedLogic logicPrinted, IShopLogic logicShop)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logicPrinted = logicPrinted;
|
||||||
|
_logicShop = logicShop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormShopSell_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка авто для продажи");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicPrinted.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxPrinted.DisplayMember = "PrintedName";
|
||||||
|
comboBoxPrinted.ValueMember = "Id";
|
||||||
|
comboBoxPrinted.DataSource = list;
|
||||||
|
comboBoxPrinted.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 (comboBoxPrinted.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите авто", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Создание продажи");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicShop.SellPrinted(
|
||||||
|
new PrintedBindingModel
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxPrinted.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
TypographyView/FormShopSell.resx
Normal file
120
TypographyView/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>
|
Loading…
x
Reference in New Issue
Block a user