ISEbd-21.Fedotov.I.A.LabWork06 #6
@ -14,7 +14,7 @@ namespace DinerContracts.BindingModels
|
||||
|
||||
public int ClientID { get; set; }
|
||||
|
||||
public int ImplementerID { get; set; }
|
||||
public int? ImplementerID { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace DinerContracts.ViewModels
|
||||
|
||||
public int ClientID { get; set; }
|
||||
public int SnackID { get; set; }
|
||||
public int ImplementerID { get; set; }
|
||||
public int? ImplementerID { get; set; }
|
||||
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
@ -41,6 +41,6 @@ namespace DinerContracts.ViewModels
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Исполнитель")]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
public string? ImplementerFIO { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,15 @@ namespace DinerDataBaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if ((int)model.Status >= 0) {
|
||||
return context.Orders
|
||||
.Include(x => x.Snack)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.Status >= 0)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return new();
|
||||
}
|
||||
|
||||
@ -89,10 +98,7 @@ namespace DinerDataBaseImplement.Implements
|
||||
}
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return context.Orders.Include(x => x.Snack)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.FirstOrDefault(x => x.ID == newOrder.ID)?.GetViewModel;
|
||||
return newOrder.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Update(OrderBindingModel model) {
|
||||
using var context = new DinerDatabaseBy6Work();
|
||||
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace DinerDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(DinerDatabaseBy6Work))]
|
||||
[Migration("20240513124832_InitMigration")]
|
||||
[Migration("20240513154945_InitMigration")]
|
||||
partial class InitMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -117,7 +117,8 @@ namespace DinerDataBaseImplement.Migrations
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ImplementerID")
|
||||
b.Property<int?>("ImplementerID")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SnackID")
|
257
Diner/DinerDataBaseImplement/Migrations/20240513162929_Migration01.Designer.cs
generated
Normal file
257
Diner/DinerDataBaseImplement/Migrations/20240513162929_Migration01.Designer.cs
generated
Normal file
@ -0,0 +1,257 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DinerDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DinerDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(DinerDatabaseBy6Work))]
|
||||
[Migration("20240513162929_Migration01")]
|
||||
partial class Migration01
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.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("DinerDataBaseImplement.Models.Food", 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>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
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("DinerDataBaseImplement.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?>("ImplementerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SnackID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ClientID");
|
||||
|
||||
b.HasIndex("ImplementerID");
|
||||
|
||||
b.HasIndex("SnackID");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Snack", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Snacks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", 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>("SnackID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ComponentID");
|
||||
|
||||
b.HasIndex("SnackID");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("DinerDataBaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DinerDataBaseImplement.Models.Implementer", "Implementer")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ImplementerID");
|
||||
|
||||
b.HasOne("DinerDataBaseImplement.Models.Snack", "Snack")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("SnackID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Implementer");
|
||||
|
||||
b.Navigation("Snack");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
||||
{
|
||||
b.HasOne("DinerDataBaseImplement.Models.Food", "Component")
|
||||
.WithMany("SnackFood")
|
||||
.HasForeignKey("ComponentID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DinerDataBaseImplement.Models.Snack", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("SnackID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Food", b =>
|
||||
{
|
||||
b.Navigation("SnackFood");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DinerDataBaseImplement.Models.Snack", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DinerDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration01 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerID",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ImplementerID",
|
||||
table: "Orders",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerID",
|
||||
table: "Orders",
|
||||
column: "ImplementerID",
|
||||
principalTable: "Implementers",
|
||||
principalColumn: "ID");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerID",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ImplementerID",
|
||||
table: "Orders",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerID",
|
||||
table: "Orders",
|
||||
column: "ImplementerID",
|
||||
principalTable: "Implementers",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ namespace DinerDataBaseImplement.Migrations
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ImplementerID")
|
||||
b.Property<int?>("ImplementerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SnackID")
|
||||
@ -193,9 +193,7 @@ namespace DinerDataBaseImplement.Migrations
|
||||
|
||||
b.HasOne("DinerDataBaseImplement.Models.Implementer", "Implementer")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ImplementerID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("ImplementerID");
|
||||
|
||||
b.HasOne("DinerDataBaseImplement.Models.Snack", "Snack")
|
||||
.WithMany("Orders")
|
||||
|
@ -42,16 +42,6 @@ namespace DinerDataBaseImplement.Models {
|
||||
};
|
||||
}
|
||||
|
||||
public static Implementer Create(ImplementerViewModel model) {
|
||||
return new Implementer() {
|
||||
ImplementerFIO = model.ImplementerFIO,
|
||||
Password = model.Password,
|
||||
WorkExperience = model.WorkExperience,
|
||||
Qualification = model.Qualification,
|
||||
ID = model.ID
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ImplementerBindingModel? model) {
|
||||
if (model == null) {
|
||||
return;
|
||||
|
@ -1,23 +1,25 @@
|
||||
using DinerContracts.BindingModels;
|
||||
using DinerContracts.ViewModels;
|
||||
using DinerDataBaseImplement.Implements;
|
||||
using DinerDataBaseImplement.Migrations;
|
||||
using DinerDataModels.Enums;
|
||||
using DinerDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace DinerDataBaseImplement.Models
|
||||
{
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
[Required]
|
||||
[ForeignKey("SnackID")]
|
||||
public int SnackID { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ClientID { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ImplementerID { get; set; }
|
||||
public int? ImplementerID { get; set; }
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
|
||||
@ -36,9 +38,9 @@ namespace DinerDataBaseImplement.Models
|
||||
|
||||
public virtual Snack Snack { get; set; }
|
||||
public virtual Client Client { get; set; }
|
||||
public virtual Implementer Implementer { get; set; }
|
||||
public virtual Implementer? Implementer { get; set; }
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
public static Order? Create(OrderBindingModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
return new Order()
|
||||
@ -61,20 +63,25 @@ namespace DinerDataBaseImplement.Models
|
||||
Status = model.Status;
|
||||
DateImplement = model?.DateImplement;
|
||||
}
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
ID = ID,
|
||||
SnackID = SnackID,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement,
|
||||
ProductName = Snack.ProductName,
|
||||
ClientID = ClientID,
|
||||
ClientFIO = Client.ClientFIO,
|
||||
ImplementerID = ImplementerID,
|
||||
ImplementerFIO = Implementer.ImplementerFIO
|
||||
};
|
||||
public OrderViewModel GetViewModel {
|
||||
get
|
||||
{
|
||||
using var context = new DinerDatabaseBy6Work();
|
||||
return new OrderViewModel {
|
||||
ID = ID,
|
||||
SnackID = SnackID,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement,
|
||||
ProductName = context.Snacks.FirstOrDefault(x => x.ID == SnackID)?.ProductName ?? string.Empty,
|
||||
ClientID = ClientID,
|
||||
ClientFIO = context.Clients.FirstOrDefault(x => x.ID == ClientID)?.ClientFIO ?? string.Empty,
|
||||
ImplementerID = ImplementerID,
|
||||
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace DinerListImplement.Models
|
||||
|
||||
public int ClientID { get; private set; }
|
||||
|
||||
public int ImplementerID { get; private set; }
|
||||
public int? ImplementerID { get; private set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace DinerFileImplement.Models
|
||||
|
||||
public int ClientID { get; private set; }
|
||||
|
||||
public int ImplementerID { get; set; }
|
||||
public int? ImplementerID { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
|
250
Diner/DinerView/FormCreateOrder.Designer.cs
generated
250
Diner/DinerView/FormCreateOrder.Designer.cs
generated
@ -20,121 +20,143 @@
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
#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()
|
||||
{
|
||||
labelProduct = new Label();
|
||||
comboBoxProduct = new ComboBox();
|
||||
labelCount = new Label();
|
||||
textBoxCount = new TextBox();
|
||||
label1 = new Label();
|
||||
textBoxSum = new TextBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelProduct
|
||||
//
|
||||
labelProduct.AutoSize = true;
|
||||
labelProduct.Location = new Point(12, 9);
|
||||
labelProduct.Name = "labelProduct";
|
||||
labelProduct.Size = new Size(37, 15);
|
||||
labelProduct.TabIndex = 0;
|
||||
labelProduct.Text = "Cнэк:";
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.BackColor = SystemColors.ButtonShadow;
|
||||
comboBoxProduct.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(93, 6);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(289, 23);
|
||||
comboBoxProduct.TabIndex = 3;
|
||||
comboBoxProduct.SelectedIndexChanged += comboBoxProduct_SelectedIndexChanged;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(12, 37);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(75, 15);
|
||||
labelCount.TabIndex = 4;
|
||||
labelCount.Text = "Количество:";
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(93, 34);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(289, 23);
|
||||
textBoxCount.TabIndex = 5;
|
||||
textBoxCount.TextChanged += textBoxCount_TextChanged;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 66);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(48, 15);
|
||||
label1.TabIndex = 6;
|
||||
label1.Text = "Сумма:";
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(93, 63);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.ReadOnly = true;
|
||||
textBoxSum.Size = new Size(289, 23);
|
||||
textBoxSum.TabIndex = 7;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(307, 92);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 8;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(226, 92);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 9;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormCreateOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(394, 122);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxSum);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(labelProduct);
|
||||
Name = "FormCreateOrder";
|
||||
Text = "Заказ";
|
||||
Load += FormCreateOrder_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
labelProduct = new Label();
|
||||
comboBoxProduct = new ComboBox();
|
||||
labelCount = new Label();
|
||||
textBoxCount = new TextBox();
|
||||
label1 = new Label();
|
||||
textBoxSum = new TextBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
labelClient = new Label();
|
||||
comboBoxClient = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelProduct
|
||||
//
|
||||
labelProduct.AutoSize = true;
|
||||
labelProduct.Location = new Point(12, 39);
|
||||
labelProduct.Name = "labelProduct";
|
||||
labelProduct.Size = new Size(37, 15);
|
||||
labelProduct.TabIndex = 0;
|
||||
labelProduct.Text = "Cнэк:";
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.BackColor = SystemColors.ButtonShadow;
|
||||
comboBoxProduct.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(93, 36);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(289, 23);
|
||||
comboBoxProduct.TabIndex = 3;
|
||||
comboBoxProduct.SelectedIndexChanged += comboBoxProduct_SelectedIndexChanged;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(12, 67);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(75, 15);
|
||||
labelCount.TabIndex = 4;
|
||||
labelCount.Text = "Количество:";
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(93, 64);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(289, 23);
|
||||
textBoxCount.TabIndex = 5;
|
||||
textBoxCount.TextChanged += textBoxCount_TextChanged;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 96);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(48, 15);
|
||||
label1.TabIndex = 6;
|
||||
label1.Text = "Сумма:";
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(93, 93);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.ReadOnly = true;
|
||||
textBoxSum.Size = new Size(289, 23);
|
||||
textBoxSum.TabIndex = 7;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(307, 122);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 8;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(226, 122);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 9;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// labelClient
|
||||
//
|
||||
labelClient.AutoSize = true;
|
||||
labelClient.Location = new Point(12, 9);
|
||||
labelClient.Name = "labelClient";
|
||||
labelClient.Size = new Size(49, 15);
|
||||
labelClient.TabIndex = 10;
|
||||
labelClient.Text = "Клиент:";
|
||||
//
|
||||
// comboBoxClient
|
||||
//
|
||||
comboBoxClient.BackColor = SystemColors.ButtonShadow;
|
||||
comboBoxClient.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxClient.FormattingEnabled = true;
|
||||
comboBoxClient.Location = new Point(93, 7);
|
||||
comboBoxClient.Name = "comboBoxClient";
|
||||
comboBoxClient.Size = new Size(289, 23);
|
||||
comboBoxClient.TabIndex = 11;
|
||||
//
|
||||
// FormCreateOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(394, 156);
|
||||
Controls.Add(comboBoxClient);
|
||||
Controls.Add(labelClient);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxSum);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(labelProduct);
|
||||
Name = "FormCreateOrder";
|
||||
Text = "Заказ";
|
||||
Load += FormCreateOrder_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private Label labelProduct;
|
||||
private Label labelProduct;
|
||||
private ComboBox comboBoxProduct;
|
||||
private Label labelCount;
|
||||
private TextBox textBoxCount;
|
||||
@ -142,5 +164,7 @@
|
||||
private TextBox textBoxSum;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
private Label labelClient;
|
||||
private ComboBox comboBoxClient;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using DinerContracts.BindingModels;
|
||||
using DinerContracts.BusinessLogicsContacts;
|
||||
using DinerContracts.BusinessLogicsContracts;
|
||||
using DinerContracts.SearchModels;
|
||||
using DinerDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -20,13 +21,15 @@ namespace DinerView
|
||||
private readonly ILogger _logger;
|
||||
private readonly ISnackLogic _logicSnack;
|
||||
private readonly IOrderLogic _logicOrder;
|
||||
private readonly IClientLogic _clientLogic;
|
||||
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISnackLogic logicSnack, IOrderLogic logicOrder)
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISnackLogic logicSnack, IOrderLogic logicOrder, IClientLogic clientLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicSnack = logicSnack;
|
||||
_logicOrder = logicOrder;
|
||||
_clientLogic = clientLogic;
|
||||
}
|
||||
|
||||
private void CalcSum()
|
||||
@ -72,7 +75,11 @@ namespace DinerView
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
if (comboBoxClient.SelectedValue == null) {
|
||||
MessageBox.Show("Выбирите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicOrder.CreateOrder(new OrderBindingModel
|
||||
@ -80,6 +87,7 @@ namespace DinerView
|
||||
SnackID = Convert.ToInt32(comboBoxProduct.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text),
|
||||
ClientID = Convert.ToInt32(comboBoxClient.SelectedValue)
|
||||
|
||||
});
|
||||
if (!operationResult) throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
||||
@ -113,9 +121,17 @@ namespace DinerView
|
||||
comboBoxProduct.DataSource = list;
|
||||
comboBoxProduct.SelectedItem = null;
|
||||
}
|
||||
|
||||
var listClient = _clientLogic.ReadList(null);
|
||||
if (listClient != null) {
|
||||
comboBoxClient.DisplayMember = "ClientFIO";
|
||||
comboBoxClient.ValueMember = "ID";
|
||||
comboBoxClient.DataSource = listClient;
|
||||
comboBoxClient.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка загрузки списка снэков");
|
||||
_logger.LogError(ex, "Ошибка загрузки списка снэков или клиентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
157
Diner/DinerView/FormImplementer.Designer.cs
generated
Normal file
157
Diner/DinerView/FormImplementer.Designer.cs
generated
Normal file
@ -0,0 +1,157 @@
|
||||
namespace DinerView {
|
||||
partial class FormImplementer {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
labelFIO = new Label();
|
||||
labelPassword = new Label();
|
||||
labelWorkExperience = new Label();
|
||||
labelQualification = new Label();
|
||||
textBoxFIO = new TextBox();
|
||||
textBoxPaassword = new TextBox();
|
||||
textBoxWorkExperience = new TextBox();
|
||||
textBoxQualification = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
labelFIO.AutoSize = true;
|
||||
labelFIO.Location = new Point(12, 19);
|
||||
labelFIO.Name = "labelFIO";
|
||||
labelFIO.Size = new Size(37, 15);
|
||||
labelFIO.TabIndex = 1;
|
||||
labelFIO.Text = "ФИО:";
|
||||
//
|
||||
// labelPassword
|
||||
//
|
||||
labelPassword.AutoSize = true;
|
||||
labelPassword.Location = new Point(12, 50);
|
||||
labelPassword.Name = "labelPassword";
|
||||
labelPassword.Size = new Size(49, 15);
|
||||
labelPassword.TabIndex = 2;
|
||||
labelPassword.Text = "Пароль";
|
||||
//
|
||||
// labelWorkExperience
|
||||
//
|
||||
labelWorkExperience.AutoSize = true;
|
||||
labelWorkExperience.Location = new Point(12, 88);
|
||||
labelWorkExperience.Name = "labelWorkExperience";
|
||||
labelWorkExperience.Size = new Size(82, 15);
|
||||
labelWorkExperience.TabIndex = 3;
|
||||
labelWorkExperience.Text = "Стаж работы:";
|
||||
//
|
||||
// labelQualification
|
||||
//
|
||||
labelQualification.AutoSize = true;
|
||||
labelQualification.Location = new Point(180, 88);
|
||||
labelQualification.Name = "labelQualification";
|
||||
labelQualification.Size = new Size(88, 15);
|
||||
labelQualification.TabIndex = 4;
|
||||
labelQualification.Text = "Квалификация";
|
||||
//
|
||||
// textBoxFIO
|
||||
//
|
||||
textBoxFIO.Location = new Point(67, 16);
|
||||
textBoxFIO.Name = "textBoxFIO";
|
||||
textBoxFIO.Size = new Size(305, 23);
|
||||
textBoxFIO.TabIndex = 5;
|
||||
//
|
||||
// textBoxPaassword
|
||||
//
|
||||
textBoxPaassword.Location = new Point(67, 47);
|
||||
textBoxPaassword.Name = "textBoxPaassword";
|
||||
textBoxPaassword.Size = new Size(305, 23);
|
||||
textBoxPaassword.TabIndex = 6;
|
||||
//
|
||||
// textBoxWorkExperience
|
||||
//
|
||||
textBoxWorkExperience.Location = new Point(100, 85);
|
||||
textBoxWorkExperience.Name = "textBoxWorkExperience";
|
||||
textBoxWorkExperience.Size = new Size(69, 23);
|
||||
textBoxWorkExperience.TabIndex = 7;
|
||||
//
|
||||
// textBoxQualification
|
||||
//
|
||||
textBoxQualification.Location = new Point(274, 85);
|
||||
textBoxQualification.Name = "textBoxQualification";
|
||||
textBoxQualification.Size = new Size(98, 23);
|
||||
textBoxQualification.TabIndex = 8;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(216, 124);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(297, 124);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormImplementer
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(394, 159);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxQualification);
|
||||
Controls.Add(textBoxWorkExperience);
|
||||
Controls.Add(textBoxPaassword);
|
||||
Controls.Add(textBoxFIO);
|
||||
Controls.Add(labelQualification);
|
||||
Controls.Add(labelWorkExperience);
|
||||
Controls.Add(labelPassword);
|
||||
Controls.Add(labelFIO);
|
||||
Name = "FormImplementer";
|
||||
Text = "Implementer";
|
||||
Load += FormImplementer_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelFIO;
|
||||
private Label labelPassword;
|
||||
private Label labelWorkExperience;
|
||||
private Label labelQualification;
|
||||
private TextBox textBoxFIO;
|
||||
private TextBox textBoxPaassword;
|
||||
private TextBox textBoxWorkExperience;
|
||||
private TextBox textBoxQualification;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
100
Diner/DinerView/FormImplementer.cs
Normal file
100
Diner/DinerView/FormImplementer.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using DinerContracts.BindingModels;
|
||||
using DinerContracts.BusinessLogicsContracts;
|
||||
using DinerContracts.SearchModels;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 DinerView {
|
||||
public partial class FormImplementer : Form {
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IImplementerLogic _logic;
|
||||
|
||||
private int? _ID;
|
||||
|
||||
public int ID {
|
||||
set { _ID = value; }
|
||||
}
|
||||
public FormImplementer(ILogger<FormImplementer> logger, IImplementerLogic logic) {
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormImplementer_Load(object sender, EventArgs e) {
|
||||
if (_ID.HasValue) {
|
||||
try {
|
||||
_logger.LogInformation("Получение исполнителя");
|
||||
var view = _logic.ReadElement(new ImplementerSearchModel {
|
||||
ID = _ID.Value
|
||||
});
|
||||
if (view != null) {
|
||||
textBoxFIO.Text = view.ImplementerFIO;
|
||||
textBoxPaassword.Text = view.Password;
|
||||
textBoxQualification.Text = view.Qualification.ToString();
|
||||
textBoxWorkExperience.Text = view.WorkExperience.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка получения исполнителя");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e) {
|
||||
if (string.IsNullOrEmpty(textBoxFIO.Text)) {
|
||||
MessageBox.Show("Заполните ФИО", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxPaassword.Text)) {
|
||||
MessageBox.Show("Придумайте пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxQualification.Text)) {
|
||||
MessageBox.Show("Укажите квалификацию", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxWorkExperience.Text)) {
|
||||
MessageBox.Show("Укажите стаж работы", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение исполнителя");
|
||||
try {
|
||||
var model = new ImplementerBindingModel {
|
||||
ID = _ID ?? 0,
|
||||
ImplementerFIO = textBoxFIO.Text,
|
||||
Password = textBoxPaassword.Text,
|
||||
Qualification = Convert.ToInt32(textBoxQualification.Text),
|
||||
WorkExperience = Convert.ToInt32(textBoxWorkExperience.Text),
|
||||
};
|
||||
var operationResult = _ID.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult) {
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка сохранения исполнителя");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) {
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
Diner/DinerView/FormImplementer.resx
Normal file
120
Diner/DinerView/FormImplementer.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
115
Diner/DinerView/FormImplementers.Designer.cs
generated
Normal file
115
Diner/DinerView/FormImplementers.Designer.cs
generated
Normal file
@ -0,0 +1,115 @@
|
||||
namespace DinerView {
|
||||
partial class FormImplementers {
|
||||
/// <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();
|
||||
buttonAdd = new Button();
|
||||
buttonCange = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonUpdate = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
||||
dataGridView.BorderStyle = BorderStyle.None;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Left;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(468, 450);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(509, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(95, 35);
|
||||
buttonAdd.TabIndex = 2;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonCange
|
||||
//
|
||||
buttonCange.Location = new Point(509, 53);
|
||||
buttonCange.Name = "buttonCange";
|
||||
buttonCange.Size = new Size(95, 35);
|
||||
buttonCange.TabIndex = 3;
|
||||
buttonCange.Text = "Изменить";
|
||||
buttonCange.UseVisualStyleBackColor = true;
|
||||
buttonCange.Click += buttonCange_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(509, 94);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(95, 35);
|
||||
buttonDelete.TabIndex = 4;
|
||||
buttonDelete.Text = "Удалить";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(509, 135);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(95, 35);
|
||||
buttonUpdate.TabIndex = 5;
|
||||
buttonUpdate.Text = "Обновить";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// FormImplementers
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = SystemColors.ActiveBorder;
|
||||
ClientSize = new Size(635, 450);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(buttonCange);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormImplementers";
|
||||
Text = "Исполнители";
|
||||
Load += FormImplementers_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCange;
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
}
|
||||
}
|
91
Diner/DinerView/FormImplementers.cs
Normal file
91
Diner/DinerView/FormImplementers.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using DinerContracts.BindingModels;
|
||||
using DinerContracts.BusinessLogicsContracts;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 DinerView {
|
||||
public partial class FormImplementers : Form {
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IImplementerLogic _logic;
|
||||
|
||||
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic logic) {
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormImplementers_Load(object sender, EventArgs e) {
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData() {
|
||||
try {
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null) {
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["ID"].Visible = false;
|
||||
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка клиентов");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpdate_Click(object sender, EventArgs e) {
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e) {
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||
if (service is FormImplementer form) {
|
||||
if (form.ShowDialog() == DialogResult.OK) {
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCange_Click(object sender, EventArgs e) {
|
||||
if (dataGridView.SelectedRows.Count == 1) {
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||
if (service is FormImplementer 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) {
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ID"].Value);
|
||||
_logger.LogInformation("Удаление компонента");
|
||||
try {
|
||||
if (!_logic.Delete(new ImplementerBindingModel { ID = id})) {
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Diner/DinerView/FormImplementers.resx
Normal file
120
Diner/DinerView/FormImplementers.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
80
Diner/DinerView/FormMain.Designer.cs
generated
80
Diner/DinerView/FormMain.Designer.cs
generated
@ -31,17 +31,17 @@
|
||||
toolStripMenuItemMenu = new ToolStripMenuItem();
|
||||
toolStripMenuItemFoods = new ToolStripMenuItem();
|
||||
toolStripMenuItemSnacks = new ToolStripMenuItem();
|
||||
toolStripMenuItemClient = new ToolStripMenuItem();
|
||||
toolStripMenuItemImplementer = new ToolStripMenuItem();
|
||||
toolStripMenuItemReport = new ToolStripMenuItem();
|
||||
FoodsToolStripMenuItem = new ToolStripMenuItem();
|
||||
FoodSnacksToolStripMenuItem = new ToolStripMenuItem();
|
||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
||||
toolStripMenuItemStartOfWork = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonInWork = new Button();
|
||||
buttonIsReady = new Button();
|
||||
buttonIsDelivery = new Button();
|
||||
buttonUpdateList = new Button();
|
||||
toolStripMenuItemClient = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -49,16 +49,16 @@
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.BackColor = SystemColors.Control;
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItemMenu, toolStripMenuItemReport });
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItemMenu, toolStripMenuItemReport, toolStripMenuItemStartOfWork });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(951, 24);
|
||||
menuStrip.Size = new Size(1114, 24);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "Справочник";
|
||||
//
|
||||
// toolStripMenuItemMenu
|
||||
//
|
||||
toolStripMenuItemMenu.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItemFoods, toolStripMenuItemSnacks, toolStripMenuItemClient });
|
||||
toolStripMenuItemMenu.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItemFoods, toolStripMenuItemSnacks, toolStripMenuItemClient, toolStripMenuItemImplementer });
|
||||
toolStripMenuItemMenu.Name = "toolStripMenuItemMenu";
|
||||
toolStripMenuItemMenu.Size = new Size(94, 20);
|
||||
toolStripMenuItemMenu.Text = "Справочники";
|
||||
@ -66,17 +66,31 @@
|
||||
// toolStripMenuItemFoods
|
||||
//
|
||||
toolStripMenuItemFoods.Name = "toolStripMenuItemFoods";
|
||||
toolStripMenuItemFoods.Size = new Size(180, 22);
|
||||
toolStripMenuItemFoods.Size = new Size(149, 22);
|
||||
toolStripMenuItemFoods.Text = "Продукты";
|
||||
toolStripMenuItemFoods.Click += toolStripMenuItemFoods_Click;
|
||||
//
|
||||
// toolStripMenuItemSnacks
|
||||
//
|
||||
toolStripMenuItemSnacks.Name = "toolStripMenuItemSnacks";
|
||||
toolStripMenuItemSnacks.Size = new Size(180, 22);
|
||||
toolStripMenuItemSnacks.Size = new Size(149, 22);
|
||||
toolStripMenuItemSnacks.Text = "Снэки";
|
||||
toolStripMenuItemSnacks.Click += toolStripMenuItemSnacks_Click;
|
||||
//
|
||||
// toolStripMenuItemClient
|
||||
//
|
||||
toolStripMenuItemClient.Name = "toolStripMenuItemClient";
|
||||
toolStripMenuItemClient.Size = new Size(149, 22);
|
||||
toolStripMenuItemClient.Text = "Клиенты";
|
||||
toolStripMenuItemClient.Click += toolStripMenuItemClient_Click;
|
||||
//
|
||||
// toolStripMenuItemImplementer
|
||||
//
|
||||
toolStripMenuItemImplementer.Name = "toolStripMenuItemImplementer";
|
||||
toolStripMenuItemImplementer.Size = new Size(149, 22);
|
||||
toolStripMenuItemImplementer.Text = "Исполнители";
|
||||
toolStripMenuItemImplementer.Click += toolStripMenuItemImplementer_Click;
|
||||
//
|
||||
// toolStripMenuItemReport
|
||||
//
|
||||
toolStripMenuItemReport.DropDownItems.AddRange(new ToolStripItem[] { FoodsToolStripMenuItem, FoodSnacksToolStripMenuItem, ordersToolStripMenuItem });
|
||||
@ -105,6 +119,13 @@
|
||||
ordersToolStripMenuItem.Text = "Список заказов";
|
||||
ordersToolStripMenuItem.Click += ordersToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripMenuItemStartOfWork
|
||||
//
|
||||
toolStripMenuItemStartOfWork.Name = "toolStripMenuItemStartOfWork";
|
||||
toolStripMenuItemStartOfWork.Size = new Size(92, 20);
|
||||
toolStripMenuItemStartOfWork.Text = "Запуск работ";
|
||||
toolStripMenuItemStartOfWork.Click += toolStripMenuItemStartOfWork_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
@ -119,12 +140,12 @@
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(726, 426);
|
||||
dataGridView.Size = new Size(889, 426);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
buttonCreateOrder.Location = new Point(732, 36);
|
||||
buttonCreateOrder.Location = new Point(895, 40);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(212, 39);
|
||||
buttonCreateOrder.TabIndex = 2;
|
||||
@ -132,29 +153,9 @@
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += buttonCreateOrder_Click;
|
||||
//
|
||||
// buttonInWork
|
||||
//
|
||||
buttonInWork.Location = new Point(732, 81);
|
||||
buttonInWork.Name = "buttonInWork";
|
||||
buttonInWork.Size = new Size(212, 39);
|
||||
buttonInWork.TabIndex = 3;
|
||||
buttonInWork.Text = "Отдать на выполнение";
|
||||
buttonInWork.UseVisualStyleBackColor = true;
|
||||
buttonInWork.Click += buttonInWork_Click;
|
||||
//
|
||||
// buttonIsReady
|
||||
//
|
||||
buttonIsReady.Location = new Point(732, 126);
|
||||
buttonIsReady.Name = "buttonIsReady";
|
||||
buttonIsReady.Size = new Size(212, 39);
|
||||
buttonIsReady.TabIndex = 4;
|
||||
buttonIsReady.Text = "Заказ готов";
|
||||
buttonIsReady.UseVisualStyleBackColor = true;
|
||||
buttonIsReady.Click += buttonIsReady_Click;
|
||||
//
|
||||
// buttonIsDelivery
|
||||
//
|
||||
buttonIsDelivery.Location = new Point(732, 171);
|
||||
buttonIsDelivery.Location = new Point(895, 100);
|
||||
buttonIsDelivery.Name = "buttonIsDelivery";
|
||||
buttonIsDelivery.Size = new Size(212, 39);
|
||||
buttonIsDelivery.TabIndex = 5;
|
||||
@ -164,7 +165,7 @@
|
||||
//
|
||||
// buttonUpdateList
|
||||
//
|
||||
buttonUpdateList.Location = new Point(732, 216);
|
||||
buttonUpdateList.Location = new Point(895, 159);
|
||||
buttonUpdateList.Name = "buttonUpdateList";
|
||||
buttonUpdateList.Size = new Size(212, 39);
|
||||
buttonUpdateList.TabIndex = 6;
|
||||
@ -172,23 +173,14 @@
|
||||
buttonUpdateList.UseVisualStyleBackColor = true;
|
||||
buttonUpdateList.Click += buttonUpdateList_Click;
|
||||
//
|
||||
// toolStripMenuItemClient
|
||||
//
|
||||
toolStripMenuItemClient.Name = "toolStripMenuItemClient";
|
||||
toolStripMenuItemClient.Size = new Size(180, 22);
|
||||
toolStripMenuItemClient.Text = "Клиенты";
|
||||
toolStripMenuItemClient.Click += toolStripMenuItemClient_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = SystemColors.ScrollBar;
|
||||
ClientSize = new Size(951, 450);
|
||||
ClientSize = new Size(1114, 450);
|
||||
Controls.Add(buttonUpdateList);
|
||||
Controls.Add(buttonIsDelivery);
|
||||
Controls.Add(buttonIsReady);
|
||||
Controls.Add(buttonInWork);
|
||||
Controls.Add(buttonCreateOrder);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip);
|
||||
@ -211,8 +203,6 @@
|
||||
private ToolStripMenuItem toolStripMenuItemFoods;
|
||||
private ToolStripMenuItem toolStripMenuItemSnacks;
|
||||
private Button buttonCreateOrder;
|
||||
private Button buttonInWork;
|
||||
private Button buttonIsReady;
|
||||
private Button buttonIsDelivery;
|
||||
private Button buttonUpdateList;
|
||||
private ToolStripMenuItem toolStripMenuItemReport;
|
||||
@ -220,5 +210,7 @@
|
||||
private ToolStripMenuItem FoodSnacksToolStripMenuItem;
|
||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||
private ToolStripMenuItem toolStripMenuItemClient;
|
||||
private ToolStripMenuItem toolStripMenuItemStartOfWork;
|
||||
private ToolStripMenuItem toolStripMenuItemImplementer;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using DinerContracts.BindingModels;
|
||||
using DinerContracts.BusinessLogicsContacts;
|
||||
using DinerContracts.BusinessLogicsContracts;
|
||||
using DinerDataBaseImplement.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -19,11 +20,13 @@ namespace DinerView
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic) {
|
||||
private readonly IWorkProcess _workProcess;
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess) {
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
_workProcess = workProcess;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e) {
|
||||
@ -38,8 +41,10 @@ namespace DinerView
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["SnackID"].Visible = false;
|
||||
dataGridView.Columns["ClientID"].Visible = false;
|
||||
dataGridView.Columns["ID"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ImplementerID"].Visible = false;
|
||||
dataGridView.Columns["ID"].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
dataGridView.Columns["Sum"].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
}
|
||||
@ -156,9 +161,22 @@ namespace DinerView
|
||||
|
||||
private void toolStripMenuItemClient_Click(object sender, EventArgs e) {
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormClient));
|
||||
if (service is FormClient form) {
|
||||
if (service is FormClient form) {
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemImplementer_Click(object sender, EventArgs e) {
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||
if (service is FormImplementers form) {
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemStartOfWork_Click(object sender, EventArgs e) {
|
||||
_workProcess.Work((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||
MessageBox.Show("Процесс обработки запущен", "Сообщение",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ namespace DinerView
|
||||
services.AddTransient<FormReportSnackFoods>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormClient>();
|
||||
services.AddTransient<FormImplementers>();
|
||||
services.AddTransient<FormImplementer>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user