Добавьте файлы проекта.
This commit is contained in:
parent
900bd97f61
commit
51f839f761
14
BuisnessLogic/BuisnessLogic.csproj
Normal file
14
BuisnessLogic/BuisnessLogic.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||
<ProjectReference Include="..\DataModels\DataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
100
BuisnessLogic/DeliveryLogic.cs
Normal file
100
BuisnessLogic/DeliveryLogic.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BuisnessLogicsContracts;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.StorageContracts;
|
||||
using Contracts.ViewModels;
|
||||
|
||||
namespace BuisnessLogic
|
||||
{
|
||||
public class DeliveryLogic : IDeliveryLogic
|
||||
{
|
||||
IDeliveryStorage _deliveryStorage;
|
||||
|
||||
public DeliveryLogic(IDeliveryStorage deliveryStorage)
|
||||
{
|
||||
_deliveryStorage = deliveryStorage;
|
||||
}
|
||||
|
||||
public bool Create(DeliveryBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_deliveryStorage.Insert(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(DeliveryBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_deliveryStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public DeliveryViewModel? ReadElement(DeliverySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _deliveryStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<DeliveryViewModel>? ReadList(DeliverySearchModel? model)
|
||||
{
|
||||
var list = model == null ? _deliveryStorage.GetFullList() : _deliveryStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(DeliveryBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_deliveryStorage.Update(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(DeliveryBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.CourierFIO))
|
||||
{
|
||||
throw new ArgumentNullException("Нет ФИО Курьера", nameof(model.CourierFIO));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Phone))
|
||||
{
|
||||
throw new ArgumentNullException("Нет телефона офиса", nameof(model.Phone));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Image))
|
||||
{
|
||||
throw new ArgumentNullException("Нет фото посылки", nameof(model.Image));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Type))
|
||||
{
|
||||
throw new ArgumentNullException("Нет типа посылки", nameof(model.Type));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
92
BuisnessLogic/TypeLogic.cs
Normal file
92
BuisnessLogic/TypeLogic.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BuisnessLogicsContracts;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.StorageContracts;
|
||||
using Contracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BuisnessLogic
|
||||
{
|
||||
public class TypeLogic : ITypeLogic
|
||||
{
|
||||
ITypeStorage _typeStorage;
|
||||
|
||||
public TypeLogic(ITypeStorage typeStorage)
|
||||
{
|
||||
_typeStorage = typeStorage;
|
||||
}
|
||||
|
||||
public bool Create(TypeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_typeStorage.Insert(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(TypeBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_typeStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public TypeViewModel? ReadElement(TypeSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _typeStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<TypeViewModel>? ReadList(TypeSearchModel? model)
|
||||
{
|
||||
var list = model == null ? _typeStorage.GetFullList() : _typeStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(TypeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_typeStorage.Update(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(TypeBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.PostType))
|
||||
{
|
||||
throw new ArgumentNullException("Тип не указан", nameof(model.PostType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
Contracts/BindingModels/DeliveryBindingModel.cs
Normal file
18
Contracts/BindingModels/DeliveryBindingModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
public class DeliveryBindingModel : IDeliveryModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string CourierFIO { get; set; } = string.Empty;
|
||||
public string Image { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
15
Contracts/BindingModels/ITypeModel.cs
Normal file
15
Contracts/BindingModels/ITypeModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
public class TypeBindingModel : ITypeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string PostType { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
20
Contracts/BuisnessLogicsContracts/IDeliveryLogic.cs
Normal file
20
Contracts/BuisnessLogicsContracts/IDeliveryLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BuisnessLogicsContracts
|
||||
{
|
||||
public interface IDeliveryLogic
|
||||
{
|
||||
List<DeliveryViewModel>? ReadList(DeliverySearchModel? model);
|
||||
DeliveryViewModel? ReadElement(DeliverySearchModel model);
|
||||
bool Create(DeliveryBindingModel model);
|
||||
bool Update(DeliveryBindingModel model);
|
||||
bool Delete(DeliveryBindingModel model);
|
||||
}
|
||||
}
|
20
Contracts/BuisnessLogicsContracts/ITypeLogic.cs
Normal file
20
Contracts/BuisnessLogicsContracts/ITypeLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BuisnessLogicsContracts
|
||||
{
|
||||
public interface ITypeLogic
|
||||
{
|
||||
List<TypeViewModel>? ReadList(TypeSearchModel? model);
|
||||
TypeViewModel? ReadElement(TypeSearchModel model);
|
||||
bool Create(TypeBindingModel model);
|
||||
bool Update(TypeBindingModel model);
|
||||
bool Delete(TypeBindingModel model);
|
||||
}
|
||||
}
|
13
Contracts/Contracts.csproj
Normal file
13
Contracts/Contracts.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataModels\DataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
13
Contracts/SearchModels/DeliverySearchModel.cs
Normal file
13
Contracts/SearchModels/DeliverySearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.SearchModels
|
||||
{
|
||||
public class DeliverySearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
13
Contracts/SearchModels/TypeSearchModel.cs
Normal file
13
Contracts/SearchModels/TypeSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.SearchModels
|
||||
{
|
||||
public class TypeSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
21
Contracts/StorageContracts/IDeliveryStorage.cs
Normal file
21
Contracts/StorageContracts/IDeliveryStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.StorageContracts
|
||||
{
|
||||
public interface IDeliveryStorage
|
||||
{
|
||||
List<DeliveryViewModel> GetFullList();
|
||||
List<DeliveryViewModel> GetFilteredList(DeliverySearchModel model);
|
||||
DeliveryViewModel? GetElement(DeliverySearchModel model);
|
||||
DeliveryViewModel? Insert(DeliveryBindingModel model);
|
||||
DeliveryViewModel? Update(DeliveryBindingModel model);
|
||||
DeliveryViewModel? Delete(DeliveryBindingModel model);
|
||||
}
|
||||
}
|
21
Contracts/StorageContracts/ITypeStorage.cs
Normal file
21
Contracts/StorageContracts/ITypeStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.StorageContracts
|
||||
{
|
||||
public interface ITypeStorage
|
||||
{
|
||||
List<TypeViewModel> GetFullList();
|
||||
List<TypeViewModel> GetFilteredList(TypeSearchModel model);
|
||||
TypeViewModel? GetElement(TypeSearchModel model);
|
||||
TypeViewModel? Insert(TypeBindingModel model);
|
||||
TypeViewModel? Update(TypeBindingModel model);
|
||||
TypeViewModel? Delete(TypeBindingModel model);
|
||||
}
|
||||
}
|
18
Contracts/ViewModels/DeliveryViewModel.cs
Normal file
18
Contracts/ViewModels/DeliveryViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.ViewModels
|
||||
{
|
||||
public class DeliveryViewModel : IDeliveryModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string CourierFIO { get; set; } = string.Empty;
|
||||
public string Image { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
15
Contracts/ViewModels/TypeViewModel.cs
Normal file
15
Contracts/ViewModels/TypeViewModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.ViewModels
|
||||
{
|
||||
public class TypeViewModel : ITypeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string PostType { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
9
DataLayer/DataLayer.csproj
Normal file
9
DataLayer/DataLayer.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
7
DataLayer/Models/Delivery.cs
Normal file
7
DataLayer/Models/Delivery.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace DataLayer
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
9
DataModels/DataModels.csproj
Normal file
9
DataModels/DataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
19
DataModels/Models/Fix.cs
Normal file
19
DataModels/Models/Fix.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataModels.Models
|
||||
{
|
||||
public class Fix
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string CourierFIO { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
10
DataModels/Models/IDeliveryModel.cs
Normal file
10
DataModels/Models/IDeliveryModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace DataModels.Models
|
||||
{
|
||||
public interface IDeliveryModel
|
||||
{
|
||||
public string CourierFIO { get; }
|
||||
public string Image { get; }
|
||||
public string Type { get; }
|
||||
public string Phone { get; }
|
||||
}
|
||||
}
|
13
DataModels/Models/ITypeModel.cs
Normal file
13
DataModels/Models/ITypeModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataModels.Models
|
||||
{
|
||||
public interface ITypeModel
|
||||
{
|
||||
public string PostType { get; }
|
||||
}
|
||||
}
|
28
DatabaseImplements/DatabaseImplements.csproj
Normal file
28
DatabaseImplements/DatabaseImplements.csproj
Normal file
@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BuisnessLogic\BuisnessLogic.csproj" />
|
||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||
<ProjectReference Include="..\DataModels\DataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
24
DatabaseImplements/DeliveryDatabase.cs
Normal file
24
DatabaseImplements/DeliveryDatabase.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using DatabaseImplements.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DatabaseImplements
|
||||
{
|
||||
public class DeliveryDataBase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS02;Initial Catalog=DeliveryApp;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public virtual DbSet<Delivery> Deliverys { set; get; }
|
||||
public virtual DbSet<Models.Type> Types { set; get; }
|
||||
}
|
||||
}
|
111
DatabaseImplements/Implements/DeliveryStorage.cs
Normal file
111
DatabaseImplements/Implements/DeliveryStorage.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.StorageContracts;
|
||||
using Contracts.ViewModels;
|
||||
using DatabaseImplements.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DatabaseImplements.Implements
|
||||
{
|
||||
public class DeliveryStorage : IDeliveryStorage
|
||||
{
|
||||
public DeliveryViewModel? Delete(DeliveryBindingModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
var element = context.Deliverys.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Deliverys.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DeliveryViewModel? GetElement(DeliverySearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new DeliveryDataBase();
|
||||
return context.Deliverys.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<DeliveryViewModel> GetFilteredList(DeliverySearchModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
return context.Deliverys
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<DeliveryViewModel> GetFullList()
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
return context.Deliverys
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public DeliveryViewModel? Insert(DeliveryBindingModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
{
|
||||
try
|
||||
{
|
||||
var newDl = Delivery.Create(model);
|
||||
if (newDl == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
context.Deliverys.Add(newDl);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return newDl.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DeliveryViewModel? Update(DeliveryBindingModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
{
|
||||
try
|
||||
{
|
||||
var dl = context.Deliverys.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (dl == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
dl.Update(model);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return dl.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
111
DatabaseImplements/Implements/TypeStorage.cs
Normal file
111
DatabaseImplements/Implements/TypeStorage.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModels;
|
||||
using Contracts.StorageContracts;
|
||||
using Contracts.ViewModels;
|
||||
using DatabaseImplements.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DatabaseImplements.Implements
|
||||
{
|
||||
public class TypeStorage : ITypeStorage
|
||||
{
|
||||
public TypeViewModel? Delete(TypeBindingModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
var element = context.Types.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Types.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TypeViewModel? GetElement(TypeSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new DeliveryDataBase();
|
||||
return context.Types.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<TypeViewModel> GetFilteredList(TypeSearchModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
return context.Types
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<TypeViewModel> GetFullList()
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
return context.Types
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public TypeViewModel? Insert(TypeBindingModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
{
|
||||
try
|
||||
{
|
||||
var newTp = Models.Type.Create(model);
|
||||
if (newTp == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
context.Types.Add(newTp);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return newTp.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TypeViewModel? Update(TypeBindingModel model)
|
||||
{
|
||||
using var context = new DeliveryDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
{
|
||||
try
|
||||
{
|
||||
var tp = context.Types.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (tp == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
tp.Update(model);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return tp.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
75
DatabaseImplements/Migrations/20241022162407_InitialCreate.Designer.cs
generated
Normal file
75
DatabaseImplements/Migrations/20241022162407_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
||||
// <auto-generated />
|
||||
using DatabaseImplements;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DatabaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeliveryDataBase))]
|
||||
[Migration("20241022162407_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.16")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DatabaseImplements.Models.Delivery", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CourierFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Image")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Deliverys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplements.Models.Type", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PostType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Types");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DatabaseImplements.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Deliverys",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CourierFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Image = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Type = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Deliverys", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Types",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PostType = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Types", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Deliverys");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Types");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
// <auto-generated />
|
||||
using DatabaseImplements;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DatabaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeliveryDataBase))]
|
||||
partial class DeliveryDataBaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.16")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DatabaseImplements.Models.Delivery", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CourierFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Image")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Deliverys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplements.Models.Type", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PostType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Types");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
51
DatabaseImplements/Models/Delivery.cs
Normal file
51
DatabaseImplements/Models/Delivery.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DatabaseImplements.Models
|
||||
{
|
||||
public class Delivery : IDeliveryModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string CourierFIO { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Phone { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Image { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Type { get; private set; } = string.Empty;
|
||||
public static Delivery? Create(DeliveryBindingModel model)
|
||||
{
|
||||
return new Delivery()
|
||||
{
|
||||
Id = model.Id,
|
||||
CourierFIO = model.CourierFIO,
|
||||
Image = model.Image,
|
||||
Phone = model.Phone,
|
||||
Type = model.Type,
|
||||
};
|
||||
}
|
||||
public void Update(DeliveryBindingModel model)
|
||||
{
|
||||
CourierFIO = model.CourierFIO;
|
||||
Image = model.Image;
|
||||
Phone = model.Phone;
|
||||
Type = model.Type;
|
||||
}
|
||||
public DeliveryViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CourierFIO = CourierFIO,
|
||||
Image = Image,
|
||||
Phone = Phone,
|
||||
Type = Type,
|
||||
};
|
||||
}
|
||||
}
|
37
DatabaseImplements/Models/Type.cs
Normal file
37
DatabaseImplements/Models/Type.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DatabaseImplements.Models
|
||||
{
|
||||
public class Type : ITypeModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string PostType { get; private set; } = string.Empty;
|
||||
public static Type? Create(TypeBindingModel model)
|
||||
{
|
||||
return new Type()
|
||||
{
|
||||
Id = model.Id,
|
||||
PostType = model.PostType,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(TypeBindingModel model)
|
||||
{
|
||||
PostType = model.PostType;
|
||||
}
|
||||
public TypeViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
PostType = PostType,
|
||||
};
|
||||
}
|
||||
}
|
49
DeliveryApp.sln
Normal file
49
DeliveryApp.sln
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34714.143
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeliveryApp", "DeliveryApp\DeliveryApp.csproj", "{95BE9CF8-06E8-4A97-91D2-390B4DCC6F5B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuisnessLogic", "BuisnessLogic\BuisnessLogic.csproj", "{435AEE3E-FD12-452D-9895-27A8F0489405}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{83B5614E-215C-4B87-AF7D-D2E0ED781B2D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModels", "DataModels\DataModels.csproj", "{268CE725-6E11-4421-91F5-BBCE7B2DFF15}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseImplements", "DatabaseImplements\DatabaseImplements.csproj", "{AE946053-9269-4DCD-A71E-F5B1E570CFD9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{95BE9CF8-06E8-4A97-91D2-390B4DCC6F5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{95BE9CF8-06E8-4A97-91D2-390B4DCC6F5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{95BE9CF8-06E8-4A97-91D2-390B4DCC6F5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{95BE9CF8-06E8-4A97-91D2-390B4DCC6F5B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{435AEE3E-FD12-452D-9895-27A8F0489405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{435AEE3E-FD12-452D-9895-27A8F0489405}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{435AEE3E-FD12-452D-9895-27A8F0489405}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{435AEE3E-FD12-452D-9895-27A8F0489405}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{83B5614E-215C-4B87-AF7D-D2E0ED781B2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{83B5614E-215C-4B87-AF7D-D2E0ED781B2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83B5614E-215C-4B87-AF7D-D2E0ED781B2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83B5614E-215C-4B87-AF7D-D2E0ED781B2D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{268CE725-6E11-4421-91F5-BBCE7B2DFF15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{268CE725-6E11-4421-91F5-BBCE7B2DFF15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{268CE725-6E11-4421-91F5-BBCE7B2DFF15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{268CE725-6E11-4421-91F5-BBCE7B2DFF15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE946053-9269-4DCD-A71E-F5B1E570CFD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE946053-9269-4DCD-A71E-F5B1E570CFD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE946053-9269-4DCD-A71E-F5B1E570CFD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE946053-9269-4DCD-A71E-F5B1E570CFD9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6B20F53F-C289-4B79-BE0E-6380B03F4E4D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
54
DeliveryApp/DeliveryApp.csproj
Normal file
54
DeliveryApp/DeliveryApp.csproj
Normal file
@ -0,0 +1,54 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<COMReference Include="Microsoft.Office.Interop.Word">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>7</VersionMinor>
|
||||
<VersionMajor>8</VersionMajor>
|
||||
<Guid>00020905-0000-0000-c000-000000000046</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Controls" Version="1.0.0" />
|
||||
<PackageReference Include="CreateVisualComponent" Version="1.0.0" />
|
||||
<PackageReference Include="CustomComponentsTest" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="textboxfix" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BuisnessLogic\BuisnessLogic.csproj" />
|
||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||
<ProjectReference Include="..\DatabaseImplements\DatabaseImplements.csproj" />
|
||||
<ProjectReference Include="..\DataModels\DataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
171
DeliveryApp/Form1.Designer.cs
generated
Normal file
171
DeliveryApp/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
namespace DeliveryApp
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
toolStrip1 = new ToolStrip();
|
||||
toolStripType = new ToolStripButton();
|
||||
toolStripPdf = new ToolStripButton();
|
||||
toolStripWord = new ToolStripButton();
|
||||
toolStripExcel = new ToolStripButton();
|
||||
toolStripDropDownButton1 = new ToolStripDropDownButton();
|
||||
добавитьToolStripMenuItem = new ToolStripMenuItem();
|
||||
редактироватьToolStripMenuItem = new ToolStripMenuItem();
|
||||
удалитьToolStripMenuItem = new ToolStripMenuItem();
|
||||
listOutputComponent1 = new CreateVisualComponent.ListOutputComponent();
|
||||
tableComponent1 = new Controls.TableComponent(components);
|
||||
imageWord1 = new CustomComponents.NonViewComponents.ImageWord(components);
|
||||
excelDiagram1 = new NotVisualComponent.ExcelDiagram(components);
|
||||
toolStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
toolStrip1.ImageScalingSize = new Size(20, 20);
|
||||
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripType, toolStripPdf, toolStripWord, toolStripExcel, toolStripDropDownButton1 });
|
||||
toolStrip1.Location = new Point(0, 0);
|
||||
toolStrip1.Name = "toolStrip1";
|
||||
toolStrip1.Size = new Size(853, 27);
|
||||
toolStrip1.TabIndex = 1;
|
||||
toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// toolStripType
|
||||
//
|
||||
toolStripType.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
toolStripType.Image = (Image)resources.GetObject("toolStripType.Image");
|
||||
toolStripType.ImageTransparentColor = Color.Magenta;
|
||||
toolStripType.Name = "toolStripType";
|
||||
toolStripType.Size = new Size(106, 24);
|
||||
toolStripType.Text = "Форма типов";
|
||||
toolStripType.Click += toolStripType_Click;
|
||||
//
|
||||
// toolStripPdf
|
||||
//
|
||||
toolStripPdf.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
toolStripPdf.Image = (Image)resources.GetObject("toolStripPdf.Image");
|
||||
toolStripPdf.ImageTransparentColor = Color.Magenta;
|
||||
toolStripPdf.Name = "toolStripPdf";
|
||||
toolStripPdf.Size = new Size(83, 24);
|
||||
toolStripPdf.Text = "Отчет пдф";
|
||||
toolStripPdf.Click += toolStripPdf_Click;
|
||||
//
|
||||
// toolStripWord
|
||||
//
|
||||
toolStripWord.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
toolStripWord.Image = (Image)resources.GetObject("toolStripWord.Image");
|
||||
toolStripWord.ImageTransparentColor = Color.Magenta;
|
||||
toolStripWord.Name = "toolStripWord";
|
||||
toolStripWord.Size = new Size(90, 24);
|
||||
toolStripWord.Text = "Отчет ворд";
|
||||
toolStripWord.Click += toolStripWord_Click;
|
||||
//
|
||||
// toolStripExcel
|
||||
//
|
||||
toolStripExcel.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
toolStripExcel.Image = (Image)resources.GetObject("toolStripExcel.Image");
|
||||
toolStripExcel.ImageTransparentColor = Color.Magenta;
|
||||
toolStripExcel.Name = "toolStripExcel";
|
||||
toolStripExcel.Size = new Size(101, 24);
|
||||
toolStripExcel.Text = "Отчет эксель";
|
||||
toolStripExcel.Click += toolStripExcel_Click;
|
||||
//
|
||||
// toolStripDropDownButton1
|
||||
//
|
||||
toolStripDropDownButton1.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
toolStripDropDownButton1.DropDownItems.AddRange(new ToolStripItem[] { добавитьToolStripMenuItem, редактироватьToolStripMenuItem, удалитьToolStripMenuItem });
|
||||
toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image");
|
||||
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
|
||||
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
|
||||
toolStripDropDownButton1.Size = new Size(193, 24);
|
||||
toolStripDropDownButton1.Text = "Управление доставками";
|
||||
//
|
||||
// добавитьToolStripMenuItem
|
||||
//
|
||||
добавитьToolStripMenuItem.Name = "добавитьToolStripMenuItem";
|
||||
добавитьToolStripMenuItem.Size = new Size(224, 26);
|
||||
добавитьToolStripMenuItem.Text = "Добавить";
|
||||
добавитьToolStripMenuItem.Click += добавитьToolStripMenuItem_Click;
|
||||
//
|
||||
// редактироватьToolStripMenuItem
|
||||
//
|
||||
редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem";
|
||||
редактироватьToolStripMenuItem.Size = new Size(224, 26);
|
||||
редактироватьToolStripMenuItem.Text = "Редактировать";
|
||||
редактироватьToolStripMenuItem.Click += редактироватьToolStripMenuItem_Click;
|
||||
//
|
||||
// удалитьToolStripMenuItem
|
||||
//
|
||||
удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
|
||||
удалитьToolStripMenuItem.Size = new Size(224, 26);
|
||||
удалитьToolStripMenuItem.Text = "Удалить";
|
||||
удалитьToolStripMenuItem.Click += удалитьToolStripMenuItem_Click;
|
||||
//
|
||||
// listOutputComponent1
|
||||
//
|
||||
listOutputComponent1.Dock = DockStyle.Fill;
|
||||
listOutputComponent1.Location = new Point(0, 27);
|
||||
listOutputComponent1.Name = "listOutputComponent1";
|
||||
listOutputComponent1.Size = new Size(853, 423);
|
||||
listOutputComponent1.TabIndex = 2;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(853, 450);
|
||||
Controls.Add(listOutputComponent1);
|
||||
Controls.Add(toolStrip1);
|
||||
KeyPreview = true;
|
||||
Name = "Form1";
|
||||
Text = "FormMain";
|
||||
Load += Form1_Load;
|
||||
KeyDown += OnKeyPressed;
|
||||
toolStrip1.ResumeLayout(false);
|
||||
toolStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
private ToolStrip toolStrip1;
|
||||
private ToolStripButton toolStripType;
|
||||
private CreateVisualComponent.ListOutputComponent listOutputComponent1;
|
||||
private ToolStripButton toolStripPdf;
|
||||
private ToolStripButton toolStripWord;
|
||||
private ToolStripButton toolStripExcel;
|
||||
private Controls.TableComponent tableComponent1;
|
||||
private CustomComponents.NonViewComponents.ImageWord imageWord1;
|
||||
private NotVisualComponent.ExcelDiagram excelDiagram1;
|
||||
private ToolStripDropDownButton toolStripDropDownButton1;
|
||||
private ToolStripMenuItem добавитьToolStripMenuItem;
|
||||
private ToolStripMenuItem редактироватьToolStripMenuItem;
|
||||
private ToolStripMenuItem удалитьToolStripMenuItem;
|
||||
}
|
||||
}
|
339
DeliveryApp/Form1.cs
Normal file
339
DeliveryApp/Form1.cs
Normal file
@ -0,0 +1,339 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BuisnessLogicsContracts;
|
||||
using Contracts.ViewModels;
|
||||
using Controls.Models;
|
||||
using CreateVisualComponent;
|
||||
using CustomComponents.NonViewComponents.SupportClasses;
|
||||
using DatabaseImplements.Models;
|
||||
using DataModels.Models;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.Rendering;
|
||||
using NotVisualComponent.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Windows.Forms;
|
||||
using Word = Microsoft.Office.Interop.Word;
|
||||
|
||||
namespace DeliveryApp
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private readonly IDeliveryLogic _deliveryLogic;
|
||||
private readonly ITypeLogic _typeLogic;
|
||||
public Form1(IDeliveryLogic deliveryLogic, ITypeLogic typeLogic)
|
||||
{
|
||||
_deliveryLogic = deliveryLogic;
|
||||
_typeLogic = typeLogic;
|
||||
InitializeComponent();
|
||||
ColumnsConfiguratoin columnsConfiguratoin = new ColumnsConfiguratoin();
|
||||
columnsConfiguratoin.Columns.Add(new ColumnConfig
|
||||
{
|
||||
ColumnName = "Id",
|
||||
Width = 10,
|
||||
Visible = false,
|
||||
PropertyObject = "Id"
|
||||
});
|
||||
columnsConfiguratoin.Columns.Add(new ColumnConfig
|
||||
{
|
||||
ColumnName = "ÔÈÎ",
|
||||
Width = 400,
|
||||
Visible = true,
|
||||
PropertyObject = "CourierFIO"
|
||||
});
|
||||
columnsConfiguratoin.Columns.Add(new ColumnConfig
|
||||
{
|
||||
ColumnName = "Òèï ïîñûëêè",
|
||||
Width = 250,
|
||||
Visible = true,
|
||||
PropertyObject = "Type"
|
||||
});
|
||||
columnsConfiguratoin.Columns.Add(new ColumnConfig
|
||||
{
|
||||
ColumnName = "Òåëåôîí",
|
||||
Width = 200,
|
||||
Visible = true,
|
||||
PropertyObject = "Phone"
|
||||
});
|
||||
listOutputComponent1.ConfigColumn(columnsConfiguratoin);
|
||||
}
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
listOutputComponent1.ClearDataGrid();
|
||||
try
|
||||
{
|
||||
var deliverys = _deliveryLogic.ReadList(null);
|
||||
if (deliverys == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int k = -1;
|
||||
foreach (var delivery in deliverys)
|
||||
{
|
||||
k++;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
listOutputComponent1.AddItem(delivery, k, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå äàííûõ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void AddElement()
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDelivery));
|
||||
if (!(service is FormDelivery form))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
private void UpdateElement()
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDelivery));
|
||||
if (service is FormDelivery form)
|
||||
{
|
||||
var selectedDelivery = listOutputComponent1.GetSelectedObjectInRow<DeliveryViewModel>();
|
||||
if (selectedDelivery == null)
|
||||
{
|
||||
MessageBox.Show("Îøèáêà ïðè ðåäàêòèðîâàíèè!", "Âû íå âûáðàëè ýëåìåíò", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
form.Id = selectedDelivery.Id;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DeleteElement()
|
||||
{
|
||||
if (MessageBox.Show("Âû óâåðåííû?", "Óäàëèòü", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedDelivery = listOutputComponent1.GetSelectedObjectInRow<DeliveryViewModel>();
|
||||
int id = Convert.ToInt32(selectedDelivery.Id);
|
||||
try
|
||||
{
|
||||
_deliveryLogic.Delete(new DeliveryBindingModel { Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè óäàëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void toolStripType_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormType));
|
||||
if (!(service is FormType form))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripDelivery_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddElement();
|
||||
}
|
||||
private void toolStripPdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreatePDF();
|
||||
}
|
||||
private void CreatePDF()
|
||||
{
|
||||
Document document = new Document();
|
||||
Section section = document.AddSection();
|
||||
Paragraph paragraph = section.AddParagraph();
|
||||
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer();
|
||||
pdfRenderer.Document = document;
|
||||
pdfRenderer.RenderDocument();
|
||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
pdfRenderer.PdfDocument.Save(dialog.FileName);
|
||||
List<ColumnInfo> columns = new List<ColumnInfo>()
|
||||
{
|
||||
new ColumnInfo("Id","Id",50),
|
||||
new ColumnInfo("CourierFIO","ÔÈÎ",100),
|
||||
new ColumnInfo("Phone","Òåëåôîí",100),
|
||||
new ColumnInfo("Type","Òèï",75),
|
||||
|
||||
};
|
||||
List<Controls.Models.MergeCells> mergeCells = new List<Controls.Models.MergeCells>()
|
||||
{
|
||||
new Controls.Models.MergeCells("Äîñòàâêà", new int[] {0,3,4}),
|
||||
};
|
||||
try
|
||||
{
|
||||
var list = _deliveryLogic.ReadList(null);
|
||||
if (list == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<Fix> dm = new List<Fix>();
|
||||
foreach (var cell in list)
|
||||
{
|
||||
dm.Add(
|
||||
new Fix()
|
||||
{
|
||||
Phone = cell.Phone,
|
||||
Id = cell.Id,
|
||||
CourierFIO = cell.CourierFIO,
|
||||
Type = cell.Type,
|
||||
});
|
||||
}
|
||||
tableComponent1.CreateTable(dialog.FileName, "Òàáëèöà", mergeCells, columns, dm);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè ôîðìèðîâàíèè ïäô", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnKeyPressed(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Control)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.A:
|
||||
AddElement();
|
||||
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;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void toolStripWord_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateWord();
|
||||
}
|
||||
private void CreateWord()
|
||||
{
|
||||
var wordApp = new Word.Application();
|
||||
var document = wordApp.Documents.Add();
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
List<Tuple<string, DocImage[]>> prg = new List<Tuple<string, DocImage[]>>();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _deliveryLogic.ReadList(null);
|
||||
if (list == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var cell in list)
|
||||
{
|
||||
var paragraph = document.Paragraphs.Add();
|
||||
paragraph.Range.Text = $"Äîñòàâêà íîìåð:{cell.Id}. Òèï:{cell.Type}";
|
||||
paragraph.Range.Font.Size = 24;
|
||||
paragraph.Range.Font.Bold = 1;
|
||||
paragraph.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
|
||||
paragraph.Range.InsertParagraphAfter();
|
||||
prg.Add(new Tuple<string, DocImage[]>($"Äîñòàâêà íîìåð:{cell.Id}. Òèï:{cell.Type}", new DocImage[] { new DocImage { Path = cell.Image, Height = 200, Width = 200 } }));
|
||||
}
|
||||
document.SaveAs2(dialog.FileName);
|
||||
wordApp.Quit();
|
||||
foreach (var cell in prg)
|
||||
{
|
||||
imageWord1.AddImages(dialog.FileName, cell.Item1, cell.Item2);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè ôîðìèðîâàíèè docx", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void toolStripExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateExcel();
|
||||
}
|
||||
private void CreateExcel()
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var list = _deliveryLogic.ReadList(null);
|
||||
Dictionary<string, List<(string Name, double Value)>> data = new Dictionary<string, List<(string Name, double Value)>>();
|
||||
if (list == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<(string Name, double Value)> smth = new List<(string Name, double Value)>();
|
||||
Dictionary<string, double> dt = new Dictionary<string, double>();
|
||||
foreach (var cell in list)
|
||||
{
|
||||
if (dt.ContainsKey(cell.Type))
|
||||
{
|
||||
dt[cell.Type]++;
|
||||
continue;
|
||||
}
|
||||
dt.Add(cell.Type, 1);
|
||||
}
|
||||
foreach (var f in dt)
|
||||
{
|
||||
smth.Add(new(f.Key, f.Value));
|
||||
}
|
||||
data.Add("Series 1", smth);
|
||||
ChartConfig conf = new ChartConfig { ChartTitle = "Îò÷åò ïî òèïàì", FilePath = dialog.FileName, Header = "Chart", LegendLocation = NotVisualComponent.Models.Location.Top, Data = data };
|
||||
excelDiagram1.CreateDoc(conf);
|
||||
}
|
||||
}
|
||||
|
||||
private void äîáàâèòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddElement();
|
||||
}
|
||||
|
||||
private void ðåäàêòèðîâàòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateElement();
|
||||
}
|
||||
|
||||
private void óäàëèòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
DeleteElement();
|
||||
}
|
||||
}
|
||||
}
|
188
DeliveryApp/Form1.resx
Normal file
188
DeliveryApp/Form1.resx
Normal file
@ -0,0 +1,188 @@
|
||||
<?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="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="toolStripType.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
|
||||
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
|
||||
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
|
||||
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
|
||||
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
|
||||
qgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripPdf.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
|
||||
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
|
||||
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
|
||||
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
|
||||
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
|
||||
qgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripWord.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
|
||||
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
|
||||
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
|
||||
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
|
||||
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
|
||||
qgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripExcel.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
|
||||
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
|
||||
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
|
||||
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
|
||||
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
|
||||
qgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
|
||||
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
|
||||
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
|
||||
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
|
||||
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
|
||||
qgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="tableComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>143, 17</value>
|
||||
</metadata>
|
||||
<metadata name="imageWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>319, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelDiagram1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>461, 17</value>
|
||||
</metadata>
|
||||
</root>
|
214
DeliveryApp/FormDelivery.Designer.cs
generated
Normal file
214
DeliveryApp/FormDelivery.Designer.cs
generated
Normal file
@ -0,0 +1,214 @@
|
||||
namespace DeliveryApp
|
||||
{
|
||||
partial class FormDelivery
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
tableLayoutPanel1 = new TableLayoutPanel();
|
||||
label1 = new Label();
|
||||
textBox1 = new TextBox();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
buttonImage = new Button();
|
||||
customCheckedListBox1 = new CustomComponents.CustomCheckedListBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
customTextBoxNumber2 = new textboxfix.CustomTextBoxNumber();
|
||||
pictureBox1 = new PictureBox();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
tableLayoutPanel1.ColumnCount = 5;
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 46.62162F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 53.37838F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 94F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 169F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 100F));
|
||||
tableLayoutPanel1.Controls.Add(label1, 0, 0);
|
||||
tableLayoutPanel1.Controls.Add(textBox1, 0, 1);
|
||||
tableLayoutPanel1.Controls.Add(label2, 1, 0);
|
||||
tableLayoutPanel1.Controls.Add(label3, 2, 0);
|
||||
tableLayoutPanel1.Controls.Add(label4, 3, 0);
|
||||
tableLayoutPanel1.Controls.Add(buttonImage, 2, 1);
|
||||
tableLayoutPanel1.Controls.Add(customCheckedListBox1, 3, 1);
|
||||
tableLayoutPanel1.Controls.Add(buttonCancel, 4, 0);
|
||||
tableLayoutPanel1.Controls.Add(buttonSave, 4, 1);
|
||||
tableLayoutPanel1.Controls.Add(customTextBoxNumber2, 1, 1);
|
||||
tableLayoutPanel1.Dock = DockStyle.Top;
|
||||
tableLayoutPanel1.Location = new Point(0, 0);
|
||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
tableLayoutPanel1.RowCount = 2;
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 30.06993F));
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 69.93007F));
|
||||
tableLayoutPanel1.Size = new Size(660, 143);
|
||||
tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.Anchor = AnchorStyles.Top;
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(48, 0);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(42, 20);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "ФИО";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
textBox1.Dock = DockStyle.Fill;
|
||||
textBox1.Location = new Point(3, 46);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Size = new Size(132, 27);
|
||||
textBox1.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.Anchor = AnchorStyles.Top;
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(182, 0);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(69, 20);
|
||||
label2.TabIndex = 2;
|
||||
label2.Text = "Телефон";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.Anchor = AnchorStyles.Top;
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(321, 0);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(44, 20);
|
||||
label3.TabIndex = 3;
|
||||
label3.Text = "Фото";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.Anchor = AnchorStyles.Top;
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(457, 0);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(35, 20);
|
||||
label4.TabIndex = 4;
|
||||
label4.Text = "Тип";
|
||||
//
|
||||
// buttonImage
|
||||
//
|
||||
buttonImage.Dock = DockStyle.Fill;
|
||||
buttonImage.Location = new Point(299, 46);
|
||||
buttonImage.Name = "buttonImage";
|
||||
buttonImage.Size = new Size(88, 94);
|
||||
buttonImage.TabIndex = 5;
|
||||
buttonImage.Text = "Выбрать фото";
|
||||
buttonImage.UseVisualStyleBackColor = true;
|
||||
buttonImage.Click += buttonImage_Click;
|
||||
//
|
||||
// customCheckedListBox1
|
||||
//
|
||||
customCheckedListBox1.Anchor = AnchorStyles.None;
|
||||
customCheckedListBox1.Location = new Point(393, 49);
|
||||
customCheckedListBox1.Name = "customCheckedListBox1";
|
||||
customCheckedListBox1.SelectedValue = "";
|
||||
customCheckedListBox1.Size = new Size(163, 88);
|
||||
customCheckedListBox1.TabIndex = 6;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Dock = DockStyle.Fill;
|
||||
buttonCancel.Location = new Point(562, 3);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(95, 37);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Dock = DockStyle.Fill;
|
||||
buttonSave.Location = new Point(562, 46);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(95, 94);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// customTextBoxNumber2
|
||||
//
|
||||
customTextBoxNumber2.Dock = DockStyle.Fill;
|
||||
customTextBoxNumber2.Location = new Point(141, 46);
|
||||
customTextBoxNumber2.Name = "customTextBoxNumber2";
|
||||
customTextBoxNumber2.NumPattern = "\\(\\d{4}\\)\\d{2}-\\d{2}-\\d{2}";
|
||||
customTextBoxNumber2.Size = new Size(152, 94);
|
||||
customTextBoxNumber2.TabIndex = 9;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Dock = DockStyle.Fill;
|
||||
pictureBox1.Location = new Point(0, 143);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(660, 362);
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
pictureBox1.TabIndex = 1;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// FormDelivery
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(660, 505);
|
||||
Controls.Add(pictureBox1);
|
||||
Controls.Add(tableLayoutPanel1);
|
||||
Name = "FormDelivery";
|
||||
Text = "FormDelivery";
|
||||
Load += FormDelivery_Load;
|
||||
tableLayoutPanel1.ResumeLayout(false);
|
||||
tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TableLayoutPanel tableLayoutPanel1;
|
||||
private Label label1;
|
||||
private TextBox textBox1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private PictureBox pictureBox1;
|
||||
private Button buttonImage;
|
||||
private CustomComponents.CustomCheckedListBox customCheckedListBox1;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private textboxfix.CustomTextBoxNumber customTextBoxNumber2;
|
||||
}
|
||||
}
|
143
DeliveryApp/FormDelivery.cs
Normal file
143
DeliveryApp/FormDelivery.cs
Normal file
@ -0,0 +1,143 @@
|
||||
using BuisnessLogic;
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BuisnessLogicsContracts;
|
||||
using Contracts.SearchModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DeliveryApp
|
||||
{
|
||||
public partial class FormDelivery : Form
|
||||
{
|
||||
private readonly ITypeLogic _typeLogic;
|
||||
private readonly IDeliveryLogic _deliveryLogic;
|
||||
private int? _id;
|
||||
private string? currentImage;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormDelivery(ITypeLogic typeLogic, IDeliveryLogic deliveryLogic)
|
||||
{
|
||||
_typeLogic = typeLogic;
|
||||
_deliveryLogic = deliveryLogic;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void FormDelivery_Load(object sender, EventArgs e)
|
||||
{
|
||||
customTextBoxNumber2.TextBoxNumber = "(0000)00-00-00";
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
var list = _typeLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
customCheckedListBox1.DataList.Add(item.PostType);
|
||||
}
|
||||
}
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var element = _deliveryLogic.ReadElement(new DeliverySearchModel
|
||||
{
|
||||
Id = _id.Value,
|
||||
});
|
||||
if (element != null)
|
||||
{
|
||||
textBox1.Text = element.CourierFIO;
|
||||
customTextBoxNumber2.TextBoxNumber = element.Phone;
|
||||
customCheckedListBox1.SelectedValue = element.Type;
|
||||
pictureBox1.Image = Image.FromFile(element.Image);
|
||||
currentImage = element.Image;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBox1.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните фио", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (customCheckedListBox1.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите тип", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var ss = customTextBoxNumber2.NumPattern;
|
||||
if (customTextBoxNumber2.TextBoxNumber == null)
|
||||
{
|
||||
MessageBox.Show("Заполните номер", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (currentImage == null)
|
||||
{
|
||||
MessageBox.Show("Выберите фото", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var model = new DeliveryBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
CourierFIO = textBox1.Text,
|
||||
Image = currentImage,
|
||||
Phone = customTextBoxNumber2.TextBoxNumber,
|
||||
Type = customCheckedListBox1.SelectedValue,
|
||||
|
||||
};
|
||||
var operationResult = _id.HasValue ? _deliveryLogic.Update(model) :
|
||||
_deliveryLogic.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);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "Выберите фото";
|
||||
dlg.Filter = "Image Files (*.bmp;*.jpg;*.jpeg,*.png)|*.BMP;*.JPG;*.JPEG;*.PNG";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
pictureBox1.Image = new Bitmap(dlg.FileName);
|
||||
currentImage = dlg.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
DeliveryApp/FormDelivery.resx
Normal file
120
DeliveryApp/FormDelivery.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
67
DeliveryApp/FormType.Designer.cs
generated
Normal file
67
DeliveryApp/FormType.Designer.cs
generated
Normal file
@ -0,0 +1,67 @@
|
||||
namespace DeliveryApp
|
||||
{
|
||||
partial class FormType
|
||||
{
|
||||
/// <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();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(800, 450);
|
||||
dataGridView.TabIndex = 0;
|
||||
dataGridView.CellEndEdit += dataGridView_CellEndEdit;
|
||||
dataGridView.KeyDown += dataGridView_KeyDown;
|
||||
//
|
||||
// FormType
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormType";
|
||||
Text = "FormType";
|
||||
Load += FormType_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
122
DeliveryApp/FormType.cs
Normal file
122
DeliveryApp/FormType.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BuisnessLogicsContracts;
|
||||
using Contracts.ViewModels;
|
||||
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 DeliveryApp
|
||||
{
|
||||
public partial class FormType : Form
|
||||
{
|
||||
private readonly ITypeLogic _logic;
|
||||
List<TypeViewModel>? _list;
|
||||
public FormType(ITypeLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormType_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
_list = _logic.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
dataGridView.DataSource = _list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["PostType"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_UserAddedRow(object sender, DataGridViewRowEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridView.SelectedCells[1].Value == null)
|
||||
{
|
||||
throw new Exception("Ошибка, нельзя сохранить пустую строку");
|
||||
}
|
||||
int _id;
|
||||
bool id = Int32.TryParse(dataGridView.SelectedRows[0].Cells["Id"].Value?.ToString(), out _id);
|
||||
if (_id == -1)
|
||||
{
|
||||
id = false;
|
||||
}
|
||||
var model = new TypeBindingModel
|
||||
{
|
||||
Id = id ? _id : 0,
|
||||
PostType = dataGridView.SelectedCells[1].Value.ToString()!,
|
||||
};
|
||||
var operationResult = id ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Insert)
|
||||
{
|
||||
_list?.Add(new TypeViewModel { Id = -1, PostType = "" });
|
||||
if (_list != null)
|
||||
{
|
||||
dataGridView.DataSource = null;
|
||||
dataGridView.DataSource = _list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["PostType"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
}
|
||||
if(e.KeyCode == Keys.Delete)
|
||||
{
|
||||
if (MessageBox.Show("Вы уверены?", "Удалить", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int _id;
|
||||
bool id = Int32.TryParse(dataGridView.SelectedRows[0].Cells["Id"].Value?.ToString(), out _id);
|
||||
if (_id == -1 || !id)
|
||||
{
|
||||
id = false;
|
||||
return;
|
||||
}
|
||||
var model = new TypeBindingModel
|
||||
{
|
||||
Id = _id,
|
||||
PostType = dataGridView.SelectedCells[1].Value.ToString()!,
|
||||
};
|
||||
_logic.Delete(model);
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
DeliveryApp/FormType.resx
Normal file
120
DeliveryApp/FormType.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
49
DeliveryApp/Program.cs
Normal file
49
DeliveryApp/Program.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using BuisnessLogic;
|
||||
using Contracts.BuisnessLogicsContracts;
|
||||
using Contracts.StorageContracts;
|
||||
using DatabaseImplements.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace DeliveryApp
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
[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<Form1>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
//option.AddNLog("nlog.config");
|
||||
});
|
||||
|
||||
services.AddTransient<IDeliveryStorage, DeliveryStorage>();
|
||||
services.AddTransient<ITypeStorage, TypeStorage>();
|
||||
|
||||
services.AddTransient<IDeliveryLogic, DeliveryLogic>();
|
||||
services.AddTransient<ITypeLogic, TypeLogic>();
|
||||
|
||||
services.AddTransient<Form1>();
|
||||
services.AddTransient<FormDelivery>();
|
||||
services.AddTransient<FormType>();
|
||||
}
|
||||
}
|
||||
}
|
63
DeliveryApp/Properties/Resources.Designer.cs
generated
Normal file
63
DeliveryApp/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DeliveryApp.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DeliveryApp.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
DeliveryApp/Properties/Resources.resx
Normal file
120
DeliveryApp/Properties/Resources.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user