урряя, ряботает
This commit is contained in:
parent
521876c71b
commit
f82e1ab9b6
@ -18,8 +18,7 @@ namespace ConstructionFirmDataModels.Models
|
||||
Enum.TaskStatus Status { get; }
|
||||
int CliendId { get; }
|
||||
int EmployeeId {get;}
|
||||
|
||||
Dictionary<int, (IConstructionMaterialModel, int)> ConstructionMaterialProjects { get; }
|
||||
Dictionary<int, (IConstructionMaterialModel, int)> ConstructionMaterialProjects { get; }
|
||||
Dictionary<int, (ITeamModel, int)> TeamProject { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ConstructionFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
@ -68,5 +69,13 @@ namespace ConstructionFirmDatabaseImplement.Implements
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmDatabase();
|
||||
|
||||
string deleteAllQuery = "DELETE FROM \"Clients\"";
|
||||
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ConstructionFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
@ -68,5 +69,13 @@ namespace ConstructionFirmDatabaseImplement.Implements
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmDatabase();
|
||||
|
||||
string deleteAllQuery = "DELETE FROM \"ConstructionMaterials\"";
|
||||
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ConstructionFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
@ -68,5 +69,13 @@ namespace ConstructionFirmDatabaseImplement.Implements
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmDatabase();
|
||||
|
||||
string deleteAllQuery = "DELETE FROM \"Employees\"";
|
||||
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,5 +98,13 @@ namespace ConstructionFirmDatabaseImplement.Implements
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmDatabase();
|
||||
|
||||
string deleteAllQuery = "DELETE FROM \"Projects\"";
|
||||
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ConstructionFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
@ -68,5 +69,13 @@ namespace ConstructionFirmDatabaseImplement.Implements
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmDatabase();
|
||||
|
||||
string deleteAllQuery = "DELETE FROM \"Specialtys\"";
|
||||
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ConstructionFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
@ -68,5 +69,13 @@ namespace ConstructionFirmDatabaseImplement.Implements
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmDatabase();
|
||||
|
||||
string deleteAllQuery = "DELETE FROM \"Teams\"";
|
||||
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,15 +12,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace ConstructionFirmDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ConstructionFirmDatabase))]
|
||||
[Migration("20240507132319_EmployeeMigration")]
|
||||
partial class EmployeeMigration
|
||||
[Migration("20240514194125_NewMGMigration")]
|
||||
partial class NewMGMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.16")
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace ConstructionFirmDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EmployeeMigration : Migration
|
||||
public partial class NewMGMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
@ -17,7 +17,7 @@ namespace ConstructionFirmDatabaseImplement.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.16")
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
28
ConstructionFirmMongoDB/ConstructionFirmMongoDB.cs
Normal file
28
ConstructionFirmMongoDB/ConstructionFirmMongoDB.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB
|
||||
{
|
||||
public class ConstructionFirmMongoDB : IDisposable
|
||||
{
|
||||
private readonly MongoClient _client;
|
||||
private readonly IMongoDatabase _database;
|
||||
|
||||
public ConstructionFirmMongoDB(string connectionString = "mongodb://localhost:27017", string databaseName = "lab8SUBD")
|
||||
{
|
||||
_client = new MongoClient(connectionString);
|
||||
_database = _client.GetDatabase(databaseName);
|
||||
}
|
||||
|
||||
public IMongoCollection<T> GetCollection<T>(string collectionName)
|
||||
{
|
||||
return _database.GetCollection<T>(collectionName);
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
@ -15,4 +15,10 @@
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ConstructionFirmBusinessLogic\ConstructionFirmBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\ConstructionFirmDataModels\ConstructionFirmDataModels.csproj" />
|
||||
<ProjectReference Include="..\Subd-4\ConstructionFirmContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
104
ConstructionFirmMongoDB/Implements/ClientStorage.cs
Normal file
104
ConstructionFirmMongoDB/Implements/ClientStorage.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using ConstructionFirmMongoDB.Models;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
using Subd_4.ViewModels;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Implements
|
||||
{
|
||||
public class ClientStorage : IClientStorage
|
||||
{
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
context.GetCollection<Client>("Clients")
|
||||
.DeleteMany(Builders<Client>.Filter.Empty);
|
||||
}
|
||||
|
||||
public List<ClientViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Client>("Clients");
|
||||
return buyers.Find(Builders<Client>.Filter.Empty)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Organization)) return new List<ClientViewModel>();
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Client>("Clients");
|
||||
|
||||
var filterBuilder = Builders<Client>.Filter;
|
||||
var filter = filterBuilder.Regex(x => x.Organization, new BsonRegularExpression(model.Organization));
|
||||
return buyers
|
||||
.Find(filter)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var context = new ConstructionFirmMongoDB())
|
||||
{
|
||||
var buyers = context.GetCollection<Client>("Clients");
|
||||
|
||||
var filterBuilder = Builders<Client>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
filter &= filterBuilder.Eq(x => x.Id, model.Id);
|
||||
}
|
||||
|
||||
return buyers.Find(filter)
|
||||
.FirstOrDefault()
|
||||
?.GetViewModel;
|
||||
}
|
||||
}
|
||||
public ClientViewModel? Insert(ClientBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
|
||||
var buyers = context.GetCollection<Client>("Clients");
|
||||
|
||||
model.Id = (int)buyers.CountDocuments(FilterDefinition<Client>.Empty) + 1;
|
||||
|
||||
var client = Client.Create(model);
|
||||
buyers.InsertOne(client);
|
||||
return client.GetViewModel;
|
||||
}
|
||||
public ClientViewModel? Update(ClientBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Client>("Clients");
|
||||
|
||||
var filter = Builders<Client>.Filter.Eq(x => x.Id, model.Id);
|
||||
var buyer = buyers.Find(filter).FirstOrDefault();
|
||||
if (buyer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
buyer.Update(model);
|
||||
buyers.ReplaceOne(filter, buyer);
|
||||
return buyer.GetViewModel;
|
||||
}
|
||||
public ClientViewModel? Delete(ClientBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var categories = context.GetCollection<Client>("Clients");
|
||||
|
||||
var filter = Builders<Client>.Filter.Eq(x => x.Id, model.Id);
|
||||
var category = categories.FindOneAndDelete(filter);
|
||||
return category?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
using ConstructionFirmMongoDB.Models;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
using Subd_4.ViewModels;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Implements
|
||||
{
|
||||
public class ConstructionMaterialStorage : IConstructionMaterialStorage
|
||||
{
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
context.GetCollection<ConstructionMaterial>("ConstructionMaterials")
|
||||
.DeleteMany(Builders<ConstructionMaterial>.Filter.Empty);
|
||||
}
|
||||
|
||||
public List<ConstructionMaterialViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<ConstructionMaterial>("ConstructionMaterials");
|
||||
return buyers.Find(Builders<ConstructionMaterial>.Filter.Empty)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<ConstructionMaterialViewModel> GetFilteredList(ConstructionMaterialSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MaterialName)) return new List<ConstructionMaterialViewModel>();
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<ConstructionMaterial>("ConstructionMaterials");
|
||||
|
||||
var filterBuilder = Builders<ConstructionMaterial>.Filter;
|
||||
var filter = filterBuilder.Regex(x => x.MaterialName, new BsonRegularExpression(model.MaterialName));
|
||||
return buyers
|
||||
.Find(filter)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public ConstructionMaterialViewModel? GetElement(ConstructionMaterialSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var context = new ConstructionFirmMongoDB())
|
||||
{
|
||||
var buyers = context.GetCollection<ConstructionMaterial>("ConstructionMaterials");
|
||||
|
||||
var filterBuilder = Builders<ConstructionMaterial>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
filter &= filterBuilder.Eq(x => x.Id, model.Id);
|
||||
}
|
||||
|
||||
return buyers.Find(filter)
|
||||
.FirstOrDefault()
|
||||
?.GetViewModel;
|
||||
}
|
||||
}
|
||||
public ConstructionMaterialViewModel? Insert(ConstructionMaterialBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
|
||||
var buyers = context.GetCollection<ConstructionMaterial>("ConstructionMaterials");
|
||||
|
||||
model.Id = (int)buyers.CountDocuments(FilterDefinition<ConstructionMaterial>.Empty) + 1;
|
||||
|
||||
var client = ConstructionMaterial.Create(model);
|
||||
buyers.InsertOne(client);
|
||||
return client.GetViewModel;
|
||||
}
|
||||
public ConstructionMaterialViewModel? Update(ConstructionMaterialBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<ConstructionMaterial>("ConstructionMaterials");
|
||||
|
||||
var filter = Builders<ConstructionMaterial>.Filter.Eq(x => x.Id, model.Id);
|
||||
var buyer = buyers.Find(filter).FirstOrDefault();
|
||||
if (buyer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
buyer.Update(model);
|
||||
buyers.ReplaceOne(filter, buyer);
|
||||
return buyer.GetViewModel;
|
||||
}
|
||||
public ConstructionMaterialViewModel? Delete(ConstructionMaterialBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var categories = context.GetCollection<ConstructionMaterial>("ConstructionMaterials");
|
||||
|
||||
var filter = Builders<ConstructionMaterial>.Filter.Eq(x => x.Id, model.Id);
|
||||
var category = categories.FindOneAndDelete(filter);
|
||||
return category?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
104
ConstructionFirmMongoDB/Implements/EmployeeStorage.cs
Normal file
104
ConstructionFirmMongoDB/Implements/EmployeeStorage.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using ConstructionFirmMongoDB.Models;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
using Subd_4.ViewModels;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Implements
|
||||
{
|
||||
public class EmployeeStorage : IEmployeeStorage
|
||||
{
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
context.GetCollection<Employee>("Employees")
|
||||
.DeleteMany(Builders<Employee>.Filter.Empty);
|
||||
}
|
||||
|
||||
public List<EmployeeViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Employee>("Employees");
|
||||
return buyers.Find(Builders<Employee>.Filter.Empty)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<EmployeeViewModel> GetFilteredList(EmployeeSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.FullName)) return new List<EmployeeViewModel>();
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Employee>("Employees");
|
||||
|
||||
var filterBuilder = Builders<Employee>.Filter;
|
||||
var filter = filterBuilder.Regex(x => x.FullName, new BsonRegularExpression(model.FullName));
|
||||
return buyers
|
||||
.Find(filter)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public EmployeeViewModel? GetElement(EmployeeSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var context = new ConstructionFirmMongoDB())
|
||||
{
|
||||
var buyers = context.GetCollection<Employee>("Employees");
|
||||
|
||||
var filterBuilder = Builders<Employee>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
filter &= filterBuilder.Eq(x => x.Id, model.Id);
|
||||
}
|
||||
|
||||
return buyers.Find(filter)
|
||||
.FirstOrDefault()
|
||||
?.GetViewModel;
|
||||
}
|
||||
}
|
||||
public EmployeeViewModel? Insert(EmployeeBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
|
||||
var buyers = context.GetCollection<Employee>("Employees");
|
||||
|
||||
model.Id = (int)buyers.CountDocuments(FilterDefinition<Employee>.Empty) + 1;
|
||||
|
||||
var client = Employee.Create(model);
|
||||
buyers.InsertOne(client);
|
||||
return client.GetViewModel;
|
||||
}
|
||||
public EmployeeViewModel? Update(EmployeeBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Employee>("Employees");
|
||||
|
||||
var filter = Builders<Employee>.Filter.Eq(x => x.Id, model.Id);
|
||||
var buyer = buyers.Find(filter).FirstOrDefault();
|
||||
if (buyer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
buyer.Update(model);
|
||||
buyers.ReplaceOne(filter, buyer);
|
||||
return buyer.GetViewModel;
|
||||
}
|
||||
public EmployeeViewModel? Delete(EmployeeBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var categories = context.GetCollection<Employee>("Employees");
|
||||
|
||||
var filter = Builders<Employee>.Filter.Eq(x => x.Id, model.Id);
|
||||
var category = categories.FindOneAndDelete(filter);
|
||||
return category?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
85
ConstructionFirmMongoDB/Implements/ProjectStorage.cs
Normal file
85
ConstructionFirmMongoDB/Implements/ProjectStorage.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using MongoDB.Driver;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
using Subd_4.ViewModels;
|
||||
using Project = ConstructionFirmMongoDB.Models.Project;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Implements
|
||||
{
|
||||
public class ProjectStorage : IProjectStorage
|
||||
{
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
context.GetCollection<Project>("Projects")
|
||||
.DeleteMany(Builders<Project>.Filter.Empty);
|
||||
}
|
||||
|
||||
public List<ProjectViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var Projects = context.GetCollection<Project>("Projects").Find(Builders<Project>.Filter.Empty).ToList();
|
||||
|
||||
return Projects.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
public List<ProjectViewModel> GetFilteredList(ProjectSearchModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
if (!model.Id.HasValue) return new List<ProjectViewModel>();
|
||||
|
||||
var filterBuilder = Builders<Project>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
filter = filterBuilder.Eq("Id", model.Id);
|
||||
|
||||
var Projects = context.GetCollection<Project>("Projects").Find(filter).ToList();
|
||||
|
||||
return Projects.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ProjectViewModel? GetElement(ProjectSearchModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var Projects = context.GetCollection<Project>("Projects");
|
||||
if (!model.Id.HasValue) return null;
|
||||
return Projects.Find(x => x.Id == model.Id).FirstOrDefault()?.GetViewModel;
|
||||
}
|
||||
public ProjectViewModel? Insert(ProjectBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
|
||||
|
||||
var Projects = context.GetCollection<Project>("Projects");
|
||||
|
||||
model.Id = (int)Projects.CountDocuments(FilterDefinition<Project>.Empty) + 1;
|
||||
|
||||
var newProject = Project.Create(model);
|
||||
|
||||
if (newProject == null) return null;
|
||||
|
||||
|
||||
Projects.InsertOne(newProject);
|
||||
return newProject.GetViewModel;
|
||||
}
|
||||
public ProjectViewModel? Update(ProjectBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var Project = context.GetCollection<Project>("Projects").Find(x => x.Id == model.Id).FirstOrDefault();
|
||||
if (Project == null) return null;
|
||||
Project.Update(model);
|
||||
context.GetCollection<Project>("Projects").ReplaceOne(x => x.Id == model.Id, Project);
|
||||
return Project.GetViewModel;
|
||||
}
|
||||
public ProjectViewModel? Delete(ProjectBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var element = context.GetCollection<Project>("Projects").Find(x => x.Id == model.Id).FirstOrDefault();
|
||||
if (element != null)
|
||||
{
|
||||
context.GetCollection<Project>("Projects").DeleteOne(x => x.Id == model.Id);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
104
ConstructionFirmMongoDB/Implements/SpecialtyStorage.cs
Normal file
104
ConstructionFirmMongoDB/Implements/SpecialtyStorage.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using ConstructionFirmMongoDB.Models;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
using Subd_4.ViewModels;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Implements
|
||||
{
|
||||
public class SpecialtyStorage : ISpecialtyStorage
|
||||
{
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
context.GetCollection<Specialty>("Specialtys")
|
||||
.DeleteMany(Builders<Specialty>.Filter.Empty);
|
||||
}
|
||||
|
||||
public List<SpecialtyViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Specialty>("Specialtys");
|
||||
return buyers.Find(Builders<Specialty>.Filter.Empty)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<SpecialtyViewModel> GetFilteredList(SpecialtySearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.SpecialtyName)) return new List<SpecialtyViewModel>();
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Specialty>("Specialtys");
|
||||
|
||||
var filterBuilder = Builders<Specialty>.Filter;
|
||||
var filter = filterBuilder.Regex(x => x.SpecialtyName, new BsonRegularExpression(model.SpecialtyName));
|
||||
return buyers
|
||||
.Find(filter)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public SpecialtyViewModel? GetElement(SpecialtySearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var context = new ConstructionFirmMongoDB())
|
||||
{
|
||||
var buyers = context.GetCollection<Specialty>("Specialtys");
|
||||
|
||||
var filterBuilder = Builders<Specialty>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
filter &= filterBuilder.Eq(x => x.Id, model.Id);
|
||||
}
|
||||
|
||||
return buyers.Find(filter)
|
||||
.FirstOrDefault()
|
||||
?.GetViewModel;
|
||||
}
|
||||
}
|
||||
public SpecialtyViewModel? Insert(SpecialtyBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
|
||||
var buyers = context.GetCollection<Specialty>("Specialtys");
|
||||
|
||||
model.Id = (int)buyers.CountDocuments(FilterDefinition<Specialty>.Empty) + 1;
|
||||
|
||||
var client = Specialty.Create(model);
|
||||
buyers.InsertOne(client);
|
||||
return client.GetViewModel;
|
||||
}
|
||||
public SpecialtyViewModel? Update(SpecialtyBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Specialty>("Specialtys");
|
||||
|
||||
var filter = Builders<Specialty>.Filter.Eq(x => x.Id, model.Id);
|
||||
var buyer = buyers.Find(filter).FirstOrDefault();
|
||||
if (buyer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
buyer.Update(model);
|
||||
buyers.ReplaceOne(filter, buyer);
|
||||
return buyer.GetViewModel;
|
||||
}
|
||||
public SpecialtyViewModel? Delete(SpecialtyBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var categories = context.GetCollection<Specialty>("Specialtys");
|
||||
|
||||
var filter = Builders<Specialty>.Filter.Eq(x => x.Id, model.Id);
|
||||
var category = categories.FindOneAndDelete(filter);
|
||||
return category?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
104
ConstructionFirmMongoDB/Implements/TeamStorage.cs
Normal file
104
ConstructionFirmMongoDB/Implements/TeamStorage.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using ConstructionFirmMongoDB.Models;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.SearchModels;
|
||||
using Subd_4.StoragesContracts;
|
||||
using Subd_4.ViewModels;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Implements
|
||||
{
|
||||
public class TeamStorage : ITeamStorage
|
||||
{
|
||||
public void ClearEntity()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
context.GetCollection<Team>("Teams")
|
||||
.DeleteMany(Builders<Team>.Filter.Empty);
|
||||
}
|
||||
|
||||
public List<TeamViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Team>("Teams");
|
||||
return buyers.Find(Builders<Team>.Filter.Empty)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<TeamViewModel> GetFilteredList(TeamSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.TeamName)) return new List<TeamViewModel>();
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Team>("Teams");
|
||||
|
||||
var filterBuilder = Builders<Team>.Filter;
|
||||
var filter = filterBuilder.Regex(x => x.TeamName, new BsonRegularExpression(model.TeamName));
|
||||
return buyers
|
||||
.Find(filter)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public TeamViewModel? GetElement(TeamSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var context = new ConstructionFirmMongoDB())
|
||||
{
|
||||
var buyers = context.GetCollection<Team>("Teams");
|
||||
|
||||
var filterBuilder = Builders<Team>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
filter &= filterBuilder.Eq(x => x.Id, model.Id);
|
||||
}
|
||||
|
||||
return buyers.Find(filter)
|
||||
.FirstOrDefault()
|
||||
?.GetViewModel;
|
||||
}
|
||||
}
|
||||
public TeamViewModel? Insert(TeamBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
|
||||
var buyers = context.GetCollection<Team>("Teams");
|
||||
|
||||
model.Id = (int)buyers.CountDocuments(FilterDefinition<Team>.Empty) + 1;
|
||||
|
||||
var client = Team.Create(model);
|
||||
buyers.InsertOne(client);
|
||||
return client.GetViewModel;
|
||||
}
|
||||
public TeamViewModel? Update(TeamBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var buyers = context.GetCollection<Team>("Teams");
|
||||
|
||||
var filter = Builders<Team>.Filter.Eq(x => x.Id, model.Id);
|
||||
var buyer = buyers.Find(filter).FirstOrDefault();
|
||||
if (buyer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
buyer.Update(model);
|
||||
buyers.ReplaceOne(filter, buyer);
|
||||
return buyer.GetViewModel;
|
||||
}
|
||||
public TeamViewModel? Delete(TeamBindingModel model)
|
||||
{
|
||||
using var context = new ConstructionFirmMongoDB();
|
||||
var categories = context.GetCollection<Team>("Teams");
|
||||
|
||||
var filter = Builders<Team>.Filter.Eq(x => x.Id, model.Id);
|
||||
var category = categories.FindOneAndDelete(filter);
|
||||
return category?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
64
ConstructionFirmMongoDB/Models/Client.cs
Normal file
64
ConstructionFirmMongoDB/Models/Client.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using ConstructionFirmDataModels.Models;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Models
|
||||
{
|
||||
public class Client : IClientModel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonElement("_id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string Organization { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string ContractPerson { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
public static Client? Create(ClientBindingModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new Client()
|
||||
{
|
||||
Id = model.Id,
|
||||
Organization = model.Organization,
|
||||
ContractPerson = model.ContractPerson,
|
||||
Phone = model.Phone,
|
||||
Email = model.Email
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ClientBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
Organization = model.Organization;
|
||||
ContractPerson = model.ContractPerson;
|
||||
Phone = model.Phone;
|
||||
Email = model.Email;
|
||||
}
|
||||
|
||||
public ClientViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Organization = Organization,
|
||||
ContractPerson = ContractPerson,
|
||||
Phone = Phone,
|
||||
Email = Email
|
||||
};
|
||||
}
|
||||
}
|
58
ConstructionFirmMongoDB/Models/ConstructionMaterial.cs
Normal file
58
ConstructionFirmMongoDB/Models/ConstructionMaterial.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using ConstructionFirmDataModels.Models;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Models
|
||||
{
|
||||
public class ConstructionMaterial : IConstructionMaterialModel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonElement("_id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string MaterialName { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public int Cost { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public static ConstructionMaterial? Create(ConstructionMaterialBindingModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new ConstructionMaterial()
|
||||
{
|
||||
Id = model.Id,
|
||||
MaterialName = model.MaterialName,
|
||||
Cost = model.Cost,
|
||||
Quantity = model.Quantity
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ConstructionMaterialBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
MaterialName = model.MaterialName;
|
||||
Cost = model.Cost;
|
||||
Quantity = model.Quantity;
|
||||
}
|
||||
|
||||
public ConstructionMaterialViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
MaterialName = MaterialName,
|
||||
Cost = Cost,
|
||||
Quantity = Quantity
|
||||
};
|
||||
}
|
||||
}
|
69
ConstructionFirmMongoDB/Models/Employee.cs
Normal file
69
ConstructionFirmMongoDB/Models/Employee.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using ConstructionFirmDataModels.Models;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Models
|
||||
{
|
||||
public class Employee : IEmployeeModel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonElement("_id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
[BsonIgnoreIfNull]
|
||||
[BsonIgnoreIfDefault]
|
||||
public DateTime HireDate { get; set; }
|
||||
|
||||
public int TeamId { get; set; }
|
||||
|
||||
public int SpecialtyId { get; set; }
|
||||
|
||||
public static Employee? Create(EmployeeBindingModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new Employee()
|
||||
{
|
||||
Id = model.Id,
|
||||
FullName = model.FullName,
|
||||
Phone = model.Phone,
|
||||
HireDate = model.HireDate,
|
||||
TeamId = model.TeamId,
|
||||
SpecialtyId = model.SpecialtyId
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(EmployeeBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
FullName = model.FullName;
|
||||
Phone = model.Phone;
|
||||
HireDate = model.HireDate;
|
||||
TeamId = model.TeamId;
|
||||
SpecialtyId = model.SpecialtyId;
|
||||
}
|
||||
|
||||
public EmployeeViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
FullName = FullName,
|
||||
Phone = Phone,
|
||||
HireDate = HireDate,
|
||||
TeamId = TeamId,
|
||||
SpecialtyId = SpecialtyId
|
||||
};
|
||||
}
|
||||
}
|
116
ConstructionFirmMongoDB/Models/Project.cs
Normal file
116
ConstructionFirmMongoDB/Models/Project.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using ConstructionFirmDataModels.Models;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Models
|
||||
{
|
||||
public class Project : IProjectModel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonElement("_id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string ClientName { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string ObjectType { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string LocationP { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public int Budget { get; set; }
|
||||
|
||||
[BsonIgnoreIfNull]
|
||||
[BsonIgnoreIfDefault]
|
||||
public DateTime DeadLine { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public ConstructionFirmDataModels.Enum.TaskStatus Status { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public double FullPrice { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
[BsonElement("cliend_id")]
|
||||
public int CliendId { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
[BsonElement("employee_id")]
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
[BsonElement("constructionmaterials_ids")]
|
||||
public List<int> ConstructionMaterialIds { get; set; } = new List<int>();
|
||||
|
||||
[BsonRequired]
|
||||
[BsonElement("team_ids")]
|
||||
public List<int> TeamIds { get; set; } = new List<int>();
|
||||
|
||||
[BsonIgnoreIfNull]
|
||||
[BsonIgnoreIfDefault]
|
||||
public virtual Client Client { get; set; }
|
||||
[BsonIgnoreIfNull]
|
||||
[BsonIgnoreIfDefault]
|
||||
public virtual Employee Employee { get; set; }
|
||||
[BsonIgnoreIfNull]
|
||||
[BsonIgnoreIfDefault]
|
||||
public virtual List<ConstructionMaterial> ConstructionMaterials { get; set; }
|
||||
[BsonIgnoreIfNull]
|
||||
[BsonIgnoreIfDefault]
|
||||
public virtual List<Team> Teams { get; set; }
|
||||
|
||||
[BsonIgnore]
|
||||
public Dictionary<int, (IConstructionMaterialModel, int)> ConstructionMaterialProjects { get; set; } = new Dictionary<int, (IConstructionMaterialModel, int)>();
|
||||
|
||||
[BsonIgnore]
|
||||
public Dictionary<int, (ITeamModel, int)> TeamProject { get; set; } = new Dictionary<int, (ITeamModel, int)>();
|
||||
|
||||
|
||||
public static Project Create(ProjectBindingModel model)
|
||||
{
|
||||
return new Project()
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientName = model.ClientName,
|
||||
ObjectType = model.ObjectType,
|
||||
LocationP = model.LocationP,
|
||||
Budget = model.Budget,
|
||||
DeadLine = model.DeadLine,
|
||||
Status = model.Status,
|
||||
CliendId = model.CliendId,
|
||||
EmployeeId = model.EmployeeId,
|
||||
ConstructionMaterialIds = model.ConstructionMaterialIds,
|
||||
TeamIds = model.TeamIds,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ProjectBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
Status = model.Status;
|
||||
}
|
||||
|
||||
public ProjectViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ClientName = ClientName,
|
||||
ObjectType = ObjectType,
|
||||
LocationP = LocationP,
|
||||
Budget = Budget,
|
||||
DeadLine = DeadLine,
|
||||
Status = Status,
|
||||
CliendId = CliendId,
|
||||
EmployeeId = EmployeeId,
|
||||
};
|
||||
}
|
||||
}
|
52
ConstructionFirmMongoDB/Models/Specialty.cs
Normal file
52
ConstructionFirmMongoDB/Models/Specialty.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using ConstructionFirmDataModels.Models;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Models
|
||||
{
|
||||
public class Specialty : ISpecialtyModel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonElement("_id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string SpecialtyName { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public int Salary { get; set; }
|
||||
|
||||
public static Specialty? Create(SpecialtyBindingModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new Specialty()
|
||||
{
|
||||
Id = model.Id,
|
||||
SpecialtyName = model.SpecialtyName,
|
||||
Salary = model.Salary
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(SpecialtyBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
SpecialtyName = model.SpecialtyName;
|
||||
Salary = model.Salary;
|
||||
}
|
||||
|
||||
public SpecialtyViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
SpecialtyName = SpecialtyName,
|
||||
Salary = Salary
|
||||
};
|
||||
}
|
||||
}
|
64
ConstructionFirmMongoDB/Models/Team.cs
Normal file
64
ConstructionFirmMongoDB/Models/Team.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using ConstructionFirmDataModels.Models;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB.Models
|
||||
{
|
||||
public class Team : ITeamModel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonElement("_id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string TeamName { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public string LeaderName { get; set; } = string.Empty;
|
||||
|
||||
[BsonRequired]
|
||||
public int Experince { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public string TeamType { get; set; } = string.Empty;
|
||||
|
||||
public static Team? Create(TeamBindingModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new Team()
|
||||
{
|
||||
Id = model.Id,
|
||||
TeamName = model.TeamName,
|
||||
LeaderName = model.LeaderName,
|
||||
Experince = model.Experince,
|
||||
TeamType = model.TeamType
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(TeamBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
TeamName = model.TeamName;
|
||||
LeaderName = model.LeaderName;
|
||||
Experince = model.Experince;
|
||||
TeamType = model.TeamType;
|
||||
}
|
||||
|
||||
public TeamViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
TeamName = TeamName,
|
||||
LeaderName = LeaderName,
|
||||
Experince = Experince,
|
||||
TeamType = TeamType
|
||||
};
|
||||
}
|
||||
}
|
139
ConstructionFirmMongoDB/PostgresToMongo.cs
Normal file
139
ConstructionFirmMongoDB/PostgresToMongo.cs
Normal file
@ -0,0 +1,139 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using Npgsql;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConstructionFirmMongoDB
|
||||
{
|
||||
public static class PostgresToMongo
|
||||
{
|
||||
public static void Convert()
|
||||
{
|
||||
string postgresConnection = "Host=localhost;Username=postgres;Password=admin;Database=ConstructionFirm_db";
|
||||
using var psqlConn = new NpgsqlConnection(postgresConnection);
|
||||
psqlConn.Open();
|
||||
|
||||
var client = new MongoClient("mongodb://localhost:27017");
|
||||
var database = client.GetDatabase("lab8SUBD");
|
||||
|
||||
var clients = database.GetCollection<BsonDocument>("Clients");
|
||||
var constructionmaterials = database.GetCollection<BsonDocument>("ConstructionMaterials");
|
||||
var employees = database.GetCollection<BsonDocument>("Employees");
|
||||
var projects = database.GetCollection<BsonDocument>("Projects");
|
||||
var specialtys = database.GetCollection<BsonDocument>("Specialtys");
|
||||
var teams = database.GetCollection<BsonDocument>("Teams");
|
||||
|
||||
//Конвертация клиентов
|
||||
|
||||
using var psqlClients = new NpgsqlCommand("SELECT * FROM \"Clients\"", psqlConn);
|
||||
using var readClients = psqlClients.ExecuteReader();
|
||||
|
||||
while (readClients.Read())
|
||||
{
|
||||
var document = new BsonDocument();
|
||||
for (int i = 0; i < readClients.FieldCount; i++)
|
||||
{
|
||||
document.Add(readClients.GetName(i), BsonValue.Create(readClients.GetValue(i)));
|
||||
}
|
||||
clients.InsertOne(document);
|
||||
}
|
||||
readClients.Close();
|
||||
psqlClients.Cancel();
|
||||
|
||||
//Конвертация материалов
|
||||
|
||||
using var psqlConstructionMaterials = new NpgsqlCommand("SELECT * FROM \"ConstructionMaterials\"", psqlConn);
|
||||
using var readConstructionMaterials = psqlConstructionMaterials.ExecuteReader();
|
||||
|
||||
while (readConstructionMaterials.Read())
|
||||
{
|
||||
var document = new BsonDocument();
|
||||
for (int i = 0; i < readConstructionMaterials.FieldCount; i++)
|
||||
{
|
||||
document.Add(readConstructionMaterials.GetName(i), BsonValue.Create(readConstructionMaterials.GetValue(i)));
|
||||
}
|
||||
constructionmaterials.InsertOne(document);
|
||||
}
|
||||
readConstructionMaterials.Close();
|
||||
psqlConstructionMaterials.Cancel();
|
||||
|
||||
//Конвертация работников
|
||||
|
||||
using var psqlEmployees = new NpgsqlCommand("SELECT * FROM \"Employees\"", psqlConn);
|
||||
using var readEmployees = psqlEmployees.ExecuteReader();
|
||||
|
||||
while (readEmployees.Read())
|
||||
{
|
||||
var document = new BsonDocument();
|
||||
for (int i = 0; i < readEmployees.FieldCount; i++)
|
||||
{
|
||||
document.Add(readEmployees.GetName(i), BsonValue.Create(readEmployees.GetValue(i)));
|
||||
}
|
||||
employees.InsertOne(document);
|
||||
}
|
||||
readEmployees.Close();
|
||||
psqlEmployees.Cancel();
|
||||
|
||||
//Конвертация проектов
|
||||
|
||||
using var psqlProjects = new NpgsqlCommand("SELECT * FROM \"Projects\"", psqlConn);
|
||||
using var readProjects = psqlProjects.ExecuteReader();
|
||||
|
||||
while (readProjects.Read())
|
||||
{
|
||||
var document = new BsonDocument();
|
||||
for (int i = 0; i < readProjects.FieldCount; i++)
|
||||
{
|
||||
string fieldName = readProjects.GetName(i);
|
||||
if (fieldName == "CliendId") fieldName = "cliend_id";
|
||||
if (fieldName == "EmployeeId") fieldName = "employee_id";
|
||||
if (fieldName == "ConstructionMaterialIds") fieldName = "constructionmaterials_ids";
|
||||
if (fieldName == "TeamIds") fieldName = "team_ids";
|
||||
document.Add(readProjects.GetName(i), BsonValue.Create(readProjects.GetValue(i)));
|
||||
}
|
||||
projects.InsertOne(document);
|
||||
}
|
||||
readProjects.Close();
|
||||
psqlProjects.Cancel();
|
||||
|
||||
//Конфертация специальностей
|
||||
|
||||
using var psqlSpecialtys = new NpgsqlCommand("SELECT * FROM \"Specialtys\"", psqlConn);
|
||||
using var readSpecialtys = psqlSpecialtys.ExecuteReader();
|
||||
|
||||
while (readSpecialtys.Read())
|
||||
{
|
||||
var document = new BsonDocument();
|
||||
for (int i = 0; i < readSpecialtys.FieldCount; i++)
|
||||
{
|
||||
document.Add(readSpecialtys.GetName(i), BsonValue.Create(readSpecialtys.GetValue(i)));
|
||||
}
|
||||
specialtys.InsertOne(document);
|
||||
}
|
||||
readSpecialtys.Close();
|
||||
psqlSpecialtys.Cancel();
|
||||
|
||||
//Конвертация бригад
|
||||
|
||||
using var psqlTeams = new NpgsqlCommand("SELECT * FROM \"Teams\"", psqlConn);
|
||||
using var readTeams = psqlTeams.ExecuteReader();
|
||||
|
||||
while (readTeams.Read())
|
||||
{
|
||||
var document = new BsonDocument();
|
||||
for (int i = 0; i < readTeams.FieldCount; i++)
|
||||
{
|
||||
document.Add(readTeams.GetName(i), BsonValue.Create(readTeams.GetValue(i)));
|
||||
}
|
||||
teams.InsertOne(document);
|
||||
}
|
||||
readTeams.Close();
|
||||
psqlTeams.Cancel();
|
||||
psqlConn.Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -18,6 +18,8 @@ namespace Subd_4.BindingModels
|
||||
public ConstructionFirmDataModels.Enum.TaskStatus Status { get; set; } = ConstructionFirmDataModels.Enum.TaskStatus.Неизвестен;
|
||||
public int CliendId { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
public List<int> ConstructionMaterialIds { get; set; } = new List<int>();
|
||||
public List<int> TeamIds { get; set; } = new List<int>();
|
||||
public Dictionary<int, (IConstructionMaterialModel, int)> ConstructionMaterialProjects { get; set; } = new();
|
||||
public Dictionary<int, (ITeamModel, int)> TeamProject { get; set; } = new();
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace Subd_4.BusinessLogicContracts
|
||||
bool Create(ConstructionMaterialBindingModel model);
|
||||
bool Update(ConstructionMaterialBindingModel model);
|
||||
bool Delete(ConstructionMaterialBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace Subd_4.BusinessLogicContracts
|
||||
bool Create(EmployeeBindingModel model);
|
||||
bool Update(EmployeeBindingModel model);
|
||||
bool Delete(EmployeeBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,6 @@ namespace Subd_4.BusinessLogicContracts
|
||||
bool TakeProjectInWork(ProjectBindingModel model);
|
||||
bool FinishProject(ProjectBindingModel model);
|
||||
bool DeliveryProject(ProjectBindingModel model);
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace Subd_4.BusinessLogicContracts
|
||||
bool Create(SpecialtyBindingModel model);
|
||||
bool Update(SpecialtyBindingModel model);
|
||||
bool Delete(SpecialtyBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace Subd_4.BusinessLogicContracts
|
||||
bool Create(TeamBindingModel model);
|
||||
bool Update(TeamBindingModel model);
|
||||
bool Delete(TeamBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,6 @@ namespace Subd_4.StoragesContracts
|
||||
ClientViewModel? Update(ClientBindingModel model);
|
||||
|
||||
ClientViewModel? Delete(ClientBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,6 @@ namespace Subd_4.StoragesContracts
|
||||
ConstructionMaterialViewModel? Update(ConstructionMaterialBindingModel model);
|
||||
|
||||
ConstructionMaterialViewModel? Delete(ConstructionMaterialBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,6 @@ namespace Subd_4.StoragesContracts
|
||||
EmployeeViewModel? Update(EmployeeBindingModel model);
|
||||
|
||||
EmployeeViewModel? Delete(EmployeeBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,7 @@ namespace Subd_4.StoragesContracts
|
||||
ProjectViewModel? Update(ProjectBindingModel model);
|
||||
|
||||
ProjectViewModel? Delete(ProjectBindingModel model);
|
||||
}
|
||||
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,6 @@ namespace Subd_4.StoragesContracts
|
||||
SpecialtyViewModel? Update(SpecialtyBindingModel model);
|
||||
|
||||
SpecialtyViewModel? Delete(SpecialtyBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,6 @@ namespace Subd_4.StoragesContracts
|
||||
TeamViewModel? Update(TeamBindingModel model);
|
||||
|
||||
TeamViewModel? Delete(TeamBindingModel model);
|
||||
}
|
||||
void ClearEntity();
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +168,11 @@ namespace viewmodel
|
||||
}
|
||||
try
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
foreach (int id in _projectmaterial.Keys)
|
||||
{
|
||||
ids.Add(id);
|
||||
}
|
||||
var model = new ProjectBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
@ -176,7 +181,9 @@ namespace viewmodel
|
||||
CliendId = comboBoxClient.SelectedIndex + 1,
|
||||
EmployeeId = comboBoxEmployee.SelectedIndex + 1,
|
||||
ConstructionMaterialProjects = _projectmaterial,
|
||||
TeamProject = _projecteam
|
||||
TeamProject = _projecteam,
|
||||
ConstructionMaterialIds = ids,
|
||||
TeamIds = ids
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logicT.Update(model) : _logicT.Create(model);
|
||||
if (!operationResult)
|
||||
|
21
viewmodel/FormMain.Designer.cs
generated
21
viewmodel/FormMain.Designer.cs
generated
@ -40,6 +40,7 @@
|
||||
buttonCreateTask = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
buttonTest = new Button();
|
||||
buttonPsqlToMongo = new Button();
|
||||
menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -63,28 +64,28 @@
|
||||
// buyerToolStripMenuItem
|
||||
//
|
||||
buyerToolStripMenuItem.Name = "buyerToolStripMenuItem";
|
||||
buyerToolStripMenuItem.Size = new Size(180, 22);
|
||||
buyerToolStripMenuItem.Size = new Size(172, 22);
|
||||
buyerToolStripMenuItem.Text = "Клиент";
|
||||
buyerToolStripMenuItem.Click += buyerToolStripMenuItem_Click;
|
||||
//
|
||||
// cookToolStripMenuItem
|
||||
//
|
||||
cookToolStripMenuItem.Name = "cookToolStripMenuItem";
|
||||
cookToolStripMenuItem.Size = new Size(180, 22);
|
||||
cookToolStripMenuItem.Size = new Size(172, 22);
|
||||
cookToolStripMenuItem.Text = "Бригада";
|
||||
cookToolStripMenuItem.Click += cookToolStripMenuItem_Click;
|
||||
//
|
||||
// menuToolStripMenuItem
|
||||
//
|
||||
menuToolStripMenuItem.Name = "menuToolStripMenuItem";
|
||||
menuToolStripMenuItem.Size = new Size(180, 22);
|
||||
menuToolStripMenuItem.Size = new Size(172, 22);
|
||||
menuToolStripMenuItem.Text = "СтройМатериалы";
|
||||
menuToolStripMenuItem.Click += menuToolStripMenuItem_Click;
|
||||
//
|
||||
// placeToolStripMenuItem
|
||||
//
|
||||
placeToolStripMenuItem.Name = "placeToolStripMenuItem";
|
||||
placeToolStripMenuItem.Size = new Size(180, 22);
|
||||
placeToolStripMenuItem.Size = new Size(172, 22);
|
||||
placeToolStripMenuItem.Text = "Управляющий";
|
||||
placeToolStripMenuItem.Click += placeToolStripMenuItem_Click;
|
||||
//
|
||||
@ -152,11 +153,22 @@
|
||||
buttonTest.UseVisualStyleBackColor = true;
|
||||
buttonTest.Click += buttonTest_Click;
|
||||
//
|
||||
// buttonPsqlToMongo
|
||||
//
|
||||
buttonPsqlToMongo.Location = new Point(1075, 310);
|
||||
buttonPsqlToMongo.Name = "buttonPsqlToMongo";
|
||||
buttonPsqlToMongo.Size = new Size(198, 42);
|
||||
buttonPsqlToMongo.TabIndex = 14;
|
||||
buttonPsqlToMongo.Text = "Перенести все данные на MongoDB";
|
||||
buttonPsqlToMongo.UseVisualStyleBackColor = true;
|
||||
buttonPsqlToMongo.Click += buttonPsqlToMongo_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1383, 450);
|
||||
Controls.Add(buttonPsqlToMongo);
|
||||
Controls.Add(buttonTest);
|
||||
Controls.Add(buttonIssuedTask);
|
||||
Controls.Add(buttonTaskReady);
|
||||
@ -189,5 +201,6 @@
|
||||
private Button buttonCreateTask;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonTest;
|
||||
private Button buttonPsqlToMongo;
|
||||
}
|
||||
}
|
@ -1,18 +1,29 @@
|
||||
|
||||
using ConstructionFirmMongoDB;
|
||||
using Subd_4.BindingModels;
|
||||
using Subd_4.BusinessLogicContracts;
|
||||
using Subd_4.SearchModels;
|
||||
|
||||
namespace viewmodel
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly IClientLogic _ClientLogic;
|
||||
private readonly IConstructionMaterialLogic _ConstructionMaterialLogic;
|
||||
private readonly IEmployeeLogic _EmployeeLogic;
|
||||
private readonly ISpecialtyLogic _SpecialtyLogic;
|
||||
private readonly ITeamLogic _TeamLogic;
|
||||
private readonly IProjectLogic _ProjectLogic;
|
||||
|
||||
private readonly IProjectLogic _logic;
|
||||
|
||||
public FormMain(IProjectLogic logic)
|
||||
public FormMain(IClientLogic cLogic, IConstructionMaterialLogic mLogic, IEmployeeLogic elogic, ISpecialtyLogic sLogic, ITeamLogic tLogic, IProjectLogic pLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
_ClientLogic = cLogic;
|
||||
_ConstructionMaterialLogic = mLogic;
|
||||
_EmployeeLogic = elogic;
|
||||
_SpecialtyLogic = sLogic;
|
||||
_TeamLogic = tLogic;
|
||||
_ProjectLogic = pLogic;
|
||||
}
|
||||
|
||||
private void buyerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -58,7 +69,7 @@ namespace viewmodel
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
var _list = _logic.ReadList(null);
|
||||
var _list = _ProjectLogic.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
dataGridView.DataSource = _list;
|
||||
@ -87,7 +98,7 @@ namespace viewmodel
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
try
|
||||
{
|
||||
var operationResult = _logic.TakeProjectInWork(new ProjectBindingModel
|
||||
var operationResult = _ProjectLogic.TakeProjectInWork(new ProjectBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Status = Enum.Parse<ConstructionFirmDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||
@ -112,7 +123,7 @@ namespace viewmodel
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
try
|
||||
{
|
||||
var operationResult = _logic.FinishProject(new ProjectBindingModel
|
||||
var operationResult = _ProjectLogic.FinishProject(new ProjectBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Status = Enum.Parse<ConstructionFirmDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||
@ -137,7 +148,7 @@ namespace viewmodel
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
try
|
||||
{
|
||||
var operationResult = _logic.DeliveryProject(new ProjectBindingModel
|
||||
var operationResult = _ProjectLogic.DeliveryProject(new ProjectBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Status = Enum.Parse<ConstructionFirmDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||
@ -158,20 +169,34 @@ namespace viewmodel
|
||||
private void buttonTest_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//CookBindingModel model = new CookBindingModel()
|
||||
//{
|
||||
// Id = 2,
|
||||
// CookName = "Иван",
|
||||
// CookSurname = "dssfsdfs",
|
||||
// Experience = 2,
|
||||
// PhoneNumber = "+79054324312",
|
||||
// Passport = "123124"
|
||||
//};
|
||||
try
|
||||
{
|
||||
_ClientLogic.ClearEntity();
|
||||
_ConstructionMaterialLogic.ClearEntity();
|
||||
_EmployeeLogic.ClearEntity();
|
||||
_ProjectLogic.ClearEntity();
|
||||
_SpecialtyLogic.ClearEntity();
|
||||
_TeamLogic.ClearEntity();
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
//DateTime start = DateTime.Now;
|
||||
//_CLogic.Delete(model);
|
||||
//DateTime stop = DateTime.Now;
|
||||
//MessageBox.Show((start - stop).ToString(), "Test", MessageBoxButtons.OK);
|
||||
private void buttonPsqlToMongo_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
PostgresToMongo.Convert();
|
||||
DateTime stop = DateTime.Now;
|
||||
LoadData();
|
||||
MessageBox.Show((stop - start).Milliseconds.ToString(), "Test", MessageBoxButtons.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ConstructionFirmBusinessLogic\ConstructionFirmBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\ConstructionFirmDatabaseImplement\ConstructionFirmDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\ConstructionFirmMongoDB\ConstructionFirmMongoDB.csproj" />
|
||||
<ProjectReference Include="..\Subd-4\ConstructionFirmContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user