PIbd-21 Lab6 KozyrevSS SewingDresses #19

Closed
Serxionaft wants to merge 10 commits from Lab6 into Lab5Magic
19 changed files with 1272 additions and 118 deletions
Showing only changes of commit 8fbd671942 - Show all commits

View File

@ -73,5 +73,38 @@ namespace SewingDressesBusinessLogic.BusinessLogic
throw new InvalidOperationException("Исполнитель с этим именем уже существует");
}
}
public bool Create(ImplementBindingModel model)
{
CheckModel(model);
_logger.LogInformation("Insert Imlement");
if (_storage.Insert(model) == null)
{
_logger.LogWarning("Insert Error");
return false;
}
return true;
}
public bool Delete(ImplementBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete Implement Id:{Id}", model.Id);
if (_storage.Delete(model) == null)
{
_logger.LogWarning("Delete Error");
return false;
}
return true;
}
public bool Update(ImplementBindingModel model)
{
CheckModel(model);
_logger.LogInformation("Update Implement Id:{Id}", model.Id);
if (_storage.Update(model) == null)
{
_logger.LogWarning("Update Error");
return false;
}
return true;
}
}
}

View File

@ -34,7 +34,7 @@ namespace SewingDressesBusinessLogic.BusinessLogic
}
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
foreach (var implementer in implementers) {
//Task.Run(() => Worker);
Task.Run(() => WorkerWorkAsync(implementer, orders));
}
}
@ -42,7 +42,38 @@ namespace SewingDressesBusinessLogic.BusinessLogic
{
if (_orderLogic == null || implement == null)
return;
//await RunOr
await RunOrderInWork(implement);
await Task.Run(() =>
{
foreach (var order in orders)
{
try
{
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", implement.Id, order.Id);
_orderLogic.TakeOrderInWork(new OrderBindingModel
{
Id = order.Id,
ImplementId = implement.Id
});
Thread.Sleep(implement.WorkExperience * _rnd.Next(100, 1000) * order.Count);
_logger.LogDebug("DoWork. Worker {Id} finish order { Order}", implement.Id, order.Id);
_orderLogic.FinishOrder(new OrderBindingModel
{
Id = order.Id
});
}
catch (InvalidOperationException ex)
{
_logger.LogWarning(ex, "Error try get work");
}
catch (Exception ex)
{
_logger.LogError(ex, "Error while do work");
throw;
}
Thread.Sleep(implement.Qualification * _rnd.Next(10, 100));
}
});
}
private async Task RunOrderInWork(ImplementViewModel implement)

View File

@ -43,57 +43,42 @@ namespace SewingDressesDatabaseImplement.Implements
}
public OrderViewModel? Insert(OrderBindingModel model)
{
var order = Order.Create(model);
using var context = new SewingDressesDatabase();
var order = Order.Create(model, context);
if (order == null)
{
return null;
}
using var context = new SewingDressesDatabase();
context.Orders.Add(order);
context.SaveChanges();
return AcessDressesStorage(order.GetViewModel, context);
return order.GetViewModel;
}
public OrderViewModel? Update(OrderBindingModel model)
{
using var context = new SewingDressesDatabase();
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
var order = context.Orders.Include(x => x.Dress).Include(x => x.Client).Include(x => x.Implement).FirstOrDefault(x => x.Id == model.Id);
if (order == null)
{
return null;
}
order.Update(model);
context.SaveChanges();
return AcessDressesStorage(order.GetViewModel, context);
return order.GetViewModel;
}
public OrderViewModel? Delete(OrderBindingModel model)
{
using var context = new SewingDressesDatabase();
var element = context.Orders.FirstOrDefault(x => x.Id == model.Id);
var element = context.Orders.Include(x => x.Dress).Include(x => x.Client).Include(x => x.Implement).FirstOrDefault(x => x.Id == model.Id);
if (element == null)
{
return null;
}
context.Orders.Remove(element);
context.SaveChanges();
return AcessDressesStorage(element.GetViewModel, context);
}
public static OrderViewModel? AcessDressesStorage(OrderViewModel? model, SewingDressesDatabase context)
{
if (model == null)
{
return null;
}
var dress = context.Dresses.FirstOrDefault(x => x.Id == model.DressId);
var client = context.Clients.FirstOrDefault(x => x.Id == model.ClientId);
if (client == null || dress == null)
return null;
model.DressName = dress.DressName;
model.ClientFIO = client.ClientFIO;
model.ClientId = client.Id;
return model;
return element.GetViewModel;
}
}

View File

@ -0,0 +1,257 @@
// <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 SewingDressesDatabaseImplement;
#nullable disable
namespace SewingDressesDatabaseImplement.Migrations
{
[DbContext(typeof(SewingDressesDatabase))]
[Migration("20240418182438_nullab")]
partial class nullab
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
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("SewingDressesDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Cost")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Dress", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("DressName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Dresses");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.DressComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("DressId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("DressId");
b.ToTable("DressComponents");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementFIO")
.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("Implements");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
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>("DressId")
.HasColumnType("int");
b.Property<int?>("ImplementId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("DressId");
b.HasIndex("ImplementId");
b.ToTable("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.DressComponent", b =>
{
b.HasOne("SewingDressesDatabaseImplement.Models.Component", "Component")
.WithMany("DressComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SewingDressesDatabaseImplement.Models.Dress", "Dress")
.WithMany("Components")
.HasForeignKey("DressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Dress");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Order", b =>
{
b.HasOne("SewingDressesDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SewingDressesDatabaseImplement.Models.Dress", "Dress")
.WithMany("Orders")
.HasForeignKey("DressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SewingDressesDatabaseImplement.Models.Implement", "Implement")
.WithMany("Orders")
.HasForeignKey("ImplementId");
b.Navigation("Client");
b.Navigation("Dress");
b.Navigation("Implement");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Component", b =>
{
b.Navigation("DressComponents");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Dress", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b =>
{
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SewingDressesDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class nullab : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders");
migrationBuilder.AlterColumn<int>(
name: "ImplementId",
table: "Orders",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders",
column: "ImplementId",
principalTable: "Implements",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders");
migrationBuilder.AlterColumn<int>(
name: "ImplementId",
table: "Orders",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders",
column: "ImplementId",
principalTable: "Implements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -164,7 +164,6 @@ namespace SewingDressesDatabaseImplement.Migrations
.HasColumnType("int");
b.Property<int?>("ImplementId")
.IsRequired()
.HasColumnType("int");
b.Property<int>("Status")
@ -219,9 +218,7 @@ namespace SewingDressesDatabaseImplement.Migrations
b.HasOne("SewingDressesDatabaseImplement.Models.Implement", "Implement")
.WithMany("Orders")
.HasForeignKey("ImplementId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("ImplementId");
b.Navigation("Client");

View File

@ -14,7 +14,6 @@ namespace SewingDressesDatabaseImplement.Models
public int DressId { get; private set; }
[Required]
public int ClientId { get; private set; }
[Required]
public int? ImplementId { get; private set; }
[Required]
public int Count { get; private set; }
@ -29,7 +28,7 @@ namespace SewingDressesDatabaseImplement.Models
public virtual Client Client { get; set; }
public virtual Implement? Implement { get; set; }
public static Order? Create(OrderBindingModel model)
public static Order? Create(OrderBindingModel model, SewingDressesDatabase context)
{
if (model == null)
{
@ -41,6 +40,9 @@ namespace SewingDressesDatabaseImplement.Models
DressId = model.DressId,
ClientId = model.ClientId,
ImplementId = model.ImplementId,
Client = context.Clients.FirstOrDefault(x => x.Id == model.ClientId)!,
Dress = context.Dresses.FirstOrDefault(x => x.Id == model.DressId)!,
Implement = model.ImplementId.HasValue ? context.Implements.FirstOrDefault(x => x.Id == model.ImplementId) : null,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,

View File

@ -0,0 +1,108 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SewingDressesContracts.BindingModels;
using SewingDressesContracts.BusinessLogicsContracts;
using SewingDressesContracts.SearchModels;
using SewingDressesContracts.ViewModels;
using SewingDressesDataModels.Enums;
namespace SewingDressesRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class ImplementController : Controller
{
private readonly ILogger _logger;
private readonly IOrderLogic _order;
private readonly IImplementLogic _logic;
public ImplementController(IOrderLogic order, IImplementLogic logic, ILogger<ImplementController> logger)
{
_logger = logger;
_order = order;
_logic = logic;
}
[HttpGet]
public ImplementViewModel? Login(string login, string password)
{
try
{
return _logic.ReadElement(new ImplementSearchModel
{
ImplementFIO = login,
Password = password
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка авторизации сотрудника");
throw;
}
}
[HttpGet]
public List<OrderViewModel>? GetNewOrders()
{
try
{
return _order.ReadList(new OrderSearchModel
{
Status = OrderStatus.Принят
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения новых заказов");
throw;
}
}
[HttpGet]
public OrderViewModel? GetImplementOrder(int ImplementId)
{
try
{
return _order.ReadElement(new OrderSearchModel
{
ImplementId = ImplementId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения текущего заказа исполнителя");
throw;
}
}
[HttpPost]
public void TakeOrderInWork(OrderBindingModel model)
{
try
{
_order.TakeOrderInWork(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка перевода заказа с №{Id} в работу", model.Id);
throw;
}
}
[HttpPost]
public void FinishOrder(OrderBindingModel model)
{
try
{
_order.FinishOrder(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка отметки о готовности заказа с №{Id}", model.Id);
throw;
}
}
}
}

View File

@ -16,6 +16,8 @@ builder.Services.AddTransient<IDressStorage, DressStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IDressLogic, DressLogic>();
builder.Services.AddTransient<IImplementStorage, ImplementStorage>();
builder.Services.AddTransient<IImplementLogic, ImplementLogic>();
builder.Services.AddControllers();
builder.Services.AddSwaggerGen(c =>

View File

@ -7,6 +7,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.18">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

View File

@ -0,0 +1,162 @@
namespace SewingDressesView
{
partial class ImplementForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
textBoxFIO = new TextBox();
label1 = new Label();
label2 = new Label();
textBoxPassword = new TextBox();
label3 = new Label();
textBoxQual = new TextBox();
label4 = new Label();
textBoxExp = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// textBoxFIO
//
textBoxFIO.Location = new Point(153, 34);
textBoxFIO.Name = "textBoxFIO";
textBoxFIO.Size = new Size(125, 27);
textBoxFIO.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(32, 37);
label1.Name = "label1";
label1.Size = new Size(39, 20);
label1.TabIndex = 1;
label1.Text = "Имя";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(32, 89);
label2.Name = "label2";
label2.Size = new Size(62, 20);
label2.TabIndex = 3;
label2.Text = "Пароль";
//
// textBoxPassword
//
textBoxPassword.Location = new Point(153, 86);
textBoxPassword.Name = "textBoxPassword";
textBoxPassword.Size = new Size(125, 27);
textBoxPassword.TabIndex = 2;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(32, 144);
label3.Name = "label3";
label3.Size = new Size(111, 20);
label3.TabIndex = 5;
label3.Text = "Квалификация";
//
// textBoxQual
//
textBoxQual.Location = new Point(153, 141);
textBoxQual.Name = "textBoxQual";
textBoxQual.Size = new Size(125, 27);
textBoxQual.TabIndex = 4;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(32, 197);
label4.Name = "label4";
label4.Size = new Size(46, 20);
label4.TabIndex = 7;
label4.Text = "Опыт";
//
// textBoxExp
//
textBoxExp.Location = new Point(153, 194);
textBoxExp.Name = "textBoxExp";
textBoxExp.Size = new Size(125, 27);
textBoxExp.TabIndex = 6;
//
// buttonSave
//
buttonSave.Location = new Point(334, 32);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 8;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(334, 84);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 9;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// ImplementForm
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(451, 237);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(label4);
Controls.Add(textBoxExp);
Controls.Add(label3);
Controls.Add(textBoxQual);
Controls.Add(label2);
Controls.Add(textBoxPassword);
Controls.Add(label1);
Controls.Add(textBoxFIO);
Name = "ImplementForm";
Text = "Исполнитель форма";
Load += ImplementForm_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBoxFIO;
private Label label1;
private Label label2;
private TextBox textBoxPassword;
private Label label3;
private TextBox textBoxQual;
private Label label4;
private TextBox textBoxExp;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,111 @@
using Microsoft.Extensions.Logging;
using SewingDressesContracts.BindingModels;
using SewingDressesContracts.BusinessLogicsContracts;
using SewingDressesContracts.SearchModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SewingDressesView
{
public partial class ImplementForm : Form
{
private readonly ILogger _logger;
private readonly IImplementLogic _logic;
private int? _id;
public int ID { set { _id = value; } }
public ImplementForm(ILogger<ImplementForm> logger, IImplementLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void buttonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxFIO.Text))
{
MessageBox.Show("Empty Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(textBoxPassword.Text))
{
MessageBox.Show("Empty Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(textBoxExp.Text))
{
MessageBox.Show("Empty Experience", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(textBoxQual.Text))
{
MessageBox.Show("Empty Qualification", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Saving Imlement");
try
{
var model = new ImplementBindingModel
{
Id = _id ?? 0,
Password = textBoxPassword.Text,
ImplementFIO = textBoxFIO.Text,
WorkExperience = Convert.ToInt32(textBoxExp.Text),
Qualification = Convert.ToInt32(textBoxQual.Text)
};
var result = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
if (!result)
throw new Exception("Error on saving implement");
MessageBox.Show("Saving success", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error saving implement");
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void ImplementForm_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
try
{
_logger.LogInformation("Init implement");
var view = _logic.ReadElement(new ImplementSearchModel
{
Id = _id.Value,
});
if (view != null)
{
textBoxPassword.Text = view.Password;
textBoxFIO.Text = view.ImplementFIO;
textBoxExp.Text = view.WorkExperience.ToString();
textBoxQual.Text = view.Qualification.ToString();
}
}
catch(Exception ex)
{
_logger.LogError(ex, "Init implement error");
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,114 @@
namespace SewingDressesView
{
partial class ImplementsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dataGridView = new DataGridView();
buttonCreate = new Button();
buttonChange = new Button();
buttonDelete = new Button();
buttonUpdate = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(17, 18);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(524, 355);
dataGridView.TabIndex = 0;
//
// buttonCreate
//
buttonCreate.Location = new Point(572, 18);
buttonCreate.Name = "buttonCreate";
buttonCreate.Size = new Size(94, 29);
buttonCreate.TabIndex = 1;
buttonCreate.Text = "Создать";
buttonCreate.UseVisualStyleBackColor = true;
buttonCreate.Click += buttonCreate_Click;
//
// buttonChange
//
buttonChange.Location = new Point(572, 64);
buttonChange.Name = "buttonChange";
buttonChange.Size = new Size(94, 29);
buttonChange.TabIndex = 2;
buttonChange.Text = "Изменить";
buttonChange.UseVisualStyleBackColor = true;
buttonChange.Click += buttonChange_Click;
//
// buttonDelete
//
buttonDelete.Location = new Point(572, 111);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 29);
buttonDelete.TabIndex = 3;
buttonDelete.Text = "Удалить";
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += buttonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.Location = new Point(572, 161);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(94, 29);
buttonUpdate.TabIndex = 4;
buttonUpdate.Text = "Обновить";
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += buttonUpdate_Click;
//
// ImplementsForm
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(678, 383);
Controls.Add(buttonUpdate);
Controls.Add(buttonDelete);
Controls.Add(buttonChange);
Controls.Add(buttonCreate);
Controls.Add(dataGridView);
Name = "ImplementsForm";
Text = "Исполнители";
Load += ImplementsForm_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button buttonCreate;
private Button buttonChange;
private Button buttonDelete;
private Button buttonUpdate;
}
}

View File

@ -0,0 +1,103 @@
using Microsoft.Extensions.Logging;
using SewingDressesContracts.BusinessLogicsContracts;
using SewingDressesContracts.BindingModels;
using SewingDressesDatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SewingDressesView
{
public partial class ImplementsForm : Form
{
private readonly ILogger _logger;
private readonly IImplementLogic _logic;
public ImplementsForm(ILogger<ImplementsForm> logger, IImplementLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
}
_logger.LogInformation("Loading employees");
}
catch (Exception ex)
{
_logger.LogError(ex, "Error loading employees");
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCreate_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(ImplementForm));
if (service is ImplementForm form)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
private void ImplementsForm_Load(object sender, EventArgs e)
{
LoadData();
}
private void buttonChange_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(ImplementForm));
if (service is ImplementForm form)
{
form.ID = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}
private void buttonDelete_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
_logger.LogInformation("Delete component: {ComponentName}- {Count}", dataGridView.SelectedRows[0].Cells[1].Value);
_logic?.Delete(new ImplementBindingModel{ Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
LoadData();
}
}
}
private void buttonUpdate_Click(object sender, EventArgs e)
{
LoadData();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -30,19 +30,18 @@
{
dataGridView = new DataGridView();
buttonCreate = new Button();
buttonDoOrder = new Button();
buttonOrderReady = new Button();
buttonOrderGive = new Button();
buttonOrderUpdate = new Button();
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
компонентыToolStripMenuItem = new ToolStripMenuItem();
платьяToolStripMenuItem = new ToolStripMenuItem();
clientsToolStripMenuItem = new ToolStripMenuItem();
исполнителиToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
DressesReportToolStripMenuItem = new ToolStripMenuItem();
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
clientsToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
@ -67,29 +66,9 @@
buttonCreate.UseVisualStyleBackColor = true;
buttonCreate.Click += buttonCreate_Click;
//
// buttonDoOrder
//
buttonDoOrder.Location = new Point(854, 130);
buttonDoOrder.Name = "buttonDoOrder";
buttonDoOrder.Size = new Size(194, 37);
buttonDoOrder.TabIndex = 2;
buttonDoOrder.Text = "Отдать на выполнение";
buttonDoOrder.UseVisualStyleBackColor = true;
buttonDoOrder.Click += buttonDoOrder_Click;
//
// buttonOrderReady
//
buttonOrderReady.Location = new Point(854, 205);
buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.Size = new Size(194, 37);
buttonOrderReady.TabIndex = 3;
buttonOrderReady.Text = "Заказ готов";
buttonOrderReady.UseVisualStyleBackColor = true;
buttonOrderReady.Click += buttonOrderReady_Click;
//
// buttonOrderGive
//
buttonOrderGive.Location = new Point(854, 280);
buttonOrderGive.Location = new Point(854, 142);
buttonOrderGive.Name = "buttonOrderGive";
buttonOrderGive.Size = new Size(194, 37);
buttonOrderGive.TabIndex = 4;
@ -99,7 +78,7 @@
//
// buttonOrderUpdate
//
buttonOrderUpdate.Location = new Point(854, 357);
buttonOrderUpdate.Location = new Point(854, 219);
buttonOrderUpdate.Name = "buttonOrderUpdate";
buttonOrderUpdate.Size = new Size(194, 37);
buttonOrderUpdate.TabIndex = 5;
@ -119,7 +98,7 @@
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, платьяToolStripMenuItem, clientsToolStripMenuItem });
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, платьяToolStripMenuItem, clientsToolStripMenuItem, исполнителиToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
@ -138,6 +117,20 @@
платьяToolStripMenuItem.Text = "Платья";
платьяToolStripMenuItem.Click += DressesToolStripMenuItem_Click;
//
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(224, 26);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
//
// исполнителиToolStripMenuItem
//
исполнителиToolStripMenuItem.Name = сполнителиToolStripMenuItem";
исполнителиToolStripMenuItem.Size = new Size(224, 26);
исполнителиToolStripMenuItem.Text = "Исполнители";
исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DressesReportToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
@ -166,13 +159,6 @@
списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItemReport_Click;
//
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(224, 26);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
//
// MainForm
//
AutoScaleDimensions = new SizeF(8F, 20F);
@ -180,8 +166,6 @@
ClientSize = new Size(1096, 493);
Controls.Add(buttonOrderUpdate);
Controls.Add(buttonOrderGive);
Controls.Add(buttonOrderReady);
Controls.Add(buttonDoOrder);
Controls.Add(buttonCreate);
Controls.Add(dataGridView);
Controls.Add(menuStrip1);
@ -200,8 +184,6 @@
private DataGridView dataGridView;
private Button buttonCreate;
private Button buttonDoOrder;
private Button buttonOrderReady;
private Button buttonOrderGive;
private Button buttonOrderUpdate;
private MenuStrip menuStrip1;
@ -213,5 +195,6 @@
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem clientsToolStripMenuItem;
private ToolStripMenuItem исполнителиToolStripMenuItem;
}
}

View File

@ -28,6 +28,7 @@ namespace SewingDressesView
dataGridView.DataSource = list;
dataGridView.Columns["DressId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["ImplementId"].Visible = false;
}
_logger.LogInformation("Load orders");
}
@ -65,57 +66,6 @@ namespace SewingDressesView
}
}
private void buttonDoOrder_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Order №{id}. Change Status on 'In work'", id);
try
{
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Change Status on 'In work' error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void buttonOrderReady_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Order №{id}. Change status on 'Ready'",
id);
try
{
var operationResult = _orderLogic.FinishOrder(new
OrderBindingModel
{ Id = id });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Change status on 'Ready' error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void buttonOrderGive_Click(object sender, EventArgs e)
{
@ -188,5 +138,14 @@ namespace SewingDressesView
form.ShowDialog();
}
}
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(ClientsForm));
if (service is ImplementsForm form)
{
form.ShowDialog();
}
}
}
}

View File

@ -40,6 +40,8 @@ namespace SewingDressesView
services.AddTransient<IDressLogic, DressLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IImplementLogic, ImplementLogic>();
services.AddTransient<IImplementStorage, ImplementStorage>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
@ -53,6 +55,8 @@ namespace SewingDressesView
services.AddTransient<DressesForm>();
services.AddTransient<ReportDressComponentsForm>();
services.AddTransient<ReportOrdersForm>();
services.AddTransient<ImplementForm>();
services.AddTransient<ImplementsForm>();
}
}
}