вот вроде так

This commit is contained in:
Inohara 2023-05-04 20:35:08 +04:00
parent 7fae4ed8f3
commit 5e6d303874
13 changed files with 146 additions and 594 deletions

View File

@ -22,183 +22,6 @@
#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()
{
buttonUpdate = new Button();
buttonSetToFinish = new Button();
buttonCreateOrder = new Button();
dataGridView = new DataGridView();
menuStrip = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
компонентыToolStripMenuItem = new ToolStripMenuItem();
мороженоеToolStripMenuItem = new ToolStripMenuItem();
клиентыToolStripMenuItem = new ToolStripMenuItem();
ImplementersToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
iceCreamComponentsToolStripMenuItem = new ToolStripMenuItem();
iceCreamToolStripMenuItem = new ToolStripMenuItem();
ordersToolStripMenuItem = new ToolStripMenuItem();
DoWorkToolStripMenuItem = new ToolStripMenuItem();
MailToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
//
// buttonUpdate
//
buttonUpdate.Location = new Point(1081, 112);
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(170, 37);
buttonUpdate.TabIndex = 13;
buttonUpdate.Text = "Обновить";
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += buttonUpdate_Click;
//
// buttonSetToFinish
//
buttonSetToFinish.Location = new Point(1081, 70);
buttonSetToFinish.Margin = new Padding(3, 2, 3, 2);
buttonSetToFinish.Name = "buttonSetToFinish";
buttonSetToFinish.Size = new Size(170, 37);
buttonSetToFinish.TabIndex = 12;
buttonSetToFinish.Text = "Заказ выдан";
buttonSetToFinish.UseVisualStyleBackColor = true;
buttonSetToFinish.Click += buttonSetToFinish_Click;
//
// buttonCreateOrder
//
buttonCreateOrder.Location = new Point(1081, 29);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(170, 37);
buttonCreateOrder.TabIndex = 9;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += buttonCreateOrder_Click;
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(12, 26);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(1063, 305);
dataGridView.TabIndex = 8;
//
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, DoWorkToolStripMenuItem, MailToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Padding = new Padding(5, 2, 0, 2);
menuStrip.Size = new Size(1261, 24);
menuStrip.TabIndex = 7;
menuStrip.Text = "Справочники";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, мороженоеToolStripMenuItem, клиентыToolStripMenuItem, ImplementersToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники";
//
// компонентыToolStripMenuItem
//
компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
компонентыToolStripMenuItem.Size = new Size(149, 22);
компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
//
// мороженоеToolStripMenuItem
//
мороженоеToolStripMenuItem.Name = ороженоеToolStripMenuItem";
мороженоеToolStripMenuItem.Size = new Size(149, 22);
мороженоеToolStripMenuItem.Text = "Мороженое";
мороженоеToolStripMenuItem.Click += мороженоеToolStripMenuItem_Click;
//
// клиентыToolStripMenuItem
//
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
клиентыToolStripMenuItem.Size = new Size(149, 22);
клиентыToolStripMenuItem.Text = "Клиенты";
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
//
// ImplementersToolStripMenuItem
//
ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem";
ImplementersToolStripMenuItem.Size = new Size(149, 22);
ImplementersToolStripMenuItem.Text = "Исполнители";
ImplementersToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { iceCreamComponentsToolStripMenuItem, iceCreamToolStripMenuItem, ordersToolStripMenuItem });
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// iceCreamComponentsToolStripMenuItem
//
iceCreamComponentsToolStripMenuItem.Name = "iceCreamComponentsToolStripMenuItem";
iceCreamComponentsToolStripMenuItem.Size = new Size(238, 22);
iceCreamComponentsToolStripMenuItem.Text = "Список мороженых";
iceCreamComponentsToolStripMenuItem.Click += IceCreamsToolStripMenuItem_Click;
//
// iceCreamToolStripMenuItem
//
iceCreamToolStripMenuItem.Name = "iceCreamToolStripMenuItem";
iceCreamToolStripMenuItem.Size = new Size(238, 22);
iceCreamToolStripMenuItem.Text = "Мороженые с компонентами";
iceCreamToolStripMenuItem.Click += IceCreamComponentsToolStripMenuItem_Click;
//
// ordersToolStripMenuItem
//
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(238, 22);
ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
// DoWorkToolStripMenuItem
//
DoWorkToolStripMenuItem.Name = "DoWorkToolStripMenuItem";
DoWorkToolStripMenuItem.Size = new Size(92, 20);
DoWorkToolStripMenuItem.Text = "Запуск работ";
DoWorkToolStripMenuItem.Click += DoWorkToolStripMenuItem_Click;
//
// MailToolStripMenuItem
//
MailToolStripMenuItem.Name = "MailToolStripMenuItem";
MailToolStripMenuItem.Size = new Size(62, 20);
MailToolStripMenuItem.Text = "Письма";
MailToolStripMenuItem.Click += MailToolStripMenuItem_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1261, 347);
Controls.Add(buttonUpdate);
Controls.Add(buttonSetToFinish);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip);
Name = "FormMain";
Text = "Магазин мороженого";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
@ -224,6 +47,7 @@
this.shopWorkloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersByDateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DoWorkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MailToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonSupplyShop = new System.Windows.Forms.Button();
this.SellIceCreamButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
@ -232,7 +56,7 @@
//
// buttonUpdate
//
this.buttonUpdate.Location = new System.Drawing.Point(1231, 392);
this.buttonUpdate.Location = new System.Drawing.Point(1235, 149);
this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(194, 49);
this.buttonUpdate.TabIndex = 13;
@ -242,7 +66,7 @@
//
// buttonSetToFinish
//
this.buttonSetToFinish.Location = new System.Drawing.Point(1231, 90);
this.buttonSetToFinish.Location = new System.Drawing.Point(1235, 93);
this.buttonSetToFinish.Name = "buttonSetToFinish";
this.buttonSetToFinish.Size = new System.Drawing.Size(194, 49);
this.buttonSetToFinish.TabIndex = 12;
@ -252,7 +76,7 @@
//
// buttonCreateOrder
//
this.buttonCreateOrder.Location = new System.Drawing.Point(1231, 35);
this.buttonCreateOrder.Location = new System.Drawing.Point(1235, 39);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(194, 49);
this.buttonCreateOrder.TabIndex = 9;
@ -267,7 +91,7 @@
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(1202, 407);
this.dataGridView.Size = new System.Drawing.Size(1215, 407);
this.dataGridView.TabIndex = 8;
//
// menuStrip
@ -276,11 +100,12 @@
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem,
this.отчетыToolStripMenuItem,
this.DoWorkToolStripMenuItem});
this.DoWorkToolStripMenuItem,
this.MailToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Padding = new System.Windows.Forms.Padding(6, 3, 0, 3);
this.menuStrip.Size = new System.Drawing.Size(1433, 30);
this.menuStrip.Size = new System.Drawing.Size(1441, 30);
this.menuStrip.TabIndex = 7;
this.menuStrip.Text = "Справочники";
//
@ -349,21 +174,18 @@
this.iceCreamComponentsToolStripMenuItem.Name = "iceCreamComponentsToolStripMenuItem";
this.iceCreamComponentsToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.iceCreamComponentsToolStripMenuItem.Text = "Список мороженых";
this.iceCreamComponentsToolStripMenuItem.Click += new System.EventHandler(this.IceCreamsToolStripMenuItem_Click);
//
// iceCreamToolStripMenuItem
//
this.iceCreamToolStripMenuItem.Name = "iceCreamToolStripMenuItem";
this.iceCreamToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.iceCreamToolStripMenuItem.Text = "Мороженые с компонентами";
this.iceCreamToolStripMenuItem.Click += new System.EventHandler(this.IceCreamComponentsToolStripMenuItem_Click);
//
// ordersToolStripMenuItem
//
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.ordersToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// listShopsToolStripMenuItem
//
@ -393,11 +215,18 @@
this.DoWorkToolStripMenuItem.Text = "Запуск работ";
this.DoWorkToolStripMenuItem.Click += new System.EventHandler(this.DoWorkToolStripMenuItem_Click);
//
// MailToolStripMenuItem
//
this.MailToolStripMenuItem.Name = "MailToolStripMenuItem";
this.MailToolStripMenuItem.Size = new System.Drawing.Size(77, 24);
this.MailToolStripMenuItem.Text = "Письма";
this.MailToolStripMenuItem.Click += new System.EventHandler(this.MailToolStripMenuItem_Click);
//
// buttonSupplyShop
//
this.buttonSupplyShop.Location = new System.Drawing.Point(1231, 292);
this.buttonSupplyShop.Location = new System.Drawing.Point(1235, 303);
this.buttonSupplyShop.Name = "buttonSupplyShop";
this.buttonSupplyShop.Size = new System.Drawing.Size(194, 44);
this.buttonSupplyShop.Size = new System.Drawing.Size(194, 49);
this.buttonSupplyShop.TabIndex = 14;
this.buttonSupplyShop.Text = "Пополнение магазина";
this.buttonSupplyShop.UseVisualStyleBackColor = true;
@ -405,9 +234,9 @@
//
// SellIceCreamButton
//
this.SellIceCreamButton.Location = new System.Drawing.Point(1231, 248);
this.SellIceCreamButton.Location = new System.Drawing.Point(1235, 358);
this.SellIceCreamButton.Name = "SellIceCreamButton";
this.SellIceCreamButton.Size = new System.Drawing.Size(194, 40);
this.SellIceCreamButton.Size = new System.Drawing.Size(194, 49);
this.SellIceCreamButton.TabIndex = 15;
this.SellIceCreamButton.Text = "Продажа мороженого";
this.SellIceCreamButton.UseVisualStyleBackColor = true;
@ -417,7 +246,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1433, 467);
this.ClientSize = new System.Drawing.Size(1441, 463);
this.Controls.Add(this.SellIceCreamButton);
this.Controls.Add(this.buttonSupplyShop);
this.Controls.Add(this.buttonUpdate);
@ -425,7 +254,7 @@
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip);
this.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "FormMain";
this.Text = "Магазин мороженого";
this.Load += new System.EventHandler(this.FormMain_Load);
@ -439,23 +268,6 @@
#endregion
private Button buttonUpdate;
private Button buttonSetToFinish;
private Button buttonCreateOrder;
private DataGridView dataGridView;
private MenuStrip menuStrip;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem компонентыToolStripMenuItem;
private ToolStripMenuItem мороженоеToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem iceCreamComponentsToolStripMenuItem;
private ToolStripMenuItem iceCreamToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
private ToolStripMenuItem клиентыToolStripMenuItem;
private ToolStripMenuItem ImplementersToolStripMenuItem;
private ToolStripMenuItem DoWorkToolStripMenuItem;
private ToolStripMenuItem MailToolStripMenuItem;
}
private Button buttonUpdate;
private Button buttonSetToFinish;
private Button buttonCreateOrder;
@ -472,10 +284,11 @@
private ToolStripMenuItem ImplementersToolStripMenuItem;
private ToolStripMenuItem DoWorkToolStripMenuItem;
private ToolStripMenuItem магазиныToolStripMenuItem;
private Button buttonSupplyShop;
private Button SellIceCreamButton;
private ToolStripMenuItem listShopsToolStripMenuItem;
private ToolStripMenuItem shopWorkloadToolStripMenuItem;
private ToolStripMenuItem ordersByDateToolStripMenuItem;
private ToolStripMenuItem MailToolStripMenuItem;
private Button buttonSupplyShop;
private Button SellIceCreamButton;
}
}

View File

@ -146,15 +146,6 @@ namespace IceCreamShopView
}
}
}
private void buttonCreateOrder_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
if (service is FormCreateOrder form)
{
form.ShowDialog();
LoadData();
}
}
private void buttonSetToFinish_Click(object sender, EventArgs e)
{
@ -274,15 +265,6 @@ namespace IceCreamShopView
}
}
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));

View File

@ -60,4 +60,7 @@
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>53</value>
</metadata>
</root>

View File

@ -101,14 +101,16 @@ namespace IceCreamShop
services.AddTransient<FormReportProductComponents>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormViewMail>();
}
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormShopSupply>();
services.AddTransient<FormSellIceCream>();
services.AddTransient<FormReportShopWorkload>();
services.AddTransient<FormReportDateOrders>();
}
services.AddTransient<FormReplyMail>();
}
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
}
}

View File

@ -152,7 +152,7 @@ namespace IceCreamShopClientApp.Controllers
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
return View();
}
[HttpGet]

View File

@ -10,6 +10,7 @@
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
</head>
<body>
<header>

View File

@ -7,9 +7,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -1,298 +0,0 @@
// <auto-generated />
using System;
using IceCreamShopDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace IceCreamShopDatabaseImplement.Migrations
{
[DbContext(typeof(IceCreamShopDatabase))]
[Migration("20230411104402_LabWork07_mail")]
partial class LabWork07_mail
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("IceCreamShopDatabaseImplement.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("IceCreamShopDatabaseImplement.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("IceCreamShopDatabaseImplement.Models.IceCream", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("IceCreamName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("IceCreams");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", 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>("IceCreamId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("IceCreamId");
b.ToTable("IceCreamComponents");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.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("IceCreamShopDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.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>("IceCreamId")
.HasColumnType("int");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("IceCreamId");
b.HasIndex("ImplementerId");
b.ToTable("Orders");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b =>
{
b.HasOne("IceCreamShopDatabaseImplement.Models.Component", "Component")
.WithMany("IceCreamComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream")
.WithMany("Components")
.HasForeignKey("IceCreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("IceCream");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("IceCreamShopDatabaseImplement.Models.Client", "Client")
.WithMany("Messages")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b =>
{
b.HasOne("IceCreamShopDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream")
.WithMany("Orders")
.HasForeignKey("IceCreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IceCreamShopDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.Navigation("Client");
b.Navigation("IceCream");
b.Navigation("Implementer");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Client", b =>
{
b.Navigation("Messages");
b.Navigation("Orders");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b =>
{
b.Navigation("IceCreamComponents");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,48 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IceCreamShopDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class LabWork07_mail : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.MessageId);
table.ForeignKey(
name: "FK_Messages_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
}
}
}

View File

@ -12,15 +12,15 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IceCreamShopDatabaseImplement.Migrations
{
[DbContext(typeof(IceCreamShopDatabase))]
[Migration("20230425055945_lab6_migr")]
partial class lab6_migr
[Migration("20230504152801_addsToMessage")]
partial class addsToMessage
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.3")
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@ -143,6 +143,42 @@ namespace IceCreamShopDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<bool>("HasRead")
.HasColumnType("bit");
b.Property<string>("Reply")
.HasColumnType("nvarchar(max)");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -263,6 +299,15 @@ namespace IceCreamShopDatabaseImplement.Migrations
b.Navigation("IceCream");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("IceCreamShopDatabaseImplement.Models.Client", "Client")
.WithMany("Messages")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b =>
{
b.HasOne("IceCreamShopDatabaseImplement.Models.Client", "Client")
@ -316,6 +361,8 @@ namespace IceCreamShopDatabaseImplement.Migrations
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Client", b =>
{
b.Navigation("Messages");
b.Navigation("Orders");
});

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace IceCreamShopDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class lab6_migr : Migration
public partial class addsToMessage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -70,6 +70,29 @@ namespace IceCreamShopDatabaseImplement.Migrations
table.PrimaryKey("PK_Implementers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
HasRead = table.Column<bool>(type: "bit", nullable: false),
Reply = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.MessageId);
table.ForeignKey(
name: "FK_Messages_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "IceCreamComponents",
columns: table => new
@ -193,6 +216,11 @@ namespace IceCreamShopDatabaseImplement.Migrations
table: "IceCreamComponents",
column: "IceCreamId");
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
@ -230,6 +258,9 @@ namespace IceCreamShopDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "IceCreamComponents");
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "Orders");

View File

@ -17,7 +17,7 @@ namespace IceCreamShopDatabaseImplement.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.3")
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@ -155,6 +155,12 @@ namespace IceCreamShopDatabaseImplement.Migrations
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<bool>("HasRead")
.HasColumnType("bit");
b.Property<string>("Reply")
.HasColumnType("nvarchar(max)");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
@ -320,6 +326,15 @@ namespace IceCreamShopDatabaseImplement.Migrations
b.Navigation("Client");
b.Navigation("IceCream");
b.Navigation("Implementer");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b =>
{
b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", null)
.WithMany("Shops")
.HasForeignKey("IceCreamId");
});
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIcecream", b =>

View File

@ -16,6 +16,8 @@ namespace IceCreamShopRestApi.Controllers
private readonly IMessageInfoLogic _mailLogic;
public int pageSize = 4;
public ClientController(IClientLogic logic, IMessageInfoLogic mailLogic, ILogger<ClientController> logger)
{
_logger = logger;
@ -70,13 +72,15 @@ namespace IceCreamShopRestApi.Controllers
}
[HttpGet]
public List<MessageInfoViewModel>? GetMessages(int clientId)
public List<MessageInfoViewModel>? GetMessages(int clientId, int page)
{
try
{
return _mailLogic.ReadList(new MessageInfoSearchModel
{
ClientId = clientId
ClientId = clientId,
Page = page,
PageSize = pageSize
});
}
catch (Exception ex)