сохра

This commit is contained in:
Extrimal 2024-05-29 12:33:22 +04:00
parent 2c4330eace
commit 7b9c99f532
14 changed files with 255 additions and 252 deletions

View File

@ -487,8 +487,12 @@ namespace HotelAdministratorApp.Controllers
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
}
using var context = new HotelDataBase();
var roomElem = APIClient.GetRequest<RoomViewModel>($"api/main/getroombyid?roomId={room}");
var dinners = _dinner.ReadList(new DinnerSearchModel { AdministratorId = APIClient.Administrator.Id });
var roomElem = APIClient.GetRequest<RoomViewModel>($"api/main/getroombyid?roomId={room}"); //комната со всеми ее атрибутами
var dinners = _dinner.ReadList(new DinnerSearchModel { AdministratorId = APIClient.Administrator.Id }); //все обеды у администратора
List<int> roomDinnersIds = context.RoomDinners
.Where(rd => rd.RoomId == room)
.Select(rd => rd.DinnerId)
.ToList();
APIClient.PostRequest("api/main/updateroom", new RoomBindingModel
{

View File

@ -35,7 +35,7 @@ namespace HotelBusinessLogic.BusinessLogic
_saveToExcel.CreateReport(new ExcelInfoAdministrator
{
FileName = model.FileName,
Title = "Список покупок по медикаментам",
Title = "Список покупок по обедам",
MealPlanDinners = GetMealPlanDinners(model)
});
}
@ -45,7 +45,7 @@ namespace HotelBusinessLogic.BusinessLogic
_saveToWord.CreateDoc(new WordInfoAdministrator
{
FileName = model.FileName,
Title = "Список покупок по медикаментам",
Title = "Список покупок по обедам",
MealPlanDinners = GetMealPlanDinners(model)
});
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -8,8 +8,9 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -18,21 +18,21 @@ namespace HotelBusinessLogic.OfficePackage
Text = info.Title,
Style =
"NormalTitle",
ParagraphAlignment = PdfParagraphAligmentType.Center
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
Style
= "Normal",
ParagraphAlignment = PdfParagraphAligmentType.Center
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "4cm", "4cm", "4cm", "4cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Дата", "Название обеда", "Комната", "Бронь" },
Texts = new List<string> { "Дата", "Название медикамента", "Посещение ", "Лекарство" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAligmentType.Center
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var dinner in info.ReportRoomsConferences)
{
@ -40,24 +40,24 @@ namespace HotelBusinessLogic.OfficePackage
{
Texts = new List<string> { "", dinner.DinnerName, "", "" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAligmentType.Center
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var conference in dinner.Conferences)
foreach (var conf in dinner.Conferences)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { conference.StartDate.ToString(), "", "", conference.ConferenceName },
Texts = new List<string> { conf.StartDate.ToString(), "", "", conf.ConferenceName },
Style = "Normal",
ParagraphAlignment = PdfParagraphAligmentType.Center
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
}
foreach (var room in dinner.Rooms)
foreach (var guidance in dinner.Rooms)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { room.DateCreate.ToString(), "", room.RoomNumber.ToString(), "" },
Texts = new List<string> { guidance.DateCreate.ToString(), "", guidance.RoomNumber.ToString(), "" },
Style = "Normal",
ParagraphAlignment = PdfParagraphAligmentType.Center
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace HotelBusinessLogic.OfficePackage.HelperEnums
{
public enum PdfParagraphAligmentType
public enum PdfParagraphAlignmentType
{
Center,
Left,

View File

@ -14,6 +14,5 @@ namespace HotelBusinessLogic.OfficePackage.HelperModels
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public List<ReportRoomsConferencesViewModel> ReportRoomsConferences { get; set; } = new();
/* public List<ReportVisitsDrugsViewModel> ReportVisitsDrugs { get; set; } = new();*/
}
}

View File

@ -11,7 +11,7 @@ namespace HotelBusinessLogic.OfficePackage.HelperModels
{
public string Text { get; set; } = string.Empty;
public string Style { get; set; } = string.Empty;
public PdfParagraphAligmentType ParagraphAlignment { get; set; }
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
}
}

View File

@ -11,6 +11,6 @@ namespace HotelBusinessLogic.OfficePackage.HelperModels
{
public List<string> Texts { get; set; } = new();
public string Style { get; set; } = string.Empty;
public PdfParagraphAligmentType ParagraphAlignment { get; set; }
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
}
}

View File

@ -17,13 +17,13 @@ namespace HotelBusinessLogic.OfficePackage.Implements
private Section? _section;
private Table? _table;
private static ParagraphAlignment
GetParagraphAlignment(PdfParagraphAligmentType type)
GetParagraphAlignment(PdfParagraphAlignmentType type)
{
return type switch
{
PdfParagraphAligmentType.Center => ParagraphAlignment.Center,
PdfParagraphAligmentType.Left => ParagraphAlignment.Left,
PdfParagraphAligmentType.Right => ParagraphAlignment.Right,
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
PdfParagraphAlignmentType.Right => ParagraphAlignment.Right,
_ => ParagraphAlignment.Justify,
};
}

View File

@ -6,18 +6,16 @@ namespace HotelDataBaseImplement
{
public class HotelDataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=Hotel_bd;Username=postgres;Password=admin");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=HotellllDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
public virtual DbSet<Conference> Conferences { get; set; }
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Conference> Conferences { get; set; }
public virtual DbSet<MealPlan> MealPlans { set; get; }
public virtual DbSet<Participant> Participants { set; get; }
public virtual DbSet<Organiser> Organisers { set; get; }

View File

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

View File

@ -3,17 +3,17 @@ using System;
using HotelDataBaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace HotelDataBaseImplement.Migrations
{
[DbContext(typeof(HotelDataBase))]
[Migration("20240501171235_DeleteManyMigration")]
partial class DeleteManyMigration
[Migration("20240528212239_Init")]
partial class Init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,37 +21,37 @@ namespace HotelDataBaseImplement.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
.HasAnnotation("Relational:MaxIdentifierLength", 128);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("HotelDataBaseImplement.Models.Administrator", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AdministratorEmail")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorFIO")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorLogin")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorPassword")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorPhone")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -62,23 +62,23 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConferenceName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<int>("OrganiserId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -91,22 +91,22 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AdministratorId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int?>("ConferenceId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<DateTime?>("DateСonference")
.HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<string>("PlaceСonference")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -121,15 +121,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ConferenceBookingId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("DinnerId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -144,15 +144,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ConferenceId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("ParticipantId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -167,22 +167,22 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AdministratorId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("DinnerName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<double>("DinnerPrice")
.HasColumnType("double precision");
.HasColumnType("float");
b.Property<int>("DinnerСalorieСontent")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -195,19 +195,19 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("MealPlanName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<double>("MealPlanPrice")
.HasColumnType("double precision");
.HasColumnType("float");
b.Property<int>("OrganiserId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -220,15 +220,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("MealPlanId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("ParticipantId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -243,29 +243,29 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("OrganiserEmail")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserFIO")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserLogin")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserNumber")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserPassword")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -276,20 +276,20 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Number")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<int>("OrganiserId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("ParticipantFIO")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -302,24 +302,24 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AdministratorId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<int?>("MealPlanId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("RoomNumber")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<double>("RoomPrice")
.HasColumnType("double precision");
.HasColumnType("float");
b.HasKey("Id");
@ -334,15 +334,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DinnerId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("RoomId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");

View File

@ -1,13 +1,12 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace HotelDataBaseImplement.Migrations
{
/// <inheritdoc />
public partial class DeleteManyMigration : Migration
public partial class Init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -16,13 +15,13 @@ namespace HotelDataBaseImplement.Migrations
name: "Administrators",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
AdministratorFIO = table.Column<string>(type: "text", nullable: false),
AdministratorPhone = table.Column<string>(type: "text", nullable: false),
AdministratorLogin = table.Column<string>(type: "text", nullable: false),
AdministratorPassword = table.Column<string>(type: "text", nullable: false),
AdministratorEmail = table.Column<string>(type: "text", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AdministratorFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
AdministratorPhone = table.Column<string>(type: "nvarchar(max)", nullable: false),
AdministratorLogin = table.Column<string>(type: "nvarchar(max)", nullable: false),
AdministratorPassword = table.Column<string>(type: "nvarchar(max)", nullable: false),
AdministratorEmail = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
@ -33,13 +32,13 @@ namespace HotelDataBaseImplement.Migrations
name: "Organisers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OrganiserLogin = table.Column<string>(type: "text", nullable: false),
OrganiserPassword = table.Column<string>(type: "text", nullable: false),
OrganiserEmail = table.Column<string>(type: "text", nullable: false),
OrganiserNumber = table.Column<string>(type: "text", nullable: false),
OrganiserFIO = table.Column<string>(type: "text", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OrganiserLogin = table.Column<string>(type: "nvarchar(max)", nullable: false),
OrganiserPassword = table.Column<string>(type: "nvarchar(max)", nullable: false),
OrganiserEmail = table.Column<string>(type: "nvarchar(max)", nullable: false),
OrganiserNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
OrganiserFIO = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
@ -50,12 +49,12 @@ namespace HotelDataBaseImplement.Migrations
name: "Dinners",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DinnerName = table.Column<string>(type: "text", nullable: false),
DinnerСalorieСontent = table.Column<int>(type: "integer", nullable: false),
DinnerPrice = table.Column<double>(type: "double precision", nullable: false),
AdministratorId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DinnerName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DinnerСalorieСontent = table.Column<int>(type: "int", nullable: false),
DinnerPrice = table.Column<double>(type: "float", nullable: false),
AdministratorId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -72,12 +71,12 @@ namespace HotelDataBaseImplement.Migrations
name: "Conferences",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ConferenceName = table.Column<string>(type: "text", nullable: false),
Subject = table.Column<string>(type: "text", nullable: false),
StartDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
OrganiserId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ConferenceName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
OrganiserId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -94,11 +93,11 @@ namespace HotelDataBaseImplement.Migrations
name: "MealPlans",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
MealPlanName = table.Column<string>(type: "text", nullable: false),
MealPlanPrice = table.Column<double>(type: "double precision", nullable: false),
OrganiserId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MealPlanName = table.Column<string>(type: "nvarchar(max)", nullable: false),
MealPlanPrice = table.Column<double>(type: "float", nullable: false),
OrganiserId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -115,11 +114,11 @@ namespace HotelDataBaseImplement.Migrations
name: "Participants",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ParticipantFIO = table.Column<string>(type: "text", nullable: false),
Number = table.Column<string>(type: "text", nullable: false),
OrganiserId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ParticipantFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
OrganiserId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -136,12 +135,12 @@ namespace HotelDataBaseImplement.Migrations
name: "ConferenceBookings",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DateСonference = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
AdministratorId = table.Column<int>(type: "integer", nullable: false),
ConferenceId = table.Column<int>(type: "integer", nullable: true),
PlaceСonference = table.Column<string>(type: "text", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DateСonference = table.Column<DateTime>(type: "datetime2", nullable: true),
AdministratorId = table.Column<int>(type: "int", nullable: false),
ConferenceId = table.Column<int>(type: "int", nullable: true),
PlaceСonference = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
@ -156,20 +155,21 @@ namespace HotelDataBaseImplement.Migrations
name: "FK_ConferenceBookings_Conferences_ConferenceId",
column: x => x.ConferenceId,
principalTable: "Conferences",
principalColumn: "Id");
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Rooms",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoomNumber = table.Column<int>(type: "integer", nullable: false),
RoomPrice = table.Column<double>(type: "double precision", nullable: false),
DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
AdministratorId = table.Column<int>(type: "integer", nullable: false),
MealPlanId = table.Column<int>(type: "integer", nullable: true)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoomNumber = table.Column<int>(type: "int", nullable: false),
RoomPrice = table.Column<double>(type: "float", nullable: false),
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
AdministratorId = table.Column<int>(type: "int", nullable: false),
MealPlanId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
@ -184,17 +184,18 @@ namespace HotelDataBaseImplement.Migrations
name: "FK_Rooms_MealPlans_MealPlanId",
column: x => x.MealPlanId,
principalTable: "MealPlans",
principalColumn: "Id");
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ConferenceParticipants",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ParticipantId = table.Column<int>(type: "integer", nullable: false),
ConferenceId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ParticipantId = table.Column<int>(type: "int", nullable: false),
ConferenceId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -204,7 +205,7 @@ namespace HotelDataBaseImplement.Migrations
column: x => x.ConferenceId,
principalTable: "Conferences",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ConferenceParticipants_Participants_ParticipantId",
column: x => x.ParticipantId,
@ -217,10 +218,10 @@ namespace HotelDataBaseImplement.Migrations
name: "MealPlanParticipants",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ParticipantId = table.Column<int>(type: "integer", nullable: false),
MealPlanId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ParticipantId = table.Column<int>(type: "int", nullable: false),
MealPlanId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -230,49 +231,49 @@ namespace HotelDataBaseImplement.Migrations
column: x => x.MealPlanId,
principalTable: "MealPlans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MealPlanParticipants_Participants_ParticipantId",
column: x => x.ParticipantId,
principalTable: "Participants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ConferenceBookingDinners",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ConferenceBookingId = table.Column<int>(type: "integer", nullable: false),
DinnerId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ConferenceBookingId = table.Column<int>(type: "int", nullable: false),
DinnerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ConferenceBookingDinners", x => x.Id);
table.ForeignKey(
name: "FK_ConferenceBookingDinners_ConferenceBookings_ConferenceBooki~",
name: "FK_ConferenceBookingDinners_ConferenceBookings_ConferenceBookingId",
column: x => x.ConferenceBookingId,
principalTable: "ConferenceBookings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ConferenceBookingDinners_Dinners_DinnerId",
column: x => x.DinnerId,
principalTable: "Dinners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RoomDinners",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoomId = table.Column<int>(type: "integer", nullable: false),
DinnerId = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoomId = table.Column<int>(type: "int", nullable: false),
DinnerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -282,13 +283,13 @@ namespace HotelDataBaseImplement.Migrations
column: x => x.DinnerId,
principalTable: "Dinners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_RoomDinners_Rooms_RoomId",
column: x => x.RoomId,
principalTable: "Rooms",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(

View File

@ -3,8 +3,8 @@ using System;
using HotelDataBaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
@ -18,37 +18,37 @@ namespace HotelDataBaseImplement.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
.HasAnnotation("Relational:MaxIdentifierLength", 128);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("HotelDataBaseImplement.Models.Administrator", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AdministratorEmail")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorFIO")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorLogin")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorPassword")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("AdministratorPhone")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -59,23 +59,23 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConferenceName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<int>("OrganiserId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -88,22 +88,22 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AdministratorId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int?>("ConferenceId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<DateTime?>("DateСonference")
.HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<string>("PlaceСonference")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -118,15 +118,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ConferenceBookingId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("DinnerId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -141,15 +141,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ConferenceId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("ParticipantId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -164,22 +164,22 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AdministratorId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("DinnerName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<double>("DinnerPrice")
.HasColumnType("double precision");
.HasColumnType("float");
b.Property<int>("DinnerСalorieСontent")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -192,19 +192,19 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("MealPlanName")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<double>("MealPlanPrice")
.HasColumnType("double precision");
.HasColumnType("float");
b.Property<int>("OrganiserId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -217,15 +217,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("MealPlanId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("ParticipantId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -240,29 +240,29 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("OrganiserEmail")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserFIO")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserLogin")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserNumber")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<string>("OrganiserPassword")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -273,20 +273,20 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Number")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.Property<int>("OrganiserId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("ParticipantFIO")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -299,24 +299,24 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AdministratorId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<int?>("MealPlanId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("RoomNumber")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<double>("RoomPrice")
.HasColumnType("double precision");
.HasColumnType("float");
b.HasKey("Id");
@ -331,15 +331,15 @@ namespace HotelDataBaseImplement.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DinnerId")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("RoomId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");