Добавлен справочник ResponseArea
This commit is contained in:
@@ -25,6 +25,7 @@ namespace PARR.DAL.Context
|
||||
|
||||
public DbSet<Host> Hosts { get; set; }
|
||||
public DbSet<EkStatus> EkStatuses { get; set; }
|
||||
public DbSet<ResponseArea> ResponseAreas { get; set; }
|
||||
public DbSet<Application> Applications { get; set; }
|
||||
public DbSet<ApplicationType> ApplicationTypes { get; set; }
|
||||
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
|
||||
@@ -137,6 +138,28 @@ namespace PARR.DAL.Context
|
||||
);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ResponseArea>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
new { Code = (int)ResponseAreaEnum.dvgd, Name = "96-ДВС" },
|
||||
new { Code = (int)ResponseAreaEnum.zrw, Name = "92-ВСИБ" },
|
||||
new { Code = (int)ResponseAreaEnum.krw, Name = "88-КРАСН" },
|
||||
new { Code = (int)ResponseAreaEnum.wsr, Name = "83-ЗСИБ" },
|
||||
new { Code = (int)ResponseAreaEnum.surw, Name = "80-ЮУР" },
|
||||
new { Code = (int)ResponseAreaEnum.svrw, Name = "76-СВРД" },
|
||||
new { Code = (int)ResponseAreaEnum.kbsh, Name = "63-КБШ" },
|
||||
new { Code = (int)ResponseAreaEnum.pvrr, Name = "61-ПРИВ" },
|
||||
new { Code = (int)ResponseAreaEnum.serw, Name = "58-ЮВСТ" },
|
||||
new { Code = (int)ResponseAreaEnum.skzd, Name = "51-СКВ" },
|
||||
new { Code = (int)ResponseAreaEnum.nrr, Name = "28-СЕВ" },
|
||||
new { Code = (int)ResponseAreaEnum.grw, Name = "24-ГОР" },
|
||||
new { Code = (int)ResponseAreaEnum.msk, Name = "17-МСК" },
|
||||
new { Code = (int)ResponseAreaEnum.klgd, Name = "10-КЛГ" },
|
||||
new { Code = (int)ResponseAreaEnum.orw, Name = "01-ОКТ" },
|
||||
new { Code = (int)ResponseAreaEnum.gvc, Name = "00-ГВЦ" }
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
94
PARR.DAL/Contracts/ResponseAreaEnum.cs
Normal file
94
PARR.DAL/Contracts/ResponseAreaEnum.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
namespace PARR.DAL.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Коды дорог
|
||||
/// </summary>
|
||||
public enum ResponseAreaEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ДВЖД
|
||||
/// </summary>
|
||||
dvgd = 96,
|
||||
|
||||
/// <summary>
|
||||
/// ЗАБ
|
||||
/// </summary>
|
||||
zrw = 94,
|
||||
|
||||
/// <summary>
|
||||
/// ВСИБ
|
||||
/// </summary>
|
||||
esrr = 92,
|
||||
|
||||
/// <summary>
|
||||
/// КРАСН
|
||||
/// </summary>
|
||||
krw = 88,
|
||||
|
||||
/// <summary>
|
||||
/// ЗСИБ
|
||||
/// </summary>
|
||||
wsr = 83,
|
||||
|
||||
/// <summary>
|
||||
/// ЮУР
|
||||
/// </summary>
|
||||
surw = 80,
|
||||
|
||||
/// <summary>
|
||||
/// СВРД
|
||||
/// </summary>
|
||||
svrw = 76,
|
||||
|
||||
/// <summary>
|
||||
/// КБШ
|
||||
/// </summary>
|
||||
kbsh = 63,
|
||||
|
||||
/// <summary>
|
||||
/// ПРИВ
|
||||
/// </summary>
|
||||
pvrr = 61,
|
||||
|
||||
/// <summary>
|
||||
/// ЮВСТ
|
||||
/// </summary>
|
||||
serw = 58,
|
||||
|
||||
/// <summary>
|
||||
/// СКВ
|
||||
/// </summary>
|
||||
skzd = 51,
|
||||
|
||||
/// <summary>
|
||||
/// СЕВ
|
||||
/// </summary>
|
||||
nrr = 28,
|
||||
|
||||
/// <summary>
|
||||
/// ГОР
|
||||
/// </summary>
|
||||
grw = 24,
|
||||
|
||||
/// <summary>
|
||||
/// МСК
|
||||
/// </summary>
|
||||
msk = 17,
|
||||
|
||||
/// <summary>
|
||||
/// КЛГ
|
||||
/// </summary>
|
||||
klgd = 10,
|
||||
|
||||
/// <summary>
|
||||
/// ОКТ
|
||||
/// </summary>
|
||||
orw = 01,
|
||||
|
||||
/// <summary>
|
||||
/// ГВЦ
|
||||
/// </summary>
|
||||
gvc = 99,
|
||||
}
|
||||
}
|
||||
1636
PARR.DAL/Migrations/20230928015451_AddResponseAreaEnum.Designer.cs
generated
Normal file
1636
PARR.DAL/Migrations/20230928015451_AddResponseAreaEnum.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
112
PARR.DAL/Migrations/20230928015451_AddResponseAreaEnum.cs
Normal file
112
PARR.DAL/Migrations/20230928015451_AddResponseAreaEnum.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddResponseAreaEnum : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Status",
|
||||
table: "Hosts",
|
||||
newName: "StatusStr");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ResponseArea",
|
||||
table: "Hosts",
|
||||
newName: "ResponseAreaStr");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ResponseAreaCode",
|
||||
table: "Hosts",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ResponseAreas",
|
||||
columns: table => new
|
||||
{
|
||||
Code = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ResponseAreas", x => x.Code);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ResponseAreas",
|
||||
columns: new[] { "Code", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "01-ОКТ" },
|
||||
{ 10, "10-КЛГ" },
|
||||
{ 17, "17-МСК" },
|
||||
{ 24, "24-ГОР" },
|
||||
{ 28, "28-СЕВ" },
|
||||
{ 51, "51-СКВ" },
|
||||
{ 58, "58-ЮВСТ" },
|
||||
{ 61, "61-ПРИВ" },
|
||||
{ 63, "63-КБШ" },
|
||||
{ 76, "76-СВРД" },
|
||||
{ 80, "80-ЮУР" },
|
||||
{ 83, "83-ЗСИБ" },
|
||||
{ 88, "88-КРАСН" },
|
||||
{ 94, "92-ВСИБ" },
|
||||
{ 96, "96-ДВС" },
|
||||
{ 99, "00-ГВЦ" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hosts_ResponseAreaCode",
|
||||
table: "Hosts",
|
||||
column: "ResponseAreaCode");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Hosts_ResponseAreas_ResponseAreaCode",
|
||||
table: "Hosts",
|
||||
column: "ResponseAreaCode",
|
||||
principalTable: "ResponseAreas",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Hosts_ResponseAreas_ResponseAreaCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ResponseAreas");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Hosts_ResponseAreaCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ResponseAreaCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "StatusStr",
|
||||
table: "Hosts",
|
||||
newName: "Status");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ResponseAreaStr",
|
||||
table: "Hosts",
|
||||
newName: "ResponseArea");
|
||||
}
|
||||
}
|
||||
}
|
||||
1630
PARR.DAL/Migrations/20230928042307_TblHostsRemoveResponseAreaColumns.Designer.cs
generated
Normal file
1630
PARR.DAL/Migrations/20230928042307_TblHostsRemoveResponseAreaColumns.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblHostsRemoveResponseAreaColumns : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ResponseAreaStr",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StatusStr",
|
||||
table: "Hosts");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ResponseAreaStr",
|
||||
table: "Hosts",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "StatusStr",
|
||||
table: "Hosts",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -595,11 +595,8 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ResponseArea")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("text");
|
||||
b.Property<int>("ResponseAreaCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorkGroup")
|
||||
.HasColumnType("text");
|
||||
@@ -608,6 +605,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasIndex("EkStatusCode");
|
||||
|
||||
b.HasIndex("ResponseAreaCode");
|
||||
|
||||
b.ToTable("Hosts");
|
||||
});
|
||||
|
||||
@@ -635,6 +634,105 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("Processes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b =>
|
||||
{
|
||||
b.Property<int>("Code")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Code"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Code");
|
||||
|
||||
b.ToTable("ResponseAreas");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Code = 96,
|
||||
Name = "96-ДВС"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 94,
|
||||
Name = "92-ВСИБ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 88,
|
||||
Name = "88-КРАСН"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 83,
|
||||
Name = "83-ЗСИБ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 80,
|
||||
Name = "80-ЮУР"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 76,
|
||||
Name = "76-СВРД"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 63,
|
||||
Name = "63-КБШ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 61,
|
||||
Name = "61-ПРИВ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 58,
|
||||
Name = "58-ЮВСТ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 51,
|
||||
Name = "51-СКВ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 28,
|
||||
Name = "28-СЕВ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 24,
|
||||
Name = "24-ГОР"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 17,
|
||||
Name = "17-МСК"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 10,
|
||||
Name = "10-КЛГ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 1,
|
||||
Name = "01-ОКТ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 99,
|
||||
Name = "00-ГВЦ"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Setting", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
@@ -1253,7 +1351,15 @@ namespace PARR.DAL.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.ResponseArea", "ResponseArea")
|
||||
.WithMany("Hosts")
|
||||
.HasForeignKey("ResponseAreaCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EkStatus");
|
||||
|
||||
b.Navigation("ResponseArea");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
|
||||
@@ -1449,6 +1555,11 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Subprocesses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b =>
|
||||
{
|
||||
b.Navigation("Hosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
|
||||
{
|
||||
b.Navigation("Templates");
|
||||
|
||||
@@ -24,11 +24,14 @@ namespace PARR.DAL.Models
|
||||
//public string? LinkEK { get; set; }
|
||||
|
||||
//TODO: удалить поле Status, вместо него использовать EkStatusCode
|
||||
public string? Status { get; set; }
|
||||
//public string? StatusStr { get; set; }
|
||||
|
||||
public string? WorkGroup { get; set; }
|
||||
|
||||
public string? ResponseArea { get; set; }
|
||||
//TODO: удалить поле ResponseAreaStr
|
||||
//public string? ResponseAreaStr { get; set; }
|
||||
|
||||
public int ResponseAreaCode { get; set; }
|
||||
|
||||
|
||||
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
|
||||
@@ -38,5 +41,8 @@ namespace PARR.DAL.Models
|
||||
|
||||
[ForeignKey(nameof(EkStatusCode))]
|
||||
public EkStatus? EkStatus { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ResponseAreaCode))]
|
||||
public ResponseArea? ResponseArea { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
17
PARR.DAL/Models/ResponseArea.cs
Normal file
17
PARR.DAL/Models/ResponseArea.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
{
|
||||
[Table("ResponseAreas")]
|
||||
public class ResponseArea
|
||||
{
|
||||
[Key]
|
||||
public int Code { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<Host> Hosts { get; set; } = new HashSet<Host>();
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,9 @@ namespace PARR.DAL.Services.Implementations
|
||||
{
|
||||
return Get()
|
||||
.Include(h => h.Host)
|
||||
.ThenInclude(t => t!.ResponseArea)
|
||||
.Include(h => h.Host)
|
||||
.ThenInclude(t => t!.EkStatus)
|
||||
.Include(a => a.ApplicationsInWork)
|
||||
.ThenInclude(w => w!.Work)
|
||||
.ThenInclude(t => t!.Tnk)
|
||||
|
||||
Reference in New Issue
Block a user