всякая дичь
This commit is contained in:
parent
7885582b9f
commit
f61214dea6
@ -26,7 +26,7 @@ namespace FlowerShopDatabaseImplement.Implements
|
||||
|
||||
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
||||
{
|
||||
if (!model.ClientId.HasValue && !model.PageLength.HasValue && !model.PageIndex.HasValue)
|
||||
if (model == null || !model.ClientId.HasValue && !model.PageLength.HasValue && !model.PageIndex.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
@ -39,11 +39,19 @@ namespace FlowerShopDatabaseImplement.Implements
|
||||
if (model.PageLength.HasValue)
|
||||
{
|
||||
int skipRows = model.PageIndex.HasValue ? (model.PageIndex.Value - 1) * model.PageLength.Value : 0;
|
||||
request = request
|
||||
return context.Messages
|
||||
.Where(x => !x.IsReply)
|
||||
.Where(x => !model.ClientId.HasValue || x.ClientId.HasValue && x.ClientId == model.ClientId)
|
||||
.OrderBy(x => x.DateDelivery)
|
||||
.Skip(skipRows)
|
||||
.Take(model.PageLength.Value);
|
||||
.Take(model.PageLength.Value)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return request
|
||||
return context.Messages
|
||||
.Where(x => !x.IsReply)
|
||||
.Where(x => !model.ClientId.HasValue || x.ClientId.HasValue && x.ClientId == model.ClientId)
|
||||
.OrderBy(x => x.DateDelivery)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -52,6 +60,7 @@ namespace FlowerShopDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new FlowerShopDataBase();
|
||||
return context.Messages
|
||||
.OrderBy(x => x.DateDelivery)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
393
FlowerShopDatabaseImplement/Migrations/20240522041624_InitialCreate.Designer.cs
generated
Normal file
393
FlowerShopDatabaseImplement/Migrations/20240522041624_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,393 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FlowerShopDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FlowerShopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(FlowerShopDataBase))]
|
||||
[Migration("20240522041624_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Flower", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<string>("FlowerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Flowers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.FlowerComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FlowerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("FlowerId");
|
||||
|
||||
b.ToTable("FlowerComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<string>("ImplementerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Qualification")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WorkExperience")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Implementers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.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>("IsReaded")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsReply")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("ReplyMessageId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ReplyMessageId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FlowerId")
|
||||
.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("FlowerId");
|
||||
|
||||
b.HasIndex("ImplementerId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("MaxCapacity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.ShopFlower", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FlowerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FlowerId");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.ToTable("ShopFlowers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.FlowerComponent", b =>
|
||||
{
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("FlowerComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Flower", "Flower")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("FlowerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Flower");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("MessageInfos")
|
||||
.HasForeignKey("ClientId");
|
||||
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.MessageInfo", "Reply")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReplyMessageId");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Reply");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Flower", "Flower")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("FlowerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Implementer", "Implementer")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ImplementerId");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Flower");
|
||||
|
||||
b.Navigation("Implementer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.ShopFlower", b =>
|
||||
{
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Flower", "Flower")
|
||||
.WithMany("ShopFlowers")
|
||||
.HasForeignKey("FlowerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Flowers")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Flower");
|
||||
|
||||
b.Navigation("Shop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("MessageInfos");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("FlowerComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Flower", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("ShopFlowers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Flowers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,283 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FlowerShopDatabaseImplement.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Components",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Cost = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Components", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Flowers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FlowerName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Flowers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Implementers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Qualification = table.Column<int>(type: "int", nullable: false),
|
||||
WorkExperience = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Implementers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shops",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
MaxCapacity = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shops", 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),
|
||||
IsReaded = table.Column<bool>(type: "bit", nullable: false),
|
||||
ReplyMessageId = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
||||
IsReply = table.Column<bool>(type: "bit", 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");
|
||||
table.ForeignKey(
|
||||
name: "FK_Messages_Messages_ReplyMessageId",
|
||||
column: x => x.ReplyMessageId,
|
||||
principalTable: "Messages",
|
||||
principalColumn: "MessageId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FlowerComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FlowerId = table.Column<int>(type: "int", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FlowerComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_FlowerComponents_Components_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_FlowerComponents_Flowers_FlowerId",
|
||||
column: x => x.FlowerId,
|
||||
principalTable: "Flowers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
FlowerId = table.Column<int>(type: "int", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
ImplementerId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Flowers_FlowerId",
|
||||
column: x => x.FlowerId,
|
||||
principalTable: "Flowers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerId",
|
||||
column: x => x.ImplementerId,
|
||||
principalTable: "Implementers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShopFlowers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FlowerId = table.Column<int>(type: "int", nullable: false),
|
||||
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShopFlowers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopFlowers_Flowers_FlowerId",
|
||||
column: x => x.FlowerId,
|
||||
principalTable: "Flowers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopFlowers_Shops_ShopId",
|
||||
column: x => x.ShopId,
|
||||
principalTable: "Shops",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FlowerComponents_ComponentId",
|
||||
table: "FlowerComponents",
|
||||
column: "ComponentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FlowerComponents_FlowerId",
|
||||
table: "FlowerComponents",
|
||||
column: "FlowerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Messages_ClientId",
|
||||
table: "Messages",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Messages_ReplyMessageId",
|
||||
table: "Messages",
|
||||
column: "ReplyMessageId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ClientId",
|
||||
table: "Orders",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_FlowerId",
|
||||
table: "Orders",
|
||||
column: "FlowerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ImplementerId",
|
||||
table: "Orders",
|
||||
column: "ImplementerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopFlowers_FlowerId",
|
||||
table: "ShopFlowers",
|
||||
column: "FlowerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopFlowers_ShopId",
|
||||
table: "ShopFlowers",
|
||||
column: "ShopId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "FlowerComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Messages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShopFlowers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Implementers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Flowers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shops");
|
||||
}
|
||||
}
|
||||
}
|
@ -155,6 +155,15 @@ namespace FlowerShopDatabaseImplement.Migrations
|
||||
b.Property<DateTime>("DateDelivery")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsReaded")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsReply")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("ReplyMessageId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -167,6 +176,8 @@ namespace FlowerShopDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ReplyMessageId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
@ -288,10 +299,16 @@ namespace FlowerShopDatabaseImplement.Migrations
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.WithMany("MessageInfos")
|
||||
.HasForeignKey("ClientId");
|
||||
|
||||
b.HasOne("FlowerShopDatabaseImplement.Models.MessageInfo", "Reply")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReplyMessageId");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Reply");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Order", b =>
|
||||
@ -340,6 +357,8 @@ namespace FlowerShopDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("MessageInfos");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
|
@ -13,6 +13,7 @@ builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
builder.Services.AddTransient<IFlowerStorage, FlowerStorage>();
|
||||
builder.Services.AddTransient<IShopStorage, ShopStorage>();
|
||||
builder.Services.AddTransient<IShopLogic, ShopLogic>();
|
||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<IFlowerLogic, FlowerLogic>();
|
||||
|
34
ProjectFlowerShop/FormViewMail.Designer.cs
generated
34
ProjectFlowerShop/FormViewMail.Designer.cs
generated
@ -34,6 +34,8 @@
|
||||
numericUpDownPage = new NumericUpDown();
|
||||
buttonPreveous = new Button();
|
||||
buttonNext = new Button();
|
||||
pageTextBox = new TextBox();
|
||||
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPage).BeginInit();
|
||||
@ -64,9 +66,9 @@
|
||||
//
|
||||
// buttonOpen
|
||||
//
|
||||
buttonOpen.Location = new Point(722, 187);
|
||||
buttonOpen.Location = new Point(705, 235);
|
||||
buttonOpen.Name = "buttonOpen";
|
||||
buttonOpen.Size = new Size(74, 23);
|
||||
buttonOpen.Size = new Size(106, 23);
|
||||
buttonOpen.TabIndex = 1;
|
||||
buttonOpen.Text = "Прочитать";
|
||||
buttonOpen.UseVisualStyleBackColor = true;
|
||||
@ -74,19 +76,19 @@
|
||||
//
|
||||
// numericUpDownPage
|
||||
//
|
||||
numericUpDownPage.Location = new Point(722, 215);
|
||||
numericUpDownPage.Location = new Point(705, 263);
|
||||
numericUpDownPage.Margin = new Padding(3, 2, 3, 2);
|
||||
numericUpDownPage.Name = "numericUpDownPage";
|
||||
numericUpDownPage.Size = new Size(74, 23);
|
||||
numericUpDownPage.Size = new Size(106, 23);
|
||||
numericUpDownPage.TabIndex = 4;
|
||||
numericUpDownPage.ValueChanged += numericUpDownPage_ValueChanged;
|
||||
//
|
||||
// buttonPreveous
|
||||
//
|
||||
buttonPreveous.Location = new Point(722, 242);
|
||||
buttonPreveous.Location = new Point(705, 289);
|
||||
buttonPreveous.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonPreveous.Name = "buttonPreveous";
|
||||
buttonPreveous.Size = new Size(34, 22);
|
||||
buttonPreveous.Size = new Size(35, 25);
|
||||
buttonPreveous.TabIndex = 5;
|
||||
buttonPreveous.Text = "<-";
|
||||
buttonPreveous.UseVisualStyleBackColor = true;
|
||||
@ -94,20 +96,31 @@
|
||||
//
|
||||
// buttonNext
|
||||
//
|
||||
buttonNext.Location = new Point(763, 242);
|
||||
buttonNext.Location = new Point(776, 289);
|
||||
buttonNext.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonNext.Name = "buttonNext";
|
||||
buttonNext.Size = new Size(34, 22);
|
||||
buttonNext.Size = new Size(35, 25);
|
||||
buttonNext.TabIndex = 6;
|
||||
buttonNext.Text = "->";
|
||||
buttonNext.UseVisualStyleBackColor = true;
|
||||
buttonNext.Click += buttonNext_Click;
|
||||
//
|
||||
// pageTextBox
|
||||
//
|
||||
pageTextBox.Enabled = false;
|
||||
pageTextBox.Location = new Point(746, 289);
|
||||
pageTextBox.Name = "pageTextBox";
|
||||
pageTextBox.ReadOnly = true;
|
||||
pageTextBox.Size = new Size(24, 23);
|
||||
pageTextBox.TabIndex = 7;
|
||||
pageTextBox.Text = "0";
|
||||
//
|
||||
// ViewMailForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(809, 321);
|
||||
ClientSize = new Size(817, 321);
|
||||
Controls.Add(pageTextBox);
|
||||
Controls.Add(buttonNext);
|
||||
Controls.Add(buttonPreveous);
|
||||
Controls.Add(numericUpDownPage);
|
||||
@ -121,6 +134,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPage).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -131,5 +145,7 @@
|
||||
private NumericUpDown numericUpDownPage;
|
||||
private Button buttonPreveous;
|
||||
private Button buttonNext;
|
||||
private TextBox pageTextBox;
|
||||
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ namespace ProjectFlowerShop
|
||||
private readonly ILogger _logger;
|
||||
private readonly IMessageInfoLogic _logic;
|
||||
private int currentPage = 1;
|
||||
private int pageLength = 2;
|
||||
private int pageLength = 3;
|
||||
public FormViewMail(ILogger<FormViewMail> logger, IMessageInfoLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -31,6 +31,7 @@ namespace ProjectFlowerShop
|
||||
{
|
||||
LoadData();
|
||||
numericUpDownPage.Value = pageLength;
|
||||
pageTextBox.Text = currentPage.ToString();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
@ -90,12 +91,14 @@ namespace ProjectFlowerShop
|
||||
private void buttonPreveous_Click(object sender, EventArgs e)
|
||||
{
|
||||
currentPage = Math.Max(1, currentPage - 1);
|
||||
pageTextBox.Text = currentPage.ToString();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void buttonNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
currentPage++;
|
||||
pageTextBox.Text = currentPage.ToString();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ namespace ProjectFlowerShop
|
||||
services.AddTransient<ImplementerForm>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormViewMail>();
|
||||
services.AddTransient<FormLetter>();
|
||||
|
||||
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
|
Loading…
Reference in New Issue
Block a user