Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f178a8a2cb | |||
| 04aca8c706 | |||
| 76c4c7c18d | |||
| d258735aae | |||
| 25607a573b | |||
| b44125677a | |||
| 9a42abc8fc | |||
| 712140a156 |
@@ -1,118 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDatabaseImplement;
|
|
||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationDatabaseImplement.Models
|
|
||||||
{
|
|
||||||
public class Shop : IShopModel
|
|
||||||
{
|
|
||||||
[Required]
|
|
||||||
public string Name { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string Address { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public int MaxCountPackages { get; private set; }
|
|
||||||
|
|
||||||
public DateTime DateOpening { get; private set; }
|
|
||||||
|
|
||||||
private Dictionary<int, (IPackageModel, int)>? _cachedPackages = null;
|
|
||||||
[NotMapped]
|
|
||||||
public Dictionary<int, (IPackageModel, int)> Packages
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_cachedPackages == null)
|
|
||||||
{
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
_cachedPackages = ShopPackages
|
|
||||||
.ToDictionary(x => x.PackageId, x => (context.Packages
|
|
||||||
.FirstOrDefault(y => y.Id == x.PackageId)! as IPackageModel, x.Count));
|
|
||||||
}
|
|
||||||
return _cachedPackages;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
[ForeignKey("ShopId")]
|
|
||||||
public virtual List<ShopPackage> ShopPackages { get; set; } = new();
|
|
||||||
|
|
||||||
public static Shop? Create(SoftwareInstallationDatabase context, ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Shop()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
Name = model.Name,
|
|
||||||
Address = model.Address,
|
|
||||||
DateOpening = model.DateOpening,
|
|
||||||
MaxCountPackages = model.MaxCountPackages,
|
|
||||||
ShopPackages = model.Packages.Select(x => new ShopPackage
|
|
||||||
{
|
|
||||||
Package = context.Packages.FirstOrDefault(y => y.Id == x.Key)!,
|
|
||||||
Count = x.Value.Item2,
|
|
||||||
}).ToList()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void Update(ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Name = model.Name;
|
|
||||||
Address = model.Address;
|
|
||||||
DateOpening = model.DateOpening;
|
|
||||||
}
|
|
||||||
public ShopViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
Name = Name,
|
|
||||||
Address = Address,
|
|
||||||
Packages = Packages,
|
|
||||||
DateOpening = DateOpening,
|
|
||||||
MaxCountPackages = MaxCountPackages,
|
|
||||||
};
|
|
||||||
|
|
||||||
public void UpdatePackages(SoftwareInstallationDatabase context, ShopBindingModel model)
|
|
||||||
{
|
|
||||||
var shopPackages = context.ShopPackages
|
|
||||||
.Where(rec => rec.ShopId == model.Id)
|
|
||||||
.ToList();
|
|
||||||
// удалили те, которых нет в модели
|
|
||||||
if (shopPackages != null && shopPackages.Count > 0)
|
|
||||||
{
|
|
||||||
context.ShopPackages
|
|
||||||
.RemoveRange(shopPackages
|
|
||||||
.Where(rec => !model.Packages
|
|
||||||
.ContainsKey(rec.PackageId)));
|
|
||||||
// обновили количество у существующих записей
|
|
||||||
foreach (var updatePackage in shopPackages.Where(x => model.Packages.ContainsKey(x.PackageId)))
|
|
||||||
{
|
|
||||||
updatePackage.Count = model.Packages[updatePackage.PackageId].Item2;
|
|
||||||
model.Packages.Remove(updatePackage.PackageId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var shop = context.Shops.First(x => x.Id == model.Id);
|
|
||||||
shop.ShopPackages.AddRange(model.Packages.Select(x => new ShopPackage
|
|
||||||
{
|
|
||||||
Package = context.Packages.First(y => y.Id == x.Key),
|
|
||||||
Count = x.Value.Item2,
|
|
||||||
}).Except(shopPackages ?? new()));
|
|
||||||
context.SaveChanges();
|
|
||||||
_cachedPackages = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using SoftwareInstallationDatabaseImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationDatabaseImplement.Models
|
|
||||||
{
|
|
||||||
public class ShopPackage
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
[Required]
|
|
||||||
public int PackageId { get; set; }
|
|
||||||
[Required]
|
|
||||||
public int ShopId { get; set; }
|
|
||||||
[Required]
|
|
||||||
public int Count { get; set; }
|
|
||||||
|
|
||||||
public virtual Shop Shop { get; set; } = new();
|
|
||||||
public virtual Package Package { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDatabaseImplement.Models;
|
|
||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationDatabaseImplement
|
|
||||||
{
|
|
||||||
public class ShopStorage : IShopStorage
|
|
||||||
{
|
|
||||||
|
|
||||||
public ShopViewModel? Delete(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
var element = context.Shops.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
context.Shops.Remove(element);
|
|
||||||
context.SaveChanges();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
return context.Shops
|
|
||||||
.Include(x => x.ShopPackages)
|
|
||||||
.ThenInclude(x => x.Package)
|
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
return context.Shops
|
|
||||||
.Include(x => x.ShopPackages)
|
|
||||||
.ThenInclude(x => x.Package)
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.Where(x => x.Name.Contains(model.Name ?? string.Empty))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ShopViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
return context.Shops
|
|
||||||
.Include(x => x.ShopPackages)
|
|
||||||
.ThenInclude(x => x.Package)
|
|
||||||
.Select(shop => shop.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? Insert(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
using var transaction = context.Database.BeginTransaction();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var newShop = Shop.Create(context, model);
|
|
||||||
if (newShop == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (context.Shops.Any(x => x.Name == newShop.Name))
|
|
||||||
{
|
|
||||||
throw new Exception("Не должно быть два магазина с одним названием");
|
|
||||||
}
|
|
||||||
context.Shops.Add(newShop);
|
|
||||||
context.SaveChanges();
|
|
||||||
transaction.Commit();
|
|
||||||
return newShop.GetViewModel;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
transaction.Rollback();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? Update(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
var shop = context.Shops.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (shop == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
shop.Update(model);
|
|
||||||
shop.UpdatePackages(context, model);
|
|
||||||
context.SaveChanges();
|
|
||||||
return shop.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasNeedPackages(IPackageModel package, int needCount)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SellPackages(IPackageModel package, int needCount)
|
|
||||||
{
|
|
||||||
using var context = new SoftwareInstallationDatabase();
|
|
||||||
using var transaction = context.Database.BeginTransaction();
|
|
||||||
foreach (var sp in context.ShopPackages.Where(x => x.PackageId == package.Id))
|
|
||||||
{
|
|
||||||
var res = Math.Min(needCount, sp.Count);
|
|
||||||
sp.Count -= res;
|
|
||||||
needCount -= res;
|
|
||||||
if (sp.Count == 0) // Изделия больше нет в магазине, значит удаляем его
|
|
||||||
{
|
|
||||||
context.ShopPackages.Remove(sp);
|
|
||||||
}
|
|
||||||
if (needCount == 0) // Нельзя коммитить изменения в цикле, что использует контекст, поэтому выходим
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (needCount == 0)
|
|
||||||
{
|
|
||||||
context.SaveChanges();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
transaction.Rollback();
|
|
||||||
}
|
|
||||||
return needCount == 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ using SoftwareInstallationContracts.ViewModels;
|
|||||||
using SoftwareInstallationDataModels.Models;
|
using SoftwareInstallationDataModels.Models;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement.Models
|
namespace SoftwareInstallationFileImplement.Models
|
||||||
{
|
{
|
||||||
public class Component : IComponentModel
|
public class Component : IComponentModel
|
||||||
@@ -11,7 +10,7 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public string ComponentName { get; private set; } = string.Empty;
|
public string ComponentName { get; private set; } = string.Empty;
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
public static Component? Create(ComponentBindingModel model)
|
public static Component? Create(ComponentBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@@ -37,7 +36,7 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
Cost = Convert.ToDouble(element.Element("Cost")!.Value)
|
Cost = Convert.ToDouble(element.Element("Cost")!.Value)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(ComponentBindingModel model)
|
public void Update(ComponentBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,16 +8,14 @@ namespace SoftwareInstallationFileImplement.Implements
|
|||||||
{
|
{
|
||||||
public class ComponentStorage : IComponentStorage
|
public class ComponentStorage : IComponentStorage
|
||||||
{
|
{
|
||||||
private readonly DataFileSingleton _source;
|
private readonly DataFileSingleton source;
|
||||||
public ComponentStorage()
|
public ComponentStorage()
|
||||||
{
|
{
|
||||||
_source = DataFileSingleton.GetInstance();
|
source = DataFileSingleton.GetInstance();
|
||||||
}
|
}
|
||||||
public List<ComponentViewModel> GetFullList()
|
public List<ComponentViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return _source.Components
|
return source.Components.Select(x => x.GetViewModel).ToList();
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel model)
|
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel model)
|
||||||
{
|
{
|
||||||
@@ -25,10 +23,7 @@ namespace SoftwareInstallationFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
return _source.Components
|
return source.Components.Where(x => x.ComponentName.Contains(model.ComponentName)).Select(x => x.GetViewModel).ToList();
|
||||||
.Where(x => x.ComponentName.Contains(model.ComponentName))
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
||||||
{
|
{
|
||||||
@@ -36,41 +31,42 @@ namespace SoftwareInstallationFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return _source.Components.FirstOrDefault(x =>
|
return source.Components.FirstOrDefault(x =>
|
||||||
(!string.IsNullOrEmpty(model.ComponentName) &&
|
(!string.IsNullOrEmpty(model.ComponentName) &&
|
||||||
x.ComponentName == model.ComponentName) ||
|
x.ComponentName == model.ComponentName) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
public ComponentViewModel? Insert(ComponentBindingModel model)
|
public ComponentViewModel? Insert(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
model.Id = _source.Components.Count > 0 ? _source.Components.Max(x => x.Id) + 1 : 1;
|
model.Id = source.Components.Count > 0 ? source.Components.Max(x => x.Id) + 1 : 1;
|
||||||
var newComponent = Component.Create(model);
|
var newComponent = Component.Create(model);
|
||||||
if (newComponent == null)
|
if (newComponent == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_source.Components.Add(newComponent);
|
source.Components.Add(newComponent);
|
||||||
_source.SaveComponents();
|
source.SaveComponents();
|
||||||
return newComponent.GetViewModel;
|
return newComponent.GetViewModel;
|
||||||
}
|
}
|
||||||
public ComponentViewModel? Update(ComponentBindingModel model)
|
public ComponentViewModel? Update(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
var component = _source.Components.FirstOrDefault(x => x.Id == model.Id);
|
var component = source.Components.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (component == null)
|
if (component == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
component.Update(model);
|
component.Update(model);
|
||||||
_source.SaveComponents();
|
source.SaveComponents();
|
||||||
return component.GetViewModel;
|
return component.GetViewModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
public ComponentViewModel? Delete(ComponentBindingModel model)
|
public ComponentViewModel? Delete(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
var element = _source.Components.FirstOrDefault(x => x.Id == model.Id);
|
var element = source.Components.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
_source.Components.Remove(element);
|
source.Components.Remove(element);
|
||||||
_source.SaveComponents();
|
source.SaveComponents();
|
||||||
return element.GetViewModel;
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -9,11 +9,9 @@ namespace SoftwareInstallationFileImplement
|
|||||||
private readonly string ComponentFileName = "Component.xml";
|
private readonly string ComponentFileName = "Component.xml";
|
||||||
private readonly string OrderFileName = "Order.xml";
|
private readonly string OrderFileName = "Order.xml";
|
||||||
private readonly string PackageFileName = "Package.xml";
|
private readonly string PackageFileName = "Package.xml";
|
||||||
private readonly string ShopFileName = "Shop.xml";
|
|
||||||
public List<Component> Components { get; private set; }
|
public List<Component> Components { get; private set; }
|
||||||
public List<Order> Orders { get; private set; }
|
public List<Order> Orders { get; private set; }
|
||||||
public List<Package> Packages { get; private set; }
|
public List<Package> Packages { get; private set; }
|
||||||
public List<Shop> Shops { get; private set; }
|
|
||||||
|
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
@@ -23,23 +21,21 @@ namespace SoftwareInstallationFileImplement
|
|||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
|
public void SaveComponents() => SaveData(Components, ComponentFileName,"Components", x => x.GetXElement);
|
||||||
public void SavePackages() => SaveData(Packages, PackageFileName, "Packages", x => x.GetXElement);
|
public void SavePackages() => SaveData(Packages, PackageFileName, "Packages", x => x.GetXElement);
|
||||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||||
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
|
||||||
|
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||||
Packages = LoadData(PackageFileName, "Package", x => Package.Create(x)!)!;
|
Packages = LoadData(PackageFileName, "Package", x => Package.Create(x)!)!;
|
||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
|
||||||
}
|
}
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList();
|
return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList();
|
||||||
}
|
}
|
||||||
return new List<T>();
|
return new List<T>();
|
||||||
}
|
}
|
||||||
@@ -51,4 +47,4 @@ namespace SoftwareInstallationFileImplement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using SoftwareInstallationFileImplement.Models;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationFileImplement
|
||||||
|
{
|
||||||
|
public class DataListSingleton
|
||||||
|
{
|
||||||
|
private static DataListSingleton? _instance;
|
||||||
|
public List<Component> Components { get; set; }
|
||||||
|
public List<Order> Orders { get; set; }
|
||||||
|
public List<Package> Packages { get; set; }
|
||||||
|
private DataListSingleton()
|
||||||
|
{
|
||||||
|
Components = new List<Component>();
|
||||||
|
Orders = new List<Order>();
|
||||||
|
Packages = new List<Package>();
|
||||||
|
}
|
||||||
|
public static DataListSingleton GetInstance()
|
||||||
|
{
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = new DataListSingleton();
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using SoftwareInstallationDataModels.Enums;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
using SoftwareInstallationDataModels.Models;
|
||||||
|
using SoftwareInstallationDataModels.Enums;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement.Models
|
namespace SoftwareInstallationFileImplement.Models
|
||||||
{
|
{
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public int PackageId { get; private set; }
|
public int PackageId { get; private set; }
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
@@ -22,6 +20,8 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@@ -39,6 +39,7 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Order? Create(XElement element)
|
public static Order? Create(XElement element)
|
||||||
{
|
{
|
||||||
if (element == null)
|
if (element == null)
|
||||||
@@ -48,12 +49,12 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
var dateImplement = element.Element("DateImplement")!.Value;
|
var dateImplement = element.Element("DateImplement")!.Value;
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
Status = (OrderStatus)Convert.ToInt32(element.Element("Status")!.Value),
|
Status = (OrderStatus)Convert.ToInt32(element.Element("Status")!.Value),
|
||||||
PackageId = Convert.ToInt32(element.Element("PackageId")!.Value),
|
PackageId = Convert.ToInt32(element.Element("PackageId")!.Value),
|
||||||
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
|
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
|
||||||
DateImplement = string.IsNullOrEmpty(dateImplement) ? null : Convert.ToDateTime(dateImplement),
|
DateImplement = string.IsNullOrEmpty(dateImplement) ? null : Convert.ToDateTime(dateImplement),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -64,14 +65,10 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PackageId = model.PackageId;
|
|
||||||
Count = model.Count;
|
|
||||||
Sum = model.Sum;
|
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateCreate = model.DateCreate;
|
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
Id = model.Id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
PackageName = DataFileSingleton.GetInstance().Packages.FirstOrDefault(x => x.Id == PackageId)?.PackageName ?? string.Empty,
|
PackageName = DataFileSingleton.GetInstance().Packages.FirstOrDefault(x => x.Id == PackageId)?.PackageName ?? string.Empty,
|
||||||
@@ -93,4 +90,4 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
new XElement("DateImplement", DateImplement)
|
new XElement("DateImplement", DateImplement)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ using SoftwareInstallationContracts.StoragesContracts;
|
|||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using SoftwareInstallationFileImplement.Models;
|
using SoftwareInstallationFileImplement.Models;
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement
|
namespace SoftwareInstallationFileImplement.Implements
|
||||||
{
|
{
|
||||||
public class OrderStorage : IOrderStorage
|
public class OrderStorage : IOrderStorage
|
||||||
{
|
{
|
||||||
@@ -13,7 +13,6 @@ namespace SoftwareInstallationFileImplement
|
|||||||
{
|
{
|
||||||
_source = DataFileSingleton.GetInstance();
|
_source = DataFileSingleton.GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
var element = _source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
var element = _source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
@@ -25,7 +24,6 @@ namespace SoftwareInstallationFileImplement
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue)
|
||||||
@@ -34,20 +32,22 @@ namespace SoftwareInstallationFileImplement
|
|||||||
}
|
}
|
||||||
return _source.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
return _source.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) // если не ищем по айдишнику, значит ищем по диапазону дат
|
||||||
|
{
|
||||||
|
return _source.Orders
|
||||||
|
.Where(x => model.DateFrom <= x.DateCreate.Date && x.DateCreate <= model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
var result = GetElement(model);
|
var result = GetElement(model);
|
||||||
return result != null ? new() { result } : new();
|
return result != null ? new() { result } : new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return _source.Orders
|
return _source.Orders.Select(x => x.GetViewModel).ToList();
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
model.Id = _source.Orders.Count > 0 ? _source.Orders.Max(x => x.Id) + 1 : 1;
|
model.Id = _source.Orders.Count > 0 ? _source.Orders.Max(x => x.Id) + 1 : 1;
|
||||||
@@ -60,7 +60,6 @@ namespace SoftwareInstallationFileImplement
|
|||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return newOrder.GetViewModel;
|
return newOrder.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
var order = _source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
var order = _source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
@@ -73,4 +72,4 @@ namespace SoftwareInstallationFileImplement
|
|||||||
return order.GetViewModel;
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ using SoftwareInstallationContracts.ViewModels;
|
|||||||
using SoftwareInstallationDataModels.Models;
|
using SoftwareInstallationDataModels.Models;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement.Models
|
namespace SoftwareInstallationFileImplement.Models
|
||||||
{
|
{
|
||||||
public class Package : IPackageModel
|
public class Package : IPackageModel
|
||||||
@@ -11,22 +12,23 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
public string PackageName { get; private set; } = string.Empty;
|
public string PackageName { get; private set; } = string.Empty;
|
||||||
public double Price { get; private set; }
|
public double Price { get; private set; }
|
||||||
public Dictionary<int, int> Components { get; private set; } = new();
|
public Dictionary<int, int> Components { get; private set; } = new();
|
||||||
private Dictionary<int, (IComponentModel, int)>? _PackageComponents = null;
|
private Dictionary<int, (IComponentModel, int)>? _packageComponents = null;
|
||||||
public Dictionary<int, (IComponentModel, int)> PackageComponents
|
public Dictionary<int, (IComponentModel, int)> PackageComponents
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_PackageComponents == null)
|
if (_packageComponents == null)
|
||||||
{
|
{
|
||||||
var source = DataFileSingleton.GetInstance();
|
var source = DataFileSingleton.GetInstance();
|
||||||
_PackageComponents = Components.ToDictionary(x => x.Key, y =>
|
_packageComponents = Components.ToDictionary(x => x.Key, y =>
|
||||||
((source.Components.FirstOrDefault(z => z.Id == y.Key) as IComponentModel)!,
|
((source.Components.FirstOrDefault(z => z.Id == y.Key) as IComponentModel)!,
|
||||||
y.Value));
|
y.Value));
|
||||||
}
|
}
|
||||||
return _PackageComponents;
|
return _packageComponents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static Package? Create(PackageBindingModel model)
|
|
||||||
|
public static Package? Create(PackageBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@@ -37,7 +39,8 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
PackageName = model.PackageName,
|
PackageName = model.PackageName,
|
||||||
Price = model.Price,
|
Price = model.Price,
|
||||||
Components = model.PackageComponents.ToDictionary(x => x.Key, x => x.Value.Item2)
|
Components = model.PackageComponents.ToDictionary(x => x.Key, x
|
||||||
|
=> x.Value.Item2)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Package? Create(XElement element)
|
public static Package? Create(XElement element)
|
||||||
@@ -52,11 +55,11 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
PackageName = element.Element("PackageName")!.Value,
|
PackageName = element.Element("PackageName")!.Value,
|
||||||
Price = Convert.ToDouble(element.Element("Price")!.Value),
|
Price = Convert.ToDouble(element.Element("Price")!.Value),
|
||||||
Components = element.Element("PackageComponents")!.Elements("PackageComponent").ToDictionary(x =>
|
Components = element.Element("PackageComponents")!.Elements("PackageComponent").ToDictionary(x =>
|
||||||
Convert.ToInt32(x.Element("Key")?.Value), x =>
|
Convert.ToInt32(x.Element("Key")?.Value), x =>
|
||||||
Convert.ToInt32(x.Element("Value")?.Value))
|
Convert.ToInt32(x.Element("Value")?.Value))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(PackageBindingModel model)
|
public void Update(PackageBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@@ -65,7 +68,7 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
PackageName = model.PackageName;
|
PackageName = model.PackageName;
|
||||||
Price = model.Price;
|
Price = model.Price;
|
||||||
Components = model.PackageComponents.ToDictionary(x => x.Key, x => x.Value.Item2);
|
Components = model.PackageComponents.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||||
_PackageComponents = null;
|
_packageComponents = null;
|
||||||
}
|
}
|
||||||
public PackageViewModel GetViewModel => new()
|
public PackageViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
@@ -74,7 +77,7 @@ namespace SoftwareInstallationFileImplement.Models
|
|||||||
Price = Price,
|
Price = Price,
|
||||||
PackageComponents = PackageComponents
|
PackageComponents = PackageComponents
|
||||||
};
|
};
|
||||||
public XElement GetXElement => new("Package",
|
public XElement GetXElement => new("Package",
|
||||||
new XAttribute("Id", Id),
|
new XAttribute("Id", Id),
|
||||||
new XElement("PackageName", PackageName),
|
new XElement("PackageName", PackageName),
|
||||||
new XElement("Price", Price.ToString()),
|
new XElement("Price", Price.ToString()),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using SoftwareInstallationContracts.StoragesContracts;
|
|||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using SoftwareInstallationFileImplement.Models;
|
using SoftwareInstallationFileImplement.Models;
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement
|
namespace SoftwareInstallationFileImplement.Implements
|
||||||
{
|
{
|
||||||
public class PackageStorage : IPackageStorage
|
public class PackageStorage : IPackageStorage
|
||||||
{
|
{
|
||||||
@@ -32,10 +32,10 @@ namespace SoftwareInstallationFileImplement
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return _source.Packages.FirstOrDefault
|
return _source.Packages.FirstOrDefault(x =>
|
||||||
(x => (!string.IsNullOrEmpty(model.PackageName) && x.PackageName == model.PackageName) ||
|
(!string.IsNullOrEmpty(model.PackageName) &&
|
||||||
(model.Id.HasValue && x.Id == model.Id)
|
x.PackageName == model.PackageName) ||
|
||||||
)?.GetViewModel;
|
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PackageViewModel> GetFilteredList(PackageSearchModel model)
|
public List<PackageViewModel> GetFilteredList(PackageSearchModel model)
|
||||||
@@ -82,4 +82,4 @@ namespace SoftwareInstallationFileImplement
|
|||||||
return package.GetViewModel;
|
return package.GetViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement
|
|
||||||
{
|
|
||||||
public class Shop : IShopModel
|
|
||||||
{
|
|
||||||
public string Name { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public string Address { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public int MaxCountPackages { get; private set; }
|
|
||||||
|
|
||||||
public DateTime DateOpening { get; private set; }
|
|
||||||
|
|
||||||
public Dictionary<int, int> CountPackages { get; private set; } = new();
|
|
||||||
|
|
||||||
private Dictionary<int, (IPackageModel, int)>? _cachedPackages = null;
|
|
||||||
public Dictionary<int, (IPackageModel, int)> Packages
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_cachedPackages == null)
|
|
||||||
{
|
|
||||||
var source = DataFileSingleton.GetInstance();
|
|
||||||
_cachedPackages = CountPackages
|
|
||||||
.ToDictionary(x => x.Key, x => (source.Packages
|
|
||||||
.FirstOrDefault(y => y.Id == x.Key)! as IPackageModel, x.Value));
|
|
||||||
}
|
|
||||||
return _cachedPackages;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public static Shop? Create(ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Shop()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
Name = model.Name,
|
|
||||||
Address = model.Address,
|
|
||||||
DateOpening = model.DateOpening,
|
|
||||||
MaxCountPackages = model.MaxCountPackages,
|
|
||||||
CountPackages = new()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public static Shop? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new()
|
|
||||||
{
|
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
|
||||||
Name = element.Element("Name")!.Value,
|
|
||||||
Address = element.Element("Address")!.Value,
|
|
||||||
DateOpening = Convert.ToDateTime(element.Element("DateOpening")!.Value),
|
|
||||||
MaxCountPackages = Convert.ToInt32(element.Element("MaxCountPackages")!.Value),
|
|
||||||
CountPackages = element.Element("CountPackages")!.Elements("CountPackage")
|
|
||||||
.ToDictionary(
|
|
||||||
x => Convert.ToInt32(x.Element("Key")?.Value),
|
|
||||||
x => Convert.ToInt32(x.Element("Value")?.Value)
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void Update(ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Name = model.Name;
|
|
||||||
Address = model.Address;
|
|
||||||
DateOpening = model.DateOpening;
|
|
||||||
CountPackages = model.Packages.ToDictionary(x => x.Key, x => x.Value.Item2);
|
|
||||||
_cachedPackages = null;
|
|
||||||
}
|
|
||||||
public ShopViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
Name = Name,
|
|
||||||
Address = Address,
|
|
||||||
Packages = Packages,
|
|
||||||
DateOpening = DateOpening,
|
|
||||||
MaxCountPackages = MaxCountPackages,
|
|
||||||
};
|
|
||||||
public XElement GetXElement => new("Shop",
|
|
||||||
new XAttribute("Id", Id),
|
|
||||||
new XElement("Name", Name),
|
|
||||||
new XElement("Address", Address),
|
|
||||||
new XElement("DateOpening", DateOpening),
|
|
||||||
new XElement("MaxCountPackages", MaxCountPackages),
|
|
||||||
new XElement("CountPackages", CountPackages
|
|
||||||
.Select(x => new XElement("CountPackage",
|
|
||||||
new XElement("Key", x.Key),
|
|
||||||
new XElement("Value", x.Value))
|
|
||||||
))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationFileImplement
|
|
||||||
{
|
|
||||||
public class ShopStorage : IShopStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton _source;
|
|
||||||
public ShopStorage()
|
|
||||||
{
|
|
||||||
_source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? Delete(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
var element = _source.Shops.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
_source.Shops.Remove(element);
|
|
||||||
_source.SaveShops();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _source.Shops.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
return _source.Shops
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.Where(x => x.Name.Contains(model.Name ?? string.Empty))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ShopViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return _source.Shops
|
|
||||||
.Select(shop => shop.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? Insert(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = _source.Shops.Count > 0 ? _source.Shops.Max(x => x.Id) + 1 : 1;
|
|
||||||
var newShop = Shop.Create(model);
|
|
||||||
if (newShop == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_source.Shops.Add(newShop);
|
|
||||||
_source.SaveShops();
|
|
||||||
return newShop.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? Update(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
var shop = _source.Shops.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (shop == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
shop.Update(model);
|
|
||||||
_source.SaveShops();
|
|
||||||
return shop.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SellPackages(IPackageModel package, int needCount)
|
|
||||||
{
|
|
||||||
var resultCount = _source.Shops
|
|
||||||
.Select(shop => shop.Packages
|
|
||||||
.FirstOrDefault(x => x.Key == package.Id).Value.Item2)
|
|
||||||
.Sum();
|
|
||||||
|
|
||||||
if (resultCount >= needCount)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
foreach (var shop in _source.Shops.Where(shop => shop.Packages.ContainsKey(package.Id)))
|
|
||||||
{
|
|
||||||
var tuple = shop.Packages[package.Id];
|
|
||||||
var diff = Math.Min(tuple.Item2, needCount);
|
|
||||||
shop.Packages[package.Id] = (tuple.Item1, tuple.Item2 - diff);
|
|
||||||
|
|
||||||
needCount -= diff;
|
|
||||||
if (needCount <= 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -13,9 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftwareInstallationListImp
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftwareInstallationView", "SoftwareInstallationView\SoftwareInstallationView.csproj", "{564F09E4-FA75-4090-BBC8-656F23FC8F3E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftwareInstallationView", "SoftwareInstallationView\SoftwareInstallationView.csproj", "{564F09E4-FA75-4090-BBC8-656F23FC8F3E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftWareInstallationFileImplement", "SoftWareInstallationFileImplement\SoftWareInstallationFileImplement.csproj", "{B2816D6F-A74D-4533-8F37-3217FB028243}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftwareInstallationFileImplement", "SoftWareInstallationFileImplement\SoftwareInstallationFileImplement.csproj", "{AF966DC2-6172-49DE-97EE-525EF00EBC67}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftWareInstallationDatabaseImplement", "SoftWareInstallationDatabaseImplement\SoftWareInstallationDatabaseImplement.csproj", "{3DF577A0-54E7-4912-B655-294B6B14C020}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftwareInstallationDatabaseImplement", "SoftwareInstallationDatabaseImplement\SoftwareInstallationDatabaseImplement.csproj", "{449AC3EB-1361-40FC-A3B7-6886C917BBC7}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -43,14 +43,14 @@ Global
|
|||||||
{564F09E4-FA75-4090-BBC8-656F23FC8F3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{564F09E4-FA75-4090-BBC8-656F23FC8F3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{564F09E4-FA75-4090-BBC8-656F23FC8F3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{564F09E4-FA75-4090-BBC8-656F23FC8F3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{564F09E4-FA75-4090-BBC8-656F23FC8F3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{564F09E4-FA75-4090-BBC8-656F23FC8F3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{B2816D6F-A74D-4533-8F37-3217FB028243}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{AF966DC2-6172-49DE-97EE-525EF00EBC67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{B2816D6F-A74D-4533-8F37-3217FB028243}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{AF966DC2-6172-49DE-97EE-525EF00EBC67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B2816D6F-A74D-4533-8F37-3217FB028243}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{AF966DC2-6172-49DE-97EE-525EF00EBC67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B2816D6F-A74D-4533-8F37-3217FB028243}.Release|Any CPU.Build.0 = Release|Any CPU
|
{AF966DC2-6172-49DE-97EE-525EF00EBC67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{3DF577A0-54E7-4912-B655-294B6B14C020}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{449AC3EB-1361-40FC-A3B7-6886C917BBC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{3DF577A0-54E7-4912-B655-294B6B14C020}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{449AC3EB-1361-40FC-A3B7-6886C917BBC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3DF577A0-54E7-4912-B655-294B6B14C020}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{449AC3EB-1361-40FC-A3B7-6886C917BBC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3DF577A0-54E7-4912-B655-294B6B14C020}.Release|Any CPU.Build.0 = Release|Any CPU
|
{449AC3EB-1361-40FC-A3B7-6886C917BBC7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ using SoftwareInstallationContracts.SearchModels;
|
|||||||
using SoftwareInstallationContracts.StoragesContracts;
|
using SoftwareInstallationContracts.StoragesContracts;
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
public class ComponentLogic : IComponentLogic
|
public class ComponentLogic : IComponentLogic
|
||||||
{
|
{
|
||||||
@@ -6,20 +6,16 @@ using SoftwareInstallationContracts.ViewModels;
|
|||||||
using SoftwareInstallationDataModels.Enums;
|
using SoftwareInstallationDataModels.Enums;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
public class OrderLogic : IOrderLogic
|
public class OrderLogic : IOrderLogic
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
private readonly IPackageStorage _packageStorage;
|
|
||||||
private readonly IShopLogic _shopLogic;
|
|
||||||
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IPackageStorage packageStorage, IShopLogic shopLogic)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_shopLogic = shopLogic;
|
|
||||||
_packageStorage = packageStorage;
|
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
}
|
}
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
public bool CreateOrder(OrderBindingModel model)
|
||||||
@@ -55,7 +51,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. OrderName.Id:{ Id} ", model?.Id);
|
_logger.LogInformation("ReadList. OrderName.Id:{ Id} ", model?.Id);
|
||||||
var list = (model == null) ? _orderStorage.GetFullList() :
|
var list = model == null ? _orderStorage.GetFullList() :
|
||||||
_orderStorage.GetFilteredList(model);
|
_orderStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
@@ -105,15 +101,6 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|||||||
$"Доступный статус: {(OrderStatus)((int)viewModel.Status + 1)}",
|
$"Доступный статус: {(OrderStatus)((int)viewModel.Status + 1)}",
|
||||||
nameof(viewModel));
|
nameof(viewModel));
|
||||||
}
|
}
|
||||||
if (orderStatus == OrderStatus.Готов)
|
|
||||||
{
|
|
||||||
var vpackage = _packageStorage.GetElement(new() { Id = viewModel.PackageId });
|
|
||||||
|
|
||||||
if (vpackage == null || !_shopLogic.AddPackagesInShops(vpackage, viewModel.Count))
|
|
||||||
{
|
|
||||||
throw new Exception($"Не удалось заполнить магазины изделием '{vpackage?.PackageName ?? string.Empty}' из заказа {viewModel.Id}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.DateImplement == null) model.DateImplement = viewModel.DateImplement;
|
if (model.DateImplement == null) model.DateImplement = viewModel.DateImplement;
|
||||||
model.Status = orderStatus;
|
model.Status = orderStatus;
|
||||||
model.Sum = viewModel.Sum;
|
model.Sum = viewModel.Sum;
|
||||||
@@ -5,7 +5,7 @@ using SoftwareInstallationContracts.StoragesContracts;
|
|||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
public class PackageLogic : IPackageLogic
|
public class PackageLogic : IPackageLogic
|
||||||
{
|
{
|
||||||
@@ -60,7 +60,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|||||||
public List<PackageViewModel>? ReadList(PackageSearchModel? model)
|
public List<PackageViewModel>? ReadList(PackageSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. PackageName:{PackageName}.Id:{ Id} ", model?.PackageName, model?.Id);
|
_logger.LogInformation("ReadList. PackageName:{PackageName}.Id:{ Id} ", model?.PackageName, model?.Id);
|
||||||
var list = (model == null) ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
|
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||||
|
using SoftwareInstallationContracts.SearchModels;
|
||||||
|
using SoftwareInstallationContracts.StoragesContracts;
|
||||||
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
|
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class ReportLogic : IReportLogic
|
||||||
|
{
|
||||||
|
private readonly IComponentStorage _componentStorage;
|
||||||
|
private readonly IPackageStorage _packageStorage;
|
||||||
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
private readonly AbstractSaveToExcel _saveToExcel;
|
||||||
|
private readonly AbstractSaveToWord _saveToWord;
|
||||||
|
private readonly AbstractSaveToPdf _saveToPdf;
|
||||||
|
public ReportLogic(IPackageStorage packageStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||||
|
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||||
|
{
|
||||||
|
_packageStorage = packageStorage;
|
||||||
|
_componentStorage = componentStorage;
|
||||||
|
_orderStorage = orderStorage;
|
||||||
|
_saveToExcel = saveToExcel;
|
||||||
|
_saveToWord = saveToWord;
|
||||||
|
_saveToPdf = saveToPdf;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ReportPackageComponentViewModel> GetPackageComponent()
|
||||||
|
{
|
||||||
|
var packages = _packageStorage.GetFullList();
|
||||||
|
var list = new List<ReportPackageComponentViewModel>();
|
||||||
|
foreach (var package in packages)
|
||||||
|
{
|
||||||
|
var record = new ReportPackageComponentViewModel
|
||||||
|
{
|
||||||
|
PackageName = package.PackageName,
|
||||||
|
Components = package.PackageComponents.Values.Select(x => Tuple.Create(x.Item1.ComponentName, x.Item2)).ToList(),
|
||||||
|
TotalCount = package.PackageComponents.Values.Select(x => x.Item2).Sum(),
|
||||||
|
};
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение списка заказов за определенный период
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||||
|
{
|
||||||
|
DateFrom = model.DateFrom,
|
||||||
|
DateTo = model.DateTo
|
||||||
|
|
||||||
|
})
|
||||||
|
.Select(x => new ReportOrdersViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
DateCreate = x.DateCreate,
|
||||||
|
PackageName = x.PackageName,
|
||||||
|
OrderStatus = x.Status.ToString(),
|
||||||
|
Sum = x.Sum
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение изделий в файл-Word
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список Изделий",
|
||||||
|
Packages = _packageStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение изделий с указаеним продуктов в файл-Excel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
public void SavePackageComponentToExcelFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список изделий",
|
||||||
|
PackageComponents = GetPackageComponent()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение заказов в файл-Pdf
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список заказов",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo!.Value,
|
||||||
|
Orders = GetOrders(model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToExcel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Создание отчета
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
public void CreateReport(ExcelInfo info)
|
||||||
|
{
|
||||||
|
CreateExcel(info);
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = 1,
|
||||||
|
Text = info.Title,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
|
});
|
||||||
|
MergeCells(new ExcelMergeParameters
|
||||||
|
{
|
||||||
|
CellFromName = "A1",
|
||||||
|
CellToName = "C1"
|
||||||
|
});
|
||||||
|
uint rowIndex = 2;
|
||||||
|
foreach (var pc in info.PackageComponents)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = pc.PackageName,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
foreach (var package in pc.Components)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "B",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = package.Item1,
|
||||||
|
StyleInfo =
|
||||||
|
ExcelStyleInfoType.TextWithBroder
|
||||||
|
});
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = package.Item2.ToString(),
|
||||||
|
StyleInfo =
|
||||||
|
ExcelStyleInfoType.TextWithBroder
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = "Итого",
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = pc.TotalCount.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
SaveExcel(info);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание excel-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void CreateExcel(ExcelInfo info);
|
||||||
|
/// <summary>
|
||||||
|
/// Добавляем новую ячейку в лист
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cellParameters"></param>
|
||||||
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters
|
||||||
|
excelParams);
|
||||||
|
/// <summary>
|
||||||
|
/// Объединение ячеек
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mergeParameters"></param>
|
||||||
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void SaveExcel(ExcelInfo info);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToPdf
|
||||||
|
{
|
||||||
|
public void CreateDoc(PdfInfo info)
|
||||||
|
{
|
||||||
|
CreatePdf(info);
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = info.Title,
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var order in info.Orders)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PackageName, Convert.ToString(order.OrderStatus), order.Sum.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
}
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
||||||
|
});
|
||||||
|
SavePdf(info);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание doc-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void CreatePdf(PdfInfo info);
|
||||||
|
/// <summary>
|
||||||
|
/// Создание параграфа с текстом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="style"></param>
|
||||||
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
|
/// <summary>
|
||||||
|
/// Создание таблицы
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="style"></param>
|
||||||
|
protected abstract void CreateTable(List<string> columns);
|
||||||
|
/// <summary>
|
||||||
|
/// Создание и заполнение строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rowParameters"></param>
|
||||||
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void SavePdf(PdfInfo info);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToWord
|
||||||
|
{
|
||||||
|
public void CreateDoc(WordInfo info)
|
||||||
|
{
|
||||||
|
CreateWord(info);
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Center
|
||||||
|
}
|
||||||
|
});
|
||||||
|
foreach (var package in info.Packages)
|
||||||
|
{
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)>
|
||||||
|
{
|
||||||
|
(package.PackageName, new WordTextProperties { Size = "24", Bold = true}),
|
||||||
|
(" - цена: " + package.Price.ToString(), new WordTextProperties { Size = "24" })
|
||||||
|
},
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
SaveWord(info);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание doc-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void CreateWord(WordInfo info);
|
||||||
|
/// <summary>
|
||||||
|
/// Создание абзаца с текстом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paragraph"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void SaveWord(WordInfo info);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum ExcelStyleInfoType
|
||||||
|
{
|
||||||
|
Title,
|
||||||
|
Text,
|
||||||
|
TextWithBroder
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
|
||||||
|
{
|
||||||
|
public class PdfInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public DateTime DateFrom { get; set; }
|
||||||
|
public DateTime DateTo { get; set; }
|
||||||
|
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum PdfParagraphAlignmentType
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Left,
|
||||||
|
Rigth
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum WordJustificationType
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Both
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelCellParameters
|
||||||
|
{
|
||||||
|
public string ColumnName { get; set; } = string.Empty;
|
||||||
|
public uint RowIndex { get; set; }
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
public string CellReference => $"{ColumnName}{RowIndex}";
|
||||||
|
public ExcelStyleInfoType StyleInfo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public List<ReportPackageComponentViewModel> PackageComponents
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelMergeParameters
|
||||||
|
{
|
||||||
|
public string CellFromName { get; set; } = string.Empty;
|
||||||
|
public string CellToName { get; set; } = string.Empty;
|
||||||
|
public string Merge => $"{CellFromName}:{CellToName}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class PdfParagraph
|
||||||
|
{
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
public string Style { get; set; } = string.Empty;
|
||||||
|
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class PdfRowParameters
|
||||||
|
{
|
||||||
|
public List<string> Texts { get; set; } = new();
|
||||||
|
public string Style { get; set; } = string.Empty;
|
||||||
|
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public List<PackageViewModel> Packages { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordParagraph
|
||||||
|
{
|
||||||
|
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||||
|
public WordTextProperties? TextProperties { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordTextProperties
|
||||||
|
{
|
||||||
|
public string Size { get; set; } = string.Empty;
|
||||||
|
public bool Bold { get; set; }
|
||||||
|
public WordJustificationType JustificationType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,330 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToExcel : AbstractSaveToExcel
|
||||||
|
{
|
||||||
|
private SpreadsheetDocument? _spreadsheetDocument;
|
||||||
|
private SharedStringTablePart? _shareStringPart;
|
||||||
|
private Worksheet? _worksheet;
|
||||||
|
/// <summary>
|
||||||
|
/// Настройка стилей для файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workbookpart"></param>
|
||||||
|
private static void CreateStyles(WorkbookPart workbookpart)
|
||||||
|
{
|
||||||
|
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||||
|
sp.Stylesheet = new Stylesheet();
|
||||||
|
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||||
|
var fontUsual = new Font();
|
||||||
|
fontUsual.Append(new FontSize() { Val = 12D });
|
||||||
|
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Theme = 1U });
|
||||||
|
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||||
|
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||||
|
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||||
|
var fontTitle = new Font();
|
||||||
|
fontTitle.Append(new Bold());
|
||||||
|
fontTitle.Append(new FontSize() { Val = 14D });
|
||||||
|
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Theme = 1U });
|
||||||
|
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||||
|
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||||
|
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||||
|
fonts.Append(fontUsual);
|
||||||
|
fonts.Append(fontTitle);
|
||||||
|
var fills = new Fills() { Count = 2U };
|
||||||
|
var fill1 = new Fill();
|
||||||
|
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||||
|
var fill2 = new Fill();
|
||||||
|
fill2.Append(new PatternFill()
|
||||||
|
{
|
||||||
|
PatternType = PatternValues.Gray125
|
||||||
|
});
|
||||||
|
fills.Append(fill1);
|
||||||
|
fills.Append(fill2);
|
||||||
|
var borders = new Borders() { Count = 2U };
|
||||||
|
var borderNoBorder = new Border();
|
||||||
|
borderNoBorder.Append(new LeftBorder());
|
||||||
|
borderNoBorder.Append(new RightBorder());
|
||||||
|
borderNoBorder.Append(new TopBorder());
|
||||||
|
borderNoBorder.Append(new BottomBorder());
|
||||||
|
borderNoBorder.Append(new DiagonalBorder());
|
||||||
|
var borderThin = new Border();
|
||||||
|
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
var rightBorder = new RightBorder()
|
||||||
|
{
|
||||||
|
Style = BorderStyleValues.Thin
|
||||||
|
};
|
||||||
|
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
var bottomBorder = new BottomBorder()
|
||||||
|
{
|
||||||
|
Style = BorderStyleValues.Thin
|
||||||
|
};
|
||||||
|
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
borderThin.Append(leftBorder);
|
||||||
|
borderThin.Append(rightBorder);
|
||||||
|
borderThin.Append(topBorder);
|
||||||
|
borderThin.Append(bottomBorder);
|
||||||
|
borderThin.Append(new DiagonalBorder());
|
||||||
|
borders.Append(borderNoBorder);
|
||||||
|
borders.Append(borderThin);
|
||||||
|
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
|
||||||
|
var cellFormatStyle = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId = 0U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 0U
|
||||||
|
};
|
||||||
|
cellStyleFormats.Append(cellFormatStyle);
|
||||||
|
var cellFormats = new CellFormats() { Count = 3U };
|
||||||
|
var cellFormatFont = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId = 0U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 0U,
|
||||||
|
FormatId = 0U,
|
||||||
|
ApplyFont = true
|
||||||
|
};
|
||||||
|
var cellFormatFontAndBorder = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId = 0U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 1U,
|
||||||
|
FormatId = 0U,
|
||||||
|
ApplyFont = true,
|
||||||
|
ApplyBorder = true
|
||||||
|
};
|
||||||
|
var cellFormatTitle = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId = 1U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 0U,
|
||||||
|
FormatId = 0U,
|
||||||
|
Alignment = new Alignment()
|
||||||
|
{
|
||||||
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
|
WrapText = true,
|
||||||
|
Horizontal = HorizontalAlignmentValues.Center
|
||||||
|
},
|
||||||
|
ApplyFont = true
|
||||||
|
};
|
||||||
|
cellFormats.Append(cellFormatFont);
|
||||||
|
cellFormats.Append(cellFormatFontAndBorder);
|
||||||
|
cellFormats.Append(cellFormatTitle);
|
||||||
|
var cellStyles = new CellStyles() { Count = 1U };
|
||||||
|
cellStyles.Append(new CellStyle()
|
||||||
|
{
|
||||||
|
Name = "Normal",
|
||||||
|
FormatId = 0U,
|
||||||
|
BuiltinId = 0U
|
||||||
|
});
|
||||||
|
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
||||||
|
{ Count = 0U };
|
||||||
|
|
||||||
|
var tableStyles = new TableStyles()
|
||||||
|
{
|
||||||
|
Count = 0U,
|
||||||
|
DefaultTableStyle = "TableStyleMedium2",
|
||||||
|
DefaultPivotStyle = "PivotStyleLight16"
|
||||||
|
};
|
||||||
|
var stylesheetExtensionList = new StylesheetExtensionList();
|
||||||
|
var stylesheetExtension1 = new StylesheetExtension()
|
||||||
|
{
|
||||||
|
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
||||||
|
};
|
||||||
|
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||||
|
stylesheetExtension1.Append(new SlicerStyles()
|
||||||
|
{
|
||||||
|
DefaultSlicerStyle = "SlicerStyleLight1"
|
||||||
|
});
|
||||||
|
var stylesheetExtension2 = new StylesheetExtension()
|
||||||
|
{
|
||||||
|
Uri =
|
||||||
|
"{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
||||||
|
};
|
||||||
|
stylesheetExtension2.AddNamespaceDeclaration("x15",
|
||||||
|
"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||||
|
stylesheetExtension2.Append(new TimelineStyles()
|
||||||
|
{
|
||||||
|
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
||||||
|
});
|
||||||
|
stylesheetExtensionList.Append(stylesheetExtension1);
|
||||||
|
stylesheetExtensionList.Append(stylesheetExtension2);
|
||||||
|
sp.Stylesheet.Append(fonts);
|
||||||
|
sp.Stylesheet.Append(fills);
|
||||||
|
sp.Stylesheet.Append(borders);
|
||||||
|
sp.Stylesheet.Append(cellStyleFormats);
|
||||||
|
sp.Stylesheet.Append(cellFormats);
|
||||||
|
sp.Stylesheet.Append(cellStyles);
|
||||||
|
sp.Stylesheet.Append(differentialFormats);
|
||||||
|
sp.Stylesheet.Append(tableStyles);
|
||||||
|
sp.Stylesheet.Append(stylesheetExtensionList);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение номера стиля из типа
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="styleInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
||||||
|
{
|
||||||
|
return styleInfo switch
|
||||||
|
{
|
||||||
|
ExcelStyleInfoType.Title => 2U,
|
||||||
|
ExcelStyleInfoType.TextWithBroder => 1U,
|
||||||
|
ExcelStyleInfoType.Text => 0U,
|
||||||
|
_ => 0U,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected override void CreateExcel(ExcelInfo info)
|
||||||
|
{
|
||||||
|
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
||||||
|
// Создаем книгу (в ней хранятся листы)
|
||||||
|
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||||
|
workbookpart.Workbook = new Workbook();
|
||||||
|
CreateStyles(workbookpart);
|
||||||
|
// Получаем/создаем хранилище текстов для книги
|
||||||
|
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
|
||||||
|
?
|
||||||
|
_spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
|
||||||
|
:
|
||||||
|
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
||||||
|
// Создаем SharedStringTable, если его нет
|
||||||
|
if (_shareStringPart.SharedStringTable == null)
|
||||||
|
{
|
||||||
|
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||||
|
}
|
||||||
|
// Создаем лист в книгу
|
||||||
|
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||||
|
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||||
|
// Добавляем лист в книгу
|
||||||
|
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||||
|
var sheet = new Sheet()
|
||||||
|
{
|
||||||
|
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||||
|
SheetId = 1,
|
||||||
|
Name = "Лист"
|
||||||
|
};
|
||||||
|
sheets.Append(sheet);
|
||||||
|
_worksheet = worksheetPart.Worksheet;
|
||||||
|
}
|
||||||
|
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
|
||||||
|
{
|
||||||
|
if (_worksheet == null || _shareStringPart == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
||||||
|
if (sheetData == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ищем строку, либо добавляем ее
|
||||||
|
Row row;
|
||||||
|
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
||||||
|
{
|
||||||
|
row = sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
||||||
|
excelParams.RowIndex).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = new Row() { RowIndex = excelParams.RowIndex };
|
||||||
|
sheetData.Append(row);
|
||||||
|
}
|
||||||
|
// Ищем нужную ячейку
|
||||||
|
Cell cell;
|
||||||
|
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
||||||
|
{
|
||||||
|
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Все ячейки должны быть последовательно друг за другом расположены
|
||||||
|
// нужно определить, после какой вставлять
|
||||||
|
Cell? refCell = null;
|
||||||
|
foreach (Cell rowCell in row.Elements<Cell>())
|
||||||
|
{
|
||||||
|
if (string.Compare(rowCell.CellReference!.Value,
|
||||||
|
excelParams.CellReference, true) > 0)
|
||||||
|
{
|
||||||
|
refCell = rowCell;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var newCell = new Cell()
|
||||||
|
{
|
||||||
|
CellReference =
|
||||||
|
excelParams.CellReference
|
||||||
|
};
|
||||||
|
row.InsertBefore(newCell, refCell);
|
||||||
|
cell = newCell;
|
||||||
|
}
|
||||||
|
// вставляем новый текст
|
||||||
|
_shareStringPart.SharedStringTable.AppendChild(new
|
||||||
|
SharedStringItem(new Text(excelParams.Text)));
|
||||||
|
_shareStringPart.SharedStringTable.Save();
|
||||||
|
cell.CellValue = new
|
||||||
|
CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count(
|
||||||
|
) - 1).ToString());
|
||||||
|
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||||
|
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||||
|
}
|
||||||
|
protected override void MergeCells(ExcelMergeParameters excelParams)
|
||||||
|
{
|
||||||
|
if (_worksheet == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MergeCells mergeCells;
|
||||||
|
if (_worksheet.Elements<MergeCells>().Any())
|
||||||
|
{
|
||||||
|
mergeCells = _worksheet.Elements<MergeCells>().First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mergeCells = new MergeCells();
|
||||||
|
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||||
|
{
|
||||||
|
_worksheet.InsertAfter(mergeCells,
|
||||||
|
_worksheet.Elements<CustomSheetView>().First());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_worksheet.InsertAfter(mergeCells,
|
||||||
|
_worksheet.Elements<SheetData>().First());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var mergeCell = new MergeCell()
|
||||||
|
{
|
||||||
|
Reference = new StringValue(excelParams.Merge)
|
||||||
|
};
|
||||||
|
mergeCells.Append(mergeCell);
|
||||||
|
}
|
||||||
|
protected override void SaveExcel(ExcelInfo info)
|
||||||
|
{
|
||||||
|
if (_spreadsheetDocument == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||||
|
_spreadsheetDocument.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using MigraDoc.DocumentObjectModel.Tables;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToPdf : AbstractSaveToPdf
|
||||||
|
{
|
||||||
|
private Document? _document;
|
||||||
|
private Section? _section;
|
||||||
|
private Table? _table;
|
||||||
|
private static ParagraphAlignment
|
||||||
|
GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||||
|
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||||
|
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||||
|
_ => ParagraphAlignment.Justify,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание стилей для документа
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="document"></param>
|
||||||
|
private static void DefineStyles(Document document)
|
||||||
|
{
|
||||||
|
var style = document.Styles["Normal"];
|
||||||
|
style.Font.Name = "Times New Roman";
|
||||||
|
style.Font.Size = 14;
|
||||||
|
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||||
|
style.Font.Bold = true;
|
||||||
|
}
|
||||||
|
protected override void CreatePdf(PdfInfo info)
|
||||||
|
{
|
||||||
|
_document = new Document();
|
||||||
|
DefineStyles(_document);
|
||||||
|
_section = _document.AddSection();
|
||||||
|
}
|
||||||
|
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
||||||
|
{
|
||||||
|
if (_section == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
||||||
|
paragraph.Format.SpaceAfter = "1cm";
|
||||||
|
paragraph.Format.Alignment =
|
||||||
|
GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||||
|
paragraph.Style = pdfParagraph.Style;
|
||||||
|
}
|
||||||
|
protected override void CreateTable(List<string> columns)
|
||||||
|
{
|
||||||
|
if (_document == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_table = _document.LastSection.AddTable();
|
||||||
|
foreach (var elem in columns)
|
||||||
|
{
|
||||||
|
_table.AddColumn(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void CreateRow(PdfRowParameters rowParameters)
|
||||||
|
{
|
||||||
|
if (_table == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var row = _table.AddRow();
|
||||||
|
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||||
|
{
|
||||||
|
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||||
|
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||||
|
{
|
||||||
|
row.Cells[i].Style = rowParameters.Style;
|
||||||
|
}
|
||||||
|
Unit borderWidth = 0.5;
|
||||||
|
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||||
|
row.Cells[i].Format.Alignment =
|
||||||
|
GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||||
|
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void SavePdf(PdfInfo info)
|
||||||
|
{
|
||||||
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
|
{
|
||||||
|
Document = _document
|
||||||
|
};
|
||||||
|
renderer.RenderDocument();
|
||||||
|
renderer.PdfDocument.Save(info.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToWord : AbstractSaveToWord
|
||||||
|
{
|
||||||
|
private WordprocessingDocument? _wordDocument;
|
||||||
|
private Body? _docBody;
|
||||||
|
/// <summary>
|
||||||
|
/// Получение типа выравнивания
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static JustificationValues
|
||||||
|
GetJustificationValues(WordJustificationType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
WordJustificationType.Both => JustificationValues.Both,
|
||||||
|
WordJustificationType.Center => JustificationValues.Center,
|
||||||
|
_ => JustificationValues.Left,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Настройки страницы
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static SectionProperties CreateSectionProperties()
|
||||||
|
{
|
||||||
|
var properties = new SectionProperties();
|
||||||
|
var pageSize = new PageSize
|
||||||
|
{
|
||||||
|
Orient = PageOrientationValues.Portrait
|
||||||
|
};
|
||||||
|
properties.AppendChild(pageSize);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Задание форматирования для абзаца
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paragraphProperties"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static ParagraphProperties?
|
||||||
|
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||||
|
{
|
||||||
|
if (paragraphProperties == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var properties = new ParagraphProperties();
|
||||||
|
properties.AppendChild(new Justification()
|
||||||
|
{
|
||||||
|
Val =
|
||||||
|
GetJustificationValues(paragraphProperties.JustificationType)
|
||||||
|
});
|
||||||
|
properties.AppendChild(new SpacingBetweenLines
|
||||||
|
{
|
||||||
|
LineRule = LineSpacingRuleValues.Auto
|
||||||
|
});
|
||||||
|
properties.AppendChild(new Indentation());
|
||||||
|
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||||
|
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||||
|
{
|
||||||
|
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||||
|
{
|
||||||
|
Val =
|
||||||
|
paragraphProperties.Size
|
||||||
|
});
|
||||||
|
}
|
||||||
|
properties.AppendChild(paragraphMarkRunProperties);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
protected override void CreateWord(WordInfo info)
|
||||||
|
{
|
||||||
|
_wordDocument = WordprocessingDocument.Create(info.FileName,
|
||||||
|
WordprocessingDocumentType.Document);
|
||||||
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
|
mainPart.Document = new Document();
|
||||||
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
|
}
|
||||||
|
protected override void CreateParagraph(WordParagraph paragraph)
|
||||||
|
{
|
||||||
|
if (_docBody == null || paragraph == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var docParagraph = new Paragraph();
|
||||||
|
|
||||||
|
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||||
|
foreach (var run in paragraph.Texts)
|
||||||
|
{
|
||||||
|
var docRun = new Run();
|
||||||
|
var properties = new RunProperties();
|
||||||
|
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||||
|
if (run.Item2.Bold)
|
||||||
|
{
|
||||||
|
properties.AppendChild(new Bold());
|
||||||
|
}
|
||||||
|
docRun.AppendChild(properties);
|
||||||
|
docRun.AppendChild(new Text
|
||||||
|
{
|
||||||
|
Text = run.Item1,
|
||||||
|
Space =
|
||||||
|
SpaceProcessingModeValues.Preserve
|
||||||
|
});
|
||||||
|
docParagraph.AppendChild(docRun);
|
||||||
|
}
|
||||||
|
_docBody.AppendChild(docParagraph);
|
||||||
|
}
|
||||||
|
protected override void SaveWord(WordInfo info)
|
||||||
|
{
|
||||||
|
if (_docBody == null || _wordDocument == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_docBody.AppendChild(CreateSectionProperties());
|
||||||
|
_wordDocument.MainDocumentPart!.Document.Save();
|
||||||
|
_wordDocument.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,215 +0,0 @@
|
|||||||
using SoftwareInstallationBusinessLogic.BusinessLogics;
|
|
||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationBusinessLogic
|
|
||||||
{
|
|
||||||
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:{ShopName}.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);
|
|
||||||
model.Packages = new();
|
|
||||||
if (_shopStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Update(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия магазина",
|
|
||||||
nameof(model.Name));
|
|
||||||
}
|
|
||||||
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.Name))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия магазина",
|
|
||||||
nameof(model.Name));
|
|
||||||
}
|
|
||||||
if (model.MaxCountPackages < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException(
|
|
||||||
"Максимальное количество изделий в магазине не должно быть отрицательным",
|
|
||||||
nameof(model.MaxCountPackages));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Shop. ShopName:{0}.Address:{1}. Id: {2}",
|
|
||||||
model.Name, model.Address, model.Id);
|
|
||||||
var element = _shopStorage.GetElement(new ShopSearchModel
|
|
||||||
{
|
|
||||||
Name = model.Name
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id && element.Name == model.Name)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AddPackage(ShopSearchModel model, IPackageModel package, int count)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (count <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Количество добавляемого изделия должно быть больше 0", nameof(count));
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("AddPackageInShop. ShopName:{ShopName}.Id:{ Id}",
|
|
||||||
model.Name, model.Id);
|
|
||||||
var element = _shopStorage.GetElement(model);
|
|
||||||
int currCount = element.Packages.Values.First().Item2;
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("AddPackageInShop element not found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (count + currCount > element.MaxCountPackages)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Количество изделий не должно быть больше максимального количества изделий");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("AddPackageInShop find. Id:{Id}", element.Id);
|
|
||||||
|
|
||||||
var prevCount = element.Packages.GetValueOrDefault(package.Id, (package, 0)).Item2;
|
|
||||||
element.Packages[package.Id] = (package, prevCount + count);
|
|
||||||
_logger.LogInformation(
|
|
||||||
"AddPackageInShop. Has been added {count} {package} in {ShopName}",
|
|
||||||
count, package.PackageName, element.Name);
|
|
||||||
|
|
||||||
_shopStorage.Update(new()
|
|
||||||
{
|
|
||||||
Id = element.Id,
|
|
||||||
Address = element.Address,
|
|
||||||
Name = element.Name,
|
|
||||||
DateOpening = element.DateOpening,
|
|
||||||
Packages = element.Packages
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public int GetFreePlacesWithPackagesInShops(int countPackages)
|
|
||||||
{
|
|
||||||
// Сумма разностей между максимальный кол-вом изделий и суммой всех изделий в магазине
|
|
||||||
return _shopStorage.GetFullList()
|
|
||||||
.Select(x => x.MaxCountPackages - x.Packages
|
|
||||||
.Select(p => p.Value.Item2).Sum())
|
|
||||||
.Sum() - countPackages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AddPackagesInShops(IPackageModel package, int count)
|
|
||||||
{
|
|
||||||
if (count <= 0)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("AddPackagesInShops. Количество добавляемых изделий должно быть больше 0. Количество - {count}", count);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var freePlaces = GetFreePlacesWithPackagesInShops(count);
|
|
||||||
if (freePlaces < 0)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("AddPackagesInShops. Не удалось добавить изделия в магазины, поскольку они переполнены." +
|
|
||||||
"Освободите магазины на {places} изделий", -freePlaces);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
foreach (var shop in _shopStorage.GetFullList())
|
|
||||||
{
|
|
||||||
var cnt = Math.Min(count, shop.MaxCountPackages - shop.Packages.Select(x => x.Value.Item2).Sum());
|
|
||||||
if (cnt <= 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!AddPackage(new() { Id = shop.Id }, package, cnt))
|
|
||||||
{
|
|
||||||
_logger.LogWarning("При добавления изделий во все магазины произошла ошибка");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
count -= cnt;
|
|
||||||
if (count == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SellPackages(IPackageModel package, int needCount)
|
|
||||||
{
|
|
||||||
return _shopStorage.SellPackages(package, needCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SoftwareInstallationContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ReportBindingModel
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class ShopBindingModel : IShopModel
|
|
||||||
{
|
|
||||||
public string Name { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string Address { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
|
||||||
|
|
||||||
public Dictionary<int, (IPackageModel, int)> Packages
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = new();
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int MaxCountPackages { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
namespace SoftwareInstallationContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IReportLogic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<ReportPackageComponentViewModel> GetPackageComponent();
|
||||||
|
/// <summary>
|
||||||
|
/// Получение списка заказов за определенный период
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение компонент в файл-Word
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
void SaveComponentsToWordFile(ReportBindingModel model);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
void SavePackageComponentToExcelFile(ReportBindingModel model);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение заказов в файл-Pdf
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationContracts.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 AddPackage(ShopSearchModel model, IPackageModel package, int count);
|
|
||||||
int GetFreePlacesWithPackagesInShops(int countPackages);
|
|
||||||
bool AddPackagesInShops(IPackageModel package, int count);
|
|
||||||
public bool SellPackages(IPackageModel package, int needCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,5 +3,7 @@
|
|||||||
public class OrderSearchModel
|
public class OrderSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
namespace SoftwareInstallationContracts.SearchModels
|
|
||||||
{
|
|
||||||
public class ShopSearchModel
|
|
||||||
{
|
|
||||||
public int? Id { get; set; }
|
|
||||||
public string? Name { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationContracts.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);
|
|
||||||
|
|
||||||
public bool SellPackages(IPackageModel package, int needCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace SoftwareInstallationContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportOrdersViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public DateTime DateCreate { get; set; }
|
||||||
|
public string PackageName { get; set; } = string.Empty;
|
||||||
|
public string OrderStatus { get; set; } = string.Empty;
|
||||||
|
public double Sum { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SoftwareInstallationContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportPackageComponentViewModel
|
||||||
|
{
|
||||||
|
public string PackageName { get; set; } = string.Empty;
|
||||||
|
public int TotalCount { get; set; }
|
||||||
|
public List<Tuple<string, int>> Components { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationContracts.ViewModels
|
|
||||||
{
|
|
||||||
public class ShopViewModel : IShopModel
|
|
||||||
{
|
|
||||||
[DisplayName("Название магазина")]
|
|
||||||
public string Name { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[DisplayName("Адрес магазина")]
|
|
||||||
public string Address { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[DisplayName("Максимальное количество изделий в магазине")]
|
|
||||||
public int MaxCountPackages { get; set; }
|
|
||||||
|
|
||||||
[DisplayName("Время открытия")]
|
|
||||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
|
||||||
|
|
||||||
public Dictionary<int, (IPackageModel, int)> Packages
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = new();
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationDataModels
|
|
||||||
{
|
|
||||||
public interface IShopModel : IId
|
|
||||||
{
|
|
||||||
string Name { get; }
|
|
||||||
string Address { get; }
|
|
||||||
int MaxCountPackages { get; }
|
|
||||||
DateTime DateOpening { get; }
|
|
||||||
Dictionary<int, (IPackageModel, int)> Packages { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,4 +6,11 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ using SoftwareInstallationDatabaseImplement;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace SoftWareInstallationDatabaseImplement.Migrations
|
namespace SoftwareInstallationDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(SoftwareInstallationDatabase))]
|
[DbContext(typeof(SoftwareInstallationDatabase))]
|
||||||
[Migration("20230403200159_InitialCreate")]
|
[Migration("20230305152308_InitMigration")]
|
||||||
partial class InitialCreate
|
partial class InitMigration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.4")
|
.HasAnnotation("PackageVersion", "7.0.3")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
@@ -124,64 +124,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
b.ToTable("PackageComponents");
|
b.ToTable("PackageComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Shop", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateOpening")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("MaxCountPackages")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("PackageId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("PackageId");
|
|
||||||
|
|
||||||
b.ToTable("Shops");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.ShopPackage", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PackageId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ShopId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("PackageId");
|
|
||||||
|
|
||||||
b.HasIndex("ShopId");
|
|
||||||
|
|
||||||
b.ToTable("ShopPackages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
||||||
@@ -212,32 +154,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
b.Navigation("Package");
|
b.Navigation("Package");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Shop", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", null)
|
|
||||||
.WithMany("Shops")
|
|
||||||
.HasForeignKey("PackageId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.ShopPackage", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("PackageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Shop", "Shop")
|
|
||||||
.WithMany("ShopPackages")
|
|
||||||
.HasForeignKey("ShopId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Package");
|
|
||||||
|
|
||||||
b.Navigation("Shop");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
|
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("PackageComponents");
|
b.Navigation("PackageComponents");
|
||||||
@@ -248,13 +164,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
|
||||||
b.Navigation("Orders");
|
b.Navigation("Orders");
|
||||||
|
|
||||||
b.Navigation("Shops");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Shop", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("ShopPackages");
|
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,10 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace SoftWareInstallationDatabaseImplement.Migrations
|
namespace SoftwareInstallationDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitialCreate : Migration
|
public partial class InitMigration : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@@ -90,55 +90,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Shops",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
MaxCountPackages = table.Column<int>(type: "int", nullable: false),
|
|
||||||
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
PackageId = table.Column<int>(type: "int", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Shops", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Shops_Packages_PackageId",
|
|
||||||
column: x => x.PackageId,
|
|
||||||
principalTable: "Packages",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "ShopPackages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
PackageId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
ShopId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
Count = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_ShopPackages", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_ShopPackages_Packages_PackageId",
|
|
||||||
column: x => x.PackageId,
|
|
||||||
principalTable: "Packages",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_ShopPackages_Shops_ShopId",
|
|
||||||
column: x => x.ShopId,
|
|
||||||
principalTable: "Shops",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Orders_PackageId",
|
name: "IX_Orders_PackageId",
|
||||||
table: "Orders",
|
table: "Orders",
|
||||||
@@ -153,21 +104,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
name: "IX_PackageComponents_PackageId",
|
name: "IX_PackageComponents_PackageId",
|
||||||
table: "PackageComponents",
|
table: "PackageComponents",
|
||||||
column: "PackageId");
|
column: "PackageId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_ShopPackages_PackageId",
|
|
||||||
table: "ShopPackages",
|
|
||||||
column: "PackageId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_ShopPackages_ShopId",
|
|
||||||
table: "ShopPackages",
|
|
||||||
column: "ShopId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Shops_PackageId",
|
|
||||||
table: "Shops",
|
|
||||||
column: "PackageId");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -179,15 +115,9 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "PackageComponents");
|
name: "PackageComponents");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "ShopPackages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Components");
|
name: "Components");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Shops");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Packages");
|
name: "Packages");
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ using SoftwareInstallationDatabaseImplement;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace SoftWareInstallationDatabaseImplement.Migrations
|
namespace SoftwareInstallationDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(SoftwareInstallationDatabase))]
|
[DbContext(typeof(SoftwareInstallationDatabase))]
|
||||||
partial class SoftwareInstallationDatabaseModelSnapshot : ModelSnapshot
|
partial class SoftwareInstallationDatabaseModelSnapshot : ModelSnapshot
|
||||||
@@ -17,7 +17,7 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.4")
|
.HasAnnotation("ProductVersion", "7.0.3")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
@@ -121,64 +121,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
b.ToTable("PackageComponents");
|
b.ToTable("PackageComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Shop", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateOpening")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("MaxCountPackages")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("PackageId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("PackageId");
|
|
||||||
|
|
||||||
b.ToTable("Shops");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.ShopPackage", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PackageId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ShopId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("PackageId");
|
|
||||||
|
|
||||||
b.HasIndex("ShopId");
|
|
||||||
|
|
||||||
b.ToTable("ShopPackages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
||||||
@@ -209,32 +151,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
b.Navigation("Package");
|
b.Navigation("Package");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Shop", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", null)
|
|
||||||
.WithMany("Shops")
|
|
||||||
.HasForeignKey("PackageId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.ShopPackage", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("PackageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Shop", "Shop")
|
|
||||||
.WithMany("ShopPackages")
|
|
||||||
.HasForeignKey("ShopId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Package");
|
|
||||||
|
|
||||||
b.Navigation("Shop");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
|
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("PackageComponents");
|
b.Navigation("PackageComponents");
|
||||||
@@ -245,13 +161,6 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
|
|||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
|
||||||
b.Navigation("Orders");
|
b.Navigation("Orders");
|
||||||
|
|
||||||
b.Navigation("Shops");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Shop", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("ShopPackages");
|
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,7 @@
|
|||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using SoftwareInstallationDataModels.Enums;
|
using SoftwareInstallationDataModels.Enums;
|
||||||
using SoftwareInstallationDataModels.Models;
|
using SoftwareInstallationDataModels.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationDatabaseImplement.Models
|
namespace SoftwareInstallationDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
@@ -76,7 +68,7 @@ namespace SoftwareInstallationDatabaseImplement.Models
|
|||||||
var context = new SoftwareInstallationDatabase();
|
var context = new SoftwareInstallationDatabase();
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
PackageName = context.Packages.FirstOrDefault(x => x.Id == PackageId)?.PackageName ?? string.Empty,
|
PackageName = Package?.PackageName ?? string.Empty,
|
||||||
PackageId = PackageId,
|
PackageId = PackageId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
using SoftwareInstallationContracts.SearchModels;
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
using SoftwareInstallationContracts.StoragesContracts;
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
@@ -28,11 +29,22 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return context.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
return context.Orders
|
||||||
|
.Include(x => x.Package)
|
||||||
|
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) // если не ищем по айдишнику, значит ищем по диапазону дат
|
||||||
|
{
|
||||||
|
using var context = new SoftwareInstallationDatabase();
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Package)
|
||||||
|
.Where(x => model.DateFrom <= x.DateCreate.Date && x.DateCreate <= model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
var result = GetElement(model);
|
var result = GetElement(model);
|
||||||
return result != null ? new() { result } : new();
|
return result != null ? new() { result } : new();
|
||||||
}
|
}
|
||||||
@@ -41,6 +53,7 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new SoftwareInstallationDatabase();
|
using var context = new SoftwareInstallationDatabase();
|
||||||
return context.Orders
|
return context.Orders
|
||||||
|
.Include(x => x.Package)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -61,7 +74,7 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
|||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new SoftwareInstallationDatabase();
|
using var context = new SoftwareInstallationDatabase();
|
||||||
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
var order = context.Orders.Include(x => x.Package).FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (order == null)
|
if (order == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
using SoftwareInstallationDataModels.Models;
|
using SoftwareInstallationDataModels.Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SoftwareInstallationContracts.BindingModels;
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
|
|
||||||
@@ -39,8 +34,6 @@ namespace SoftwareInstallationDatabaseImplement.Models
|
|||||||
public virtual List<PackageComponent> Components { get; set; } = new();
|
public virtual List<PackageComponent> Components { get; set; } = new();
|
||||||
[ForeignKey("PackageId")]
|
[ForeignKey("PackageId")]
|
||||||
public virtual List<Order> Orders { get; set; } = new();
|
public virtual List<Order> Orders { get; set; } = new();
|
||||||
[ForeignKey("PackageId")]
|
|
||||||
public virtual List<Shop> Shops { get; set; } = new();
|
|
||||||
|
|
||||||
public static Package Create(SoftwareInstallationDatabase context, PackageBindingModel model)
|
public static Package Create(SoftwareInstallationDatabase context, PackageBindingModel model)
|
||||||
{
|
{
|
||||||
@@ -15,4 +15,4 @@ namespace SoftwareInstallationDatabaseImplement.Models
|
|||||||
public virtual Component Component { get; set; } = new();
|
public virtual Component Component { get; set; } = new();
|
||||||
public virtual Package Package { get; set; } = new();
|
public virtual Package Package { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
using SoftwareInstallationContracts.SearchModels;
|
using SoftwareInstallationContracts.SearchModels;
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
using SoftwareInstallationContracts.StoragesContracts;
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
using SoftwareInstallationContracts.ViewModels;
|
||||||
using SoftwareInstallationDatabaseImplement;
|
|
||||||
using SoftwareInstallationDatabaseImplement.Models;
|
using SoftwareInstallationDatabaseImplement.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -101,4 +100,4 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace SoftwareInstallationDatabaseImplement
|
|||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"
|
optionsBuilder.UseSqlServer(@"
|
||||||
Server = localhost\SQLEXPRESS;
|
Server = localhost\SQLEXPRESS;
|
||||||
Initial Catalog = SoftwareHardInstallationDatabaseFull;
|
Initial Catalog = SoftwareInstallationDatabaseFull;
|
||||||
Integrated Security = True;
|
Integrated Security = True;
|
||||||
MultipleActiveResultSets = True;
|
MultipleActiveResultSets = True;
|
||||||
TrustServerCertificate = True");
|
TrustServerCertificate = True");
|
||||||
@@ -23,8 +23,5 @@ namespace SoftwareInstallationDatabaseImplement
|
|||||||
public virtual DbSet<Package> Packages { set; get; }
|
public virtual DbSet<Package> Packages { set; get; }
|
||||||
public virtual DbSet<PackageComponent> PackageComponents { set; get; }
|
public virtual DbSet<PackageComponent> PackageComponents { set; get; }
|
||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
public virtual DbSet<Shop> Shops { set; get; }
|
|
||||||
public virtual DbSet<ShopPackage> ShopPackages { set; get; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.3" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -8,13 +8,11 @@ namespace SoftwareInstallationListImplement
|
|||||||
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<Package> Packages { get; set; }
|
public List<Package> Packages { 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>();
|
||||||
Packages = new List<Package>();
|
Packages = new List<Package>();
|
||||||
Shops = new List<Shop>();
|
|
||||||
}
|
}
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ namespace SoftwareInstallationListImplement.Implements
|
|||||||
{
|
{
|
||||||
return new() { order.GetViewModel };
|
return new() { order.GetViewModel };
|
||||||
}
|
}
|
||||||
|
if(model.DateFrom != null && model.DateTo != null && model.DateFrom <= order.DateCreate.Date && order.DateCreate <= model.DateTo)
|
||||||
|
{
|
||||||
|
result.Add(order.GetViewModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationListImplement
|
|
||||||
{
|
|
||||||
public class Shop : IShopModel
|
|
||||||
{
|
|
||||||
public string Name { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public string Address { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public int MaxCountPackages { get; private set; }
|
|
||||||
|
|
||||||
public DateTime DateOpening { get; private set; }
|
|
||||||
|
|
||||||
public Dictionary<int, (IPackageModel, int)> Packages
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
} = new();
|
|
||||||
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public static Shop? Create(ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Shop()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
Name = model.Name,
|
|
||||||
Address = model.Address,
|
|
||||||
DateOpening = model.DateOpening,
|
|
||||||
MaxCountPackages = model.MaxCountPackages,
|
|
||||||
Packages = new()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void Update(ShopBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Name = model.Name;
|
|
||||||
Address = model.Address;
|
|
||||||
DateOpening = model.DateOpening;
|
|
||||||
MaxCountPackages = model.MaxCountPackages;
|
|
||||||
Packages = model.Packages;
|
|
||||||
}
|
|
||||||
public ShopViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
Name = Name,
|
|
||||||
Address = Address,
|
|
||||||
Packages = Packages,
|
|
||||||
DateOpening = DateOpening,
|
|
||||||
MaxCountPackages = MaxCountPackages,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.SearchModels;
|
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationListImplement
|
|
||||||
{
|
|
||||||
public class ShopStorage : IShopStorage
|
|
||||||
{
|
|
||||||
private readonly DataListSingleton _source;
|
|
||||||
public ShopStorage()
|
|
||||||
{
|
|
||||||
_source = DataListSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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.Name == model.Name) ||
|
|
||||||
(model.Id.HasValue && shop.Id == model.Id))
|
|
||||||
{
|
|
||||||
return shop.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
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.Name.Contains(model.Name ?? string.Empty))
|
|
||||||
{
|
|
||||||
result.Add(shop.GetViewModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ShopViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
var result = new List<ShopViewModel>();
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
result.Add(shop.GetViewModel);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasNeedPackages(IPackageModel package, int needCount)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
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 bool SellPackages(IPackageModel package, int needCount)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopViewModel? Update(ShopBindingModel model)
|
|
||||||
{
|
|
||||||
foreach (var shop in _source.Shops)
|
|
||||||
{
|
|
||||||
if (shop.Id == model.Id)
|
|
||||||
{
|
|
||||||
shop.Update(model);
|
|
||||||
return shop.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
partial class FormAddPackageInShop
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.textBoxShop = new System.Windows.Forms.ComboBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxPackage = new System.Windows.Forms.ComboBox();
|
|
||||||
this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// textBoxShop
|
|
||||||
//
|
|
||||||
this.textBoxShop.FormattingEnabled = true;
|
|
||||||
this.textBoxShop.Location = new System.Drawing.Point(214, 17);
|
|
||||||
this.textBoxShop.Name = "textBoxShop";
|
|
||||||
this.textBoxShop.Size = new System.Drawing.Size(222, 23);
|
|
||||||
this.textBoxShop.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(84, 20);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(124, 15);
|
|
||||||
this.label1.TabIndex = 2;
|
|
||||||
this.label1.Text = "Выбранный магазин:";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(12, 47);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(196, 15);
|
|
||||||
this.label2.TabIndex = 4;
|
|
||||||
this.label2.Text = "Изделие которое нужно добавить:";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(133, 73);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(75, 15);
|
|
||||||
this.label3.TabIndex = 5;
|
|
||||||
this.label3.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// comboBoxPackage
|
|
||||||
//
|
|
||||||
this.textBoxPackage.FormattingEnabled = true;
|
|
||||||
this.textBoxPackage.Location = new System.Drawing.Point(214, 44);
|
|
||||||
this.textBoxPackage.Name = "comboBoxPackage";
|
|
||||||
this.textBoxPackage.Size = new System.Drawing.Size(222, 23);
|
|
||||||
this.textBoxPackage.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// numericUpDownCount
|
|
||||||
//
|
|
||||||
this.numericUpDownCount.Location = new System.Drawing.Point(215, 71);
|
|
||||||
this.numericUpDownCount.Maximum = new decimal(new int[] {
|
|
||||||
1410065408,
|
|
||||||
2,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownCount.Name = "numericUpDownCount";
|
|
||||||
this.numericUpDownCount.Size = new System.Drawing.Size(221, 23);
|
|
||||||
this.numericUpDownCount.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(280, 123);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonSave.TabIndex = 8;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(361, 123);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonCancel.TabIndex = 9;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormAddPackageInShop
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(448, 158);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.numericUpDownCount);
|
|
||||||
this.Controls.Add(this.textBoxPackage);
|
|
||||||
this.Controls.Add(this.label3);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.textBoxShop);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Name = "FormAddPackageInShop";
|
|
||||||
this.Text = "форма добавления пакета в магазин";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private ComboBox textBoxShop;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
private ComboBox textBoxPackage;
|
|
||||||
private NumericUpDown numericUpDownCount;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
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 SoftwareInstallationView
|
|
||||||
{
|
|
||||||
public partial class FormAddPackageInShop : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IShopLogic _shopLogic;
|
|
||||||
private readonly IPackageLogic _packageLogic;
|
|
||||||
private readonly List<ShopViewModel>? _listShops;
|
|
||||||
private readonly List<PackageViewModel>? _listPackages;
|
|
||||||
|
|
||||||
public FormAddPackageInShop(ILogger<FormAddPackageInShop> logger, IShopLogic shopLogic, IPackageLogic packageLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_shopLogic = shopLogic;
|
|
||||||
_packageLogic = packageLogic;
|
|
||||||
_logger = logger;
|
|
||||||
_listShops = shopLogic.ReadList(null);
|
|
||||||
if (_listShops != null)
|
|
||||||
{
|
|
||||||
textBoxShop.DisplayMember = "Name";
|
|
||||||
textBoxShop.ValueMember = "Id";
|
|
||||||
textBoxShop.DataSource = _listShops;
|
|
||||||
textBoxShop.SelectedItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
_listPackages = packageLogic.ReadList(null);
|
|
||||||
if (_listPackages != null)
|
|
||||||
{
|
|
||||||
textBoxPackage.DisplayMember = "PackageName";
|
|
||||||
textBoxPackage.ValueMember= "Id";
|
|
||||||
textBoxPackage.DataSource = _listPackages;
|
|
||||||
textBoxPackage.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (textBoxShop.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (textBoxPackage.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Добавление изделия в магазин");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var package = _packageLogic.ReadElement(new()
|
|
||||||
{
|
|
||||||
Id = (int)textBoxPackage.SelectedValue
|
|
||||||
});
|
|
||||||
if (package == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Не найдено изделие. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
var resultOperation = _shopLogic.AddPackage(
|
|
||||||
model: new() { Id = (int)textBoxShop.SelectedValue },
|
|
||||||
package: package,
|
|
||||||
count: (int)numericUpDownCount.Value
|
|
||||||
);
|
|
||||||
if (!resultOperation)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при добавлении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -102,6 +102,7 @@
|
|||||||
this.Controls.Add(this.buttonAdd);
|
this.Controls.Add(this.buttonAdd);
|
||||||
this.Name = "FormComponents";
|
this.Name = "FormComponents";
|
||||||
this.Text = "Компоненты";
|
this.Text = "Компоненты";
|
||||||
|
this.Load += new System.EventHandler(this.FormComponents_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ namespace SoftwareInstallationView
|
|||||||
}
|
}
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
var service =
|
||||||
|
Program.ServiceProvider?.GetService(typeof(FormComponent));
|
||||||
if (service is FormComponent form)
|
if (service is FormComponent form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
|||||||
@@ -28,177 +28,168 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.packageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
packageToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.componentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
componentToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.ButtonIssuedOrder = new System.Windows.Forms.Button();
|
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.ButtonOrderReady = new System.Windows.Forms.Button();
|
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
ButtonRef = new Button();
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
ButtonIssuedOrder = new Button();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
ButtonOrderReady = new Button();
|
||||||
this.buttonAddPackageInShop = new System.Windows.Forms.Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
this.buttonSellPackage = new System.Windows.Forms.Button();
|
buttonCreateOrder = new Button();
|
||||||
this.menuStrip1.SuspendLayout();
|
dataGridView = new DataGridView();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
//
|
SuspendLayout();
|
||||||
// menuStrip1
|
//
|
||||||
//
|
// menuStrip1
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
//
|
||||||
this.справочникиToolStripMenuItem});
|
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчётыToolStripMenuItem });
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
menuStrip1.Location = new Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1125, 24);
|
menuStrip1.Size = new Size(1125, 24);
|
||||||
this.menuStrip1.TabIndex = 1;
|
menuStrip1.TabIndex = 1;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { packageToolStripMenuItem, componentToolStripMenuItem });
|
||||||
this.packageToolStripMenuItem,
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
this.componentToolStripMenuItem,
|
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||||
this.магазиныToolStripMenuItem});
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
//
|
||||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
|
// packageToolStripMenuItem
|
||||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
//
|
||||||
//
|
packageToolStripMenuItem.Name = "packageToolStripMenuItem";
|
||||||
// packageToolStripMenuItem
|
packageToolStripMenuItem.Size = new Size(145, 22);
|
||||||
//
|
packageToolStripMenuItem.Text = "Изделия";
|
||||||
this.packageToolStripMenuItem.Name = "packageToolStripMenuItem";
|
packageToolStripMenuItem.Click += PackagesToolStripMenuItem_Click;
|
||||||
this.packageToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
//
|
||||||
this.packageToolStripMenuItem.Text = "Изделия";
|
// componentToolStripMenuItem
|
||||||
this.packageToolStripMenuItem.Click += new System.EventHandler(this.PackagesToolStripMenuItem_Click);
|
//
|
||||||
//
|
componentToolStripMenuItem.Name = "componentToolStripMenuItem";
|
||||||
// componentToolStripMenuItem
|
componentToolStripMenuItem.Size = new Size(145, 22);
|
||||||
//
|
componentToolStripMenuItem.Text = "Компоненты";
|
||||||
this.componentToolStripMenuItem.Name = "componentToolStripMenuItem";
|
componentToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||||
this.componentToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
//
|
||||||
this.componentToolStripMenuItem.Text = "Компоненты";
|
// отчётыToolStripMenuItem
|
||||||
this.componentToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
//
|
||||||
//
|
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||||
// магазиныToolStripMenuItem
|
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
//
|
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
||||||
this.магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||||
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
//
|
||||||
this.магазиныToolStripMenuItem.Text = "Магазины";
|
// списокКомпонентовToolStripMenuItem
|
||||||
this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.ShopsToolStripMenuItem_Click);
|
//
|
||||||
//
|
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||||
// ButtonRef
|
списокКомпонентовToolStripMenuItem.Size = new Size(218, 22);
|
||||||
//
|
списокКомпонентовToolStripMenuItem.Text = "Список изделий";
|
||||||
this.ButtonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
списокКомпонентовToolStripMenuItem.Click += ComponentsReportToolStripMenuItem_Click;
|
||||||
this.ButtonRef.Location = new System.Drawing.Point(966, 232);
|
//
|
||||||
this.ButtonRef.Name = "ButtonRef";
|
// компонентыПоИзделиямToolStripMenuItem
|
||||||
this.ButtonRef.Size = new System.Drawing.Size(147, 42);
|
//
|
||||||
this.ButtonRef.TabIndex = 12;
|
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||||
this.ButtonRef.Text = "Обновить список";
|
компонентыПоИзделиямToolStripMenuItem.Size = new Size(218, 22);
|
||||||
this.ButtonRef.UseVisualStyleBackColor = true;
|
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||||
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
компонентыПоИзделиямToolStripMenuItem.Click += ComponentPackagesToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// ButtonIssuedOrder
|
// списокЗаказовToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.ButtonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||||
this.ButtonIssuedOrder.Location = new System.Drawing.Point(966, 184);
|
списокЗаказовToolStripMenuItem.Size = new Size(218, 22);
|
||||||
this.ButtonIssuedOrder.Name = "ButtonIssuedOrder";
|
списокЗаказовToolStripMenuItem.Text = "Список Заказов";
|
||||||
this.ButtonIssuedOrder.Size = new System.Drawing.Size(147, 42);
|
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||||
this.ButtonIssuedOrder.TabIndex = 11;
|
//
|
||||||
this.ButtonIssuedOrder.Text = "Заказ выдан";
|
// ButtonRef
|
||||||
this.ButtonIssuedOrder.UseVisualStyleBackColor = true;
|
//
|
||||||
this.ButtonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
ButtonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
//
|
ButtonRef.Location = new Point(966, 374);
|
||||||
// ButtonOrderReady
|
ButtonRef.Name = "ButtonRef";
|
||||||
//
|
ButtonRef.Size = new Size(147, 55);
|
||||||
this.ButtonOrderReady.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonRef.TabIndex = 12;
|
||||||
this.ButtonOrderReady.Location = new System.Drawing.Point(966, 136);
|
ButtonRef.Text = "Обновить список";
|
||||||
this.ButtonOrderReady.Name = "ButtonOrderReady";
|
ButtonRef.UseVisualStyleBackColor = true;
|
||||||
this.ButtonOrderReady.Size = new System.Drawing.Size(147, 42);
|
ButtonRef.Click += ButtonRef_Click;
|
||||||
this.ButtonOrderReady.TabIndex = 10;
|
//
|
||||||
this.ButtonOrderReady.Text = "Заказ готов";
|
// ButtonIssuedOrder
|
||||||
this.ButtonOrderReady.UseVisualStyleBackColor = true;
|
//
|
||||||
this.ButtonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
|
ButtonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
//
|
ButtonIssuedOrder.Location = new Point(966, 284);
|
||||||
// buttonTakeOrderInWork
|
ButtonIssuedOrder.Name = "ButtonIssuedOrder";
|
||||||
//
|
ButtonIssuedOrder.Size = new Size(147, 55);
|
||||||
this.buttonTakeOrderInWork.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonIssuedOrder.TabIndex = 11;
|
||||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(966, 88);
|
ButtonIssuedOrder.Text = "Заказ выдан";
|
||||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
ButtonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(147, 42);
|
ButtonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||||
this.buttonTakeOrderInWork.TabIndex = 9;
|
//
|
||||||
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
// ButtonOrderReady
|
||||||
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
//
|
||||||
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
|
ButtonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
//
|
ButtonOrderReady.Location = new Point(966, 194);
|
||||||
// buttonCreateOrder
|
ButtonOrderReady.Name = "ButtonOrderReady";
|
||||||
//
|
ButtonOrderReady.Size = new Size(147, 55);
|
||||||
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonOrderReady.TabIndex = 10;
|
||||||
this.buttonCreateOrder.Location = new System.Drawing.Point(966, 40);
|
ButtonOrderReady.Text = "Заказ готов";
|
||||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
ButtonOrderReady.UseVisualStyleBackColor = true;
|
||||||
this.buttonCreateOrder.Size = new System.Drawing.Size(147, 42);
|
ButtonOrderReady.Click += ButtonOrderReady_Click;
|
||||||
this.buttonCreateOrder.TabIndex = 8;
|
//
|
||||||
this.buttonCreateOrder.Text = "Создать заказ";
|
// buttonTakeOrderInWork
|
||||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
//
|
||||||
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
//
|
buttonTakeOrderInWork.Location = new Point(966, 112);
|
||||||
// dataGridView
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
//
|
buttonTakeOrderInWork.Size = new Size(147, 55);
|
||||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
buttonTakeOrderInWork.TabIndex = 9;
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
//
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 27);
|
// buttonCreateOrder
|
||||||
this.dataGridView.Name = "dataGridView";
|
//
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(948, 402);
|
buttonCreateOrder.Location = new Point(966, 27);
|
||||||
this.dataGridView.TabIndex = 7;
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
//
|
buttonCreateOrder.Size = new Size(147, 55);
|
||||||
// buttonAddPackageInShop
|
buttonCreateOrder.TabIndex = 8;
|
||||||
//
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
this.buttonAddPackageInShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
this.buttonAddPackageInShop.Location = new System.Drawing.Point(966, 387);
|
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||||
this.buttonAddPackageInShop.Name = "buttonAddPackageInShop";
|
//
|
||||||
this.buttonAddPackageInShop.Size = new System.Drawing.Size(147, 42);
|
// dataGridView
|
||||||
this.buttonAddPackageInShop.TabIndex = 13;
|
//
|
||||||
this.buttonAddPackageInShop.Text = "Пополнение магазина";
|
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
this.buttonAddPackageInShop.UseVisualStyleBackColor = true;
|
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
||||||
this.buttonAddPackageInShop.Click += new System.EventHandler(this.ButtonAddPackageInShop_Click);
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
//
|
dataGridView.Location = new Point(12, 27);
|
||||||
// buttonSellPackage
|
dataGridView.Name = "dataGridView";
|
||||||
//
|
dataGridView.RowTemplate.Height = 25;
|
||||||
this.buttonSellPackage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
dataGridView.Size = new Size(948, 402);
|
||||||
this.buttonSellPackage.Location = new System.Drawing.Point(966, 339);
|
dataGridView.TabIndex = 7;
|
||||||
this.buttonSellPackage.Name = "buttonSellPackage";
|
//
|
||||||
this.buttonSellPackage.Size = new System.Drawing.Size(147, 42);
|
// FormMain
|
||||||
this.buttonSellPackage.TabIndex = 14;
|
//
|
||||||
this.buttonSellPackage.Text = "Продать изделие";
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.buttonSellPackage.UseVisualStyleBackColor = true;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.buttonSellPackage.Click += new System.EventHandler(this.ButtonSellPackage_Click);
|
ClientSize = new Size(1125, 441);
|
||||||
//
|
Controls.Add(ButtonRef);
|
||||||
// FormMain
|
Controls.Add(ButtonIssuedOrder);
|
||||||
//
|
Controls.Add(ButtonOrderReady);
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
Controls.Add(buttonTakeOrderInWork);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
Controls.Add(buttonCreateOrder);
|
||||||
this.ClientSize = new System.Drawing.Size(1125, 441);
|
Controls.Add(dataGridView);
|
||||||
this.Controls.Add(this.buttonSellPackage);
|
Controls.Add(menuStrip1);
|
||||||
this.Controls.Add(this.buttonAddPackageInShop);
|
Name = "FormMain";
|
||||||
this.Controls.Add(this.ButtonRef);
|
Text = "Установка ПО";
|
||||||
this.Controls.Add(this.ButtonIssuedOrder);
|
Load += FormMain_Load;
|
||||||
this.Controls.Add(this.ButtonOrderReady);
|
menuStrip1.ResumeLayout(false);
|
||||||
this.Controls.Add(this.buttonTakeOrderInWork);
|
menuStrip1.PerformLayout();
|
||||||
this.Controls.Add(this.buttonCreateOrder);
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
this.Controls.Add(this.dataGridView);
|
ResumeLayout(false);
|
||||||
this.Controls.Add(this.menuStrip1);
|
PerformLayout();
|
||||||
this.Name = "FormMain";
|
|
||||||
this.Text = "Установка ПО";
|
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
|
||||||
this.menuStrip1.ResumeLayout(false);
|
|
||||||
this.menuStrip1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -213,8 +204,9 @@
|
|||||||
private Button buttonTakeOrderInWork;
|
private Button buttonTakeOrderInWork;
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private ToolStripMenuItem магазиныToolStripMenuItem;
|
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||||
private Button buttonAddPackageInShop;
|
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
||||||
private Button buttonSellPackage;
|
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SoftwareInstallationBusinessLogic.BusinessLogics;
|
||||||
|
|
||||||
namespace SoftwareInstallationView
|
namespace SoftwareInstallationView
|
||||||
{
|
{
|
||||||
@@ -8,11 +9,13 @@ namespace SoftwareInstallationView
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
private readonly IReportLogic _reportLogic;
|
||||||
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
|
_reportLogic = reportLogic;
|
||||||
}
|
}
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -134,27 +137,30 @@ namespace SoftwareInstallationView
|
|||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ComponentsReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormViewShops));
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
if (service is FormViewShops form)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName
|
||||||
|
});
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ComponentPackagesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportPackageComponents));
|
||||||
|
if (service is FormReportPackageComponents form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
private void ButtonAddPackageInShop_Click(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormAddPackageInShop));
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
if (service is FormAddPackageInShop form)
|
if (service is FormReportOrders form)
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonSellPackage_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSellPackage));
|
|
||||||
if (service is FormSellPackage form)
|
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@
|
|||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Name = "FormPackages";
|
this.Name = "FormPackages";
|
||||||
this.Text = "Изделия";
|
this.Text = "Изделия";
|
||||||
|
this.Load += new System.EventHandler(this.FormViewPackage_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
|||||||
141
SoftwareInstallation/SoftwareInstallationView/FormReportOrders.Designer.cs
generated
Normal file
141
SoftwareInstallation/SoftwareInstallationView/FormReportOrders.Designer.cs
generated
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
namespace SoftwareInstallationView
|
||||||
|
{
|
||||||
|
partial class FormReportOrders
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.panel = new System.Windows.Forms.Panel();
|
||||||
|
this.buttonToPdf = new System.Windows.Forms.Button();
|
||||||
|
this.buttonMake = new System.Windows.Forms.Button();
|
||||||
|
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.labelTo = new System.Windows.Forms.Label();
|
||||||
|
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.labelFrom = new System.Windows.Forms.Label();
|
||||||
|
this.panel.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel
|
||||||
|
//
|
||||||
|
this.panel.Controls.Add(this.buttonToPdf);
|
||||||
|
this.panel.Controls.Add(this.buttonMake);
|
||||||
|
this.panel.Controls.Add(this.dateTimePickerTo);
|
||||||
|
this.panel.Controls.Add(this.labelTo);
|
||||||
|
this.panel.Controls.Add(this.dateTimePickerFrom);
|
||||||
|
this.panel.Controls.Add(this.labelFrom);
|
||||||
|
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.panel.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.panel.Name = "panel";
|
||||||
|
this.panel.Size = new System.Drawing.Size(1031, 40);
|
||||||
|
this.panel.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonToPdf
|
||||||
|
//
|
||||||
|
this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonToPdf.Location = new System.Drawing.Point(878, 8);
|
||||||
|
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.buttonToPdf.Name = "buttonToPdf";
|
||||||
|
this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
|
||||||
|
this.buttonToPdf.TabIndex = 5;
|
||||||
|
this.buttonToPdf.Text = "В Pdf";
|
||||||
|
this.buttonToPdf.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
|
||||||
|
//
|
||||||
|
// buttonMake
|
||||||
|
//
|
||||||
|
this.buttonMake.Location = new System.Drawing.Point(476, 8);
|
||||||
|
this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.buttonMake.Name = "buttonMake";
|
||||||
|
this.buttonMake.Size = new System.Drawing.Size(139, 27);
|
||||||
|
this.buttonMake.TabIndex = 4;
|
||||||
|
this.buttonMake.Text = "Сформировать";
|
||||||
|
this.buttonMake.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
||||||
|
//
|
||||||
|
// dateTimePickerTo
|
||||||
|
//
|
||||||
|
this.dateTimePickerTo.Location = new System.Drawing.Point(237, 7);
|
||||||
|
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
||||||
|
this.dateTimePickerTo.Size = new System.Drawing.Size(163, 23);
|
||||||
|
this.dateTimePickerTo.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// labelTo
|
||||||
|
//
|
||||||
|
this.labelTo.AutoSize = true;
|
||||||
|
this.labelTo.Location = new System.Drawing.Point(208, 10);
|
||||||
|
this.labelTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
|
this.labelTo.Name = "labelTo";
|
||||||
|
this.labelTo.Size = new System.Drawing.Size(21, 15);
|
||||||
|
this.labelTo.TabIndex = 2;
|
||||||
|
this.labelTo.Text = "по";
|
||||||
|
//
|
||||||
|
// dateTimePickerFrom
|
||||||
|
//
|
||||||
|
this.dateTimePickerFrom.Location = new System.Drawing.Point(37, 7);
|
||||||
|
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||||
|
this.dateTimePickerFrom.Size = new System.Drawing.Size(163, 23);
|
||||||
|
this.dateTimePickerFrom.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// labelFrom
|
||||||
|
//
|
||||||
|
this.labelFrom.AutoSize = true;
|
||||||
|
this.labelFrom.Location = new System.Drawing.Point(14, 10);
|
||||||
|
this.labelFrom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
|
this.labelFrom.Name = "labelFrom";
|
||||||
|
this.labelFrom.Size = new System.Drawing.Size(15, 15);
|
||||||
|
this.labelFrom.TabIndex = 0;
|
||||||
|
this.labelFrom.Text = "С";
|
||||||
|
//
|
||||||
|
// FormReportOrders
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1031, 647);
|
||||||
|
this.Controls.Add(this.panel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.Name = "FormReportOrders";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "Заказы";
|
||||||
|
this.panel.ResumeLayout(false);
|
||||||
|
this.panel.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Panel panel;
|
||||||
|
private System.Windows.Forms.Button buttonToPdf;
|
||||||
|
private System.Windows.Forms.Button buttonMake;
|
||||||
|
private System.Windows.Forms.DateTimePicker dateTimePickerTo;
|
||||||
|
private System.Windows.Forms.Label labelTo;
|
||||||
|
private System.Windows.Forms.DateTimePicker dateTimePickerFrom;
|
||||||
|
private System.Windows.Forms.Label labelFrom;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
|
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Reporting.WinForms;
|
||||||
|
|
||||||
|
namespace SoftwareInstallationView
|
||||||
|
{
|
||||||
|
public partial class FormReportOrders : Form
|
||||||
|
{
|
||||||
|
private readonly ReportViewer reportViewer;
|
||||||
|
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IReportLogic _logic;
|
||||||
|
|
||||||
|
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
reportViewer = new ReportViewer
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Fill
|
||||||
|
};
|
||||||
|
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
||||||
|
Controls.Clear();
|
||||||
|
Controls.Add(reportViewer);
|
||||||
|
Controls.Add(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonMake_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dataSource = _logic.GetOrders(new ReportBindingModel
|
||||||
|
{
|
||||||
|
DateFrom = dateTimePickerFrom.Value,
|
||||||
|
DateTo = dateTimePickerTo.Value
|
||||||
|
});
|
||||||
|
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||||
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
|
var parameters = new[] { new ReportParameter("ReportParameterPeriod",$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
||||||
|
reportViewer.LocalReport.SetParameters(parameters);
|
||||||
|
|
||||||
|
reportViewer.RefreshReport();
|
||||||
|
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка заказов на период");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonToPdf_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName,
|
||||||
|
DateFrom = dateTimePickerFrom.Value,
|
||||||
|
DateTo = dateTimePickerTo.Value
|
||||||
|
});
|
||||||
|
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
113
SoftwareInstallation/SoftwareInstallationView/FormReportPackageComponents.Designer.cs
generated
Normal file
113
SoftwareInstallation/SoftwareInstallationView/FormReportPackageComponents.Designer.cs
generated
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
namespace SoftwareInstallationView
|
||||||
|
{
|
||||||
|
partial class FormReportPackageComponents
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
buttonSaveToExcel = new Button();
|
||||||
|
ColumnPackage = new DataGridViewTextBoxColumn();
|
||||||
|
ColumnComponent = new DataGridViewTextBoxColumn();
|
||||||
|
ColumnCount = new DataGridViewTextBoxColumn();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToOrderColumns = true;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnPackage, ColumnComponent, ColumnCount });
|
||||||
|
dataGridView.Dock = DockStyle.Bottom;
|
||||||
|
dataGridView.Location = new Point(0, 47);
|
||||||
|
dataGridView.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.Size = new Size(616, 510);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonSaveToExcel
|
||||||
|
//
|
||||||
|
buttonSaveToExcel.Location = new Point(14, 14);
|
||||||
|
buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||||
|
buttonSaveToExcel.Size = new Size(186, 27);
|
||||||
|
buttonSaveToExcel.TabIndex = 1;
|
||||||
|
buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||||
|
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||||
|
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
|
||||||
|
//
|
||||||
|
// ColumnPackage
|
||||||
|
//
|
||||||
|
ColumnPackage.HeaderText = "Изделие";
|
||||||
|
ColumnPackage.Name = "ColumnPackage";
|
||||||
|
ColumnPackage.ReadOnly = true;
|
||||||
|
ColumnPackage.Width = 200;
|
||||||
|
//
|
||||||
|
// ColumnComponent
|
||||||
|
//
|
||||||
|
ColumnComponent.HeaderText = "Компонент";
|
||||||
|
ColumnComponent.Name = "ColumnComponent";
|
||||||
|
ColumnComponent.ReadOnly = true;
|
||||||
|
ColumnComponent.Width = 200;
|
||||||
|
//
|
||||||
|
// ColumnCount
|
||||||
|
//
|
||||||
|
ColumnCount.HeaderText = "Количество";
|
||||||
|
ColumnCount.Name = "ColumnCount";
|
||||||
|
ColumnCount.ReadOnly = true;
|
||||||
|
//
|
||||||
|
// FormReportPackageComponents
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(616, 557);
|
||||||
|
Controls.Add(buttonSaveToExcel);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Margin = new Padding(4, 3, 4, 3);
|
||||||
|
Name = "FormReportPackageComponents";
|
||||||
|
Text = "Изделия с компонентами";
|
||||||
|
Load += FormReportPackageComponents_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView;
|
||||||
|
private System.Windows.Forms.Button buttonSaveToExcel;
|
||||||
|
private DataGridViewTextBoxColumn ColumnPackage;
|
||||||
|
private DataGridViewTextBoxColumn ColumnComponent;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
using SoftwareInstallationContracts.BindingModels;
|
||||||
|
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
namespace SoftwareInstallationView
|
||||||
|
{
|
||||||
|
public partial class FormReportPackageComponents : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IReportLogic _logic;
|
||||||
|
public FormReportPackageComponents(ILogger<FormReportPackageComponents> logger, IReportLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
private void FormReportPackageComponents_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dict = _logic.GetPackageComponent();
|
||||||
|
if (dict != null)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
foreach (var elem in dict)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[] { elem.PackageName,"", "" });
|
||||||
|
foreach (var listElem in elem.Components)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||||
|
}
|
||||||
|
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
||||||
|
dataGridView.Rows.Add(Array.Empty<object>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка списка изделий по компонентам");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
||||||
|
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Filter = "xlsx|*.xlsx"
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SavePackageComponentToExcelFile(new
|
||||||
|
ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName
|
||||||
|
});
|
||||||
|
_logger.LogInformation("Сохранение списка изделий по компонентам");
|
||||||
|
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
||||||
|
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
partial class FormSellPackage
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.comboBoxPackage = new System.Windows.Forms.ComboBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.buttonSell = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// comboBoxPackage
|
|
||||||
//
|
|
||||||
this.comboBoxPackage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.comboBoxPackage.FormattingEnabled = true;
|
|
||||||
this.comboBoxPackage.Location = new System.Drawing.Point(141, 12);
|
|
||||||
this.comboBoxPackage.Name = "comboBoxPackage";
|
|
||||||
this.comboBoxPackage.Size = new System.Drawing.Size(121, 23);
|
|
||||||
this.comboBoxPackage.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(12, 15);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(123, 15);
|
|
||||||
this.label1.TabIndex = 1;
|
|
||||||
this.label1.Text = "Изделие на продажу:";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(60, 46);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(75, 15);
|
|
||||||
this.label2.TabIndex = 2;
|
|
||||||
this.label2.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// numericUpDownCount
|
|
||||||
//
|
|
||||||
this.numericUpDownCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.numericUpDownCount.Location = new System.Drawing.Point(142, 46);
|
|
||||||
this.numericUpDownCount.Maximum = new decimal(new int[] {
|
|
||||||
10000000,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownCount.Name = "numericUpDownCount";
|
|
||||||
this.numericUpDownCount.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
|
||||||
this.numericUpDownCount.Size = new System.Drawing.Size(120, 23);
|
|
||||||
this.numericUpDownCount.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// buttonSell
|
|
||||||
//
|
|
||||||
this.buttonSell.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonSell.Location = new System.Drawing.Point(12, 90);
|
|
||||||
this.buttonSell.Name = "buttonSell";
|
|
||||||
this.buttonSell.Size = new System.Drawing.Size(123, 23);
|
|
||||||
this.buttonSell.TabIndex = 4;
|
|
||||||
this.buttonSell.Text = "Продать";
|
|
||||||
this.buttonSell.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSell.Click += new System.EventHandler(this.ButtonSell_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(142, 90);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(123, 23);
|
|
||||||
this.buttonCancel.TabIndex = 5;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormSellPackage
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(277, 122);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSell);
|
|
||||||
this.Controls.Add(this.numericUpDownCount);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.comboBoxPackage);
|
|
||||||
this.Name = "FormSellPackage";
|
|
||||||
this.Text = "Продажа изделия";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private ComboBox comboBoxPackage;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private NumericUpDown numericUpDownCount;
|
|
||||||
private Button buttonSell;
|
|
||||||
private Button buttonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
public partial class FormSellPackage : Form
|
|
||||||
{
|
|
||||||
private readonly IShopLogic _shopLogic;
|
|
||||||
private readonly IPackageLogic _packageLogic;
|
|
||||||
|
|
||||||
public FormSellPackage(IPackageLogic logic, IShopLogic shopLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_packageLogic = logic;
|
|
||||||
_shopLogic = shopLogic;
|
|
||||||
var list = logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
comboBoxPackage.DisplayMember = "PackageName";
|
|
||||||
comboBoxPackage.ValueMember = "Id";
|
|
||||||
comboBoxPackage.DataSource = list;
|
|
||||||
comboBoxPackage.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSell_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (comboBoxPackage.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (numericUpDownCount.Value <= 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Количество должно быть больше нуля", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var count = (int)numericUpDownCount.Value;
|
|
||||||
var package = _packageLogic.ReadElement(new() { Id = (int)comboBoxPackage.SelectedValue });
|
|
||||||
if (package == null || !_shopLogic.SellPackages(package, count))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось продать изделия. Информацию смотрите в логах", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<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>
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.PackageName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Price = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxAddress = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.numericUpDownMaxPackage = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxDateOpening = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.textBoxShop = new System.Windows.Forms.TextBox();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxPackage)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(116, 15);
|
|
||||||
this.label1.TabIndex = 0;
|
|
||||||
this.label1.Text = "Название магазина:";
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.PackageName,
|
|
||||||
this.Price,
|
|
||||||
this.Count});
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 64);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(583, 213);
|
|
||||||
this.dataGridView.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// PackageName
|
|
||||||
//
|
|
||||||
this.PackageName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
this.PackageName.HeaderText = "Имя изделия";
|
|
||||||
this.PackageName.Name = "PackageName";
|
|
||||||
//
|
|
||||||
// Price
|
|
||||||
//
|
|
||||||
this.Price.HeaderText = "Цена";
|
|
||||||
this.Price.Name = "Price";
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
this.Count.HeaderText = "Количество";
|
|
||||||
this.Count.Name = "Count";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(159, 9);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(97, 15);
|
|
||||||
this.label2.TabIndex = 3;
|
|
||||||
this.label2.Text = "Адрес магазина:";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(340, 9);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(100, 15);
|
|
||||||
this.label3.TabIndex = 4;
|
|
||||||
this.label3.Text = "Время открытия:";
|
|
||||||
//
|
|
||||||
// textBoxAddress
|
|
||||||
//
|
|
||||||
this.textBoxAddress.Location = new System.Drawing.Point(159, 27);
|
|
||||||
this.textBoxAddress.Name = "textBoxAddress";
|
|
||||||
this.textBoxAddress.Size = new System.Drawing.Size(175, 23);
|
|
||||||
this.textBoxAddress.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(492, 283);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(103, 23);
|
|
||||||
this.buttonCancel.TabIndex = 7;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(366, 284);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(120, 22);
|
|
||||||
this.buttonSave.TabIndex = 8;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// numericUpDownMaxPackage
|
|
||||||
//
|
|
||||||
this.numericUpDownMaxPackage.Location = new System.Drawing.Point(462, 27);
|
|
||||||
this.numericUpDownMaxPackage.Maximum = new decimal(new int[] {
|
|
||||||
10000000,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownMaxPackage.Name = "numericUpDownMaxPackage";
|
|
||||||
this.numericUpDownMaxPackage.Size = new System.Drawing.Size(133, 23);
|
|
||||||
this.numericUpDownMaxPackage.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(462, 9);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(118, 15);
|
|
||||||
this.label4.TabIndex = 12;
|
|
||||||
this.label4.Text = "Максимум изделий:";
|
|
||||||
//
|
|
||||||
// textBoxDateOpening
|
|
||||||
//
|
|
||||||
this.textBoxDateOpening.Location = new System.Drawing.Point(340, 27);
|
|
||||||
this.textBoxDateOpening.Name = "textBoxDateOpening";
|
|
||||||
this.textBoxDateOpening.Size = new System.Drawing.Size(116, 23);
|
|
||||||
this.textBoxDateOpening.TabIndex = 13;
|
|
||||||
//
|
|
||||||
// textBoxShop
|
|
||||||
//
|
|
||||||
this.textBoxShop.Location = new System.Drawing.Point(12, 26);
|
|
||||||
this.textBoxShop.Name = "textBoxShop";
|
|
||||||
this.textBoxShop.Size = new System.Drawing.Size(141, 23);
|
|
||||||
this.textBoxShop.TabIndex = 14;
|
|
||||||
//
|
|
||||||
// FormShop
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(607, 317);
|
|
||||||
this.Controls.Add(this.textBoxShop);
|
|
||||||
this.Controls.Add(this.textBoxDateOpening);
|
|
||||||
this.Controls.Add(this.label4);
|
|
||||||
this.Controls.Add(this.numericUpDownMaxPackage);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.textBoxAddress);
|
|
||||||
this.Controls.Add(this.label3);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Name = "FormShop";
|
|
||||||
this.Text = "Просмотр изделий магазина";
|
|
||||||
this.Load += new System.EventHandler(this.FormShop_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxPackage)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label label1;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
private TextBox textBoxAddress;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
private DataGridViewTextBoxColumn PackageName;
|
|
||||||
private DataGridViewTextBoxColumn Price;
|
|
||||||
private DataGridViewTextBoxColumn Count;
|
|
||||||
private NumericUpDown numericUpDownMaxPackage;
|
|
||||||
private Label label4;
|
|
||||||
private DateTimePicker textBoxDateOpening;
|
|
||||||
private TextBox textBoxShop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
|
||||||
using SoftwareInstallationContracts.ViewModels;
|
|
||||||
using SoftwareInstallationDataModels;
|
|
||||||
using SoftwareInstallationDataModels.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
public partial class FormShop : Form
|
|
||||||
{
|
|
||||||
private readonly List<ShopViewModel>? _listShops;
|
|
||||||
private readonly IShopLogic _logic;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IShopModel? GetShop(int id)
|
|
||||||
{
|
|
||||||
if (_listShops == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _listShops)
|
|
||||||
{
|
|
||||||
if (elem.Id == id)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_listShops = logic.ReadList(null);
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData(bool extendDate = true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = GetShop(extendDate ? Id : Convert.ToInt32(null));
|
|
||||||
if (model != null)
|
|
||||||
{
|
|
||||||
numericUpDownMaxPackage.Value = model.MaxCountPackages;
|
|
||||||
textBoxShop.Text = model.Name;
|
|
||||||
textBoxAddress.Text = model.Address;
|
|
||||||
textBoxDateOpening.Text = Convert.ToString(model.DateOpening);
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var el in model.Packages.Values)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[]{el.Item1.PackageName, el.Item1.Price, el.Item2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка магазинов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxShop.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxAddress.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DateTime.TryParse(textBoxDateOpening.Text, out var dateTime);
|
|
||||||
ShopBindingModel model = new()
|
|
||||||
{
|
|
||||||
Name = textBoxShop.Text,
|
|
||||||
Address = textBoxAddress.Text,
|
|
||||||
DateOpening = dateTime,
|
|
||||||
MaxCountPackages = (int)numericUpDownMaxPackage.Value,
|
|
||||||
};
|
|
||||||
var vmodel = GetShop(Id);
|
|
||||||
bool operationResult = false;
|
|
||||||
|
|
||||||
if (vmodel != null)
|
|
||||||
{
|
|
||||||
model.Id = vmodel.Id;
|
|
||||||
operationResult = _logic.Update(model);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operationResult = _logic.Create(model);
|
|
||||||
}
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormShop_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<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>
|
|
||||||
<metadata name="PackageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Price.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="PackageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Price.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
partial class FormViewShops
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.buttonRef = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDel = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUpd = new System.Windows.Forms.Button();
|
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonRef
|
|
||||||
//
|
|
||||||
this.buttonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonRef.Location = new System.Drawing.Point(685, 202);
|
|
||||||
this.buttonRef.Name = "buttonRef";
|
|
||||||
this.buttonRef.Size = new System.Drawing.Size(90, 37);
|
|
||||||
this.buttonRef.TabIndex = 14;
|
|
||||||
this.buttonRef.Text = "Обновить";
|
|
||||||
this.buttonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
|
||||||
//
|
|
||||||
// buttonDel
|
|
||||||
//
|
|
||||||
this.buttonDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonDel.Location = new System.Drawing.Point(685, 151);
|
|
||||||
this.buttonDel.Name = "buttonDel";
|
|
||||||
this.buttonDel.Size = new System.Drawing.Size(90, 33);
|
|
||||||
this.buttonDel.TabIndex = 13;
|
|
||||||
this.buttonDel.Text = "Удалить";
|
|
||||||
this.buttonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
|
||||||
//
|
|
||||||
// buttonUpd
|
|
||||||
//
|
|
||||||
this.buttonUpd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonUpd.Location = new System.Drawing.Point(685, 102);
|
|
||||||
this.buttonUpd.Name = "buttonUpd";
|
|
||||||
this.buttonUpd.Size = new System.Drawing.Size(90, 34);
|
|
||||||
this.buttonUpd.TabIndex = 12;
|
|
||||||
this.buttonUpd.Text = "Изменить";
|
|
||||||
this.buttonUpd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(685, 57);
|
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(90, 30);
|
|
||||||
this.buttonAdd.TabIndex = 11;
|
|
||||||
this.buttonAdd.Text = "Добавить";
|
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(540, 379);
|
|
||||||
this.dataGridView.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// FormViewShops
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(787, 403);
|
|
||||||
this.Controls.Add(this.buttonRef);
|
|
||||||
this.Controls.Add(this.buttonDel);
|
|
||||||
this.Controls.Add(this.buttonUpd);
|
|
||||||
this.Controls.Add(this.buttonAdd);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormViewShops";
|
|
||||||
this.Text = "Просмотр магазинов";
|
|
||||||
this.Load += new System.EventHandler(this.FormShops_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button buttonRef;
|
|
||||||
private Button buttonDel;
|
|
||||||
private Button buttonUpd;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
using SoftwareInstallationContracts.BindingModels;
|
|
||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationView
|
|
||||||
{
|
|
||||||
public partial class FormViewShops : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IShopLogic _logic;
|
|
||||||
public FormViewShops(ILogger<FormViewShops> logger, IShopLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormShops_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["Packages"].Visible = false;
|
|
||||||
dataGridView.Columns["Name"].AutoSizeMode =
|
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка магазинов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
|
||||||
if (service is FormShop form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
|
||||||
if (service is FormShop form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление магазина");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ShopBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления магазина");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<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>
|
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
using SoftwareInstallationBusinessLogic.BusinessLogics;
|
|
||||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||||
using SoftwareInstallationContracts.StoragesContracts;
|
using SoftwareInstallationContracts.StoragesContracts;
|
||||||
using SoftwareInstallationDatabaseImplement.Implements;
|
using SoftwareInstallationDatabaseImplement.Implements;
|
||||||
using SoftwareInstallationDatabaseImplement;
|
|
||||||
using SoftwareInstallationBusinessLogic;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
|
using SoftwareInstallationBusinessLogic.BusinessLogic;
|
||||||
|
using SoftwareInstallationBusinessLogic.BusinessLogics;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.Implements;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage;
|
||||||
|
|
||||||
namespace SoftwareInstallationView
|
namespace SoftwareInstallationView
|
||||||
{
|
{
|
||||||
@@ -38,11 +39,16 @@ namespace SoftwareInstallationView
|
|||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<IPackageStorage, PackageStorage>();
|
services.AddTransient<IPackageStorage, PackageStorage>();
|
||||||
services.AddTransient<IShopStorage, ShopStorage>();
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IPackageLogic, PackageLogic>();
|
services.AddTransient<IPackageLogic, PackageLogic>();
|
||||||
services.AddTransient<IShopLogic, ShopLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
|
||||||
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
|
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormComponent>();
|
services.AddTransient<FormComponent>();
|
||||||
services.AddTransient<FormComponents>();
|
services.AddTransient<FormComponents>();
|
||||||
@@ -50,10 +56,9 @@ namespace SoftwareInstallationView
|
|||||||
services.AddTransient<FormPackage>();
|
services.AddTransient<FormPackage>();
|
||||||
services.AddTransient<FormPackageComponent>();
|
services.AddTransient<FormPackageComponent>();
|
||||||
services.AddTransient<FormPackages>();
|
services.AddTransient<FormPackages>();
|
||||||
services.AddTransient<FormAddPackageInShop>();
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormViewShops>();
|
services.AddTransient<FormReportPackageComponents>();
|
||||||
services.AddTransient<FormShop>();
|
|
||||||
services.AddTransient<FormSellPackage>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
599
SoftwareInstallation/SoftwareInstallationView/ReportOrders.rdlc
Normal file
599
SoftwareInstallation/SoftwareInstallationView/ReportOrders.rdlc
Normal file
@@ -0,0 +1,599 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||||
|
<AutoRefresh>0</AutoRefresh>
|
||||||
|
<DataSources>
|
||||||
|
<DataSource Name="SoftwareInstallationContractsViewModels">
|
||||||
|
<ConnectionProperties>
|
||||||
|
<DataProvider>System.Data.DataSet</DataProvider>
|
||||||
|
<ConnectString>/* Local Connection */</ConnectString>
|
||||||
|
</ConnectionProperties>
|
||||||
|
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||||
|
</DataSource>
|
||||||
|
</DataSources>
|
||||||
|
<DataSets>
|
||||||
|
<DataSet Name="DataSetOrders">
|
||||||
|
<Query>
|
||||||
|
<DataSourceName>SoftwareInstallationContractsViewModels</DataSourceName>
|
||||||
|
<CommandText>/* Local Query */</CommandText>
|
||||||
|
</Query>
|
||||||
|
<Fields>
|
||||||
|
<Field Name="Id">
|
||||||
|
<DataField>Id</DataField>
|
||||||
|
<rd:TypeName>System.Int32</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="DateCreate">
|
||||||
|
<DataField>DateCreate</DataField>
|
||||||
|
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="PackageName">
|
||||||
|
<DataField>PackageName</DataField>
|
||||||
|
<rd:TypeName>System.String</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Sum">
|
||||||
|
<DataField>Sum</DataField>
|
||||||
|
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="OrderStatus">
|
||||||
|
<DataField>OrderStatus</DataField>
|
||||||
|
<rd:TypeName>SoftwareInstallationDataModels.OrderStatus</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
</Fields>
|
||||||
|
<rd:DataSetInfo>
|
||||||
|
<rd:DataSetName>SoftwareInstallationContracts.ViewModels</rd:DataSetName>
|
||||||
|
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
||||||
|
<rd:ObjectDataSourceType>SoftwareInstallationContracts.ViewModels.ReportOrdersViewModel, SoftwareInstallationContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||||
|
</rd:DataSetInfo>
|
||||||
|
</DataSet>
|
||||||
|
</DataSets>
|
||||||
|
<ReportSections>
|
||||||
|
<ReportSection>
|
||||||
|
<Body>
|
||||||
|
<ReportItems>
|
||||||
|
<Textbox Name="ReportParameterPeriod">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
||||||
|
<Style>
|
||||||
|
<FontSize>14pt</FontSize>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
||||||
|
<Top>1cm</Top>
|
||||||
|
<Height>1cm</Height>
|
||||||
|
<Width>21cm</Width>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="TextboxTitle">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Заказы</Value>
|
||||||
|
<Style>
|
||||||
|
<FontSize>16pt</FontSize>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Height>1cm</Height>
|
||||||
|
<Width>21cm</Width>
|
||||||
|
<ZIndex>1</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Tablix Name="Tablix1">
|
||||||
|
<TablixBody>
|
||||||
|
<TablixColumns>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.21438cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>8.23317cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.02917cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>2.87042cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
</TablixColumns>
|
||||||
|
<TablixRows>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox5">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Номер</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox5</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox1">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Дата создания</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox1</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox3">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Изделие</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox3</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox2">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Статус заказа</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox7">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Сумма</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox7</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Id">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Id.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Id</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="DateCreate">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!DateCreate.Value</Value>
|
||||||
|
<Style>
|
||||||
|
<Format>d</Format>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>DateCreate</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="PackageName">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!PackageName.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>PackageName</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="OrderStatus">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!OrderStatus.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>OrderStatus</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Sum">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Sum.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Sum</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
</TablixRows>
|
||||||
|
</TablixBody>
|
||||||
|
<TablixColumnHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixColumnHierarchy>
|
||||||
|
<TablixRowHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember>
|
||||||
|
<KeepWithGroup>After</KeepWithGroup>
|
||||||
|
</TablixMember>
|
||||||
|
<TablixMember>
|
||||||
|
<Group Name="Подробности" />
|
||||||
|
</TablixMember>
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixRowHierarchy>
|
||||||
|
<DataSetName>DataSetOrders</DataSetName>
|
||||||
|
<Top>2.48391cm</Top>
|
||||||
|
<Left>0.55245cm</Left>
|
||||||
|
<Height>1.2cm</Height>
|
||||||
|
<Width>19.84714cm</Width>
|
||||||
|
<ZIndex>2</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>Double</Style>
|
||||||
|
</Border>
|
||||||
|
</Style>
|
||||||
|
</Tablix>
|
||||||
|
<Textbox Name="TextboxTotalSum">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Итого:</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Right</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Top>4cm</Top>
|
||||||
|
<Left>15.39958cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>3</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="SumTotal">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Right</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Top>4cm</Top>
|
||||||
|
<Left>17.89958cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>4</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</ReportItems>
|
||||||
|
<Height>5.72875cm</Height>
|
||||||
|
<Style />
|
||||||
|
</Body>
|
||||||
|
<Width>21cm</Width>
|
||||||
|
<Page>
|
||||||
|
<PageHeight>29.7cm</PageHeight>
|
||||||
|
<PageWidth>21cm</PageWidth>
|
||||||
|
<LeftMargin>2cm</LeftMargin>
|
||||||
|
<RightMargin>2cm</RightMargin>
|
||||||
|
<TopMargin>2cm</TopMargin>
|
||||||
|
<BottomMargin>2cm</BottomMargin>
|
||||||
|
<ColumnSpacing>0.13cm</ColumnSpacing>
|
||||||
|
<Style />
|
||||||
|
</Page>
|
||||||
|
</ReportSection>
|
||||||
|
</ReportSections>
|
||||||
|
<ReportParameters>
|
||||||
|
<ReportParameter Name="ReportParameterPeriod">
|
||||||
|
<DataType>String</DataType>
|
||||||
|
<Nullable>true</Nullable>
|
||||||
|
<Prompt>ReportParameter1</Prompt>
|
||||||
|
</ReportParameter>
|
||||||
|
</ReportParameters>
|
||||||
|
<ReportParametersLayout>
|
||||||
|
<GridLayoutDefinition>
|
||||||
|
<NumberOfColumns>4</NumberOfColumns>
|
||||||
|
<NumberOfRows>2</NumberOfRows>
|
||||||
|
<CellDefinitions>
|
||||||
|
<CellDefinition>
|
||||||
|
<ColumnIndex>0</ColumnIndex>
|
||||||
|
<RowIndex>0</RowIndex>
|
||||||
|
<ParameterName>ReportParameterPeriod</ParameterName>
|
||||||
|
</CellDefinition>
|
||||||
|
</CellDefinitions>
|
||||||
|
</GridLayoutDefinition>
|
||||||
|
</ReportParametersLayout>
|
||||||
|
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||||
|
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
|
||||||
|
</Report>
|
||||||
@@ -9,22 +9,28 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.1" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.1" />
|
||||||
|
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SoftwareInstallationBusinessLogic\SoftwareInstallationBusinessLogic.csproj" />
|
<ProjectReference Include="..\SoftwareInstallationBusinessLogic\SoftwareInstallationBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\SoftwareInstallationContracts\SoftwareInstallationContracts.csproj" />
|
<ProjectReference Include="..\SoftwareInstallationContracts\SoftwareInstallationContracts.csproj" />
|
||||||
<ProjectReference Include="..\SoftWareInstallationDatabaseImplement\SoftWareInstallationDatabaseImplement.csproj" />
|
<ProjectReference Include="..\SoftwareInstallationDatabaseImplement\SoftwareInstallationDatabaseImplement.csproj" />
|
||||||
<ProjectReference Include="..\SoftwareInstallationDataModels\SoftwareInstallationDataModels.csproj" />
|
<ProjectReference Include="..\SoftWareInstallationFileImplement\SoftwareInstallationFileImplement.csproj" />
|
||||||
<ProjectReference Include="..\SoftWareInstallationFileImplement\SoftWareInstallationFileImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\SoftwareInstallationListImplement\SoftwareInstallationListImplement.csproj" />
|
<ProjectReference Include="..\SoftwareInstallationListImplement\SoftwareInstallationListImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="ReportOrders.rdlc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user