PIbd-21. Razubaev SM Lab work 6 hard #14

Closed
Sergey wants to merge 5 commits from lab_6_hard into lab_5_hard
13 changed files with 358 additions and 1022 deletions
Showing only changes of commit 6043650fbe - Show all commits

View File

@ -15,16 +15,11 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
private readonly ILogger _logger;
private readonly IOrderStorage _orderStorage;
<<<<<<< HEAD
private readonly IShopStorage _shopStorage;
private readonly IWorkStorage _workStorage;
private readonly IShopLogic _shopLogic;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IWorkStorage workStorage, IShopLogic shopLogic)
=======
private readonly object _locker =new();
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
>>>>>>> lab_6
static readonly object _locker = new object();
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IWorkStorage workStorage, IShopLogic shopLogic)
{
_logger = logger;
_orderStorage = orderStorage;
@ -105,46 +100,38 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
_logger.LogWarning("Find order failed");
return false;
}
<<<<<<< HEAD
if (newStatus == OrderStatus.Выдан)
{
var work = _workStorage.GetElement(new WorkSearchModel() { Id = viewModel.WorkId});
if (work == null)
{
_logger.LogWarning("Change status operation failed.Work not found");
return false;
}
if (!_shopLogic.CheckAndSupply(work, viewModel.Count))
{
_logger.LogWarning("Change status operation failed. Works delivery operation failed");
return false;
}
}
model.Status = newStatus;
if (model.Status == OrderStatus.Готов)
{
model.DateImplement = DateTime.Now;
}
else
{
model.DateImplement = viewModel.DateImplement;
}
CheckModel(model, false);
if (_orderStorage.Update(model) == null)
{
_logger.LogWarning("Change status operation failed");
return false;
}
=======
if (viewModel.Status != newStatus - 1)
if (viewModel.Status != newStatus - 1 && viewModel.Status != OrderStatus.Ожидание)
{
_logger.LogWarning("Status change failed");
throw new InvalidOperationException("Невозможно перевести состояние заказа");
}
model.Status = newStatus;
if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now;
_orderStorage.Update(model);
>>>>>>> lab_6
if (viewModel.ImplementerId != null)
viewModel.ImplementerId = model.ImplementerId;
model.Status = newStatus;
if (model.WorkId == 0)
model.WorkId = viewModel.WorkId;
if (model.Count == 0)
model.Count = viewModel.Count;
if (newStatus == OrderStatus.Готов)
{
var work = _workStorage.GetElement(new WorkSearchModel { Id = model.WorkId });
if (work == null)
{
_logger.LogWarning("Status change operation failed. Work not found.");
return false;
}
if (!_shopLogic.CheckAndSupply(work, model.Count))
{
_logger.LogWarning("Status change operation failed. Shop supply error.");
model.Status = OrderStatus.Ожидание;
if (_orderStorage.Update(model) == null)
_logger.LogWarning("Update operation failed");
return false;
}
}
_orderStorage.Update(model);
return true;
}
private void CheckModel(OrderBindingModel model, bool withParams = true)

View File

@ -32,9 +32,16 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
return;
}
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят });
if (orders == null || orders.Count == 0)
if (orders == null)
{
_logger.LogWarning("DoWork. Orders is null");
return;
}
orders.AddRange(_orderLogic.ReadList(new() { Status = OrderStatus.Выполняется }) ?? new());
orders.AddRange(_orderLogic.ReadList(new() { Status = OrderStatus.Ожидание }) ?? new());
if (orders.Count == 0)
{
_logger.LogWarning("DoWork. Orders is null or empty");
_logger.LogWarning("DoWork. Orders is empty");
return;
}
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
@ -55,7 +62,8 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
{
return;
}
await RunOrderInWork(implementer);
await RunWaitingOrder(implementer);
await RunOrderInWork(implementer);
await Task.Run(() =>
{
@ -75,8 +83,9 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
_orderLogic.FinishOrder(new OrderBindingModel
{
Id = order.Id
});
Id = order.Id,
ImplementerId = implementer.Id
});
// отдыхаем
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
}
@ -127,8 +136,10 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
{
Id = runOrder.Id
});
// отдыхаем
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
_logger.LogDebug("DoWork. Worker {Id} delivery order {Order}", implementer.Id, runOrder.Id);
_orderLogic.DeliveryOrder(new() { Id = runOrder.Id });
// отдыхаем
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
}
// заказа может не быть, просто игнорируем ошибку
catch (InvalidOperationException ex)
@ -142,5 +153,39 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
throw;
}
}
}
private async Task RunWaitingOrder(ImplementerViewModel implementer)
{
if (_orderLogic == null || implementer == null)
{
return;
}
try
{
var order = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
Review

Почему только один заказ может быть в статусе ожидания?

Почему только один заказ может быть в статусе ожидания?
{
ImplementerId = implementer.Id,
Status = OrderStatus.Ожидание
}));
if (order == null)
{
return;
}
_logger.LogDebug("DoWork. Worker {Id} delivery order {Order}", implementer.Id, order.Id);
_orderLogic.DeliveryOrder(new OrderBindingModel
{
Id = order.Id
});
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
}
catch (InvalidOperationException ex)
{
_logger.LogWarning(ex, "Error try get work");
}
catch (Exception ex)
{
_logger.LogError(ex, "Error while do work");
throw;
}
}
}
}

View File

@ -10,6 +10,8 @@
Готов = 2,
Выдан = 3
Выдан = 3,
Ожидание = 4
}
}

View File

@ -55,10 +55,14 @@ namespace PlumbingRepairDatabaseImplement.Implements
}
if (model.Status.HasValue)
{
return context.Orders
.Where(x => x.ImplementerId == model.ImplementerId && x.Status == model.Status)
.Select(x => AttachNames(x.GetViewModel)).ToList();
}
return context.Orders.
Include(x => x.Work)
.Include(x => x.Client)
.Include(x => x.Implementer)
.Where(x => x.Status.Equals(model.Status))
.Select(x => x.GetViewModel)
.ToList();
}
if (model.ClientId.HasValue)
{
return context.Orders

View File

@ -1,338 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PlumbingRepairDatabaseImplement;
#nullable disable
namespace PlumbingRepairDatabaseImplement.Migrations
{
[DbContext(typeof(PlumbingRepairDatabase))]
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
[Migration("20240501122640_InitCreate")]
========
[Migration("20240418172421_InitCreate")]
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
partial class InitCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.27")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ComponentName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Cost")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.Property<int>("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("WorkId");
b.ToTable("Orders");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpening")
.HasColumnType("datetime2");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("maxCountWorks")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.ShopWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ShopId")
.HasColumnType("int");
b.Property<int>("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ShopId");
b.HasIndex("WorkId");
b.ToTable("ShopWorks");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<double>("Price")
.HasColumnType("float");
b.Property<string>("WorkName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Works");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.WorkComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("ComponentId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("WorkId");
b.ToTable("WorkComponents");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
{
b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PlumbingRepairDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
.WithMany("Orders")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Work");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.ShopWork", b =>
{
b.HasOne("PlumbingRepairDatabaseImplement.Models.Shop", "Shop")
.WithMany("Works")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
.WithMany()
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Shop");
b.Navigation("Work");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.WorkComponent", b =>
{
b.HasOne("PlumbingRepairDatabaseImplement.Models.Component", "Component")
.WithMany("WorkComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
.WithMany("Components")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Work");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Component", b =>
{
b.Navigation("WorkComponents");
});
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Works");
========
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,241 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PlumbingRepairDatabaseImplement.Migrations
{
public partial class InitCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Components",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Cost = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Components", x => x.Id);
});
migrationBuilder.CreateTable(
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
name: "Shops",
========
name: "Implementers",
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
maxCountWorks = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
========
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
WorkExperience = table.Column<int>(type: "int", nullable: false),
Qualification = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Implementers", x => x.Id);
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
});
migrationBuilder.CreateTable(
name: "Works",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Works", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkId = table.Column<int>(type: "int", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: false),
ImplementerId = table.Column<int>(type: "int", nullable: true),
Count = table.Column<int>(type: "int", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.Id);
table.ForeignKey(
name: "FK_Orders_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
column: x => x.ImplementerId,
principalTable: "Implementers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Orders_Works_WorkId",
column: x => x.WorkId,
principalTable: "Works",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ShopWorks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkId = table.Column<int>(type: "int", nullable: false),
ShopId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ShopWorks", x => x.Id);
table.ForeignKey(
name: "FK_ShopWorks_Shops_ShopId",
column: x => x.ShopId,
principalTable: "Shops",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ShopWorks_Works_WorkId",
column: x => x.WorkId,
principalTable: "Works",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "WorkComponents",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkId = table.Column<int>(type: "int", nullable: false),
ComponentId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WorkComponents", x => x.Id);
table.ForeignKey(
name: "FK_WorkComponents_Components_ComponentId",
column: x => x.ComponentId,
principalTable: "Components",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_WorkComponents_Works_WorkId",
column: x => x.WorkId,
principalTable: "Works",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ImplementerId",
table: "Orders",
column: "ImplementerId");
migrationBuilder.CreateIndex(
name: "IX_Orders_WorkId",
table: "Orders",
column: "WorkId");
migrationBuilder.CreateIndex(
name: "IX_ShopWorks_ShopId",
table: "ShopWorks",
column: "ShopId");
migrationBuilder.CreateIndex(
name: "IX_ShopWorks_WorkId",
table: "ShopWorks",
column: "WorkId");
migrationBuilder.CreateIndex(
name: "IX_WorkComponents_ComponentId",
table: "WorkComponents",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_WorkComponents_WorkId",
table: "WorkComponents",
column: "WorkId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Orders");
migrationBuilder.DropTable(
name: "ShopWorks");
migrationBuilder.DropTable(
name: "WorkComponents");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
name: "Shops");
========
name: "Implementers");
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
migrationBuilder.DropTable(
name: "Components");
migrationBuilder.DropTable(
name: "Works");
}
}
}

View File

@ -12,12 +12,8 @@ using PlumbingRepairDatabaseImplement;
namespace PlumbingRepairDatabaseImplement.Migrations
{
[DbContext(typeof(PlumbingRepairDatabase))]
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
[Migration("20240501122640_InitCreate")]
========
[Migration("20240418172421_InitCreate")]
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
partial class InitCreate
[Migration("20240503121400_initCreate")]
partial class initCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -315,15 +311,14 @@ namespace PlumbingRepairDatabaseImplement.Migrations
b.Navigation("WorkComponents");
});
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Works");
========
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Works");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>

View File

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace PlumbingRepairDatabaseImplement.Migrations
{
public partial class InitCreate : Migration
public partial class initCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -39,25 +39,11 @@ namespace PlumbingRepairDatabaseImplement.Migrations
});
migrationBuilder.CreateTable(
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
name: "Shops",
========
name: "Implementers",
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
maxCountWorks = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
========
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
WorkExperience = table.Column<int>(type: "int", nullable: false),
@ -66,7 +52,22 @@ namespace PlumbingRepairDatabaseImplement.Migrations
constraints: table =>
{
table.PrimaryKey("PK_Implementers", x => x.Id);
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
});
migrationBuilder.CreateTable(
name: "Shops",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
maxCountWorks = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
});
migrationBuilder.CreateTable(
@ -225,11 +226,10 @@ namespace PlumbingRepairDatabaseImplement.Migrations
name: "Clients");
migrationBuilder.DropTable(
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
name: "Shops");
========
name: "Implementers");
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
migrationBuilder.DropTable(
name: "Shops");
migrationBuilder.DropTable(
name: "Components");

View File

@ -309,15 +309,14 @@ namespace PlumbingRepairDatabaseImplement.Migrations
b.Navigation("WorkComponents");
});
<<<<<<< HEAD
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Works");
=======
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
>>>>>>> lab_6
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Works");
});
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>

View File

@ -13,20 +13,14 @@ builder.Logging.AddLog4Net("log4net.config");
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IWorkStorage, WorkStorage>();
<<<<<<< HEAD
builder.Services.AddTransient<IShopStorage, ShopStorage>();
=======
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
>>>>>>> lab_6
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IWorkLogic, WorkLogic>();
<<<<<<< HEAD
builder.Services.AddTransient<IShopLogic, ShopLogic>();
=======
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
>>>>>>> lab_6
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle

View File

@ -28,274 +28,242 @@
/// </summary>
private void InitializeComponent()
{
this.buttonRef = new System.Windows.Forms.Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.РаботыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
<<<<<<< HEAD
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.пToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.продажаРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
=======
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.исполнителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
>>>>>>> lab_6
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыПоРаботамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
<<<<<<< HEAD
this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.работыПоМагазинамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокВсехЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
=======
this.выполнениеРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
>>>>>>> lab_6
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// buttonRef
//
this.buttonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRef.Location = new System.Drawing.Point(1284, 219);
this.buttonRef.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.buttonRef.Name = "buttonRef";
this.buttonRef.Size = new System.Drawing.Size(249, 45);
this.buttonRef.TabIndex = 11;
this.buttonRef.Text = "Обновить список";
this.buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// buttonIssuedOrder
//
this.buttonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonIssuedOrder.Location = new System.Drawing.Point(1284, 143);
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
this.buttonIssuedOrder.Size = new System.Drawing.Size(249, 45);
this.buttonIssuedOrder.TabIndex = 10;
this.buttonIssuedOrder.Text = "Заказ выдан";
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
//
// buttonCreateOrder
//
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCreateOrder.Location = new System.Drawing.Point(1284, 83);
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(249, 45);
this.buttonCreateOrder.TabIndex = 7;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
//
// dataGridView
//
this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.buttonRef = new System.Windows.Forms.Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.РаботыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.пToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.продажаРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыПоРаботамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.работыПоМагазинамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокВсехЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.выполнениеРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.исполнителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// buttonRef
//
this.buttonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRef.Location = new System.Drawing.Point(1113, 227);
this.buttonRef.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.buttonRef.Name = "buttonRef";
this.buttonRef.Size = new System.Drawing.Size(249, 45);
this.buttonRef.TabIndex = 11;
this.buttonRef.Text = "Обновить список";
this.buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// buttonIssuedOrder
//
this.buttonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonIssuedOrder.Location = new System.Drawing.Point(1113, 151);
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
this.buttonIssuedOrder.Size = new System.Drawing.Size(249, 45);
this.buttonIssuedOrder.TabIndex = 10;
this.buttonIssuedOrder.Text = "Заказ выдан";
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
//
// buttonCreateOrder
//
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCreateOrder.Location = new System.Drawing.Point(1113, 83);
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(249, 45);
this.buttonCreateOrder.TabIndex = 7;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
//
// dataGridView
//
this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(2, 44);
this.dataGridView.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.dataGridView.MultiSelect = false;
this.dataGridView.Name = "dataGridView";
this.dataGridView.ReadOnly = true;
this.dataGridView.RowHeadersVisible = false;
this.dataGridView.RowHeadersWidth = 62;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(1226, 533);
this.dataGridView.TabIndex = 6;
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(2, 44);
this.dataGridView.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.dataGridView.MultiSelect = false;
this.dataGridView.Name = "dataGridView";
this.dataGridView.ReadOnly = true;
this.dataGridView.RowHeadersVisible = false;
this.dataGridView.RowHeadersWidth = 62;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(1055, 533);
this.dataGridView.TabIndex = 6;
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem,
this.отчетыToolStripMenuItem,
this.выполнениеРаботToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1548, 33);
this.menuStrip1.TabIndex = 12;
this.menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1377, 33);
this.menuStrip1.TabIndex = 12;
this.menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.компонентыToolStripMenuItem,
this.РаботыToolStripMenuItem,
<<<<<<< HEAD
this.магазиныToolStripMenuItem,
this.пToolStripMenuItem,
this.продажаРаботToolStripMenuItem,
this.клиентыToolStripMenuItem});
=======
this.клиентыToolStripMenuItem,
this.исполнителиToolStripMenuItem});
>>>>>>> lab_6
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29);
this.справочникиToolStripMenuItem.Text = "Справочники";
//
// компонентыToolStripMenuItem
//
this.компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
<<<<<<< HEAD
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
=======
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
>>>>>>> lab_6
this.компонентыToolStripMenuItem.Text = "Компоненты";
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
//
// РаботыToolStripMenuItem
//
this.РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem";
<<<<<<< HEAD
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.РаботыToolStripMenuItem.Text = "Работы";
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
//
// магазиныToolStripMenuItem
//
this.магазиныToolStripMenuItem.Name = агазиныToolStripMenuItem";
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.магазиныToolStripMenuItem.Text = "Магазины";
this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.магазиныToolStripMenuItem_Click);
//
// пToolStripMenuItem
//
this.пToolStripMenuItem.Name = "пToolStripMenuItem";
this.пToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.пToolStripMenuItem.Text = "Пополнение магазина";
this.пToolStripMenuItem.Click += new System.EventHandler(this.пополнениеToolStripMenuItem_Click);
//
// продажаРаботToolStripMenuItem
//
this.продажаРаботToolStripMenuItem.Name = "продажаРаботToolStripMenuItem";
this.продажаРаботToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.продажаРаботToolStripMenuItem.Text = "Продажа работ";
this.продажаРаботToolStripMenuItem.Click += new System.EventHandler(this.продажаРаботToolStripMenuItem_Click);
=======
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
this.РаботыToolStripMenuItem.Text = "Работы";
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
//
// клиентыToolStripMenuItem
//
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
//
// исполнителиToolStripMenuItem
//
this.исполнителиToolStripMenuItem.Name = сполнителиToolStripMenuItem";
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
this.исполнителиToolStripMenuItem.Text = "Исполнители";
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
>>>>>>> lab_6
//
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29);
this.справочникиToolStripMenuItem.Text = "Справочники";
//
// компонентыToolStripMenuItem
//
this.компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.компонентыToolStripMenuItem.Text = "Компоненты";
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
//
// РаботыToolStripMenuItem
//
this.РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem";
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.РаботыToolStripMenuItem.Text = "Работы";
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
//
// магазиныToolStripMenuItem
//
this.магазиныToolStripMenuItem.Name = агазиныToolStripMenuItem";
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.магазиныToolStripMenuItem.Text = "Магазины";
this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.магазиныToolStripMenuItem_Click);
//
// пToolStripMenuItem
//
this.пToolStripMenuItem.Name = "пToolStripMenuItem";
this.пToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.пToolStripMenuItem.Text = "Пополнение магазина";
this.пToolStripMenuItem.Click += new System.EventHandler(this.пополнениеToolStripMenuItem_Click);
//
// продажаРаботToolStripMenuItem
//
this.продажаРаботToolStripMenuItem.Name = "продажаРаботToolStripMenuItem";
this.продажаРаботToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.продажаРаботToolStripMenuItem.Text = "Продажа работ";
this.продажаРаботToolStripMenuItem.Click += new System.EventHandler(this.продажаРаботToolStripMenuItem_Click);
//
// клиентыToolStripMenuItem
//
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
//
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокКомпонентовToolStripMenuItem,
this.компонентыПоРаботамToolStripMenuItem,
this.списокЗаказовToolStripMenuItem,
this.списокМагазиновToolStripMenuItem,
this.работыПоМагазинамToolStripMenuItem,
this.списокВсехЗаказовToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(88, 29);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокКомпонентовToolStripMenuItem
//
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.списокКомпонентовToolStripMenuItem_Click);
//
// компонентыПоРаботамToolStripMenuItem
//
this.компонентыПоРаботамToolStripMenuItem.Name = омпонентыПоРаботамToolStripMenuItem";
this.компонентыПоРаботамToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.компонентыПоРаботамToolStripMenuItem.Text = "Компоненты по работам";
<<<<<<< HEAD
=======
this.компонентыПоРаботамToolStripMenuItem.Click += new System.EventHandler(this.ComponentWorksToolStripMenuItem_Click);
>>>>>>> lab_6
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
//
// списокМагазиновToolStripMenuItem
//
this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.ShopsToolStripMenuItem_Click);
//
// работыПоМагазинамToolStripMenuItem
//
this.работыПоМагазинамToolStripMenuItem.Name = "работыПоМагазинамToolStripMenuItem";
this.работыПоМагазинамToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.работыПоМагазинамToolStripMenuItem.Text = "Работы по магазинам";
this.работыПоМагазинамToolStripMenuItem.Click += new System.EventHandler(this.ShopWorksToolStripMenuItem_Click);
//
// списокВсехЗаказовToolStripMenuItem
//
this.списокВсехЗаказовToolStripMenuItem.Name = "списокВсехЗаказовToolStripMenuItem";
this.списокВсехЗаказовToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокВсехЗаказовToolStripMenuItem.Text = "Список всех заказов";
this.списокВсехЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersByDateToolStripMenuItem_Click);
//
// выполнениеРаботToolStripMenuItem
//
<<<<<<< HEAD
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
=======
this.выполнениеРаботToolStripMenuItem.Name = "выполнениеРаботToolStripMenuItem";
this.выполнениеРаботToolStripMenuItem.Size = new System.Drawing.Size(136, 29);
this.выполнениеРаботToolStripMenuItem.Text = "Запуск работ";
this.выполнениеРаботToolStripMenuItem.Click += new System.EventHandler(this.ЗапускРаботToolStripMenuItem_Click);
>>>>>>> lab_6
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1548, 602);
this.Controls.Add(this.buttonRef);
this.Controls.Add(this.buttonIssuedOrder);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMain";
this.Text = "Ремонт труб";
this.Load += new System.EventHandler(this.FormMain_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(88, 29);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокКомпонентовToolStripMenuItem
//
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.списокКомпонентовToolStripMenuItem_Click);
//
// компонентыПоРаботамToolStripMenuItem
//
this.компонентыПоРаботамToolStripMenuItem.Name = омпонентыПоРаботамToolStripMenuItem";
this.компонентыПоРаботамToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.компонентыПоРаботамToolStripMenuItem.Text = "Компоненты по работам";
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
//
// списокМагазиновToolStripMenuItem
//
this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.ShopsToolStripMenuItem_Click);
//
// работыПоМагазинамToolStripMenuItem
//
this.работыПоМагазинамToolStripMenuItem.Name = "работыПоМагазинамToolStripMenuItem";
this.работыПоМагазинамToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.работыПоМагазинамToolStripMenuItem.Text = "Работы по магазинам";
this.работыПоМагазинамToolStripMenuItem.Click += new System.EventHandler(this.ShopWorksToolStripMenuItem_Click);
//
// списокВсехЗаказовToolStripMenuItem
//
this.списокВсехЗаказовToolStripMenuItem.Name = "списокВсехЗаказовToolStripMenuItem";
this.списокВсехЗаказовToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
this.списокВсехЗаказовToolStripMenuItem.Text = "Список всех заказов";
this.списокВсехЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersByDateToolStripMenuItem_Click);
//
// выполнениеРаботToolStripMenuItem
//
this.выполнениеРаботToolStripMenuItem.Name = "выполнениеРаботToolStripMenuItem";
this.выполнениеРаботToolStripMenuItem.Size = new System.Drawing.Size(136, 29);
this.выполнениеРаботToolStripMenuItem.Text = "Запуск работ";
this.выполнениеРаботToolStripMenuItem.Click += new System.EventHandler(this.выполнениеРаботToolStripMenuItem_Click);
//
// исполнителиToolStripMenuItem
//
this.исполнителиToolStripMenuItem.Name = сполнителиToolStripMenuItem";
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
this.исполнителиToolStripMenuItem.Text = "Исполнители";
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1377, 602);
this.Controls.Add(this.buttonRef);
this.Controls.Add(this.buttonIssuedOrder);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMain";
this.Text = "Ремонт труб";
this.Load += new System.EventHandler(this.FormMain_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -321,6 +289,6 @@
private ToolStripMenuItem списокВсехЗаказовToolStripMenuItem;
private ToolStripMenuItem клиентыToolStripMenuItem;
private ToolStripMenuItem выполнениеРаботToolStripMenuItem;
private ToolStripMenuItem исполнителиToolStripMenuItem;
}
private ToolStripMenuItem исполнителиToolStripMenuItem;
}
}

View File

@ -11,11 +11,7 @@ namespace PlumbingRepairView
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
<<<<<<< HEAD
=======
private readonly IWorkProcess _workProcess;
>>>>>>> lab_6
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
{
InitializeComponent();
@ -39,11 +35,6 @@ namespace PlumbingRepairView
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
<<<<<<< HEAD
=======
dataGridView.Columns["WorkId"].Visible = false;
>>>>>>> lab_6
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["ImplementerId"].Visible = false;
}
_logger.LogInformation("Загрузка заказов");
@ -73,7 +64,6 @@ namespace PlumbingRepairView
form.ShowDialog();
}
}
<<<<<<< HEAD
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
@ -101,72 +91,6 @@ namespace PlumbingRepairView
}
}
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
try
{
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка передачи заказа в работу");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
=======
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
private void ComponentWorksToolStripMenuItem_Click(object sender,
EventArgs e)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormReportWorkComponents));
if (service is FormReportWorkComponents form)
{
form.ShowDialog();
}
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
>>>>>>> lab_6
}
}
private void ButtonCreateOrder_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
if (service is FormCreateOrder form)
{
form.ShowDialog();
LoadData();
}
}
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
{
@ -285,21 +209,21 @@ e)
}
}
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
if (service is FormImplementers form)
{
form.ShowDialog();
}
}
private void ЗапускРаботToolStripMenuItem_Click(object sender, EventArgs
e)
private void выполнениеРаботToolStripMenuItem_Click(object sender, EventArgs e)
{
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
MessageBox.Show("Процесс обработки запущен", "Сообщение",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormImplementers));
if (service is FormImplementers form)
{
form.ShowDialog();
}
}
}
}

View File

@ -70,15 +70,12 @@ namespace PlumbingRepairView
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormWorkComponent>();
<<<<<<< HEAD
services.AddTransient<FormStoreReplenishment>();
services.AddTransient<FormSellWorks>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportOrdersByDate>();
services.AddTransient<FormReportWorkComponents>();
services.AddTransient<FormReportShopWorks>();
=======
>>>>>>> lab_6
services.AddTransient<FormClients>();
services.AddTransient<FormImplementer>();
services.AddTransient<FormImplementers>();