Kashin M.I. Lab work 7 hard #15

Closed
Sosees04ka wants to merge 6 commits from LabWork07_hard into LabWork06_hard
8 changed files with 162 additions and 129 deletions
Showing only changes of commit e987e043bf - Show all commits

View File

@ -43,6 +43,7 @@
this.магазиныСИзделиямиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокГруппЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.запускРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DataGridView = new System.Windows.Forms.DataGridView();
this.CreateOrderButton = new System.Windows.Forms.Button();
this.IssuedOrderButton = new System.Windows.Forms.Button();
@ -63,7 +64,8 @@
this.письмаToolStripMenuItem});
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
this.MenuStrip.Name = "MenuStrip";
this.MenuStrip.Size = new System.Drawing.Size(1058, 24);
this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
this.MenuStrip.Size = new System.Drawing.Size(1209, 30);
this.MenuStrip.TabIndex = 0;
this.MenuStrip.Text = "menuStrip1";
//
@ -76,41 +78,41 @@
this.исполнителиToolStripMenuItem,
this.МагазинtoolStripMenuItem});
this.СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem";
this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
this.СправочникиToolStripMenuItem.Text = "Cправочники";
//
// ИзделияToolStripMenuItem
//
this.ИзделияToolStripMenuItem.Name = "ИзделияToolStripMenuItem";
this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
this.ИзделияToolStripMenuItem.Text = "Изделия";
this.ИзделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
//
// КомпонентыToolStripMenuItem
//
this.КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
this.КомпонентыToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.КомпонентыToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
this.КомпонентыToolStripMenuItem.Text = "Компоненты";
this.КомпонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
//
// КлиентыToolStripMenuItem
//
this.КлиентыToolStripMenuItem.Name = "КлиентыToolStripMenuItem";
this.КлиентыToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.КлиентыToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
this.КлиентыToolStripMenuItem.Text = "Клиенты";
this.КлиентыToolStripMenuItem.Click += new System.EventHandler(this.КлиентыToolStripMenuItem_Click);
//
// исполнителиToolStripMenuItem
//
this.исполнителиToolStripMenuItem.Name = сполнителиToolStripMenuItem";
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
this.исполнителиToolStripMenuItem.Text = "Исполнители";
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
//
// МагазинtoolStripMenuItem
//
this.МагазинtoolStripMenuItem.Name = "МагазинtoolStripMenuItem";
this.МагазинtoolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.МагазинtoolStripMenuItem.Size = new System.Drawing.Size(185, 26);
this.МагазинtoolStripMenuItem.Text = "Магазины";
this.МагазинtoolStripMenuItem.Click += new System.EventHandler(this.МагазинtoolStripMenuItem_Click);
//
@ -124,73 +126,82 @@
this.магазиныСИзделиямиToolStripMenuItem,
this.списокГруппЗаказовToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокДокументовToolStripMenuItem
//
this.списокДокументовToolStripMenuItem.Name = "списокДокументовToolStripMenuItem";
this.списокДокументовToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
this.списокДокументовToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
this.списокДокументовToolStripMenuItem.Text = "Список документов";
this.списокДокументовToolStripMenuItem.Click += new System.EventHandler(this.списокДокументовToolStripMenuItem_Click);
//
// компонентыПоДокументамToolStripMenuItem
//
this.компонентыПоДокументамToolStripMenuItem.Name = омпонентыПоДокументамToolStripMenuItem";
this.компонентыПоДокументамToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
this.компонентыПоДокументамToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
this.компонентыПоДокументамToolStripMenuItem.Text = "Компоненты по документам";
this.компонентыПоДокументамToolStripMenuItem.Click += new System.EventHandler(this.компонентыПоДокументамToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click);
//
// списокМагазиновToolStripMenuItem
//
this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.списокМагазиновToolStripMenuItem_Click);
//
// магазиныСИзделиямиToolStripMenuItem
//
this.магазиныСИзделиямиToolStripMenuItem.Name = агазиныСИзделиямиToolStripMenuItem";
this.магазиныСИзделиямиToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
this.магазиныСИзделиямиToolStripMenuItem.Text = "Магазины с изделиями";
this.магазиныСИзделиямиToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
this.магазиныСИзделиямиToolStripMenuItem.Text = "Магазины с изделями";
this.магазиныСИзделиямиToolStripMenuItem.Click += new System.EventHandler(this.магазиныСИзделиямиToolStripMenuItem_Click);
//
// списокГруппЗаказовToolStripMenuItem
//
this.списокГруппЗаказовToolStripMenuItem.Name = "списокГруппЗаказовToolStripMenuItem";
this.списокГруппЗаказовToolStripMenuItem.Size = new System.Drawing.Size(232, 22);
this.списокГруппЗаказовToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
this.списокГруппЗаказовToolStripMenuItem.Text = "Список групп заказов";
this.списокГруппЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокГруппЗаказовToolStripMenuItem_Click);
//
// запускРаботToolStripMenuItem
//
this.запускРаботToolStripMenuItem.Name = апускРаботToolStripMenuItem";
this.запускРаботToolStripMenuItem.Size = new System.Drawing.Size(92, 20);
this.запускРаботToolStripMenuItem.Size = new System.Drawing.Size(114, 24);
this.запускРаботToolStripMenuItem.Text = "Запуск работ";
this.запускРаботToolStripMenuItem.Click += new System.EventHandler(this.запускРаботToolStripMenuItem_Click);
//
// письмаToolStripMenuItem
//
this.письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
this.письмаToolStripMenuItem.Size = new System.Drawing.Size(77, 24);
this.письмаToolStripMenuItem.Text = "Письма";
this.письмаToolStripMenuItem.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click);
//
// DataGridView
//
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridView.Location = new System.Drawing.Point(0, 27);
this.DataGridView.Location = new System.Drawing.Point(0, 36);
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.DataGridView.Name = "DataGridView";
this.DataGridView.RowHeadersWidth = 51;
this.DataGridView.RowTemplate.Height = 25;
this.DataGridView.Size = new System.Drawing.Size(881, 421);
this.DataGridView.Size = new System.Drawing.Size(1007, 561);
this.DataGridView.TabIndex = 1;
//
// CreateOrderButton
//
this.CreateOrderButton.Location = new System.Drawing.Point(905, 27);
this.CreateOrderButton.Location = new System.Drawing.Point(1034, 36);
this.CreateOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.CreateOrderButton.Name = "CreateOrderButton";
this.CreateOrderButton.Size = new System.Drawing.Size(125, 33);
this.CreateOrderButton.Size = new System.Drawing.Size(143, 44);
this.CreateOrderButton.TabIndex = 2;
this.CreateOrderButton.Text = "Создать заказ";
this.CreateOrderButton.UseVisualStyleBackColor = true;
@ -198,10 +209,10 @@
//
// IssuedOrderButton
//
this.IssuedOrderButton.Location = new System.Drawing.Point(905, 112);
this.IssuedOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.IssuedOrderButton.Location = new System.Drawing.Point(1034, 149);
this.IssuedOrderButton.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.IssuedOrderButton.Name = "IssuedOrderButton";
this.IssuedOrderButton.Size = new System.Drawing.Size(125, 33);
this.IssuedOrderButton.Size = new System.Drawing.Size(143, 44);
this.IssuedOrderButton.TabIndex = 5;
this.IssuedOrderButton.Text = "Заказ выдан";
this.IssuedOrderButton.UseVisualStyleBackColor = true;
@ -209,9 +220,10 @@
//
// UpdateListButton
//
this.UpdateListButton.Location = new System.Drawing.Point(905, 189);
this.UpdateListButton.Location = new System.Drawing.Point(1034, 252);
this.UpdateListButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.UpdateListButton.Name = "UpdateListButton";
this.UpdateListButton.Size = new System.Drawing.Size(125, 33);
this.UpdateListButton.Size = new System.Drawing.Size(143, 44);
this.UpdateListButton.TabIndex = 6;
this.UpdateListButton.Text = "Обновить список";
this.UpdateListButton.UseVisualStyleBackColor = true;
@ -219,9 +231,9 @@
//
// buttonSellReinforced
//
this.buttonSellReinforced.Location = new System.Drawing.Point(905, 295);
this.buttonSellReinforced.Location = new System.Drawing.Point(1036, 372);
this.buttonSellReinforced.Name = "buttonSellReinforced";
this.buttonSellReinforced.Size = new System.Drawing.Size(125, 33);
this.buttonSellReinforced.Size = new System.Drawing.Size(141, 46);
this.buttonSellReinforced.TabIndex = 7;
this.buttonSellReinforced.Text = "Продать изделие";
this.buttonSellReinforced.UseVisualStyleBackColor = true;
@ -229,9 +241,9 @@
//
// buttonAddReinforcedInShop
//
this.buttonAddReinforcedInShop.Location = new System.Drawing.Point(905, 365);
this.buttonAddReinforcedInShop.Location = new System.Drawing.Point(1036, 456);
this.buttonAddReinforcedInShop.Name = "buttonAddReinforcedInShop";
this.buttonAddReinforcedInShop.Size = new System.Drawing.Size(125, 39);
this.buttonAddReinforcedInShop.Size = new System.Drawing.Size(141, 51);
this.buttonAddReinforcedInShop.TabIndex = 8;
this.buttonAddReinforcedInShop.Text = "Пополнение магазина";
this.buttonAddReinforcedInShop.UseVisualStyleBackColor = true;
@ -239,9 +251,9 @@
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1058, 475);
this.ClientSize = new System.Drawing.Size(1209, 633);
this.Controls.Add(this.buttonAddReinforcedInShop);
this.Controls.Add(this.buttonSellReinforced);
this.Controls.Add(this.UpdateListButton);
@ -250,6 +262,7 @@
this.Controls.Add(this.DataGridView);
this.Controls.Add(this.MenuStrip);
this.MainMenuStrip = this.MenuStrip;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "FormMain";
this.Text = "Завод ЖБИ";
this.Load += new System.EventHandler(this.FormMain_Load);
@ -279,10 +292,11 @@
private ToolStripMenuItem запускРаботToolStripMenuItem;
private ToolStripMenuItem исполнителиToolStripMenuItem;
private ToolStripMenuItem МагазинtoolStripMenuItem;
private Button buttonSellReinforced;
private Button buttonAddReinforcedInShop;
private ToolStripMenuItem списокМагазиновToolStripMenuItem;
private ToolStripMenuItem магазиныСИзделиямиToolStripMenuItem;
private ToolStripMenuItem списокГруппЗаказовToolStripMenuItem;
private ToolStripMenuItem письмаToolStripMenuItem;
private Button buttonSellReinforced;
private Button buttonAddReinforcedInShop;
}
}

View File

@ -258,25 +258,6 @@ namespace PrecastConcretePlantView
}
}
private void buttonSellReinforced_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSellReinforced));
if (service is FormSellReinforced form)
{
form.ShowDialog();
}
}
private void buttonAddReinforcedInShop_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReinforcedShop));
if (service is FormReinforcedShop form)
{
form.ShowDialog();
}
}
private void списокМагазиновToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
@ -304,5 +285,33 @@ namespace PrecastConcretePlantView
form.ShowDialog();
}
}
private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormViewMail));
if (service is FormViewMail form)
{
form.ShowDialog();
}
}
private void buttonSellReinforced_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSellReinforced));
if (service is FormSellReinforced form)
{
form.ShowDialog();
}
}
private void buttonAddReinforcedInShop_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReinforcedShop));
if (service is FormReinforcedShop form)
{
form.ShowDialog();
}
}
}
}

View File

@ -21,11 +21,9 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
private readonly IOrderStorage _orderStorage;
private readonly IReinforcedStorage _reinforcedStorage;
private readonly IShopLogic _shopLogic;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IReinforcedStorage reinforcedStorage, IShopLogic shopLogic)
private readonly AbstractMailWorker _mailWorker;
private readonly IClientLogic _clientLogic;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, AbstractMailWorker mailWorker, IClientLogic clientLogic)
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IReinforcedStorage reinforcedStorage, IShopLogic shopLogic, AbstractMailWorker mailWorker, IClientLogic clientLogic)
{
_logger = logger;
_shopLogic = shopLogic;
@ -46,15 +44,13 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
}
model.Status = OrderStatus.Принят;
model.DateCreate = DateTime.Now;
if (_orderStorage.Insert(model) == null)
{
var result = _orderStorage.Insert(model);
if (result == null)
{
model.Status = OrderStatus.Неизвестен;
{
_logger.LogWarning("Insert operation failed");
return false;
}
SendOrderStatusMail(result.ClientId, $"Новый заказ создан. Номер заказа #{result.Id}", $"Заказ #{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
return true;
}
@ -98,7 +94,6 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
{
throw new ArgumentException("Время создания заказа не может быть больше времени его выполнения", nameof(model.DateImplement));
}
SendOrderStatusMail(result.ClientId, $"Новый заказ создан. Номер заказа #{result.Id}", $"Заказ #{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
return true;
}

View File

@ -12,13 +12,8 @@ using PrecastConcretePlantDatabaseImplement;
namespace PrecastConcretePlantDatabaseImplement.Migrations
{
[DbContext(typeof(PrecastConcretePlantDataBase))]
<<<<<<<< HEAD:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230422114831_Lab7.Designer.cs
[Migration("20230422114831_Lab7")]
partial class Lab7
========
[Migration("20230424164351_lab6hard")]
partial class lab6hard
>>>>>>>> LabWork06_hard:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230424164351_lab6hard.Designer.cs
[Migration("20230503170550_Lab7Hard")]
partial class Lab7Hard
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -221,15 +216,6 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
b.ToTable("ReinforcedComponents");
});
<<<<<<<< HEAD:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230422114831_Lab7.Designer.cs
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Client", "Client")
.WithMany("Messages")
.HasForeignKey("ClientId");
b.Navigation("Client");
========
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
@ -281,7 +267,15 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
b.HasIndex("ShopId");
b.ToTable("ShopReinforcedies");
>>>>>>>> LabWork06_hard:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230424164351_lab6hard.Designer.cs
});
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Client", "Client")
.WithMany("Messages")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Order", b =>

View File

@ -6,11 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace PrecastConcretePlantDatabaseImplement.Migrations
{
/// <inheritdoc />
<<<<<<<< HEAD:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230422114831_Lab7.cs
public partial class Lab7 : Migration
========
public partial class lab6hard : Migration
>>>>>>>> LabWork06_hard:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230424164351_lab6hard.cs
public partial class Lab7Hard : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -75,7 +71,22 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
});
migrationBuilder.CreateTable(
<<<<<<<< HEAD:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230422114831_Lab7.cs
name: "Shops",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
ReinforcedMaxCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
@ -94,21 +105,6 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id");
========
name: "Shops",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
ReinforcedMaxCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
>>>>>>>> LabWork06_hard:PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230424164351_lab6hard.cs
});
migrationBuilder.CreateTable(

View File

@ -213,6 +213,59 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
b.ToTable("ReinforcedComponents");
});
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpening")
.HasColumnType("datetime2");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ReinforcedMaxCount")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ReinforcedId")
.HasColumnType("int");
b.Property<int>("ShopId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ReinforcedId");
b.HasIndex("ShopId");
b.ToTable("ShopReinforcedies");
});
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Client", "Client")

View File

@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PrecastConcretePlantDatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrecastConcretePlantDatabaseImplement
{
public class PrecastConcretePlantDataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=PrecastConcretePlantDataBaseFullHard;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Reinforced> Reinforcedies { set; get; }
public virtual DbSet<ReinforcedComponent> ReinforcedComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Shop> Shops { set; get; }
public virtual DbSet<ShopReinforced> ShopReinforcedies { set; get; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }
}
}

View File

@ -14,7 +14,7 @@ namespace PrecastConcretePlantDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=MAKSIM\SQLEXPRESS;Initial Catalog=PrecastConcretePlantDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=MAKSIM\SQLEXPRESS;Initial Catalog=PrecastConcretePlantDataBaseFullHard;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
@ -22,6 +22,8 @@ namespace PrecastConcretePlantDatabaseImplement
public virtual DbSet<Reinforced> Reinforcedies { set; get; }
public virtual DbSet<ReinforcedComponent> ReinforcedComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Shop> Shops { set; get; }
public virtual DbSet<ShopReinforced> ShopReinforcedies { set; get; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }
public virtual DbSet<MessageInfo> Messages { set; get; }