This commit is contained in:
GokaPek 2024-02-14 00:11:21 +04:00
parent ecf0f08437
commit 2af5c30a4f
58 changed files with 1162 additions and 584 deletions

View File

@ -1,11 +1,11 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.StoragesContracts;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using LawFirmContracts.StoragesContracts;
using LawFirmContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace AbstractShopBusinessLogic.BusinessLogics
namespace LawFirmBusinessLogic.BusinessLogics
{
public class ComponentLogic : IComponentLogic
{

View File

@ -0,0 +1,107 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using LawFirmContracts.StoragesContracts;
using LawFirmContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace LawFirmBusinessLogic.BusinessLogics
{
public class DocumentLogic : IDocumentLogic
{
private readonly ILogger _logger;
private readonly IDocumentStorage _documentStorage;
public DocumentLogic(ILogger<DocumentLogic> logger, IDocumentStorage documentStorage)
{
_logger = logger;
_documentStorage = documentStorage;
}
public List<DocumentViewModel>? ReadList(DocumentSearchModel? model)
{
_logger.LogInformation("ReadList. DocumentName:{DocumentName}. Id:{Id}", model?.DocumentName, model?.Id);
var list = model == null ? _documentStorage.GetFullList() : _documentStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public DocumentViewModel? ReadElement(DocumentSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. ComponentName:{DocumentName}. Id:{Id}", model.DocumentName, model.Id);
var element = _documentStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(DocumentBindingModel model)
{
CheckModel(model);
if (_documentStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(DocumentBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_documentStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(DocumentBindingModel model)
{
CheckModel(model);
if (_documentStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(DocumentBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.DocumentName))
{
throw new ArgumentNullException("Нет названия компонента", nameof(model.DocumentName));
}
_logger.LogInformation("Component. ComponentName:{ComponentName}. Id:{Id}", model.DocumentName, model.Id);
var element = _documentStorage.GetElement(new DocumentSearchModel
{
DocumentName = model.DocumentName
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Компонент с таким названием уже есть");
}
}
}
}

View File

@ -1,35 +1,60 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using LawFirmContracts.StoragesContracts;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Enums;
using Microsoft.Extensions.Logging;
namespace AbstractShopBusinessLogic.BusinessLogics
namespace LawFirmBusinessLogic.BusinessLogics
{
public class OrderLogic : IOrderLogic
{
private readonly ILogger _logger;
private readonly IOrderStorage _orderStorage;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
{
_logger = logger;
_orderStorage = orderStorage;
}
public bool CreateOrder(OrderBindingModel model)
{
throw new NotImplementedException();
if (_orderStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
model.Status = OrderStatus.Неизвестен;
return true;
}
public bool DeliveryOrder(OrderBindingModel model)
{
throw new NotImplementedException();
_logger.LogInformation("Delivery. Id:{Id}", model.Id);
model.Status = OrderStatus.Готов;
return _orderStorage.Update(model) != null;
}
public bool FinishOrder(OrderBindingModel model)
{
throw new NotImplementedException();
}
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{
throw new NotImplementedException();
model.Status = OrderStatus.Выдан;
return _orderStorage.Update(model) != null;
}
public bool TakeOrderInWork(OrderBindingModel model)
{
throw new NotImplementedException();
model.Status = OrderStatus.Выполняется;
return _orderStorage.Update(model) != null;
}
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{
if (model == null)
{
return _orderStorage.GetFullList();
}
return _orderStorage.GetFilteredList(model);
}
}
}

View File

@ -1,35 +0,0 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
namespace AbstractShopBusinessLogic.BusinessLogics
{
public class ProductLogic : IProductLogic
{
public bool Create(ProductBindingModel model)
{
throw new NotImplementedException();
}
public bool Delete(ProductBindingModel model)
{
throw new NotImplementedException();
}
public ProductViewModel? ReadElement(ProductSearchModel model)
{
throw new NotImplementedException();
}
public List<ProductViewModel>? ReadList(ProductSearchModel? model)
{
throw new NotImplementedException();
}
public bool Update(ProductBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,6 +1,6 @@
using AbstractShopDataModels.Models;
using LawFirmDataModels.Models;
namespace AbstractShopContracts.BindingModels
namespace LawFirmContracts.BindingModels
{
public class ComponentBindingModel : IComponentModel
{

View File

@ -0,0 +1,15 @@
using LawFirmDataModels.Models;
namespace LawFirmContracts.BindingModels
{
public class DocumentBindingModel : IDocumentModel
{
public int Id { get; set; }
public string DocumentName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> DocumentComponents { get; set; } = new();
}
}

View File

@ -1,13 +1,13 @@
using AbstractShopDataModels.Enums;
using AbstractShopDataModels.Models;
using LawFirmDataModels.Enums;
using LawFirmDataModels.Models;
namespace AbstractShopContracts.BindingModels
namespace LawFirmContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public int ProductId { get; set; }
public int DocumentId { get; set; }
public int Count { get; set; }

View File

@ -1,15 +0,0 @@
using AbstractShopDataModels.Models;
namespace AbstractShopContracts.BindingModels
{
public class ProductBindingModel : IProductModel
{
public int Id { get; set; }
public string ProductName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
}
}

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
namespace AbstractShopContracts.BusinessLogicsContracts
namespace LawFirmContracts.BusinessLogicsContracts
{
public interface IComponentLogic
{

View File

@ -0,0 +1,19 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
namespace LawFirmContracts.BusinessLogicsContracts
{
public interface IDocumentLogic
{
List<DocumentViewModel>? ReadList(DocumentSearchModel? model);
DocumentViewModel? ReadElement(DocumentSearchModel model);
bool Create(DocumentBindingModel model);
bool Update(DocumentBindingModel model);
bool Delete(DocumentBindingModel model);
}
}

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
namespace AbstractShopContracts.BusinessLogicsContracts
namespace LawFirmContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{

View File

@ -1,19 +0,0 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
namespace AbstractShopContracts.BusinessLogicsContracts
{
public interface IProductLogic
{
List<ProductViewModel>? ReadList(ProductSearchModel? model);
ProductViewModel? ReadElement(ProductSearchModel model);
bool Create(ProductBindingModel model);
bool Update(ProductBindingModel model);
bool Delete(ProductBindingModel model);
}
}

View File

@ -1,4 +1,4 @@
namespace AbstractShopContracts.SearchModels
namespace LawFirmContracts.SearchModels
{
public class ComponentSearchModel
{

View File

@ -0,0 +1,9 @@
namespace LawFirmContracts.SearchModels
{
public class DocumentSearchModel
{
public int? Id { get; set; }
public string? DocumentName { get; set; }
}
}

View File

@ -1,4 +1,4 @@
namespace AbstractShopContracts.SearchModels
namespace LawFirmContracts.SearchModels
{
public class OrderSearchModel
{

View File

@ -1,9 +0,0 @@
namespace AbstractShopContracts.SearchModels
{
public class ProductSearchModel
{
public int? Id { get; set; }
public string? ProductName { get; set; }
}
}

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
namespace AbstractShopContracts.StoragesContracts
namespace LawFirmContracts.StoragesContracts
{
public interface IComponentStorage
{

View File

@ -0,0 +1,21 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
namespace LawFirmContracts.StoragesContracts
{
public interface IDocumentStorage
{
List<DocumentViewModel> GetFullList();
List<DocumentViewModel> GetFilteredList(DocumentSearchModel model);
DocumentViewModel? GetElement(DocumentSearchModel model);
DocumentViewModel? Insert(DocumentBindingModel model);
DocumentViewModel? Update(DocumentBindingModel model);
DocumentViewModel? Delete(DocumentBindingModel model);
}
}

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
namespace AbstractShopContracts.StoragesContracts
namespace LawFirmContracts.StoragesContracts
{
public interface IOrderStorage
{

View File

@ -1,21 +0,0 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.ViewModels;
namespace AbstractShopContracts.StoragesContracts
{
public interface IProductStorage
{
List<ProductViewModel> GetFullList();
List<ProductViewModel> GetFilteredList(ProductSearchModel model);
ProductViewModel? GetElement(ProductSearchModel model);
ProductViewModel? Insert(ProductBindingModel model);
ProductViewModel? Update(ProductBindingModel model);
ProductViewModel? Delete(ProductBindingModel model);
}
}

View File

@ -1,7 +1,7 @@
using AbstractShopDataModels.Models;
using LawFirmDataModels.Models;
using System.ComponentModel;
namespace AbstractShopContracts.ViewModels
namespace LawFirmContracts.ViewModels
{
public class ComponentViewModel : IComponentModel
{

View File

@ -0,0 +1,18 @@
using LawFirmDataModels.Models;
using System.ComponentModel;
namespace LawFirmContracts.ViewModels
{
public class DocumentViewModel : IDocumentModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
public string DocumentName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> DocumentComponents { get; set; } = new();
}
}

View File

@ -1,18 +1,18 @@
using AbstractShopDataModels.Enums;
using AbstractShopDataModels.Models;
using LawFirmDataModels.Enums;
using LawFirmDataModels.Models;
using System.ComponentModel;
namespace AbstractShopContracts.ViewModels
namespace LawFirmContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
public int ProductId { get; set; }
public int DocumentId { get; set; }
[DisplayName("Изделие")]
public string ProductName { get; set; } = string.Empty;
public string DocumentName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }

View File

@ -1,18 +0,0 @@
using AbstractShopDataModels.Models;
using System.ComponentModel;
namespace AbstractShopContracts.ViewModels
{
public class ProductViewModel : IProductModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
public string ProductName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
}
}

View File

@ -1,4 +1,4 @@
namespace AbstractShopDataModels.Enums
namespace LawFirmDataModels.Enums
{
public enum OrderStatus
{

View File

@ -1,4 +1,4 @@
namespace AbstractShopDataModels
namespace LawFirmDataModels
{
public interface IId
{

View File

@ -1,4 +1,4 @@
namespace AbstractShopDataModels.Models
namespace LawFirmDataModels.Models
{
public interface IComponentModel : IId
{

View File

@ -0,0 +1,11 @@
namespace LawFirmDataModels.Models
{
public interface IDocumentModel : IId
{
string DocumentName { get; }
double Price { get; }
Dictionary<int, (IComponentModel, int)> DocumentComponents { get; }
}
}

View File

@ -1,10 +1,10 @@
using AbstractShopDataModels.Enums;
using LawFirmDataModels.Enums;
namespace AbstractShopDataModels.Models
namespace LawFirmDataModels.Models
{
public interface IOrderModel : IId
{
int ProductId { get; }
int DocumentId { get; }
int Count { get; }

View File

@ -1,11 +0,0 @@
namespace AbstractShopDataModels.Models
{
public interface IProductModel : IId
{
string ProductName { get; }
double Price { get; }
Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
}
}

View File

@ -1,6 +1,6 @@
using AbstractShopListImplement.Models;
using LawFirmListImplement.Models;
namespace AbstractShopListImplement
namespace LawFirmListImplement
{
internal class DataListSingleton
{
@ -10,13 +10,13 @@ namespace AbstractShopListImplement
public List<Order> Orders { get; set; }
public List<Product> Products { get; set; }
public List<Document> Documents { get; set; }
private DataListSingleton()
{
Components = new List<Component>();
Orders = new List<Order>();
Products = new List<Product>();
Documents = new List<Document>();
}
public static DataListSingleton GetInstance()

View File

@ -1,10 +1,10 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.StoragesContracts;
using AbstractShopContracts.ViewModels;
using AbstractShopListImplement.Models;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.StoragesContracts;
using LawFirmContracts.ViewModels;
using LawFirmListImplement.Models;
namespace AbstractShopListImplement.Implements
namespace LawFirmListImplement.Implements
{
public class ComponentStorage : IComponentStorage
{

View File

@ -0,0 +1,102 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.StoragesContracts;
using LawFirmContracts.ViewModels;
using LawFirmListImplement.Models;
namespace LawFirmListImplement.Implements
{
public class DocumentStorage : IDocumentStorage
{
private readonly DataListSingleton _source;
public DocumentStorage()
{
_source = DataListSingleton.GetInstance();
}
public List<DocumentViewModel> GetFullList()
{
var result = new List<DocumentViewModel>();
foreach (var sushi in _source.Documents)
{
result.Add(sushi.GetViewModel);
}
return result;
}
public List<DocumentViewModel> GetFilteredList(DocumentSearchModel model)
{
var result = new List<DocumentViewModel>();
if (string.IsNullOrEmpty(model.DocumentName))
{
return result;
}
foreach (var sushi in _source.Documents)
{
if (sushi.DocumentName.Contains(model.DocumentName))
{
result.Add(sushi.GetViewModel);
}
}
return result;
}
public DocumentViewModel? GetElement(DocumentSearchModel model)
{
if (string.IsNullOrEmpty(model.DocumentName) && !model.Id.HasValue)
{
return null;
}
foreach (var sushi in _source.Documents)
{
if ((!string.IsNullOrEmpty(model.DocumentName) &&
sushi.DocumentName == model.DocumentName) ||
(model.Id.HasValue && sushi.Id == model.Id))
{
return sushi.GetViewModel;
}
}
return null;
}
public DocumentViewModel? Insert(DocumentBindingModel model)
{
model.Id = 1;
foreach (var sushi in _source.Documents)
{
if (model.Id <= sushi.Id)
{
model.Id = sushi.Id + 1;
}
}
var newDocument = Document.Create(model);
if (newDocument == null)
{
return null;
}
_source.Documents.Add(newDocument);
return newDocument.GetViewModel;
}
public DocumentViewModel? Update(DocumentBindingModel model)
{
foreach (var sushi in _source.Documents)
{
if (sushi.Id == model.Id)
{
sushi.Update(model);
return sushi.GetViewModel;
}
}
return null;
}
public DocumentViewModel? Delete(DocumentBindingModel model)
{
for (int i = 0; i < _source.Documents.Count; ++i)
{
if (_source.Documents[i].Id == model.Id)
{
var element = _source.Documents[i];
_source.Documents.RemoveAt(i);
return element.GetViewModel;
}
}
return null;
}
}
}

View File

@ -1,40 +1,89 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.StoragesContracts;
using AbstractShopContracts.ViewModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.StoragesContracts;
using LawFirmContracts.ViewModels;
using LawFirmListImplement.Models;
namespace AbstractShopListImplement.Implements
namespace LawFirmListImplement.Implements
{
public class OrderStorage : IOrderStorage
{
public OrderViewModel? Delete(OrderBindingModel model)
private readonly DataListSingleton _source;
public OrderStorage()
{
throw new NotImplementedException();
_source = DataListSingleton.GetInstance();
}
public OrderViewModel? GetElement(OrderSearchModel model)
{
throw new NotImplementedException();
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
throw new NotImplementedException();
}
public List<OrderViewModel> GetFullList()
{
throw new NotImplementedException();
var result = new List<OrderViewModel>();
foreach (var order in _source.Orders)
{
result.Add(order.GetViewModel);
}
return result;
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
return result;
}
public OrderViewModel? GetElement(OrderSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
foreach (var order in _source.Orders)
{
if (model.Id.HasValue && order.Id == model.Id)
{
return order.GetViewModel;
}
}
return null;
}
public OrderViewModel? Insert(OrderBindingModel model)
{
throw new NotImplementedException();
model.Id = 1;
foreach (var order in _source.Orders)
{
if (model.Id <= order.Id)
{
model.Id = order.Id + 1;
}
}
var newOrder = Order.Create(model);
if (newOrder == null)
{
return null;
}
_source.Orders.Add(newOrder);
return newOrder.GetViewModel;
}
public OrderViewModel? Update(OrderBindingModel model)
{
throw new NotImplementedException();
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)
{
order.Update(model);
return order.GetViewModel;
}
}
return null;
}
public OrderViewModel? Delete(OrderBindingModel model)
{
for (int i = 0; i < _source.Orders.Count; ++i)
{
if (_source.Orders[i].Id == model.Id)
{
var element = _source.Orders[i];
_source.Orders.RemoveAt(i);
return element.GetViewModel;
}
}
return null;
}
}
}

View File

@ -1,40 +0,0 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.SearchModels;
using AbstractShopContracts.StoragesContracts;
using AbstractShopContracts.ViewModels;
namespace AbstractShopListImplement.Implements
{
public class ProductStorage : IProductStorage
{
public ProductViewModel? Delete(ProductBindingModel model)
{
throw new NotImplementedException();
}
public ProductViewModel? GetElement(ProductSearchModel model)
{
throw new NotImplementedException();
}
public List<ProductViewModel> GetFilteredList(ProductSearchModel model)
{
throw new NotImplementedException();
}
public List<ProductViewModel> GetFullList()
{
throw new NotImplementedException();
}
public ProductViewModel? Insert(ProductBindingModel model)
{
throw new NotImplementedException();
}
public ProductViewModel? Update(ProductBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.ViewModels;
using AbstractShopDataModels.Models;
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Models;
namespace AbstractShopListImplement.Models
namespace LawFirmListImplement.Models
{
internal class Component : IComponentModel
{

View File

@ -0,0 +1,51 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Models;
namespace LawFirmListImplement.Models
{
internal class Document : IDocumentModel
{
public int Id { get; private set; }
public string DocumentName { get; private set; } = string.Empty;
public double Price { get; private set; }
public Dictionary<int, (IComponentModel, int)> DocumentComponents { get; private set; } = new Dictionary<int, (IComponentModel, int)>();
public static Document? Create(DocumentBindingModel? model)
{
if (model == null)
{
return null;
}
return new Document()
{
Id = model.Id,
DocumentName = model.DocumentName,
Price = model.Price,
DocumentComponents = model.DocumentComponents
};
}
public void Update(DocumentBindingModel? model)
{
if (model == null)
{
return;
}
DocumentName = model.DocumentName;
Price = model.Price;
DocumentComponents = model.DocumentComponents;
}
public DocumentViewModel GetViewModel => new()
{
Id = Id,
DocumentName = DocumentName,
Price = Price,
DocumentComponents = DocumentComponents
};
}
}

View File

@ -1,38 +1,57 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.ViewModels;
using AbstractShopDataModels.Enums;
using AbstractShopDataModels.Models;
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Enums;
using LawFirmDataModels.Models;
namespace AbstractShopListImplement.Models
namespace LawFirmListImplement.Models
{
internal class Order : IOrderModel
public class Order : IOrderModel
{
public int ProductId => throw new NotImplementedException();
public int Count => throw new NotImplementedException();
public double Sum => throw new NotImplementedException();
public OrderStatus Status => throw new NotImplementedException();
public DateTime DateCreate => throw new NotImplementedException();
public DateTime? DateImplement => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
public int Id { get; private set; }
public int DocumentId { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; private set; }
public DateTime? DateImplement { get; private set; }
public static Order? Create(OrderBindingModel? model)
{
return new Order();
if (model == null)
{
return null;
}
return new Order()
{
Id = model.Id,
DocumentId = model.DocumentId,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
DateCreate = model.DateCreate,
DateImplement = model.DateImplement
};
}
public void Update(OrderBindingModel? model)
{
if (model == null)
{
return;
}
DocumentId = model.DocumentId;
Count = model.Count;
Sum = model.Sum;
Status = model.Status;
DateImplement = model.DateImplement;
}
public OrderViewModel GetViewModel => new()
{
Id = Id,
DocumentId = DocumentId,
Count = Count,
Sum = Sum,
Status = Status,
DateCreate = DateCreate,
DateImplement = DateImplement
};
}
}

View File

@ -1,51 +0,0 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.ViewModels;
using AbstractShopDataModels.Models;
namespace AbstractShopListImplement.Models
{
internal class Product : IProductModel
{
public int Id { get; private set; }
public string ProductName { get; private set; } = string.Empty;
public double Price { get; private set; }
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; private set; } = new Dictionary<int, (IComponentModel, int)>();
public static Product? Create(ProductBindingModel? model)
{
if (model == null)
{
return null;
}
return new Product()
{
Id = model.Id,
ProductName = model.ProductName,
Price = model.Price,
ProductComponents = model.ProductComponents
};
}
public void Update(ProductBindingModel? model)
{
if (model == null)
{
return;
}
ProductName = model.ProductName;
Price = model.Price;
ProductComponents = model.ProductComponents;
}
public ProductViewModel GetViewModel => new()
{
Id = Id,
ProductName = ProductName,
Price = Price,
ProductComponents = ProductComponents
};
}
}

View File

@ -1,9 +1,9 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.SearchModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using Microsoft.Extensions.Logging;
namespace AbstractShopView
namespace LawFirmView
{
public partial class FormComponent : Form
{

View File

@ -1,4 +1,4 @@
namespace AbstractShopView
namespace LawFirmView
{
partial class FormComponent
{

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
namespace AbstractShopView
namespace LawFirmView
{
public partial class FormComponents : Form
{

View File

@ -1,4 +1,4 @@
namespace AbstractShopView
namespace LawFirmView
{
partial class FormComponents
{

View File

@ -1,19 +1,19 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.SearchModels;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using Microsoft.Extensions.Logging;
namespace AbstractShopView
namespace LawFirmView
{
public partial class FormCreateOrder : Form
{
private readonly ILogger _logger;
private readonly IProductLogic _logicP;
private readonly IDocumentLogic _logicP;
private readonly IOrderLogic _logicO;
public FormCreateOrder(ILogger<FormCreateOrder> logger, IProductLogic logicP, IOrderLogic logicO)
public FormCreateOrder(ILogger<FormCreateOrder> logger, IDocumentLogic logicP, IOrderLogic logicO)
{
InitializeComponent();
_logger = logger;
@ -34,7 +34,7 @@ namespace AbstractShopView
try
{
int id = Convert.ToInt32(comboBoxProduct.SelectedValue);
var product = _logicP.ReadElement(new ProductSearchModel { Id = id });
var product = _logicP.ReadElement(new DocumentSearchModel { Id = id });
int count = Convert.ToInt32(textBoxCount.Text);
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString();
_logger.LogInformation("Расчет суммы заказа");
@ -74,7 +74,7 @@ namespace AbstractShopView
{
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
ProductId = Convert.ToInt32(comboBoxProduct.SelectedValue),
DocumentId = Convert.ToInt32(comboBoxProduct.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text)
});

View File

@ -1,4 +1,4 @@
namespace AbstractShopView
namespace LawFirmView
{
partial class FormCreateOrder
{

View File

@ -1,16 +1,16 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.SearchModels;
using AbstractShopDataModels.Models;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using LawFirmDataModels.Models;
using Microsoft.Extensions.Logging;
namespace AbstractShopView
namespace LawFirmView
{
public partial class FormProduct : Form
public partial class FormDocument : Form
{
private readonly ILogger _logger;
private readonly IProductLogic _logic;
private readonly IDocumentLogic _logic;
private int? _id;
@ -18,7 +18,7 @@ namespace AbstractShopView
public int Id { set { _id = value; } }
public FormProduct(ILogger<FormProduct> logger, IProductLogic logic)
public FormDocument(ILogger<FormDocument> logger, IDocumentLogic logic)
{
InitializeComponent();
_logger = logger;
@ -33,12 +33,12 @@ namespace AbstractShopView
_logger.LogInformation("Загрузка изделия");
try
{
var view = _logic.ReadElement(new ProductSearchModel { Id = _id.Value });
var view = _logic.ReadElement(new DocumentSearchModel { Id = _id.Value });
if (view != null)
{
textBoxName.Text = view.ProductName;
textBoxName.Text = view.DocumentName;
textBoxPrice.Text = view.Price.ToString();
_productComponents = view.ProductComponents ?? new Dictionary<int, (IComponentModel, int)>();
_productComponents = view.DocumentComponents ?? new Dictionary<int, (IComponentModel, int)>();
LoadData();
}
}
@ -74,8 +74,8 @@ namespace AbstractShopView
private void ButtonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormProductComponent));
if (service is FormProductComponent form)
var service = Program.ServiceProvider?.GetService(typeof(FormDocumentComponent));
if (service is FormDocumentComponent form)
{
if (form.ShowDialog() == DialogResult.OK)
{
@ -101,8 +101,8 @@ namespace AbstractShopView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormProductComponent));
if (service is FormProductComponent form)
var service = Program.ServiceProvider?.GetService(typeof(FormDocumentComponent));
if (service is FormDocumentComponent form)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
form.Id = id;
@ -166,12 +166,12 @@ namespace AbstractShopView
_logger.LogInformation("Сохранение изделия");
try
{
var model = new ProductBindingModel
var model = new DocumentBindingModel
{
Id = _id ?? 0,
ProductName = textBoxName.Text,
DocumentName = textBoxName.Text,
Price = Convert.ToDouble(textBoxPrice.Text),
ProductComponents = _productComponents
DocumentComponents = _productComponents
};
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
if (!operationResult)

View File

@ -1,6 +1,6 @@
namespace AbstractShopView
namespace LawFirmView
{
partial class FormProduct
partial class FormDocument
{
/// <summary>
/// Required designer variable.

View File

@ -1,10 +1,10 @@
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.ViewModels;
using AbstractShopDataModels.Models;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Models;
namespace AbstractShopView
namespace LawFirmView
{
public partial class FormProductComponent : Form
public partial class FormDocumentComponent : Form
{
private readonly List<ComponentViewModel>? _list;
@ -31,7 +31,7 @@ namespace AbstractShopView
public int Count { get { return Convert.ToInt32(textBoxCount.Text); } set { textBoxCount.Text = value.ToString(); } }
public FormProductComponent(IComponentLogic logic)
public FormDocumentComponent(IComponentLogic logic)
{
InitializeComponent();

View File

@ -1,6 +1,6 @@
namespace AbstractShopView
namespace LawFirmView
{
partial class FormProductComponent
partial class FormDocumentComponent
{
/// <summary>
/// Required designer variable.

View File

@ -0,0 +1,125 @@
namespace LawFirmView
{
partial class FormDocuments
{
/// <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()
{
buttonRef = new Button();
buttonDel = new Button();
buttonUpd = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// buttonRef
//
buttonRef.Location = new Point(597, 203);
buttonRef.Margin = new Padding(4, 5, 4, 5);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(100, 35);
buttonRef.TabIndex = 9;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
//
// buttonDel
//
buttonDel.Location = new Point(597, 140);
buttonDel.Margin = new Padding(4, 5, 4, 5);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(100, 35);
buttonDel.TabIndex = 8;
buttonDel.Text = "Удалить";
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// buttonUpd
//
buttonUpd.Location = new Point(597, 77);
buttonUpd.Margin = new Padding(4, 5, 4, 5);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(100, 35);
buttonUpd.TabIndex = 7;
buttonUpd.Text = "Изменить";
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonAdd
//
buttonAdd.Location = new Point(597, 18);
buttonAdd.Margin = new Padding(4, 5, 4, 5);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(100, 35);
buttonAdd.TabIndex = 6;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Left;
dataGridView.Location = new Point(0, 0);
dataGridView.Margin = new Padding(4, 5, 4, 5);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(467, 450);
dataGridView.TabIndex = 5;
//
// FormDocuments
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(724, 450);
Controls.Add(buttonRef);
Controls.Add(buttonDel);
Controls.Add(buttonUpd);
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
Name = "FormDocuments";
Text = "Документы";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Button buttonRef;
private Button buttonDel;
private Button buttonUpd;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,103 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.SearchModels;
using Microsoft.Extensions.Logging;
namespace LawFirmView
{
public partial class FormDocuments : Form
{
private readonly ILogger _logger;
private readonly IDocumentLogic _logic;
public FormDocuments(ILogger<FormDocument> logger, IDocumentLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormComponents_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["DocumentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка компонентов");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки компонентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormDocument));
if (service is FormDocument form)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormDocument));
if (service is FormDocument form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление компонента");
try
{
if (!_logic.Delete(new DocumentBindingModel { Id = id }))
{
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка удаления компонента");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
}
}

View 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>

View File

@ -1,8 +1,8 @@
using AbstractShopContracts.BindingModels;
using AbstractShopContracts.BusinessLogicsContracts;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
namespace AbstractShopView
namespace LawFirmView
{
public partial class FormMain : Form
{
@ -39,7 +39,11 @@ namespace AbstractShopView
private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e)
{
// прописать логику
var service = Program.ServiceProvider?.GetService(typeof(FormDocuments));
if (service is FormDocuments form)
{
form.ShowDialog();
}
}
private void ButtonCreateOrder_Click(object sender, EventArgs e)

View File

@ -1,4 +1,4 @@
namespace AbstractShopView
namespace LawFirmView
{
partial class FormMain
{
@ -28,171 +28,167 @@
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonOrderReady = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonRef = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1031, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.компонентыToolStripMenuItem,
this.изделияToolStripMenuItem});
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.справочникиToolStripMenuItem.Text = "Справочники";
//
// компонентыToolStripMenuItem
//
this.компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.компонентыToolStripMenuItem.Text = "Компоненты";
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
//
// изделияToolStripMenuItem
//
this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
this.изделияToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.изделияToolStripMenuItem.Text = "Изделия";
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
//
// buttonIssuedOrder
//
this.buttonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonIssuedOrder.Location = new System.Drawing.Point(844, 231);
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
this.buttonIssuedOrder.Size = new System.Drawing.Size(174, 27);
this.buttonIssuedOrder.TabIndex = 4;
this.buttonIssuedOrder.Text = "Заказ выдан";
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
//
// buttonOrderReady
//
this.buttonOrderReady.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOrderReady.Location = new System.Drawing.Point(844, 171);
this.buttonOrderReady.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.buttonOrderReady.Name = "buttonOrderReady";
this.buttonOrderReady.Size = new System.Drawing.Size(174, 27);
this.buttonOrderReady.TabIndex = 3;
this.buttonOrderReady.Text = "Заказ готов";
this.buttonOrderReady.UseVisualStyleBackColor = true;
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
//
// buttonTakeOrderInWork
//
this.buttonTakeOrderInWork.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(844, 117);
this.buttonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(174, 27);
this.buttonTakeOrderInWork.TabIndex = 2;
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
//
// buttonCreateOrder
//
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCreateOrder.Location = new System.Drawing.Point(844, 58);
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(174, 27);
this.buttonCreateOrder.TabIndex = 1;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
//
// dataGridView
//
this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(0, 28);
this.dataGridView.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.dataGridView.MultiSelect = false;
this.dataGridView.Name = "dataGridView";
this.dataGridView.ReadOnly = true;
this.dataGridView.RowHeadersVisible = false;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(826, 320);
this.dataGridView.TabIndex = 0;
//
// buttonRef
//
this.buttonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRef.Location = new System.Drawing.Point(844, 290);
this.buttonRef.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.buttonRef.Name = "buttonRef";
this.buttonRef.Size = new System.Drawing.Size(174, 27);
this.buttonRef.TabIndex = 5;
this.buttonRef.Text = "Обновить список";
this.buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1031, 347);
this.Controls.Add(this.buttonRef);
this.Controls.Add(this.buttonIssuedOrder);
this.Controls.Add(this.buttonOrderReady);
this.Controls.Add(this.buttonTakeOrderInWork);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "FormMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Абстрактный магазин";
this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
компонентыToolStripMenuItem = new ToolStripMenuItem();
изделияToolStripMenuItem = new ToolStripMenuItem();
buttonIssuedOrder = new Button();
buttonOrderReady = new Button();
buttonTakeOrderInWork = new Button();
buttonCreateOrder = new Button();
dataGridView = new DataGridView();
buttonRef = new Button();
menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new Padding(8, 3, 0, 3);
menuStrip1.Size = new Size(1178, 30);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
//
// компонентыToolStripMenuItem
//
компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
компонентыToolStripMenuItem.Size = new Size(182, 26);
компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
//
// изделияToolStripMenuItem
//
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
изделияToolStripMenuItem.Size = new Size(182, 26);
изделияToolStripMenuItem.Text = "Изделия";
изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
//
// buttonIssuedOrder
//
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonIssuedOrder.Location = new Point(965, 308);
buttonIssuedOrder.Margin = new Padding(5, 4, 5, 4);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(199, 36);
buttonIssuedOrder.TabIndex = 4;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
//
// buttonOrderReady
//
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonOrderReady.Location = new Point(965, 228);
buttonOrderReady.Margin = new Padding(5, 4, 5, 4);
buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.Size = new Size(199, 36);
buttonOrderReady.TabIndex = 3;
buttonOrderReady.Text = "Заказ готов";
buttonOrderReady.UseVisualStyleBackColor = true;
buttonOrderReady.Click += ButtonOrderReady_Click;
//
// buttonTakeOrderInWork
//
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonTakeOrderInWork.Location = new Point(965, 156);
buttonTakeOrderInWork.Margin = new Padding(5, 4, 5, 4);
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.Size = new Size(199, 36);
buttonTakeOrderInWork.TabIndex = 2;
buttonTakeOrderInWork.Text = "Отдать на выполнение";
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
//
// buttonCreateOrder
//
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonCreateOrder.Location = new Point(965, 77);
buttonCreateOrder.Margin = new Padding(5, 4, 5, 4);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(199, 36);
buttonCreateOrder.TabIndex = 1;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += ButtonCreateOrder_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(0, 37);
dataGridView.Margin = new Padding(5, 4, 5, 4);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(944, 424);
dataGridView.TabIndex = 0;
//
// buttonRef
//
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonRef.Location = new Point(965, 387);
buttonRef.Margin = new Padding(5, 4, 5, 4);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(199, 36);
buttonRef.TabIndex = 5;
buttonRef.Text = "Обновить список";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1178, 463);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonOrderReady);
Controls.Add(buttonTakeOrderInWork);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Margin = new Padding(5, 4, 5, 4);
Name = "FormMain";
StartPosition = FormStartPosition.CenterScreen;
Text = "Юридическая фирма Все сидят";
Load += FormMain_Load;
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem справочникиToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem компонентыToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem изделияToolStripMenuItem;
private System.Windows.Forms.Button buttonIssuedOrder;
private System.Windows.Forms.Button buttonOrderReady;
private System.Windows.Forms.Button buttonTakeOrderInWork;
private System.Windows.Forms.Button buttonCreateOrder;
private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.Button buttonRef;
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem компонентыToolStripMenuItem;
private ToolStripMenuItem изделияToolStripMenuItem;
private Button buttonIssuedOrder;
private Button buttonOrderReady;
private Button buttonTakeOrderInWork;
private Button buttonCreateOrder;
private DataGridView dataGridView;
private Button buttonRef;
}
}

View File

@ -1,17 +1,17 @@
<?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
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>
@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,13 +1,13 @@
using AbstractShopBusinessLogic.BusinessLogics;
using AbstractShopContracts.BusinessLogicsContracts;
using AbstractShopContracts.StoragesContracts;
using AbstractShopListImplement.Implements;
using LawFirmBusinessLogic.BusinessLogics;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.StoragesContracts;
using LawFirmListImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System.Drawing;
namespace AbstractShopView
namespace LawFirmView
{
internal static class Program
{
@ -34,17 +34,17 @@ namespace AbstractShopView
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IProductStorage, ProductStorage>();
services.AddTransient<IDocumentStorage, DocumentStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IProductLogic, ProductLogic>();
services.AddTransient<IDocumentLogic, DocumentLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormProduct>();
services.AddTransient<FormProductComponent>();
//services.AddTransient<FormProducts>();
services.AddTransient<FormDocument>();
services.AddTransient<FormDocumentComponent>();
services.AddTransient<FormDocuments>();
}
}
}