Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9041546347 |
@@ -11,7 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MotorPlantListImplement", "
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MotorPlantBusinessLogic", "..\MotorPlantBusinessLogic\MotorPlantBusinessLogic.csproj", "{BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MotorPlantBusinessLogic", "..\MotorPlantBusinessLogic\MotorPlantBusinessLogic.csproj", "{BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorPlantView", "..\MotorPlantView\MotorPlantView.csproj", "{76FE3E67-6BFC-4C12-AD2F-2267F8986605}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MotorPlantView", "..\MotorPlantView\MotorPlantView.csproj", "{76FE3E67-6BFC-4C12-AD2F-2267F8986605}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorPlantFileImplement", "..\MotorPlantFileImplement\MotorPlantFileImplement.csproj", "{44BB8347-D6F7-4AD3-BC7D-E565CA02E0F8}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -39,6 +41,10 @@ Global
|
|||||||
{76FE3E67-6BFC-4C12-AD2F-2267F8986605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{76FE3E67-6BFC-4C12-AD2F-2267F8986605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{76FE3E67-6BFC-4C12-AD2F-2267F8986605}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{76FE3E67-6BFC-4C12-AD2F-2267F8986605}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{76FE3E67-6BFC-4C12-AD2F-2267F8986605}.Release|Any CPU.Build.0 = Release|Any CPU
|
{76FE3E67-6BFC-4C12-AD2F-2267F8986605}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{44BB8347-D6F7-4AD3-BC7D-E565CA02E0F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{44BB8347-D6F7-4AD3-BC7D-E565CA02E0F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{44BB8347-D6F7-4AD3-BC7D-E565CA02E0F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{44BB8347-D6F7-4AD3-BC7D-E565CA02E0F8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -7,15 +7,11 @@ namespace MotorPlantListImplement
|
|||||||
public List<Component> Components { get; set; }
|
public List<Component> Components { get; set; }
|
||||||
public List<Order> Orders { get; set; }
|
public List<Order> Orders { get; set; }
|
||||||
public List<Engine> Engines { get; set; }
|
public List<Engine> Engines { get; set; }
|
||||||
public List<Shop> Shops { get; set; }
|
|
||||||
|
|
||||||
private DataListSingleton()
|
private DataListSingleton()
|
||||||
{
|
{
|
||||||
Components = new List<Component>();
|
Components = new List<Component>();
|
||||||
Orders = new List<Order>();
|
Orders = new List<Order>();
|
||||||
Engines = new List<Engine>();
|
Engines = new List<Engine>();
|
||||||
Shops = new List<Shop>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.SearchModels;
|
|
||||||
using MotorPlantContracts.StoragesContracts;
|
|
||||||
using MotorPlantContracts.ViewModels;
|
|
||||||
using MotorPlantListImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantListImplement.Implements
|
|
||||||
{
|
|
||||||
public class ShopStorage : IShopStorage
|
|
||||||
{
|
|
||||||
private readonly DataListSingleton _source;
|
|
||||||
public ShopStorage()
|
|
||||||
{
|
|
||||||
_source = DataListSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
public List<ShopViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
var result = new List<ShopViewModel>();
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
result.Add(shop.GetViewModel);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
var result = new List<ShopViewModel>();
|
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
if (shop.ShopName.Contains(model.Name))
|
|
||||||
{
|
|
||||||
result.Add(shop.GetViewModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
if ((!string.IsNullOrEmpty(model.Name) &&
|
|
||||||
shop.ShopName == model.Name) ||
|
|
||||||
(model.Id.HasValue && shop.Id == model.Id))
|
|
||||||
{
|
|
||||||
return shop.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public ShopViewModel? Insert(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = 1;
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
if (model.Id <= shop.Id)
|
|
||||||
{
|
|
||||||
model.Id = shop.Id + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var newShop = Shop.Create(model);
|
|
||||||
if (newShop == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_source.Shops.Add(newShop);
|
|
||||||
return newShop.GetViewModel;
|
|
||||||
}
|
|
||||||
public ShopViewModel? Update(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
if (shop.Id == model.Id)
|
|
||||||
{
|
|
||||||
shop.Update(model);
|
|
||||||
return shop.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public ShopViewModel? Delete(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _source.Shops.Count; ++i)
|
|
||||||
{
|
|
||||||
if (_source.Shops[i].Id == model.Id)
|
|
||||||
{
|
|
||||||
var element = _source.Shops[i];
|
|
||||||
_source.Shops.RemoveAt(i);
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.ViewModels;
|
|
||||||
using MotorPlantDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantListImplement.Models
|
|
||||||
{
|
|
||||||
public class Shop : IShopModel
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public string ShopName { get; private set; }
|
|
||||||
public string Adress { get; private set; }
|
|
||||||
public DateTime DateOpen { get; private set; }
|
|
||||||
public Dictionary<int, (IEngineModel, int)> ShopEngines { get; private set; } = new();
|
|
||||||
public static Shop? Create(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Shop()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
ShopName = model.ShopName,
|
|
||||||
Adress = model.Adress,
|
|
||||||
DateOpen = model.DateOpen,
|
|
||||||
ShopEngines = new()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void Update(ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ShopName = model.ShopName;
|
|
||||||
Adress = model.Adress;
|
|
||||||
DateOpen = model.DateOpen;
|
|
||||||
ShopEngines = model.ShopEngines;
|
|
||||||
}
|
|
||||||
public ShopViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
ShopName = ShopName,
|
|
||||||
Adress = Adress,
|
|
||||||
DateOpen = DateOpen,
|
|
||||||
ShopEngines = ShopEngines
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.BusinessLogicsContracts;
|
|
||||||
using MotorPlantContracts.SearchModels;
|
|
||||||
using MotorPlantContracts.StoragesContracts;
|
|
||||||
using MotorPlantContracts.ViewModels;
|
|
||||||
using MotorPlantDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantBusinessLogic.BusinessLogic
|
|
||||||
{
|
|
||||||
public class ShopLogic : IShopLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IShopStorage _shopStorage;
|
|
||||||
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage shopStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_shopStorage = shopStorage;
|
|
||||||
}
|
|
||||||
public List<ShopViewModel> ReadList(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ShopName:{Name}. Id:{ Id}", model?.Name, model?.Id);
|
|
||||||
var list = model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public ShopViewModel ReadElement(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", model.Name, model.Id);
|
|
||||||
var element = _shopStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_shopStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_shopStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Delete(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_shopStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(ShopBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ShopName))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия магазина",
|
|
||||||
nameof(model.ShopName));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Adress))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет адресса магазина",
|
|
||||||
nameof(model.ShopName));
|
|
||||||
}
|
|
||||||
if (model.DateOpen == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет даты открытия магазина",
|
|
||||||
nameof(model.ShopName));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Shop. ShopName:{ShopName}.Address:{Address}. DateOpen:{DateOpen}. Id: { Id}", model.ShopName, model.Adress, model.DateOpen, model.Id);
|
|
||||||
var element = _shopStorage.GetElement(new ShopSearchModel
|
|
||||||
{
|
|
||||||
Name = model.ShopName
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public bool MakeSupply(ShopSearchModel model, IEngineModel engine, int count)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
if (engine == null)
|
|
||||||
throw new ArgumentNullException(nameof(engine));
|
|
||||||
if (count <= 0)
|
|
||||||
throw new ArgumentNullException("Количество должно быть положительным числом");
|
|
||||||
|
|
||||||
ShopViewModel? curModel = _shopStorage.GetElement(model);
|
|
||||||
_logger.LogInformation("Make Supply. Id: {Id}. ShopName: {Name}", model.Id, model.Name);
|
|
||||||
if (curModel == null)
|
|
||||||
throw new ArgumentNullException(nameof(curModel));
|
|
||||||
if (curModel.ShopEngines.TryGetValue(engine.Id, out var pair))
|
|
||||||
{
|
|
||||||
curModel.ShopEngines[engine.Id] = (pair.Item1, pair.Item2 + count);
|
|
||||||
_logger.LogInformation("Make Supply. Add Engine. EngineName: {Name}. Count: {Count}", pair.Item1, count + pair.Item2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curModel.ShopEngines.Add(engine.Id, (engine, count));
|
|
||||||
_logger.LogInformation("Make Supply. Add new Engine. EngineName: {Name}. Count: {Count}", pair.Item1, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Update(new()
|
|
||||||
{
|
|
||||||
Id = curModel.Id,
|
|
||||||
ShopName = curModel.ShopName,
|
|
||||||
DateOpen = curModel.DateOpen,
|
|
||||||
Adress = curModel.Adress,
|
|
||||||
ShopEngines = curModel.ShopEngines,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using MotorPlantDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class ShopBindingModel : IShopModel
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string ShopName { get; set; }
|
|
||||||
public string Adress { get; set; }
|
|
||||||
public DateTime DateOpen { get; set; }
|
|
||||||
public Dictionary<int, (IEngineModel, int)> ShopEngines { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.SearchModels;
|
|
||||||
using MotorPlantContracts.ViewModels;
|
|
||||||
using MotorPlantDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IShopLogic
|
|
||||||
{
|
|
||||||
List<ShopViewModel>? ReadList(ShopSearchModel? model);
|
|
||||||
ShopViewModel? ReadElement(ShopSearchModel? model);
|
|
||||||
bool Create(ShopBindingModel? model);
|
|
||||||
bool Update(ShopBindingModel? model);
|
|
||||||
bool Delete(ShopBindingModel? model);
|
|
||||||
bool MakeSupply(ShopSearchModel model, IEngineModel engine, int count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantContracts.SearchModels
|
|
||||||
{
|
|
||||||
public class ShopSearchModel
|
|
||||||
{
|
|
||||||
public int? Id { get; set; }
|
|
||||||
public string? Name { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.SearchModels;
|
|
||||||
using MotorPlantContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantContracts.StoragesContracts
|
|
||||||
{
|
|
||||||
public interface IShopStorage
|
|
||||||
{
|
|
||||||
List<ShopViewModel> GetFullList();
|
|
||||||
List<ShopViewModel> GetFilteredList(ShopSearchModel model);
|
|
||||||
ShopViewModel? GetElement(ShopSearchModel model);
|
|
||||||
ShopViewModel? Insert(ShopBindingModel model);
|
|
||||||
ShopViewModel? Update(ShopBindingModel model);
|
|
||||||
ShopViewModel? Delete(ShopBindingModel model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using MotorPlantDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantContracts.ViewModels
|
|
||||||
{
|
|
||||||
public class ShopViewModel : IShopModel
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[DisplayName("Название магазина")]
|
|
||||||
|
|
||||||
public string ShopName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[DisplayName("Адрес")]
|
|
||||||
|
|
||||||
public string Adress { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[DisplayName("Дата открытия")]
|
|
||||||
|
|
||||||
public DateTime DateOpen { get; set; }
|
|
||||||
|
|
||||||
public Dictionary<int, (IEngineModel, int)> ShopEngines { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MotorPlantDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IShopModel : IId
|
|
||||||
{
|
|
||||||
string ShopName { get; }
|
|
||||||
string Adress { get; }
|
|
||||||
DateTime DateOpen { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
48
MotorPlantFileImplement/DataFileSingleton.cs
Normal file
48
MotorPlantFileImplement/DataFileSingleton.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using MotorPlantFileImplement.Models;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
namespace MotorPlantFileImplement
|
||||||
|
{
|
||||||
|
public class DataFileSingleton
|
||||||
|
{
|
||||||
|
private static DataFileSingleton? instance;
|
||||||
|
private readonly string ComponentFileName = "Component.xml";
|
||||||
|
private readonly string OrderFileName = "Order.xml";
|
||||||
|
private readonly string EngineFileName = "Engine.xml";
|
||||||
|
public List<Component> Components { get; private set; }
|
||||||
|
public List<Order> Orders { get; private set; }
|
||||||
|
public List<Engine> Engines { get; private set; }
|
||||||
|
|
||||||
|
public static DataFileSingleton GetInstance()
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new DataFileSingleton();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
|
||||||
|
public void SaveEngines() => SaveData(Engines, EngineFileName, "Engines", x => x.GetXElement);
|
||||||
|
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||||
|
private DataFileSingleton()
|
||||||
|
{
|
||||||
|
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||||
|
Engines = LoadData(EngineFileName, "Engine", x => Engine.Create(x)!)!;
|
||||||
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
|
}
|
||||||
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList();
|
||||||
|
}
|
||||||
|
return new List<T>();
|
||||||
|
}
|
||||||
|
private static void SaveData<T>(List<T> data, string filename, string xmlNodeName, Func<T, XElement> selectFunction)
|
||||||
|
{
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
new XDocument(new XElement(xmlNodeName, data.Select(selectFunction).ToArray())).Save(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
74
MotorPlantFileImplement/Implements/ComponentStorage.cs
Normal file
74
MotorPlantFileImplement/Implements/ComponentStorage.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using MotorPlantContracts.BindingModels;
|
||||||
|
using MotorPlantContracts.SearchModels;
|
||||||
|
using MotorPlantContracts.StoragesContracts;
|
||||||
|
using MotorPlantContracts.VeiwModels;
|
||||||
|
using MotorPlantFileImplement.Models;
|
||||||
|
|
||||||
|
namespace MotorPlantFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class ComponentStorage : IComponentStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
public ComponentStorage()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
public List<ComponentViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return source.Components.Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ComponentName))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return source.Components.Where(x => x.ComponentName.Contains(model.ComponentName)).Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return source.Components.FirstOrDefault(x =>
|
||||||
|
(!string.IsNullOrEmpty(model.ComponentName) && x.ComponentName == model.ComponentName) ||
|
||||||
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
public ComponentViewModel? Insert(ComponentBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = source.Components.Count > 0 ? source.Components.Max(x => x.Id) + 1 : 1;
|
||||||
|
var newComponent = Component.Create(model);
|
||||||
|
if (newComponent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
source.Components.Add(newComponent);
|
||||||
|
source.SaveComponents();
|
||||||
|
return newComponent.GetViewModel;
|
||||||
|
}
|
||||||
|
public ComponentViewModel? Update(ComponentBindingModel model)
|
||||||
|
{
|
||||||
|
var component = source.Components.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (component == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
component.Update(model);
|
||||||
|
source.SaveComponents();
|
||||||
|
return component.GetViewModel;
|
||||||
|
}
|
||||||
|
public ComponentViewModel? Delete(ComponentBindingModel model)
|
||||||
|
{
|
||||||
|
var element = source.Components.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
source.Components.Remove(element);
|
||||||
|
source.SaveComponents();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
70
MotorPlantFileImplement/Implements/EngineStorage.cs
Normal file
70
MotorPlantFileImplement/Implements/EngineStorage.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
using MotorPlantContracts.BindingModels;
|
||||||
|
using MotorPlantContracts.SearchModels;
|
||||||
|
using MotorPlantContracts.StoragesContracts;
|
||||||
|
using MotorPlantContracts.VeiwModels;
|
||||||
|
using MotorPlantFileImplement.Models;
|
||||||
|
namespace MotorPlantFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class EngineStorage : IEngineStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
public EngineStorage()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
public List<EngineViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return source.Engines.Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
public List<EngineViewModel> GetFilteredList(EngineSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.EngineName))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return source.Engines.Where(x => x.EngineName.Contains(model.EngineName)).Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
public EngineViewModel? GetElement(EngineSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.EngineName) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return source.Engines.FirstOrDefault(x => (!string.IsNullOrEmpty(model.EngineName) && x.EngineName == model.EngineName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
|
}
|
||||||
|
public EngineViewModel? Insert(EngineBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = source.Engines.Count > 0 ? source.Engines.Max(x => x.Id) + 1 : 1;
|
||||||
|
var newPizza = Engine.Create(model);
|
||||||
|
if (newPizza == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
source.Engines.Add(newPizza);
|
||||||
|
source.SaveEngines();
|
||||||
|
return newPizza.GetViewModel;
|
||||||
|
}
|
||||||
|
public EngineViewModel? Update(EngineBindingModel model)
|
||||||
|
{
|
||||||
|
var Pizza = source.Engines.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (Pizza == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Pizza.Update(model);
|
||||||
|
source.SaveEngines();
|
||||||
|
return Pizza.GetViewModel;
|
||||||
|
}
|
||||||
|
public EngineViewModel? Delete(EngineBindingModel model)
|
||||||
|
{
|
||||||
|
var Pizza = source.Engines.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (Pizza != null)
|
||||||
|
{
|
||||||
|
source.Engines.Remove(Pizza);
|
||||||
|
source.SaveEngines();
|
||||||
|
return Pizza.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
81
MotorPlantFileImplement/Implements/OrderStorage.cs
Normal file
81
MotorPlantFileImplement/Implements/OrderStorage.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using MotorPlantContracts.BindingModels;
|
||||||
|
using MotorPlantContracts.SearchModels;
|
||||||
|
using MotorPlantContracts.StoragesContracts;
|
||||||
|
using MotorPlantContracts.VeiwModels;
|
||||||
|
using MotorPlantFileImplement.Models;
|
||||||
|
namespace MotorPlantFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class OrderStorage : IOrderStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
public OrderStorage()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
public List<OrderViewModel> GetFullList() => source.Orders.Select(x => AttachEngineName(x.GetViewModel)).ToList();
|
||||||
|
|
||||||
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return source.Orders.Where(x => x.Id == model.Id).Select(x => AttachEngineName(x.GetViewModel)).ToList();
|
||||||
|
}
|
||||||
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return AttachEngineName(source.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel);
|
||||||
|
}
|
||||||
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = source.Orders.Count > 0 ? source.Orders.Max(x => x.Id) + 1 : 1;
|
||||||
|
var newOrder = Order.Create(model);
|
||||||
|
if (newOrder == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
source.Orders.Add(newOrder);
|
||||||
|
source.SaveOrders();
|
||||||
|
return AttachEngineName(newOrder.GetViewModel);
|
||||||
|
}
|
||||||
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
var order = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (order == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
order.Update(model);
|
||||||
|
source.SaveOrders();
|
||||||
|
return AttachEngineName(order.GetViewModel);
|
||||||
|
}
|
||||||
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
var order = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (order != null)
|
||||||
|
{
|
||||||
|
source.Orders.Remove(order);
|
||||||
|
source.SaveOrders();
|
||||||
|
return AttachEngineName(order.GetViewModel);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private OrderViewModel? AttachEngineName(OrderViewModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var engine = source.Engines.FirstOrDefault(x => x.Id == model.EngineId);
|
||||||
|
if (engine != null)
|
||||||
|
{
|
||||||
|
model.EngineName = engine.EngineName;
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
58
MotorPlantFileImplement/Models/Component.cs
Normal file
58
MotorPlantFileImplement/Models/Component.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using MotorPlantContracts.BindingModels;
|
||||||
|
using MotorPlantContracts.VeiwModels;
|
||||||
|
using MotorPlantDataModels.Models;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
namespace MotorPlantFileImplement.Models
|
||||||
|
{
|
||||||
|
public class Component : IComponentModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string ComponentName { get; private set; } = string.Empty;
|
||||||
|
public double Cost { get; set; }
|
||||||
|
public static Component? Create(ComponentBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Component()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ComponentName = model.ComponentName,
|
||||||
|
Cost = model.Cost
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static Component? Create(XElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Component()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
|
ComponentName = element.Element("ComponentName")!.Value,
|
||||||
|
Cost = Convert.ToDouble(element.Element("Cost")!.Value)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(ComponentBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ComponentName = model.ComponentName;
|
||||||
|
Cost = model.Cost;
|
||||||
|
}
|
||||||
|
public ComponentViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ComponentName = ComponentName,
|
||||||
|
Cost = Cost
|
||||||
|
};
|
||||||
|
public XElement GetXElement => new("Component",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("ComponentName", ComponentName),
|
||||||
|
new XElement("Cost", Cost.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
80
MotorPlantFileImplement/Models/Engine.cs
Normal file
80
MotorPlantFileImplement/Models/Engine.cs
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
using MotorPlantDataModels.Models;
|
||||||
|
using MotorPlantContracts.BindingModels;
|
||||||
|
using MotorPlantContracts.VeiwModels;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
namespace MotorPlantFileImplement.Models
|
||||||
|
{
|
||||||
|
public class Engine : IEngineModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string EngineName { get; private set; } = string.Empty;
|
||||||
|
public double Price { get; private set; }
|
||||||
|
public Dictionary<int, int> Components { get; private set; } = new();
|
||||||
|
private Dictionary<int, (IComponentModel, int)>? _EngineComponents = null;
|
||||||
|
public Dictionary<int, (IComponentModel, int)> EngineComponents
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_EngineComponents == null)
|
||||||
|
{
|
||||||
|
var source = DataFileSingleton.GetInstance();
|
||||||
|
_EngineComponents = Components.ToDictionary(x => x.Key, y => ((source.Components.FirstOrDefault(z => z.Id == y.Key) as IComponentModel)!, y.Value));
|
||||||
|
}
|
||||||
|
return _EngineComponents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Engine? Create(EngineBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Engine()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
EngineName = model.EngineName,
|
||||||
|
Price = model.Price,
|
||||||
|
Components = model.EngineComponents.ToDictionary(x => x.Key, x => x.Value.Item2)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static Engine? Create(XElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Engine()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
|
EngineName = element.Element("EngineName")!.Value,
|
||||||
|
Price = Convert.ToDouble(element.Element("Price")!.Value),
|
||||||
|
Components = element.Element("EngineComponents")!.Elements("EngineComponent").ToDictionary(x => Convert.ToInt32(x.Element("Key")?.Value),
|
||||||
|
x => Convert.ToInt32(x.Element("Value")?.Value))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(EngineBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EngineName = model.EngineName;
|
||||||
|
Price = model.Price;
|
||||||
|
Components = model.EngineComponents.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||||
|
_EngineComponents = null;
|
||||||
|
}
|
||||||
|
public EngineViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
EngineName = EngineName,
|
||||||
|
Price = Price,
|
||||||
|
EngineComponents = EngineComponents
|
||||||
|
};
|
||||||
|
public XElement GetXElement => new("Engine",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("EngineName", EngineName),
|
||||||
|
new XElement("Price", Price.ToString()),
|
||||||
|
new XElement("EngineComponents", Components.Select(
|
||||||
|
x => new XElement("EngineComponent", new XElement("Key", x.Key), new XElement("Value", x.Value))).ToArray()));
|
||||||
|
}
|
||||||
|
}
|
||||||
81
MotorPlantFileImplement/Models/Order.cs
Normal file
81
MotorPlantFileImplement/Models/Order.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using MotorPlantContracts.BindingModels;
|
||||||
|
using MotorPlantContracts.VeiwModels;
|
||||||
|
using MotorPlantDataModels.Enums;
|
||||||
|
using MotorPlantDataModels.Models;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
namespace MotorPlantFileImplement.Models
|
||||||
|
{
|
||||||
|
public class Order : IOrderModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int EngineId { 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; } = DateTime.Now;
|
||||||
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
public static Order? Create(OrderBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Order()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
EngineId = model.EngineId,
|
||||||
|
Count = model.Count,
|
||||||
|
Sum = model.Sum,
|
||||||
|
Status = model.Status,
|
||||||
|
DateCreate = model.DateCreate,
|
||||||
|
DateImplement = model.DateImplement
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static Order? Create(XElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
string dateImplement = element.Element("DateImplement")!.Value;
|
||||||
|
return new Order()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
|
EngineId = Convert.ToInt32(element.Element("EngineId")!.Value),
|
||||||
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
|
Status = (OrderStatus)(Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value)),
|
||||||
|
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
|
||||||
|
DateImplement = (dateImplement == "" || dateImplement is null) ? Convert.ToDateTime(null) : Convert.ToDateTime(dateImplement)
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
public void Update(OrderBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Status = model.Status;
|
||||||
|
if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement;
|
||||||
|
}
|
||||||
|
public OrderViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
EngineId = EngineId,
|
||||||
|
Count = Count,
|
||||||
|
Sum = Sum,
|
||||||
|
Status = Status,
|
||||||
|
DateCreate = DateCreate,
|
||||||
|
DateImplement = DateImplement,
|
||||||
|
};
|
||||||
|
public XElement GetXElement => new("Order",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("EngineId", EngineId.ToString()),
|
||||||
|
new XElement("Count", Count.ToString()),
|
||||||
|
new XElement("Sum", Sum.ToString()),
|
||||||
|
new XElement("Status", Status.ToString()),
|
||||||
|
new XElement("DateCreate", DateCreate.ToString()),
|
||||||
|
new XElement("DateImplement", DateImplement.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
14
MotorPlantFileImplement/MotorPlantFileImplement.csproj
Normal file
14
MotorPlantFileImplement/MotorPlantFileImplement.csproj
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\MotorPlantContracts\MotorPlantContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\MotorPlantDataModels\MotorPlantDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
246
MotorPlantView/FormMain.Designer.cs
generated
246
MotorPlantView/FormMain.Designer.cs
generated
@@ -1,16 +1,9 @@
|
|||||||
namespace MotorPlantView.Forms
|
namespace MotorPlantView
|
||||||
{
|
{
|
||||||
partial class FormMain
|
partial class FormMain
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
private System.ComponentModel.IContainer components = null;
|
||||||
/// 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)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
@@ -19,188 +12,151 @@
|
|||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
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()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
toolStrip1 = new ToolStrip();
|
menuStrip = new MenuStrip();
|
||||||
toolStripDropDownButton1 = new ToolStripDropDownButton();
|
cправочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
КомпонентыToolStripMenuItem = new ToolStripMenuItem();
|
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ДвигателиToolStripMenuItem = new ToolStripMenuItem();
|
изделияToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ShopsToolStripMenuItem = new ToolStripMenuItem();
|
dataGridView = new DataGridView();
|
||||||
поставкиToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
buttonCreateOrder = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonTakeOrderInWork = new Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
buttonOrderReady = new Button();
|
buttonOrderReady = new Button();
|
||||||
buttonIssuedOrder = new Button();
|
buttonIssuedOrder = new Button();
|
||||||
buttonRef = new Button();
|
buttonRef = new Button();
|
||||||
dataGridView = new DataGridView();
|
menuStrip.SuspendLayout();
|
||||||
toolStrip1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// toolStrip1
|
// menuStrip
|
||||||
//
|
//
|
||||||
toolStrip1.ImageScalingSize = new Size(20, 20);
|
menuStrip.Items.AddRange(new ToolStripItem[] { cправочникиToolStripMenuItem });
|
||||||
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1 });
|
menuStrip.Location = new Point(0, 0);
|
||||||
toolStrip1.Location = new Point(0, 0);
|
menuStrip.Name = "menuStrip";
|
||||||
toolStrip1.Name = "toolStrip1";
|
menuStrip.Size = new Size(1069, 24);
|
||||||
toolStrip1.Size = new Size(985, 25);
|
menuStrip.TabIndex = 0;
|
||||||
toolStrip1.TabIndex = 0;
|
menuStrip.Text = "menuStrip1";
|
||||||
toolStrip1.Text = "toolStrip1";
|
|
||||||
//
|
//
|
||||||
// toolStripDropDownButton1
|
// cправочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
toolStripDropDownButton1.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
cправочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem });
|
||||||
toolStripDropDownButton1.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыToolStripMenuItem, ДвигателиToolStripMenuItem, ShopsToolStripMenuItem, поставкиToolStripMenuItem });
|
cправочникиToolStripMenuItem.Name = "cправочникиToolStripMenuItem";
|
||||||
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
|
cправочникиToolStripMenuItem.Size = new Size(97, 20);
|
||||||
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
|
cправочникиToolStripMenuItem.Text = "Cправочники";
|
||||||
toolStripDropDownButton1.Size = new Size(90, 22);
|
|
||||||
toolStripDropDownButton1.Text = "Справочник";
|
|
||||||
//
|
//
|
||||||
// КомпонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
КомпонентыToolStripMenuItem.Size = new Size(148, 22);
|
компонентыToolStripMenuItem.Size = new Size(148, 22);
|
||||||
КомпонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// ДвигателиToolStripMenuItem
|
// изделияToolStripMenuItem
|
||||||
//
|
//
|
||||||
ДвигателиToolStripMenuItem.Name = "ДвигателиToolStripMenuItem";
|
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||||
ДвигателиToolStripMenuItem.Size = new Size(148, 22);
|
изделияToolStripMenuItem.Size = new Size(148, 22);
|
||||||
ДвигателиToolStripMenuItem.Text = "Двигатели";
|
изделияToolStripMenuItem.Text = "Изделия";
|
||||||
ДвигателиToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
|
изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
|
||||||
//
|
|
||||||
// ShopsToolStripMenuItem
|
|
||||||
//
|
|
||||||
ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
|
|
||||||
ShopsToolStripMenuItem.Size = new Size(148, 22);
|
|
||||||
ShopsToolStripMenuItem.Text = "Магазины";
|
|
||||||
ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// поставкиToolStripMenuItem
|
|
||||||
//
|
|
||||||
поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem";
|
|
||||||
поставкиToolStripMenuItem.Size = new Size(148, 22);
|
|
||||||
поставкиToolStripMenuItem.Text = "Поставки";
|
|
||||||
поставкиToolStripMenuItem.Click += SupplyToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// buttonCreateOrder
|
|
||||||
//
|
|
||||||
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonCreateOrder.BackColor = SystemColors.ControlLight;
|
|
||||||
buttonCreateOrder.Location = new Point(860, 114);
|
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
|
||||||
buttonCreateOrder.Size = new Size(87, 48);
|
|
||||||
buttonCreateOrder.TabIndex = 1;
|
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = false;
|
|
||||||
buttonCreateOrder.Click += buttonCreateOrder_Click;
|
|
||||||
//
|
|
||||||
// buttonTakeOrderInWork
|
|
||||||
//
|
|
||||||
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonTakeOrderInWork.BackColor = SystemColors.ControlLight;
|
|
||||||
buttonTakeOrderInWork.Location = new Point(860, 178);
|
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
|
||||||
buttonTakeOrderInWork.Size = new Size(87, 48);
|
|
||||||
buttonTakeOrderInWork.TabIndex = 2;
|
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = false;
|
|
||||||
buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
|
|
||||||
//
|
|
||||||
// buttonOrderReady
|
|
||||||
//
|
|
||||||
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonOrderReady.BackColor = SystemColors.ControlLight;
|
|
||||||
buttonOrderReady.Location = new Point(860, 245);
|
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
|
||||||
buttonOrderReady.Size = new Size(87, 48);
|
|
||||||
buttonOrderReady.TabIndex = 3;
|
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
|
||||||
buttonOrderReady.UseVisualStyleBackColor = false;
|
|
||||||
buttonOrderReady.Click += buttonOrderReady_Click;
|
|
||||||
//
|
|
||||||
// buttonIssuedOrder
|
|
||||||
//
|
|
||||||
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonIssuedOrder.BackColor = SystemColors.ControlLight;
|
|
||||||
buttonIssuedOrder.Location = new Point(860, 311);
|
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
|
||||||
buttonIssuedOrder.Size = new Size(87, 48);
|
|
||||||
buttonIssuedOrder.TabIndex = 4;
|
|
||||||
buttonIssuedOrder.Text = "Заказ выдан";
|
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = false;
|
|
||||||
buttonIssuedOrder.Click += buttonIssuedOrder_Click;
|
|
||||||
//
|
|
||||||
// buttonRef
|
|
||||||
//
|
|
||||||
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonRef.BackColor = SystemColors.ControlLight;
|
|
||||||
buttonRef.Location = new Point(860, 60);
|
|
||||||
buttonRef.Name = "buttonRef";
|
|
||||||
buttonRef.Size = new Size(87, 48);
|
|
||||||
buttonRef.TabIndex = 5;
|
|
||||||
buttonRef.Text = "Обновить список";
|
|
||||||
buttonRef.UseVisualStyleBackColor = false;
|
|
||||||
buttonRef.Click += buttonRef_Click;
|
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
dataGridView.BackgroundColor = SystemColors.Control;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(11, 28);
|
dataGridView.Location = new Point(12, 27);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.ReadOnly = true;
|
dataGridView.ReadOnly = true;
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowTemplate.Height = 25;
|
||||||
dataGridView.RowTemplate.Height = 24;
|
dataGridView.Size = new Size(893, 369);
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.TabIndex = 1;
|
||||||
dataGridView.Size = new Size(780, 441);
|
dataGridView.CellContentClick += dataGridView_CellContentClick;
|
||||||
dataGridView.TabIndex = 6;
|
//
|
||||||
|
// buttonCreateOrder
|
||||||
|
//
|
||||||
|
buttonCreateOrder.Location = new Point(923, 43);
|
||||||
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
|
buttonCreateOrder.Size = new Size(117, 40);
|
||||||
|
buttonCreateOrder.TabIndex = 2;
|
||||||
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||||
|
//
|
||||||
|
// buttonTakeOrderInWork
|
||||||
|
//
|
||||||
|
buttonTakeOrderInWork.Location = new Point(923, 100);
|
||||||
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
|
buttonTakeOrderInWork.Size = new Size(117, 42);
|
||||||
|
buttonTakeOrderInWork.TabIndex = 3;
|
||||||
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
|
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||||
|
//
|
||||||
|
// buttonOrderReady
|
||||||
|
//
|
||||||
|
buttonOrderReady.Location = new Point(923, 157);
|
||||||
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
|
buttonOrderReady.Size = new Size(117, 39);
|
||||||
|
buttonOrderReady.TabIndex = 4;
|
||||||
|
buttonOrderReady.Text = "Заказ готов";
|
||||||
|
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||||
|
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||||
|
//
|
||||||
|
// buttonIssuedOrder
|
||||||
|
//
|
||||||
|
buttonIssuedOrder.Location = new Point(923, 214);
|
||||||
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
|
buttonIssuedOrder.Size = new Size(117, 41);
|
||||||
|
buttonIssuedOrder.TabIndex = 5;
|
||||||
|
buttonIssuedOrder.Text = "Заказ выдан";
|
||||||
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
|
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||||
|
//
|
||||||
|
// buttonRef
|
||||||
|
//
|
||||||
|
buttonRef.Location = new Point(923, 274);
|
||||||
|
buttonRef.Name = "buttonRef";
|
||||||
|
buttonRef.Size = new Size(117, 36);
|
||||||
|
buttonRef.TabIndex = 6;
|
||||||
|
buttonRef.Text = "Обновить список";
|
||||||
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
buttonRef.Click += ButtonRef_Click;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(985, 467);
|
ClientSize = new Size(1069, 408);
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(buttonRef);
|
Controls.Add(buttonRef);
|
||||||
Controls.Add(buttonIssuedOrder);
|
Controls.Add(buttonIssuedOrder);
|
||||||
Controls.Add(buttonOrderReady);
|
Controls.Add(buttonOrderReady);
|
||||||
Controls.Add(buttonTakeOrderInWork);
|
Controls.Add(buttonTakeOrderInWork);
|
||||||
Controls.Add(buttonCreateOrder);
|
Controls.Add(buttonCreateOrder);
|
||||||
Controls.Add(toolStrip1);
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(menuStrip);
|
||||||
|
MainMenuStrip = menuStrip;
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Моторный завод";
|
Text = "Моторный завод";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
toolStrip1.ResumeLayout(false);
|
menuStrip.ResumeLayout(false);
|
||||||
toolStrip1.PerformLayout();
|
menuStrip.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
private ToolStrip toolStrip1;
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem cправочникиToolStripMenuItem;
|
||||||
|
private DataGridView dataGridView;
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private Button buttonTakeOrderInWork;
|
private Button buttonTakeOrderInWork;
|
||||||
private Button buttonOrderReady;
|
private Button buttonOrderReady;
|
||||||
private Button buttonIssuedOrder;
|
private Button buttonIssuedOrder;
|
||||||
private Button buttonRef;
|
private Button buttonRef;
|
||||||
private DataGridView dataGridView;
|
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||||
private ToolStripDropDownButton toolStripDropDownButton1;
|
private ToolStripMenuItem изделияToolStripMenuItem;
|
||||||
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem ДвигателиToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem ShopsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem поставкиToolStripMenuItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MotorPlantContracts.BindingModels;
|
using MotorPlantContracts.BindingModels;
|
||||||
using MotorPlantContracts.BusinessLogicsContracts;
|
using MotorPlantContracts.BusinessLogicsContracts;
|
||||||
using MotorPlantView;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MotorPlantDataModels.Enums;
|
||||||
namespace MotorPlantView.Forms
|
namespace MotorPlantView
|
||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
@@ -15,50 +14,7 @@ namespace MotorPlantView.Forms
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
}
|
}
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _orderLogic.ReadList(null);
|
|
||||||
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["EngineId"].Visible = false;
|
|
||||||
dataGridView.Columns["EngineName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
|
||||||
|
|
||||||
if (service is FormComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormEngines));
|
|
||||||
|
|
||||||
if (service is FormEngines form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
if (service is FormCreateOrder form)
|
if (service is FormCreateOrder form)
|
||||||
@@ -67,7 +23,7 @@ namespace MotorPlantView.Forms
|
|||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
|
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
@@ -78,6 +34,12 @@ namespace MotorPlantView.Forms
|
|||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
|
EngineId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["EngineId"].Value),
|
||||||
|
EngineName = dataGridView.SelectedRows[0].Cells["EngineName"].Value.ToString(),
|
||||||
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||||
});
|
});
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
@@ -92,19 +54,61 @@ namespace MotorPlantView.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void buttonOrderReady_Click(object sender, EventArgs e)
|
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
int id =
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD> <20>{id}. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> '<27><><EFBFBD><EFBFBD><EFBFBD>'", id);
|
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD> <20>{id}. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> '<27><><EFBFBD><EFBFBD><EFBFBD>'", id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
EngineId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["EngineId"].Value),
|
||||||
|
EngineName = dataGridView.SelectedRows[0].Cells["EngineName"].Value.ToString(),
|
||||||
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||||
|
});
|
||||||
|
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>.");
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'");
|
||||||
|
}
|
||||||
|
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD> <20>{id} <20><><EFBFBD><EFBFBD><EFBFBD>", id);
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
|
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD> <20>{id}. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> '<27><><EFBFBD><EFBFBD><EFBFBD>'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
EngineId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["EngineId"].Value),
|
||||||
|
EngineName = dataGridView.SelectedRows[0].Cells["EngineName"].Value.ToString(),
|
||||||
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '<27><><EFBFBD><EFBFBD><EFBFBD>'");
|
||||||
}
|
}
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
@@ -115,50 +119,49 @@ namespace MotorPlantView.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void buttonIssuedOrder_Click(object sender, EventArgs e)
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
LoadData();
|
||||||
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD> <20>{id}. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> '<27><><EFBFBD><EFBFBD><EFBFBD>'", id);
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
var list = _orderLogic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
{
|
{
|
||||||
Id = id
|
dataGridView.DataSource = list;
|
||||||
});
|
dataGridView.Columns["EngineId"].Visible = false;
|
||||||
if (!operationResult)
|
dataGridView.Columns["EngineName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
{
|
|
||||||
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>.");
|
|
||||||
}
|
}
|
||||||
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD> <20>{id} <20><><EFBFBD><EFBFBD><EFBFBD>", id);
|
_logger.LogInformation("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
LoadData();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
_logger.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
|
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
private void <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
private void buttonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
LoadData();
|
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
||||||
}
|
if (service is FormComponents form)
|
||||||
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
|
||||||
|
|
||||||
if (service is FormShops form)
|
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SupplyToolStripMenuItem_Click(object sender, EventArgs e)
|
private void <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSupply));
|
var service = Program.ServiceProvider?.GetService(typeof(FormEngines));
|
||||||
|
if (service is FormEngines form)
|
||||||
if (service is FormSupply form)
|
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|||||||
193
MotorPlantView/FormShop.Designer.cs
generated
193
MotorPlantView/FormShop.Designer.cs
generated
@@ -1,193 +0,0 @@
|
|||||||
namespace MotorPlantView
|
|
||||||
{
|
|
||||||
partial class FormShop
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
dateTimePicker = new DateTimePicker();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
textBoxAdress = new TextBox();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
IdColumn = new DataGridViewTextBoxColumn();
|
|
||||||
Title = new DataGridViewTextBoxColumn();
|
|
||||||
Cost = new DataGridViewTextBoxColumn();
|
|
||||||
Count = new DataGridViewTextBoxColumn();
|
|
||||||
buttonSave = new Button();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
label3 = new Label();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dateTimePicker
|
|
||||||
//
|
|
||||||
dateTimePicker.Location = new Point(714, 34);
|
|
||||||
dateTimePicker.Name = "dateTimePicker";
|
|
||||||
dateTimePicker.Size = new Size(250, 27);
|
|
||||||
dateTimePicker.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(714, 85);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(250, 27);
|
|
||||||
textBoxName.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// textBoxAdress
|
|
||||||
//
|
|
||||||
textBoxAdress.Location = new Point(714, 139);
|
|
||||||
textBoxAdress.Name = "textBoxAdress";
|
|
||||||
textBoxAdress.Size = new Size(250, 27);
|
|
||||||
textBoxAdress.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { IdColumn, Title, Cost, Count });
|
|
||||||
dataGridView.Location = new Point(10, 32);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.Size = new Size(554, 380);
|
|
||||||
dataGridView.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// IdColumn
|
|
||||||
//
|
|
||||||
IdColumn.HeaderText = "Номер платья";
|
|
||||||
IdColumn.MinimumWidth = 6;
|
|
||||||
IdColumn.Name = "IdColumn";
|
|
||||||
IdColumn.Visible = false;
|
|
||||||
IdColumn.Width = 125;
|
|
||||||
//
|
|
||||||
// Title
|
|
||||||
//
|
|
||||||
Title.HeaderText = "Название";
|
|
||||||
Title.MinimumWidth = 6;
|
|
||||||
Title.Name = "Title";
|
|
||||||
Title.Width = 125;
|
|
||||||
//
|
|
||||||
// Cost
|
|
||||||
//
|
|
||||||
Cost.HeaderText = "Цена";
|
|
||||||
Cost.MinimumWidth = 6;
|
|
||||||
Cost.Name = "Cost";
|
|
||||||
Cost.Width = 125;
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
Count.HeaderText = "Количество";
|
|
||||||
Count.MinimumWidth = 6;
|
|
||||||
Count.Name = "Count";
|
|
||||||
Count.Width = 125;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(714, 219);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(94, 29);
|
|
||||||
buttonSave.TabIndex = 4;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += buttonSave_Click;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(870, 219);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(94, 29);
|
|
||||||
buttonCancel.TabIndex = 5;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
buttonCancel.Click += buttonCancel_Click;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(592, 39);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(110, 20);
|
|
||||||
label1.TabIndex = 6;
|
|
||||||
label1.Text = "Дата создания";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(592, 88);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(77, 20);
|
|
||||||
label2.TabIndex = 7;
|
|
||||||
label2.Text = "Название";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(592, 142);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(51, 20);
|
|
||||||
label3.TabIndex = 8;
|
|
||||||
label3.Text = "Адрес";
|
|
||||||
//
|
|
||||||
// ShopForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(976, 450);
|
|
||||||
Controls.Add(label3);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonSave);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(textBoxAdress);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(dateTimePicker);
|
|
||||||
Name = "ShopForm";
|
|
||||||
Text = "Форма магазина";
|
|
||||||
Load += ShopForm_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DateTimePicker dateTimePicker;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private TextBox textBoxAdress;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
private DataGridViewTextBoxColumn IdColumn;
|
|
||||||
private DataGridViewTextBoxColumn Title;
|
|
||||||
private DataGridViewTextBoxColumn Cost;
|
|
||||||
private DataGridViewTextBoxColumn Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.BusinessLogicsContracts;
|
|
||||||
using MotorPlantContracts.SearchModels;
|
|
||||||
using MotorPlantDataModels.Models;
|
|
||||||
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 MotorPlantView
|
|
||||||
{
|
|
||||||
public partial class FormShop : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IShopLogic _logic;
|
|
||||||
public int? _id;
|
|
||||||
private Dictionary<int, (IEngineModel, int)> _engine;
|
|
||||||
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShopForm_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Shop load");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var shop = _logic.ReadElement(new ShopSearchModel { Id = _id });
|
|
||||||
if (shop != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = shop.ShopName;
|
|
||||||
textBoxAdress.Text = shop.Adress;
|
|
||||||
dateTimePicker.Text = shop.DateOpen.ToString();
|
|
||||||
_engine = shop.ShopEngines;
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Load shop error");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Load engines");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_engine != null)
|
|
||||||
{
|
|
||||||
foreach (var engine in _engine)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { engine.Key, engine.Value.Item1.EngineName, engine.Value.Item1.Price, engine.Value.Item2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Load engines into shop error");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxAdress.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Save shop");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ShopBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ShopName = textBoxName.Text,
|
|
||||||
Adress = textBoxAdress.Text,
|
|
||||||
DateOpen = dateTimePicker.Value.Date,
|
|
||||||
ShopEngines = _engine
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Save shop error");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
||||||
114
MotorPlantView/FormShops.Designer.cs
generated
114
MotorPlantView/FormShops.Designer.cs
generated
@@ -1,114 +0,0 @@
|
|||||||
namespace MotorPlantView
|
|
||||||
{
|
|
||||||
partial class FormShops
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
buttonUpdate = new Button();
|
|
||||||
buttonReset = new Button();
|
|
||||||
buttonDelete = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(12, 12);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowTemplate.Height = 25;
|
|
||||||
dataGridView.Size = new Size(617, 426);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.Location = new Point(665, 114);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(123, 45);
|
|
||||||
buttonAdd.TabIndex = 1;
|
|
||||||
buttonAdd.Text = "Добавить";
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
buttonUpdate.Location = new Point(665, 165);
|
|
||||||
buttonUpdate.Name = "buttonUpdate";
|
|
||||||
buttonUpdate.Size = new Size(123, 44);
|
|
||||||
buttonUpdate.TabIndex = 2;
|
|
||||||
buttonUpdate.Text = "Изменить";
|
|
||||||
buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
buttonUpdate.Click += buttonUpdate_Click;
|
|
||||||
//
|
|
||||||
// buttonReset
|
|
||||||
//
|
|
||||||
buttonReset.Location = new Point(665, 215);
|
|
||||||
buttonReset.Name = "buttonReset";
|
|
||||||
buttonReset.Size = new Size(123, 48);
|
|
||||||
buttonReset.TabIndex = 3;
|
|
||||||
buttonReset.Text = "Обновить";
|
|
||||||
buttonReset.UseVisualStyleBackColor = true;
|
|
||||||
buttonReset.Click += buttonReset_Click;
|
|
||||||
//
|
|
||||||
// buttonDelete
|
|
||||||
//
|
|
||||||
buttonDelete.Location = new Point(665, 269);
|
|
||||||
buttonDelete.Name = "buttonDelete";
|
|
||||||
buttonDelete.Size = new Size(123, 48);
|
|
||||||
buttonDelete.TabIndex = 4;
|
|
||||||
buttonDelete.Text = "Удалить";
|
|
||||||
buttonDelete.UseVisualStyleBackColor = true;
|
|
||||||
buttonDelete.Click += buttonDelete_Click;
|
|
||||||
//
|
|
||||||
// FormShops
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(buttonDelete);
|
|
||||||
Controls.Add(buttonReset);
|
|
||||||
Controls.Add(buttonUpdate);
|
|
||||||
Controls.Add(buttonAdd);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Name = "FormShops";
|
|
||||||
Text = "FormShops";
|
|
||||||
Load += FormShops_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonReset;
|
|
||||||
private Button buttonDelete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MotorPlantContracts.BindingModels;
|
|
||||||
using MotorPlantContracts.BusinessLogicsContracts;
|
|
||||||
using MotorPlantView.Forms;
|
|
||||||
|
|
||||||
namespace MotorPlantView
|
|
||||||
{
|
|
||||||
public partial class FormShops : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IShopLogic _logic;
|
|
||||||
public FormShops(ILogger<FormShops> logger, IShopLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["Adress"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["DateOpen"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["ShopEngines"].Visible = false;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Load shops");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Load shop error");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void FormShops_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
|
||||||
if (service is FormShop form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
|
||||||
if (service is FormShop form)
|
|
||||||
{
|
|
||||||
var tmp = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
form._id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonReset_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonDelete_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление магазина");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ShopBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления магазина");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
||||||
147
MotorPlantView/FormSupply.Designer.cs
generated
147
MotorPlantView/FormSupply.Designer.cs
generated
@@ -1,147 +0,0 @@
|
|||||||
namespace MotorPlantView
|
|
||||||
{
|
|
||||||
partial class FormSupply
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
ShopComboBox = new ComboBox();
|
|
||||||
EngineComboBox = new ComboBox();
|
|
||||||
CountTextBox = new TextBox();
|
|
||||||
SaveButton = new Button();
|
|
||||||
Cancel = new Button();
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
label3 = new Label();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// ShopComboBox
|
|
||||||
//
|
|
||||||
ShopComboBox.FormattingEnabled = true;
|
|
||||||
ShopComboBox.Location = new Point(136, 26);
|
|
||||||
ShopComboBox.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
ShopComboBox.Name = "ShopComboBox";
|
|
||||||
ShopComboBox.Size = new Size(279, 23);
|
|
||||||
ShopComboBox.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// EngineComboBox
|
|
||||||
//
|
|
||||||
EngineComboBox.FormattingEnabled = true;
|
|
||||||
EngineComboBox.Location = new Point(136, 59);
|
|
||||||
EngineComboBox.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
EngineComboBox.Name = "EngineComboBox";
|
|
||||||
EngineComboBox.Size = new Size(279, 23);
|
|
||||||
EngineComboBox.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// CountTextBox
|
|
||||||
//
|
|
||||||
CountTextBox.Location = new Point(136, 96);
|
|
||||||
CountTextBox.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
CountTextBox.Name = "CountTextBox";
|
|
||||||
CountTextBox.Size = new Size(279, 23);
|
|
||||||
CountTextBox.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// SaveButton
|
|
||||||
//
|
|
||||||
SaveButton.Location = new Point(220, 150);
|
|
||||||
SaveButton.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
SaveButton.Name = "SaveButton";
|
|
||||||
SaveButton.Size = new Size(94, 27);
|
|
||||||
SaveButton.TabIndex = 3;
|
|
||||||
SaveButton.Text = "Сохранить";
|
|
||||||
SaveButton.UseVisualStyleBackColor = true;
|
|
||||||
SaveButton.Click += SaveButton_Click;
|
|
||||||
//
|
|
||||||
// Cancel
|
|
||||||
//
|
|
||||||
Cancel.Location = new Point(319, 150);
|
|
||||||
Cancel.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
Cancel.Name = "Cancel";
|
|
||||||
Cancel.Size = new Size(94, 27);
|
|
||||||
Cancel.TabIndex = 4;
|
|
||||||
Cancel.Text = "Отмена";
|
|
||||||
Cancel.UseVisualStyleBackColor = true;
|
|
||||||
Cancel.Click += CancelButton_Click;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(35, 28);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(54, 15);
|
|
||||||
label1.TabIndex = 5;
|
|
||||||
label1.Text = "Магазин";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(35, 62);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(64, 15);
|
|
||||||
label2.TabIndex = 6;
|
|
||||||
label2.Text = "Двигатели";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(35, 98);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(72, 15);
|
|
||||||
label3.TabIndex = 7;
|
|
||||||
label3.Text = "Количество";
|
|
||||||
//
|
|
||||||
// FormSupply
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(443, 195);
|
|
||||||
Controls.Add(label3);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(Cancel);
|
|
||||||
Controls.Add(SaveButton);
|
|
||||||
Controls.Add(CountTextBox);
|
|
||||||
Controls.Add(EngineComboBox);
|
|
||||||
Controls.Add(ShopComboBox);
|
|
||||||
Margin = new Padding(3, 2, 3, 2);
|
|
||||||
Name = "FormSupply";
|
|
||||||
Text = "Форма поставки";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private ComboBox ShopComboBox;
|
|
||||||
private ComboBox EngineComboBox;
|
|
||||||
private TextBox CountTextBox;
|
|
||||||
private Button SaveButton;
|
|
||||||
private Button Cancel;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
using MotorPlantContracts.BusinessLogicsContracts;
|
|
||||||
using MotorPlantContracts.SearchModels;
|
|
||||||
using MotorPlantContracts.VeiwModels;
|
|
||||||
using MotorPlantContracts.ViewModels;
|
|
||||||
using MotorPlantDataModels.Models;
|
|
||||||
|
|
||||||
namespace MotorPlantView
|
|
||||||
{
|
|
||||||
public partial class FormSupply : Form
|
|
||||||
{
|
|
||||||
private readonly List<EngineViewModel>? _engineList;
|
|
||||||
private readonly List<ShopViewModel>? _shopsList;
|
|
||||||
IShopLogic _shopLogic;
|
|
||||||
IEngineLogic _engineLogic;
|
|
||||||
public int ShopId
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Convert.ToInt32(ShopComboBox.SelectedValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
ShopComboBox.SelectedValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int EngineId
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Convert.ToInt32(EngineComboBox.SelectedValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
EngineComboBox.SelectedValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEngineModel? EngineModel
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_engineList == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _engineList)
|
|
||||||
{
|
|
||||||
if (elem.Id == EngineId)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return Convert.ToInt32(CountTextBox.Text); }
|
|
||||||
set
|
|
||||||
{ CountTextBox.Text = value.ToString(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormSupply(IEngineLogic engineLogic, IShopLogic shopLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_shopLogic = shopLogic;
|
|
||||||
_engineLogic = engineLogic;
|
|
||||||
_engineList = engineLogic.ReadList(null);
|
|
||||||
_shopsList = shopLogic.ReadList(null);
|
|
||||||
if (_engineList != null)
|
|
||||||
{
|
|
||||||
EngineComboBox.DisplayMember = "EngineName";
|
|
||||||
EngineComboBox.ValueMember = "Id";
|
|
||||||
EngineComboBox.DataSource = _engineList;
|
|
||||||
EngineComboBox.SelectedItem = null;
|
|
||||||
}
|
|
||||||
if (_shopsList != null)
|
|
||||||
{
|
|
||||||
ShopComboBox.DisplayMember = "ShopName";
|
|
||||||
ShopComboBox.ValueMember = "Id";
|
|
||||||
ShopComboBox.DataSource = _shopsList;
|
|
||||||
ShopComboBox.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(CountTextBox.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (EngineComboBox.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите двигатель", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ShopComboBox.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите магазин", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int count = Convert.ToInt32(CountTextBox.Text);
|
|
||||||
|
|
||||||
bool res = _shopLogic.MakeSupply(
|
|
||||||
new ShopSearchModel() { Id = Convert.ToInt32(ShopComboBox.SelectedValue) },
|
|
||||||
_engineLogic.ReadElement(new() { Id = Convert.ToInt32(EngineComboBox.SelectedValue) }),
|
|
||||||
count
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!res)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при пополнении. Дополнительная информация в логах");
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageBox.Show("Пополнение прошло успешно");
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception er)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Ошибка пополнения");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CancelButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<ProjectReference Include="..\MoorPlantListImplement\MotorPlantListImplement.csproj" />
|
<ProjectReference Include="..\MoorPlantListImplement\MotorPlantListImplement.csproj" />
|
||||||
<ProjectReference Include="..\MotorPlantBusinessLogic\MotorPlantBusinessLogic.csproj" />
|
<ProjectReference Include="..\MotorPlantBusinessLogic\MotorPlantBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\MotorPlantDataModels\MotorPlantDataModels.csproj" />
|
<ProjectReference Include="..\MotorPlantDataModels\MotorPlantDataModels.csproj" />
|
||||||
|
<ProjectReference Include="..\MotorPlantFileImplement\MotorPlantFileImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
|
using MotorPlantBusinessLogic.BusinessLogic;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using MotorPlantContracts.BusinessLogicsContracts;
|
using MotorPlantContracts.BusinessLogicsContracts;
|
||||||
using MotorPlantContracts.StoragesContracts;
|
using MotorPlantContracts.StoragesContracts;
|
||||||
using MotorPlantListImplement.Implements;
|
using MotorPlantFileImplement.Implements;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using MotorPlantBusinessLogic.BusinessLogics;
|
using MotorPlantBusinessLogic.BusinessLogics;
|
||||||
using MotorPlantBusinessLogic.BusinessLogic;
|
|
||||||
using MotorPlantView.Forms;
|
|
||||||
|
|
||||||
namespace MotorPlantView
|
namespace MotorPlantView
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@@ -23,7 +21,6 @@ namespace MotorPlantView
|
|||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddLogging(option =>
|
services.AddLogging(option =>
|
||||||
@@ -37,8 +34,6 @@ namespace MotorPlantView
|
|||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IEngineLogic, EngineLogic>();
|
services.AddTransient<IEngineLogic, EngineLogic>();
|
||||||
services.AddTransient<IShopStorage, ShopStorage>();
|
|
||||||
services.AddTransient<IShopLogic, ShopLogic>();
|
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormComponent>();
|
services.AddTransient<FormComponent>();
|
||||||
services.AddTransient<FormComponents>();
|
services.AddTransient<FormComponents>();
|
||||||
@@ -46,9 +41,6 @@ namespace MotorPlantView
|
|||||||
services.AddTransient<FormEngine>();
|
services.AddTransient<FormEngine>();
|
||||||
services.AddTransient<FormEngineComponent>();
|
services.AddTransient<FormEngineComponent>();
|
||||||
services.AddTransient<FormEngines>();
|
services.AddTransient<FormEngines>();
|
||||||
services.AddTransient<FormShop>();
|
|
||||||
services.AddTransient<FormShops>();
|
|
||||||
services.AddTransient<FormSupply>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user