Compare commits
2 Commits
Lab4_Tikho
...
main
Author | SHA1 | Date | |
---|---|---|---|
ff655a907c | |||
d13bd2692c |
@ -1,7 +0,0 @@
|
||||
namespace InternetShopOrdersDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersDataModels.Models
|
||||
{
|
||||
public interface ICityModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersDataModels.Models
|
||||
{
|
||||
public interface IOrderModel : IId
|
||||
{
|
||||
// Полное имя заказчика
|
||||
string Fullname { get; }
|
||||
|
||||
// Метки движения заказа (не более 6)
|
||||
List<string> OrderStatusHistory { get; }
|
||||
|
||||
// Город назначения
|
||||
int DestinationCityId { get; }
|
||||
|
||||
// Дата получения заказа
|
||||
DateTime ExpectedDeliveryDate { get; }
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.BusinessLogicContracts;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.StorageContracts;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
|
||||
namespace InternetShopOrdersBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class CityLogic : ICityLogic
|
||||
{
|
||||
private readonly ICityStorage _cityStorage;
|
||||
|
||||
public CityLogic(ICityStorage cityStorage)
|
||||
{
|
||||
_cityStorage = cityStorage;
|
||||
}
|
||||
|
||||
public List<CityViewModel>? ReadList(CitySearchModel? model)
|
||||
{
|
||||
var list = model == null ? _cityStorage.GetFullList() : _cityStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public CityViewModel? ReadElement(CitySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _cityStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(CityBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_cityStorage.Insert(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(CityBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_cityStorage.Update(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(CityBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_cityStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(CityBindingModel 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.BusinessLogicContracts;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.StorageContracts;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
|
||||
namespace InternetShopOrdersBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class OrderLogic : IOrderLogic
|
||||
{
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
public OrderLogic(IOrderStorage orderStorage)
|
||||
{
|
||||
_orderStorage = orderStorage;
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public OrderViewModel? ReadElement(OrderSearchModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _orderStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_orderStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Fullname))
|
||||
{
|
||||
throw new ArgumentNullException("Нет ФИО заказчика", nameof(model.Fullname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InetShopDataModels\InternetShopOrdersDataModels.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersContracts\InternetShopOrdersContracts.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,15 +0,0 @@
|
||||
using InternetShopOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.BindingModels
|
||||
{
|
||||
public class CityBindingModel : ICityModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using InternetShopOrdersDataModels.Models;
|
||||
|
||||
namespace InternetShopOrdersContracts.BindingModels
|
||||
{
|
||||
public class OrderBindingModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Fullname { get; set; } = string.Empty;
|
||||
public List<string> OrderStatusHistory { get; set; } = new List<string>();
|
||||
public int DestinationCityId { get; set; }
|
||||
//public ICityModel DestinationCity { get; set; }
|
||||
public DateTime ExpectedDeliveryDate { get; set; }
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface ICityLogic
|
||||
{
|
||||
List<CityViewModel>? ReadList(CitySearchModel? model);
|
||||
CityViewModel? ReadElement(CitySearchModel model);
|
||||
bool Create(CityBindingModel model);
|
||||
bool Update(CityBindingModel model);
|
||||
bool Delete(CityBindingModel model);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IOrderLogic
|
||||
{
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||
bool Create(OrderBindingModel model);
|
||||
bool Update(OrderBindingModel model);
|
||||
bool Delete(OrderBindingModel model);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InetShopDataModels\InternetShopOrdersDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.SearchModels
|
||||
{
|
||||
public class CitySearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.StorageContracts
|
||||
{
|
||||
public interface ICityStorage
|
||||
{
|
||||
List<CityViewModel> GetFullList();
|
||||
List<CityViewModel> GetFilteredList(CitySearchModel model);
|
||||
CityViewModel? GetElement(CitySearchModel model);
|
||||
CityViewModel? Insert(CityBindingModel model);
|
||||
CityViewModel? Update(CityBindingModel model);
|
||||
CityViewModel? Delete(CityBindingModel model);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.StorageContracts
|
||||
{
|
||||
public interface IOrderStorage
|
||||
{
|
||||
List<OrderViewModel> GetFullList();
|
||||
List<OrderViewModel> GetFilteredList(OrderSearchModel model);
|
||||
OrderViewModel? GetElement(OrderSearchModel model);
|
||||
OrderViewModel? Insert(OrderBindingModel model);
|
||||
OrderViewModel? Update(OrderBindingModel model);
|
||||
OrderViewModel? Delete(OrderBindingModel model);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using InternetShopOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.ViewModels
|
||||
{
|
||||
public class CityViewModel : ICityModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.ViewModels
|
||||
{
|
||||
public class OrderExcelViewModel
|
||||
{
|
||||
public OrderExcelViewModel(int id, string fullname, string destinationCityName, DateTime expectedDeliveryDate)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Fullname = fullname;
|
||||
//this.DestinationCityId = destinationCityId;
|
||||
this.DestinationCityName = destinationCityName;
|
||||
this.ExpectedDeliveryDate = expectedDeliveryDate;
|
||||
}
|
||||
|
||||
public int Id;
|
||||
public string Fullname;
|
||||
//public int DestinationCityId;
|
||||
public string DestinationCityName;
|
||||
public DateTime ExpectedDeliveryDate;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using InternetShopOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО заказчика")]
|
||||
public string Fullname { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("История заказа")]
|
||||
public List<string> OrderStatusHistory { get; set; }
|
||||
|
||||
public int DestinationCityId { get; set; }
|
||||
[DisplayName("Город назначения")]
|
||||
public string DestinationCityName { get; set; }
|
||||
|
||||
[DisplayName("Дата получения заказа")]
|
||||
public DateTime ExpectedDeliveryDate { get; set; }
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.StorageContracts;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using InternetShopOrdersDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Implements
|
||||
{
|
||||
public class CityStorage : ICityStorage
|
||||
{
|
||||
public List<CityViewModel> GetFullList()
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
return context.Cities
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<CityViewModel> GetFilteredList(CitySearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new OrdersDatabase();
|
||||
return context.Cities
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public CityViewModel? GetElement(CitySearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new OrdersDatabase();
|
||||
return context.Cities
|
||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
public CityViewModel? Insert(CityBindingModel model)
|
||||
{
|
||||
var newcity = Cities.Create(model);
|
||||
if (newcity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new OrdersDatabase();
|
||||
context.Cities.Add(newcity);
|
||||
context.SaveChanges();
|
||||
return newcity.GetViewModel;
|
||||
}
|
||||
public CityViewModel? Update(CityBindingModel model)
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
var component = context.Cities.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (component == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
component.Update(model);
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
public CityViewModel? Delete(CityBindingModel model)
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
var element = context.Cities.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Cities.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.StorageContracts;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using InternetShopOrdersDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Implements
|
||||
{
|
||||
public class OrderStorage : IOrderStorage
|
||||
{
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.DestinationCity)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
using var context = new OrdersDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.DestinationCity)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new OrdersDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.DestinationCity)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
var newOrder = Orders.Create(context, model);
|
||||
if (newOrder == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return newOrder.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
var Order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (Order == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Order.Update(model, context);
|
||||
context.SaveChanges();
|
||||
return Order.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
using var context = new OrdersDatabase();
|
||||
var element = context.Orders
|
||||
.Include(x => x.DestinationCity)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Orders.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InetShopDataModels\InternetShopOrdersDataModels.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersContracts\InternetShopOrdersContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,88 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using InternetShopOrdersDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(OrdersDatabase))]
|
||||
[Migration("20241027193729_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Cities", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DestinationCityId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("ExpectedDeliveryDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Fullname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<List<string>>("OrderStatusHistory")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DestinationCityId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
|
||||
{
|
||||
b.HasOne("InternetShopOrdersDatabaseImplement.Models.Cities", "DestinationCity")
|
||||
.WithMany()
|
||||
.HasForeignKey("DestinationCityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DestinationCity");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cities",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cities", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Fullname = table.Column<string>(type: "text", nullable: false),
|
||||
OrderStatusHistory = table.Column<List<string>>(type: "text[]", nullable: false),
|
||||
DestinationCityId = table.Column<int>(type: "integer", nullable: false),
|
||||
ExpectedDeliveryDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Cities_DestinationCityId",
|
||||
column: x => x.DestinationCityId,
|
||||
principalTable: "Cities",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_DestinationCityId",
|
||||
table: "Orders",
|
||||
column: "DestinationCityId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cities");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using InternetShopOrdersDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(OrdersDatabase))]
|
||||
partial class OrdersDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Cities", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DestinationCityId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("ExpectedDeliveryDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Fullname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<List<string>>("OrderStatusHistory")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DestinationCityId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
|
||||
{
|
||||
b.HasOne("InternetShopOrdersDatabaseImplement.Models.Cities", "DestinationCity")
|
||||
.WithMany()
|
||||
.HasForeignKey("DestinationCityId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DestinationCity");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using InternetShopOrdersDataModels.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Models
|
||||
{
|
||||
public class Cities : ICityModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public static Cities? Create(CityBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Cities()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
};
|
||||
}
|
||||
public static Cities? Create(CityViewModel? model)
|
||||
{
|
||||
return new Cities()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
};
|
||||
}
|
||||
public void Update(CityBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
}
|
||||
public CityViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using InternetShopOrdersDataModels.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement.Models
|
||||
{
|
||||
public class Orders : IOrderModel
|
||||
{
|
||||
[Required]
|
||||
public string Fullname { get; set; } = string.Empty;
|
||||
|
||||
// Метки движения заказа (не более 6)
|
||||
public List<string> OrderStatusHistory { get; set; } = new List<string>();
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int DestinationCityId { get; set; }
|
||||
public virtual Cities DestinationCity { get; set; } = new();
|
||||
|
||||
public DateTime ExpectedDeliveryDate { get; set; }
|
||||
|
||||
public static Orders? Create(OrdersDatabase context, OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Orders()
|
||||
{
|
||||
Id = model.Id,
|
||||
Fullname = model.Fullname,
|
||||
DestinationCity = context.Cities.First(x => x.Id == model.DestinationCityId),
|
||||
OrderStatusHistory = model.OrderStatusHistory,
|
||||
ExpectedDeliveryDate = model.ExpectedDeliveryDate.ToUniversalTime()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(OrderBindingModel? model, OrdersDatabase context)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Fullname = model.Fullname;
|
||||
DestinationCity = context.Cities.First(x => x.Id == model.Id);
|
||||
OrderStatusHistory = model.OrderStatusHistory.ToList();
|
||||
ExpectedDeliveryDate = model.ExpectedDeliveryDate.ToUniversalTime();
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Fullname = Fullname,
|
||||
DestinationCityId = DestinationCity.Id,
|
||||
DestinationCityName = DestinationCity.Name,
|
||||
OrderStatusHistory = OrderStatusHistory,
|
||||
ExpectedDeliveryDate = ExpectedDeliveryDate,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using InternetShopOrdersDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InternetShopOrdersDatabaseImplement
|
||||
{
|
||||
public class OrdersDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
=> optionsBuilder.UseNpgsql("Host=localhost;Database=InternetShopOrdersDB;Username=postgres;Password=postgres");
|
||||
|
||||
public virtual DbSet<Orders> Orders { set; get; }
|
||||
public virtual DbSet<Cities> Cities { set; get; }
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35222.181
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersDataModels", "InetShopDataModels\InternetShopOrdersDataModels.csproj", "{FC789ABE-4687-4521-871C-72E1130C6BE6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersDatabaseImplement", "InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj", "{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersContracts", "InternetShopOrdersContracts\InternetShopOrdersContracts.csproj", "{21E46342-A4FE-437D-BE39-9950919DECDC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersBusinessLogic", "InternetShopOrdersBusinessLogic\InternetShopOrdersBusinessLogic.csproj", "{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lab3Form", "Lab3Form\Lab3Form.csproj", "{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{B8173741-064A-41C8-83C1-1E2A5B91B0D3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FC789ABE-4687-4521-871C-72E1130C6BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FC789ABE-4687-4521-871C-72E1130C6BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FC789ABE-4687-4521-871C-72E1130C6BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FC789ABE-4687-4521-871C-72E1130C6BE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{21E46342-A4FE-437D-BE39-9950919DECDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{21E46342-A4FE-437D-BE39-9950919DECDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{21E46342-A4FE-437D-BE39-9950919DECDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{21E46342-A4FE-437D-BE39-9950919DECDC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C6DEED66-161D-4CE7-B327-9DB0A6D32439}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
84
KopLab1/Lab3Form/FormCities.Designer.cs
generated
84
KopLab1/Lab3Form/FormCities.Designer.cs
generated
@ -1,84 +0,0 @@
|
||||
namespace Lab3Form
|
||||
{
|
||||
partial class FormCities
|
||||
{
|
||||
/// <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();
|
||||
NameCol = new DataGridViewTextBoxColumn();
|
||||
Id = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { NameCol, Id });
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 47;
|
||||
dataGridView.Size = new Size(800, 356);
|
||||
dataGridView.TabIndex = 0;
|
||||
dataGridView.CellValueChanged += dataGridView_CellValueChanged;
|
||||
dataGridView.UserDeletingRow += dataGridView_UserDeletingRow;
|
||||
dataGridView.KeyUp += dataGridView_KeyUp;
|
||||
//
|
||||
// NameCol
|
||||
//
|
||||
NameCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
NameCol.HeaderText = "Название товара";
|
||||
NameCol.MinimumWidth = 6;
|
||||
NameCol.Name = "NameCol";
|
||||
//
|
||||
// Id
|
||||
//
|
||||
Id.HeaderText = "Id";
|
||||
Id.MinimumWidth = 6;
|
||||
Id.Name = "Id";
|
||||
Id.Visible = false;
|
||||
Id.Width = 125;
|
||||
//
|
||||
// Formcitys
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 19F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 356);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "Formcitys";
|
||||
Text = "Выбранные товары";
|
||||
Load += Formcitys_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn NameCol;
|
||||
private DataGridViewTextBoxColumn Id;
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.BusinessLogicContracts;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lab3Form
|
||||
{
|
||||
public partial class FormCities : Form
|
||||
{
|
||||
private readonly ICityLogic _logic;
|
||||
private bool loading = false;
|
||||
|
||||
public FormCities(ICityLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
loading = true;
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var city in list)
|
||||
{
|
||||
int rowIndex = dataGridView.Rows.Add();
|
||||
dataGridView.Rows[rowIndex].Cells[0].Value = city.Name;
|
||||
dataGridView.Rows[rowIndex].Cells[1].Value = city.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Formcitys_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (loading || e.RowIndex < 0 || e.ColumnIndex != 0) return;
|
||||
if (dataGridView.Rows[e.RowIndex].Cells[1].Value != null && !string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()))
|
||||
{
|
||||
var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if (name is null) return;
|
||||
_logic.Update(new CityBindingModel { Id = Convert.ToInt32(dataGridView.Rows[e.RowIndex].Cells[1].Value), Name = name.ToString() });
|
||||
}
|
||||
else
|
||||
{
|
||||
var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if (name is null) return;
|
||||
_logic.Create(new CityBindingModel { Id = 0, Name = name.ToString() });
|
||||
int newInterestId = _logic.ReadList(null).ToList().Last().Id;
|
||||
dataGridView.Rows[e.RowIndex].Cells[1].Value = newInterestId;
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Insert:
|
||||
dataGridView.Rows.Add();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteRows(DataGridViewSelectedRowCollection rows)
|
||||
{
|
||||
for (int i = 0; i < rows.Count; i++)
|
||||
{
|
||||
DataGridViewRow row = rows[i];
|
||||
if (!_logic.Delete(new CityBindingModel { Id = Convert.ToInt32(row.Cells[1].Value) })) continue;
|
||||
}
|
||||
dataGridView.Rows.Clear();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
if (dataGridView.SelectedRows == null) return;
|
||||
if (MessageBox.Show("Удалить записи?", "Подтвердите действие", MessageBoxButtons.YesNo) == DialogResult.No) return;
|
||||
deleteRows(dataGridView.SelectedRows);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="NameCol.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
174
KopLab1/Lab3Form/FormMain.Designer.cs
generated
174
KopLab1/Lab3Form/FormMain.Designer.cs
generated
@ -1,174 +0,0 @@
|
||||
namespace Lab3Form
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <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.panelControl = new System.Windows.Forms.Panel();
|
||||
this.ControlsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ActionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AddElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UpdElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DelElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DocsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SimpleDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.TableDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ChartDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panelControl
|
||||
//
|
||||
this.panelControl.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.panelControl.BackColor = System.Drawing.SystemColors.Info;
|
||||
this.panelControl.Location = new System.Drawing.Point(12, 27);
|
||||
this.panelControl.Name = "panelControl";
|
||||
this.panelControl.Size = new System.Drawing.Size(896, 177);
|
||||
this.panelControl.TabIndex = 2;
|
||||
//
|
||||
// ControlsStripMenuItem
|
||||
//
|
||||
this.ControlsStripMenuItem.Name = "ControlsStripMenuItem";
|
||||
this.ControlsStripMenuItem.Size = new System.Drawing.Size(94, 20);
|
||||
this.ControlsStripMenuItem.Text = "Directories";
|
||||
//
|
||||
// ActionsToolStripMenuItem
|
||||
//
|
||||
this.ActionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.AddElementToolStripMenuItem,
|
||||
this.UpdElementToolStripMenuItem,
|
||||
this.DelElementToolStripMenuItem});
|
||||
this.ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem";
|
||||
this.ActionsToolStripMenuItem.Size = new System.Drawing.Size(70, 20);
|
||||
this.ActionsToolStripMenuItem.Text = "Actions";
|
||||
//
|
||||
// AddElementToolStripMenuItem
|
||||
//
|
||||
this.AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem";
|
||||
this.AddElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||
this.AddElementToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
|
||||
this.AddElementToolStripMenuItem.Text = "Add";
|
||||
this.AddElementToolStripMenuItem.Click += new System.EventHandler(this.AddElementToolStripMenuItem_Click);
|
||||
//
|
||||
// UpdElementToolStripMenuItem
|
||||
//
|
||||
this.UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem";
|
||||
this.UpdElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
|
||||
this.UpdElementToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
|
||||
this.UpdElementToolStripMenuItem.Text = "Edit";
|
||||
this.UpdElementToolStripMenuItem.Click += new System.EventHandler(this.UpdElementToolStripMenuItem_Click);
|
||||
//
|
||||
// DelElementToolStripMenuItem
|
||||
//
|
||||
this.DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem";
|
||||
this.DelElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
|
||||
this.DelElementToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
|
||||
this.DelElementToolStripMenuItem.Text = "Delete";
|
||||
this.DelElementToolStripMenuItem.Click += new System.EventHandler(this.DelElementToolStripMenuItem_Click);
|
||||
//
|
||||
// DocsToolStripMenuItem
|
||||
//
|
||||
this.DocsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SimpleDocToolStripMenuItem,
|
||||
this.TableDocToolStripMenuItem,
|
||||
this.ChartDocToolStripMenuItem});
|
||||
this.DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
|
||||
this.DocsToolStripMenuItem.Size = new System.Drawing.Size(82, 20);
|
||||
this.DocsToolStripMenuItem.Text = "Documnets";
|
||||
//
|
||||
// SimpleDocToolStripMenuItem
|
||||
//
|
||||
this.SimpleDocToolStripMenuItem.Name = "SimpleDocToolStripMenuItem";
|
||||
this.SimpleDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.SimpleDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.SimpleDocToolStripMenuItem.Text = "Excel";
|
||||
this.SimpleDocToolStripMenuItem.Click += new System.EventHandler(this.WordDocToolStripMenuItem_Click);
|
||||
//
|
||||
// TableDocToolStripMenuItem
|
||||
//
|
||||
this.TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem";
|
||||
this.TableDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
|
||||
this.TableDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.TableDocToolStripMenuItem.Text = "Word";
|
||||
this.TableDocToolStripMenuItem.Click += new System.EventHandler(this.PdfDocToolStripMenuItem_Click);
|
||||
//
|
||||
// ChartDocToolStripMenuItem
|
||||
//
|
||||
this.ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem";
|
||||
this.ChartDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.ChartDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.ChartDocToolStripMenuItem.Text = "Pdf";
|
||||
this.ChartDocToolStripMenuItem.Click += new System.EventHandler(this.ExcelDocToolStripMenuItem_Click);
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.AutoSize = false;
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ControlsStripMenuItem,
|
||||
this.ActionsToolStripMenuItem,
|
||||
this.DocsToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(920, 24);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "Menu";
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(920, 216);
|
||||
this.Controls.Add(this.panelControl);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
this.Name = "FormMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Main Form";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown);
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private Panel panelControl;
|
||||
private ToolStripMenuItem ControlsStripMenuItem;
|
||||
private ToolStripMenuItem ActionsToolStripMenuItem;
|
||||
private ToolStripMenuItem AddElementToolStripMenuItem;
|
||||
private ToolStripMenuItem UpdElementToolStripMenuItem;
|
||||
private ToolStripMenuItem DelElementToolStripMenuItem;
|
||||
private ToolStripMenuItem DocsToolStripMenuItem;
|
||||
private ToolStripMenuItem SimpleDocToolStripMenuItem;
|
||||
private ToolStripMenuItem TableDocToolStripMenuItem;
|
||||
private ToolStripMenuItem ChartDocToolStripMenuItem;
|
||||
private MenuStrip menuStrip;
|
||||
}
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
using PluginsConventionLibrary.Plugins;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lab3Form
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly Dictionary<string, IPluginsConvention> _plugins;
|
||||
private string _selectedPlugin;
|
||||
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
_plugins = LoadPlugins();
|
||||
_selectedPlugin = string.Empty;
|
||||
}
|
||||
|
||||
private Dictionary<string, IPluginsConvention> LoadPlugins()
|
||||
{
|
||||
PluginsManager manager = new PluginsManager();
|
||||
var plugins = manager.plugins_dictionary;
|
||||
|
||||
ToolStripItem[] toolStripItems = new ToolStripItem[plugins.Count];
|
||||
int i = 0;
|
||||
if (plugins.Count > 0)
|
||||
{
|
||||
foreach (var plugin in plugins)
|
||||
{
|
||||
ToolStripMenuItem itemMenu = new()
|
||||
{
|
||||
Text = plugin.Value.PluginName
|
||||
};
|
||||
itemMenu.Click += (sender, e) =>
|
||||
{
|
||||
_selectedPlugin = plugin.Value.PluginName;
|
||||
panelControl.Controls.Clear();
|
||||
panelControl.Controls.Add(_plugins[_selectedPlugin].GetControl);
|
||||
panelControl.Controls[0].Dock = DockStyle.Fill;
|
||||
};
|
||||
toolStripItems[i] = itemMenu;
|
||||
i++;
|
||||
}
|
||||
ControlsStripMenuItem.DropDownItems.AddRange(toolStripItems);
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
|
||||
private void AddNewElement()
|
||||
{
|
||||
var form = _plugins[_selectedPlugin].GetForm(null);
|
||||
if (form != null && form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateElement()
|
||||
{
|
||||
var element = _plugins[_selectedPlugin].GetElement;
|
||||
if (element == null)
|
||||
{
|
||||
MessageBox.Show("Íåò âûáðàííîãî ýëåìåíòà", "Îøèáêà",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var form = _plugins[_selectedPlugin].GetForm(element);
|
||||
if (form != null && form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteElement()
|
||||
{
|
||||
if (MessageBox.Show("Óäàëèòü âûáðàííûé ýëåìåíò", "Óäàëåíèå", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; }
|
||||
var element = _plugins[_selectedPlugin].GetElement;
|
||||
if (element == null)
|
||||
{
|
||||
MessageBox.Show("Íåò âûáðàííîãî ýëåìåíòà", "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (_plugins[_selectedPlugin].DeleteElement(element))
|
||||
{
|
||||
_plugins[_selectedPlugin].ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateWord()
|
||||
{
|
||||
if (_plugins[_selectedPlugin].GetElement == null) return;
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() != DialogResult.OK) return;
|
||||
if (!_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName }))
|
||||
{
|
||||
MessageBox.Show("Error", "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreatePdf()
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||
if (dialog.ShowDialog() != DialogResult.OK) return;
|
||||
if (!_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName }))
|
||||
{
|
||||
MessageBox.Show("Error", "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateExcel()
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||
if (dialog.ShowDialog() != DialogResult.OK) return;
|
||||
if (!_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName }))
|
||||
{
|
||||
MessageBox.Show("Error", "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void FormMain_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (!e.Control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.A:
|
||||
AddNewElement();
|
||||
break;
|
||||
case Keys.U:
|
||||
UpdateElement();
|
||||
break;
|
||||
case Keys.D:
|
||||
DeleteElement();
|
||||
break;
|
||||
case Keys.S:
|
||||
CreateWord();
|
||||
break;
|
||||
case Keys.T:
|
||||
CreatePdf();
|
||||
break;
|
||||
case Keys.C:
|
||||
CreateExcel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement();
|
||||
private void UpdElementToolStripMenuItem_Click(object sender, EventArgs e) => UpdateElement();
|
||||
private void DelElementToolStripMenuItem_Click(object sender, EventArgs e) => DeleteElement();
|
||||
private void WordDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateExcel();
|
||||
private void PdfDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateWord();
|
||||
private void ExcelDocToolStripMenuItem_Click(object sender, EventArgs e) => CreatePdf();
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
177
KopLab1/Lab3Form/FormOrder.Designer.cs
generated
177
KopLab1/Lab3Form/FormOrder.Designer.cs
generated
@ -1,177 +0,0 @@
|
||||
namespace Lab3Form
|
||||
{
|
||||
partial class FormOrder
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelFIO = new Label();
|
||||
textBoxFIO = new TextBox();
|
||||
labelcity = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
openFileDialog = new OpenFileDialog();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
customListBox1 = new FormLibrary.CustomListBox();
|
||||
customInputRangeDate1 = new WinFormsLibraryVolkov.CustomInputRangeDate();
|
||||
listBox1 = new ListBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
labelFIO.AutoSize = true;
|
||||
labelFIO.Location = new Point(10, 7);
|
||||
labelFIO.Name = "labelFIO";
|
||||
labelFIO.Size = new Size(91, 15);
|
||||
labelFIO.TabIndex = 0;
|
||||
labelFIO.Text = "ФИО заказчика";
|
||||
//
|
||||
// textBoxFIO
|
||||
//
|
||||
textBoxFIO.Location = new Point(10, 24);
|
||||
textBoxFIO.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxFIO.Name = "textBoxFIO";
|
||||
textBoxFIO.Size = new Size(241, 23);
|
||||
textBoxFIO.TabIndex = 1;
|
||||
//
|
||||
// labelcity
|
||||
//
|
||||
labelcity.AutoSize = true;
|
||||
labelcity.Location = new Point(10, 62);
|
||||
labelcity.Name = "labelcity";
|
||||
labelcity.Size = new Size(107, 15);
|
||||
labelcity.TabIndex = 4;
|
||||
labelcity.Text = "Город назначения";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(161, 414);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(83, 21);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(7, 414);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(94, 21);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
openFileDialog.FileName = "openFileDialog";
|
||||
openFileDialog.Multiselect = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(10, 360);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(132, 15);
|
||||
label1.TabIndex = 10;
|
||||
label1.Text = "Дата получения заказа";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(10, 264);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(123, 15);
|
||||
label2.TabIndex = 12;
|
||||
label2.Text = "Точки передвижения";
|
||||
//
|
||||
// customListBox1
|
||||
//
|
||||
customListBox1.Location = new Point(10, 80);
|
||||
customListBox1.Name = "customListBox1";
|
||||
customListBox1.SelectedItem = "";
|
||||
customListBox1.Size = new Size(237, 179);
|
||||
customListBox1.TabIndex = 17;
|
||||
//
|
||||
// customInputRangeDate1
|
||||
//
|
||||
customInputRangeDate1.Location = new Point(10, 378);
|
||||
customInputRangeDate1.MaxDate = new DateTime(0L);
|
||||
customInputRangeDate1.MinDate = new DateTime(0L);
|
||||
customInputRangeDate1.Name = "customInputRangeDate1";
|
||||
customInputRangeDate1.Size = new Size(199, 31);
|
||||
customInputRangeDate1.TabIndex = 18;
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
listBox1.FormattingEnabled = true;
|
||||
listBox1.ItemHeight = 15;
|
||||
listBox1.Location = new Point(13, 282);
|
||||
listBox1.Name = "listBox1";
|
||||
listBox1.SelectionMode = SelectionMode.MultiExtended;
|
||||
listBox1.Size = new Size(231, 64);
|
||||
listBox1.TabIndex = 19;
|
||||
//
|
||||
// FormOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(256, 459);
|
||||
Controls.Add(listBox1);
|
||||
Controls.Add(customInputRangeDate1);
|
||||
Controls.Add(customListBox1);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(labelcity);
|
||||
Controls.Add(textBoxFIO);
|
||||
Controls.Add(labelFIO);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormOrder";
|
||||
Text = "Заказ";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelFIO;
|
||||
private TextBox textBoxFIO;
|
||||
private Label labelcity;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private FormLibrary.CustomListBox customListBox1;
|
||||
private WinFormsLibraryVolkov.CustomInputRangeDate customInputRangeDate1;
|
||||
private ListBox listBox1;
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.BusinessLogicContracts;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lab3Form
|
||||
{
|
||||
public partial class FormOrder : Form
|
||||
{
|
||||
public int? _id;
|
||||
private readonly IOrderLogic _logic;
|
||||
private readonly ICityLogic _cityLogic;
|
||||
private List<CityViewModel> _Cities;
|
||||
public int Id { set { _id = value; } }
|
||||
|
||||
public FormOrder(IOrderLogic logic, ICityLogic cityLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_logic = logic;
|
||||
_cityLogic = cityLogic;
|
||||
_Cities = new List<CityViewModel>();
|
||||
_Cities = _cityLogic.ReadList(null);
|
||||
var cityNames = _Cities.Select(city => city.Name).ToList();
|
||||
customListBox1.PopulateListBox(cityNames);
|
||||
var orderStatuses = new List<string> { "Создан", "Подтвержден", "Отправлен", "Доставлен" };
|
||||
listBox1.Items.AddRange(orderStatuses.ToArray());
|
||||
DateTime now = DateTime.Now;
|
||||
customInputRangeDate1.MinDate = now.AddYears(-1);
|
||||
customInputRangeDate1.MaxDate = now.AddYears(1);
|
||||
this.Load += FormOrder_Load;
|
||||
}
|
||||
|
||||
private void FormOrder_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
OrderSearchModel searchModel = new OrderSearchModel { Id = _id.Value };
|
||||
OrderViewModel orderViewModel = _logic.ReadElement(searchModel);
|
||||
|
||||
if (orderViewModel != null)
|
||||
{
|
||||
textBoxFIO.Text = orderViewModel.Fullname;
|
||||
|
||||
CityViewModel selectedCity = _Cities.FirstOrDefault(city => city.Id == orderViewModel.DestinationCityId);
|
||||
if (selectedCity != null)
|
||||
{
|
||||
customListBox1.SelectedItem = selectedCity.Name;
|
||||
}
|
||||
|
||||
customInputRangeDate1.Date = orderViewModel.ExpectedDeliveryDate;
|
||||
|
||||
foreach (string status in orderViewModel.OrderStatusHistory)
|
||||
{
|
||||
int index = listBox1.Items.IndexOf(status);
|
||||
if (index != -1)
|
||||
{
|
||||
listBox1.SetSelected(index, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Заказ с указанным ID не найден.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxFIO.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните ФИО заказчика", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
if (customListBox1.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Укажите город назначения", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
try
|
||||
{
|
||||
var model = new OrderBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
Fullname = textBoxFIO.Text,
|
||||
DestinationCityId = _Cities.First(x => x.Name == customListBox1.SelectedItem).Id,
|
||||
ExpectedDeliveryDate = customInputRangeDate1.Date,
|
||||
OrderStatusHistory = listBox1.SelectedItems.Cast<string>().ToList(),
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Возникла ошибка при сохранении. Дополнительная информация в логах");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Успешное сохранение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>90</value>
|
||||
</metadata>
|
||||
</root>
|
175
KopLab1/Lab3Form/FormOrders.Designer.cs
generated
175
KopLab1/Lab3Form/FormOrders.Designer.cs
generated
@ -1,175 +0,0 @@
|
||||
namespace Lab3Form
|
||||
{
|
||||
partial class FormOrders
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
menuStrip = new MenuStrip();
|
||||
заказыToolStripMenuItem = new ToolStripMenuItem();
|
||||
создатьToolStripMenuItem = new ToolStripMenuItem();
|
||||
редактироватьToolStripMenuItem = new ToolStripMenuItem();
|
||||
удалитьToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||
документToolStripMenuItem = new ToolStripMenuItem();
|
||||
документСТаблицейToolStripMenuItem = new ToolStripMenuItem();
|
||||
документСДиаграммойToolStripMenuItem = new ToolStripMenuItem();
|
||||
выбранныеТоварыToolStripMenuItem = new ToolStripMenuItem();
|
||||
controlDataTable = new ControlsLibraryNet60.Data.ControlDataTableTable();
|
||||
pdfTable1 = new FormLibrary.PDFTable(components);
|
||||
excelTableComponent1 = new WinFormsLibraryVolkov.NonVisualComponents.ExcelTableComponent(components);
|
||||
componentDocumentWithChartLineWord1 = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartLineWord(components);
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(18, 18);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { заказыToolStripMenuItem, отчётыToolStripMenuItem, выбранныеТоварыToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||
menuStrip.Size = new Size(853, 24);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip";
|
||||
//
|
||||
// заказыToolStripMenuItem
|
||||
//
|
||||
заказыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { создатьToolStripMenuItem, редактироватьToolStripMenuItem, удалитьToolStripMenuItem });
|
||||
заказыToolStripMenuItem.Name = "заказыToolStripMenuItem";
|
||||
заказыToolStripMenuItem.Size = new Size(58, 20);
|
||||
заказыToolStripMenuItem.Text = "Заказы";
|
||||
//
|
||||
// создатьToolStripMenuItem
|
||||
//
|
||||
создатьToolStripMenuItem.Name = "создатьToolStripMenuItem";
|
||||
создатьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
|
||||
создатьToolStripMenuItem.Size = new Size(196, 22);
|
||||
создатьToolStripMenuItem.Text = "Создать";
|
||||
создатьToolStripMenuItem.Click += создатьToolStripMenuItem_Click;
|
||||
//
|
||||
// редактироватьToolStripMenuItem
|
||||
//
|
||||
редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem";
|
||||
редактироватьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
|
||||
редактироватьToolStripMenuItem.Size = new Size(196, 22);
|
||||
редактироватьToolStripMenuItem.Text = "Редактировать";
|
||||
редактироватьToolStripMenuItem.Click += редактироватьToolStripMenuItem_Click;
|
||||
//
|
||||
// удалитьToolStripMenuItem
|
||||
//
|
||||
удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
|
||||
удалитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
|
||||
удалитьToolStripMenuItem.Size = new Size(196, 22);
|
||||
удалитьToolStripMenuItem.Text = "Удалить";
|
||||
удалитьToolStripMenuItem.Click += удалитьToolStripMenuItem_Click;
|
||||
//
|
||||
// отчётыToolStripMenuItem
|
||||
//
|
||||
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { документToolStripMenuItem, документСТаблицейToolStripMenuItem, документСДиаграммойToolStripMenuItem });
|
||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||
//
|
||||
// документToolStripMenuItem
|
||||
//
|
||||
документToolStripMenuItem.Name = "документToolStripMenuItem";
|
||||
документToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
||||
документToolStripMenuItem.Size = new Size(309, 22);
|
||||
документToolStripMenuItem.Text = "Документ с простой таблицей";
|
||||
документToolStripMenuItem.Click += GeneratePdfButton_Click;
|
||||
//
|
||||
// документСТаблицейToolStripMenuItem
|
||||
//
|
||||
документСТаблицейToolStripMenuItem.Name = "документСТаблицейToolStripMenuItem";
|
||||
документСТаблицейToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
|
||||
документСТаблицейToolStripMenuItem.Size = new Size(309, 22);
|
||||
документСТаблицейToolStripMenuItem.Text = "Отчет по всем заказам Excel";
|
||||
документСТаблицейToolStripMenuItem.Click += buttonCreateOrderReport_Click;
|
||||
//
|
||||
// документСДиаграммойToolStripMenuItem
|
||||
//
|
||||
документСДиаграммойToolStripMenuItem.Name = "документСДиаграммойToolStripMenuItem";
|
||||
документСДиаграммойToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
|
||||
документСДиаграммойToolStripMenuItem.Size = new Size(309, 22);
|
||||
документСДиаграммойToolStripMenuItem.Text = "Документ с линейной диаграммой";
|
||||
документСДиаграммойToolStripMenuItem.Click += CreateDocumentButton_Click;
|
||||
//
|
||||
// выбранныеТоварыToolStripMenuItem
|
||||
//
|
||||
выбранныеТоварыToolStripMenuItem.Name = "выбранныеТоварыToolStripMenuItem";
|
||||
выбранныеТоварыToolStripMenuItem.Size = new Size(125, 20);
|
||||
выбранныеТоварыToolStripMenuItem.Text = "Города назначения";
|
||||
выбранныеТоварыToolStripMenuItem.Click += выбранныеТоварыToolStripMenuItem_Click;
|
||||
//
|
||||
// controlDataTable
|
||||
//
|
||||
controlDataTable.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
controlDataTable.AutoSize = true;
|
||||
controlDataTable.Location = new Point(0, 24);
|
||||
controlDataTable.Margin = new Padding(4, 3, 4, 3);
|
||||
controlDataTable.Name = "controlDataTable";
|
||||
controlDataTable.SelectedRowIndex = -1;
|
||||
controlDataTable.Size = new Size(853, 419);
|
||||
controlDataTable.TabIndex = 1;
|
||||
//
|
||||
// FormOrders
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(853, 442);
|
||||
Controls.Add(controlDataTable);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormOrders";
|
||||
Text = "Заказы";
|
||||
Load += FormOrders_Load;
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem заказыToolStripMenuItem;
|
||||
private ToolStripMenuItem создатьToolStripMenuItem;
|
||||
private ToolStripMenuItem редактироватьToolStripMenuItem;
|
||||
private ToolStripMenuItem удалитьToolStripMenuItem;
|
||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||
private ToolStripMenuItem документToolStripMenuItem;
|
||||
private ToolStripMenuItem документСТаблицейToolStripMenuItem;
|
||||
private ToolStripMenuItem выбранныеТоварыToolStripMenuItem;
|
||||
private ToolStripMenuItem документСДиаграммойToolStripMenuItem;
|
||||
private ControlsLibraryNet60.Data.ControlDataTableTable controlDataTable;
|
||||
private FormLibrary.PDFTable pdfTable1;
|
||||
private WinFormsLibraryVolkov.NonVisualComponents.ExcelTableComponent excelTableComponent1;
|
||||
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartLineWord componentDocumentWithChartLineWord1;
|
||||
}
|
||||
}
|
@ -1,343 +0,0 @@
|
||||
using InternetShopOrdersBusinessLogic.BusinessLogics;
|
||||
using InternetShopOrdersContracts.BusinessLogicContracts;
|
||||
using InternetShopOrdersContracts.ViewModels;
|
||||
using InternetShopOrdersContracts.BindingModels;
|
||||
using InternetShopOrdersContracts.SearchModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ControlsLibraryNet60.Models;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using WinFormsLibraryVolkov.NonVisualComponents;
|
||||
using ComponentsLibraryNet60.Core;
|
||||
using ComponentsLibraryNet60.DocumentWithTable;
|
||||
using ComponentsLibraryNet60.Models;
|
||||
using FormLibrary.HelperClasses;
|
||||
using FormLibrary;
|
||||
using ComponentsLibraryNet60.DocumentWithChart;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Lab3Form
|
||||
{
|
||||
public partial class FormOrders : Form
|
||||
{
|
||||
private IOrderLogic _logic;
|
||||
|
||||
public FormOrders(IOrderLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
controlDataTable.LoadColumns(new List<DataTableColumnConfig>
|
||||
{
|
||||
new DataTableColumnConfig { ColumnHeader = "Идентификатор", PropertyName = "Id", Visible = true, Width = 100 },
|
||||
new DataTableColumnConfig { ColumnHeader = "ФИО заказчика", PropertyName = "Fullname", Visible = true, Width = 200 },
|
||||
new DataTableColumnConfig { ColumnHeader = "Город назначения", PropertyName = "DestinationCityName", Visible = true, Width = 150 },
|
||||
new DataTableColumnConfig { ColumnHeader = "История передвижения", PropertyName = "OrderStatusHistory", Visible = true, Width = 250 },
|
||||
new DataTableColumnConfig { ColumnHeader = "Дата выдачи", PropertyName = "ExpectedDeliveryDate", Visible = true, Width = 125 },
|
||||
});
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
controlDataTable.Clear();
|
||||
var orders = _logic.ReadList(null);
|
||||
if (orders != null)
|
||||
{
|
||||
var displayOrders = orders.Select(order => new
|
||||
{
|
||||
order.Id,
|
||||
order.Fullname,
|
||||
order.DestinationCityName,
|
||||
OrderStatusHistory = string.Join(", ", order.OrderStatusHistory),
|
||||
order.ExpectedDeliveryDate
|
||||
}).ToList();
|
||||
controlDataTable.AddTable(displayOrders);
|
||||
}
|
||||
}
|
||||
private void FormOrders_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormOrder));
|
||||
if (service is FormOrder form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormOrder));
|
||||
if (service is FormOrder form)
|
||||
{
|
||||
form._id = controlDataTable.GetSelectedObject<OrderSearchModel>().Id;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectedOrder = controlDataTable.GetSelectedObject<OrderSearchModel>();
|
||||
if (selectedOrder == null)
|
||||
{
|
||||
MessageBox.Show("Не выбрана запись для удаления.");
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
var isDeleted = _logic.Delete(new OrderBindingModel { Id = selectedOrder.Id ?? 0 });
|
||||
if (isDeleted)
|
||||
{
|
||||
LoadData();
|
||||
MessageBox.Show("Запись успешно удалена.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Ошибка при удалении записи.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GeneratePdfButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var orders = _logic.ReadList(null);
|
||||
|
||||
|
||||
var orderTables = new List<string[,]>();
|
||||
|
||||
foreach (var order in orders)
|
||||
{
|
||||
|
||||
int rowCount = order.OrderStatusHistory.Count;
|
||||
|
||||
|
||||
string[,] orderTable = new string[rowCount+1, 4];
|
||||
|
||||
|
||||
orderTable[0, 0] = "Статус";
|
||||
orderTable[0, 1] = "Идентификатор заказа";
|
||||
orderTable[0, 2] = "Город назначения";
|
||||
orderTable[0, 3] = "Дата доставки";
|
||||
|
||||
|
||||
for (int i = 0; i < rowCount; i++)
|
||||
{
|
||||
orderTable[i+1, 0] = order.OrderStatusHistory[i];
|
||||
orderTable[i+1, 1] = order.Id.ToString();
|
||||
orderTable[i+1, 2] = order.DestinationCityName;
|
||||
orderTable[i+1, 3] = order.ExpectedDeliveryDate.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
|
||||
orderTables.Add(orderTable);
|
||||
}
|
||||
|
||||
|
||||
using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog())
|
||||
{
|
||||
saveFileDialog.Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*";
|
||||
saveFileDialog.Title = "Сохранить PDF-документ";
|
||||
saveFileDialog.FileName = "Отчет1.pdf";
|
||||
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
var pdfData = new PdfDocumentData(
|
||||
saveFileDialog.FileName,
|
||||
"Отчет по заказам",
|
||||
orderTables
|
||||
);
|
||||
|
||||
var documentGenerator = new PDFTable();
|
||||
documentGenerator.GeneratePdf(pdfData);
|
||||
|
||||
MessageBox.Show("PDF-документ успешно создан!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Произошла ошибка: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCreateOrderReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
var orders = _logic.ReadList(null);
|
||||
if (orders == null || orders.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Нет заказов для отчета.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var tableData = new List<OrderExcelViewModel>();
|
||||
foreach (var order in orders)
|
||||
{
|
||||
if (order != null)
|
||||
{
|
||||
tableData.Add(new OrderExcelViewModel(
|
||||
order.Id,
|
||||
order.Fullname,
|
||||
order.DestinationCityName,
|
||||
order.ExpectedDeliveryDate
|
||||
));
|
||||
}
|
||||
}
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "OrderReport.xlsx";
|
||||
|
||||
using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog())
|
||||
{
|
||||
saveFileDialog.Title = "Сохранить Excel-документ";
|
||||
saveFileDialog.FileName = "Отчет2.xlsx";
|
||||
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
path = saveFileDialog.FileName;
|
||||
|
||||
MessageBox.Show("Excel-документ успешно создан!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<(int, int)> merges = new List<(int, int)>
|
||||
{
|
||||
(0,1),
|
||||
(2, 3)
|
||||
};
|
||||
|
||||
List<int> heights = Enumerable.Repeat(20, 4).ToList();
|
||||
|
||||
|
||||
List<(string, string)> headers = new List<(string, string)>
|
||||
{
|
||||
|
||||
("","Данные"),
|
||||
("Id", "Идентификатор"),
|
||||
("Fullname", "ФИО заказчика"),
|
||||
("", "Заказ"),
|
||||
("DestinationCityName", "Город назначения"),
|
||||
("ExpectedDeliveryDate", "Дата получения заказа")
|
||||
};
|
||||
|
||||
if (merges.Count == 0 || heights.Count == 0 || headers.Count == 0 || tableData.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Недостаточно данных для создания отчета.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Merges Count: {merges.Count}");
|
||||
Console.WriteLine($"Heights Count: {heights.Count}");
|
||||
Console.WriteLine($"Headers Count: {headers.Count}");
|
||||
Console.WriteLine($"TableData Count: {tableData.Count}");
|
||||
if (excelTableComponent1.createWithTable(path, "Отчет по заказам", merges, heights, headers, tableData))
|
||||
{
|
||||
MessageBox.Show("Отчет успешно создан!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Ошибка при создании отчета.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CreateDocumentButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
var orders = _logic.ReadList(null).Cast<OrderViewModel>().ToList();
|
||||
|
||||
|
||||
var chartData = new Dictionary<string, List<(DateTime Date, int Count)>>();
|
||||
|
||||
foreach (var order in orders)
|
||||
{
|
||||
if (!chartData.ContainsKey(order.DestinationCityName))
|
||||
{
|
||||
chartData[order.DestinationCityName] = new List<(DateTime Date, int Count)>();
|
||||
}
|
||||
|
||||
|
||||
var existingData = chartData[order.DestinationCityName]
|
||||
.FirstOrDefault(d => d.Date.Date == order.ExpectedDeliveryDate.Date);
|
||||
|
||||
if (existingData.Date == default)
|
||||
{
|
||||
chartData[order.DestinationCityName].Add((order.ExpectedDeliveryDate.Date, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int index = chartData[order.DestinationCityName].FindIndex(d => d.Date.Date == order.ExpectedDeliveryDate.Date);
|
||||
var updatedValue = chartData[order.DestinationCityName][index];
|
||||
chartData[order.DestinationCityName][index] = (updatedValue.Date, updatedValue.Count + 1);
|
||||
}
|
||||
}
|
||||
|
||||
string filePath = "Отчет3.docx";
|
||||
|
||||
using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog())
|
||||
{
|
||||
saveFileDialog.Title = "Сохранить Word-документ";
|
||||
saveFileDialog.FileName = "Отчет3.docx";
|
||||
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filePath = saveFileDialog.FileName;
|
||||
|
||||
MessageBox.Show("Docx-документ успешно создан!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
var config = new ComponentDocumentWithChartConfig
|
||||
{
|
||||
ChartTitle = "Отчет по заказам",
|
||||
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
|
||||
Data = chartData.ToDictionary(
|
||||
entry => entry.Key,
|
||||
entry => entry.Value.Select(d => (DateTimeToInt(d.Date), (double)d.Count)).ToList()),
|
||||
FilePath = filePath,
|
||||
Header = "Заголовок отчета"
|
||||
|
||||
};
|
||||
|
||||
|
||||
var documentComponent = new ComponentDocumentWithChartLineWord();
|
||||
|
||||
|
||||
documentComponent.CreateDoc(config);
|
||||
|
||||
MessageBox.Show("Документ создан успешно!");
|
||||
}
|
||||
private int DateTimeToInt(DateTime date)
|
||||
{
|
||||
return date.Day;
|
||||
}
|
||||
|
||||
|
||||
private void выбранныеТоварыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCities));
|
||||
if (service is FormCities form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="pdfTable1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>126, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelTableComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>231, 17</value>
|
||||
</metadata>
|
||||
<metadata name="componentDocumentWithChartLineWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>409, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>177</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,31 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="ControlsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="FormLibrary" Version="1.0.0" />
|
||||
<PackageReference Include="FormLibraryTikhonenkov" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="WinFormsLibraryVolkov" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InetShopDataModels\InternetShopOrdersDataModels.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersBusinessLogic\InternetShopOrdersBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersContracts\InternetShopOrdersContracts.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,47 +0,0 @@
|
||||
using PluginsConventionLibrary.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Lab3Form
|
||||
{
|
||||
public class PluginsManager
|
||||
{
|
||||
[ImportMany(typeof(IPluginsConvention))]
|
||||
IEnumerable<IPluginsConvention> Plugins { get; set; }
|
||||
|
||||
public readonly Dictionary<string, IPluginsConvention> plugins_dictionary = new();
|
||||
|
||||
public PluginsManager()
|
||||
{
|
||||
AggregateCatalog catalog = new AggregateCatalog();
|
||||
catalog.Catalogs.Add(new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory));
|
||||
catalog.Catalogs.Add(new DirectoryCatalog(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins")));
|
||||
|
||||
//Контейнер композиции
|
||||
CompositionContainer container = new CompositionContainer(catalog);
|
||||
try
|
||||
{
|
||||
container.ComposeParts(this);
|
||||
}
|
||||
catch (CompositionException compositionException)
|
||||
{
|
||||
MessageBox.Show(compositionException.ToString());
|
||||
}
|
||||
if (Plugins.Any())
|
||||
{
|
||||
Plugins
|
||||
.ToList()
|
||||
.ForEach(p =>
|
||||
{
|
||||
if (!plugins_dictionary.Keys.Contains(p.PluginName))
|
||||
plugins_dictionary.Add(p.PluginName, p);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
using InternetShopOrdersBusinessLogic.BusinessLogics;
|
||||
using InternetShopOrdersContracts.BusinessLogicContracts;
|
||||
using InternetShopOrdersContracts.StorageContracts;
|
||||
using InternetShopOrdersDatabaseImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace Lab3Form
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddTransient<ICityStorage, CityStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<ICityLogic, CityLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormOrder>();
|
||||
services.AddTransient<FormCities>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PluginsConventionLibrary.Plugins
|
||||
{
|
||||
public interface IPluginsConvention
|
||||
{
|
||||
/// <summary>
|
||||
/// Название плагина
|
||||
/// </summary>
|
||||
string PluginName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Получение контрола для вывода набора данных
|
||||
/// </summary>
|
||||
UserControl GetControl { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Получение элемента, выбранного в контроле
|
||||
/// </summary>
|
||||
PluginsConventionElement GetElement { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Получение формы для создания/редактирования объекта
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
Form GetForm(PluginsConventionElement element);
|
||||
|
||||
/// <summary>
|
||||
/// Удаление элемента
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
bool DeleteElement(PluginsConventionElement element);
|
||||
|
||||
/// <summary>
|
||||
/// Обновление набора данных в контроле
|
||||
/// </summary>
|
||||
void ReloadData();
|
||||
|
||||
/// <summary>
|
||||
/// Создание простого документа
|
||||
/// </summary>
|
||||
/// <param name="saveDocument"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument);
|
||||
|
||||
/// <summary>
|
||||
/// Создание простого документа
|
||||
/// </summary>
|
||||
/// <param name="saveDocument"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateTableDocument(PluginsConventionSaveDocument saveDocument);
|
||||
|
||||
/// <summary>
|
||||
/// Создание документа с диаграммой
|
||||
/// </summary>
|
||||
/// <param name="saveDocument"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateChartDocument(PluginsConventionSaveDocument saveDocument);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
namespace PluginsConventionLibrary.Plugins
|
||||
{
|
||||
public class PluginsConventionElement
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace PluginsConventionLibrary.Plugins
|
||||
{
|
||||
public class PluginsConventionSaveDocument
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="ControlsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="FormLibraryTikhonenkov" Version="1.0.0" />
|
||||
<PackageReference Include="System.ComponentModel.Composition" Version="8.0.0" />
|
||||
<PackageReference Include="WinFormsLibraryVolkov" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InetShopDataModels\InternetShopOrdersDataModels.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersBusinessLogic\InternetShopOrdersBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersContracts\InternetShopOrdersContracts.csproj" />
|
||||
<ProjectReference Include="..\InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user