Сданная 4-я лаба. Перенести подключение в конфиг + доделать отчёты к 5-й лабе.
This commit is contained in:
parent
2ebf0bdeaf
commit
bf77b92a4b
@ -40,6 +40,9 @@
|
||||
generationClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
generationTruckingsToolStripMenuItem = new ToolStripMenuItem();
|
||||
buttonUpdate = new Button();
|
||||
comboBoxEmails = new ComboBox();
|
||||
label1 = new Label();
|
||||
checkBoxSorted = new CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
@ -47,11 +50,11 @@
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(11, 36);
|
||||
dataGridView.Location = new Point(11, 67);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(937, 448);
|
||||
dataGridView.Size = new Size(937, 417);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreateTrucking
|
||||
@ -141,11 +144,43 @@
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// comboBoxEmails
|
||||
//
|
||||
comboBoxEmails.FormattingEnabled = true;
|
||||
comboBoxEmails.Location = new Point(142, 33);
|
||||
comboBoxEmails.Name = "comboBoxEmails";
|
||||
comboBoxEmails.Size = new Size(208, 28);
|
||||
comboBoxEmails.TabIndex = 8;
|
||||
comboBoxEmails.SelectedIndexChanged += ComboBoxEmails_SelectedIndexChanged;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 36);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(124, 20);
|
||||
label1.TabIndex = 9;
|
||||
label1.Text = "Выберите почту:";
|
||||
//
|
||||
// checkBoxSorted
|
||||
//
|
||||
checkBoxSorted.AutoSize = true;
|
||||
checkBoxSorted.Location = new Point(541, 35);
|
||||
checkBoxSorted.Name = "checkBoxSorted";
|
||||
checkBoxSorted.Size = new Size(239, 24);
|
||||
checkBoxSorted.TabIndex = 10;
|
||||
checkBoxSorted.Text = "Сортировать по возрастанию";
|
||||
checkBoxSorted.UseVisualStyleBackColor = true;
|
||||
checkBoxSorted.CheckedChanged += CheckBoxSorted_CheckedChanged;
|
||||
//
|
||||
// FormTrucking
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1297, 496);
|
||||
Controls.Add(checkBoxSorted);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxEmails);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonCreateTrucking);
|
||||
Controls.Add(dataGridView);
|
||||
@ -188,5 +223,8 @@
|
||||
private ToolStripMenuItem generationClientsToolStripMenuItem;
|
||||
private ToolStripMenuItem generationTruckingsToolStripMenuItem;
|
||||
private Button buttonUpdate;
|
||||
private ComboBox comboBoxEmails;
|
||||
private Label label1;
|
||||
private CheckBox checkBoxSorted;
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
using TransportCompanyContracts.BusinessLogicsContracts;
|
||||
using TransportCompanyContracts.SearchModels;
|
||||
|
||||
namespace TransportCompany
|
||||
{
|
||||
@ -9,12 +12,15 @@ namespace TransportCompany
|
||||
|
||||
private readonly ITruckingLogic _truckingLogic;
|
||||
|
||||
public FormTrucking(ILogger<FormTrucking> logger, ITruckingLogic truckingLogic)
|
||||
private readonly IClientLogic _clientLogic;
|
||||
|
||||
public FormTrucking(ILogger<FormTrucking> logger, ITruckingLogic truckingLogic, IClientLogic clientLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_logger = logger;
|
||||
_truckingLogic = truckingLogic;
|
||||
_clientLogic = clientLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
@ -30,6 +36,8 @@ namespace TransportCompany
|
||||
{
|
||||
var list = _truckingLogic.ReadList(null);
|
||||
|
||||
var listClients = _clientLogic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
@ -39,6 +47,14 @@ namespace TransportCompany
|
||||
dataGridView.Columns["TransportationId"].Visible = false;
|
||||
}
|
||||
|
||||
if (listClients != null)
|
||||
{
|
||||
comboBoxEmails.DisplayMember = "Email";
|
||||
comboBoxEmails.ValueMember = "Id";
|
||||
comboBoxEmails.DataSource = listClients;
|
||||
comboBoxEmails.SelectedItem = null;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Çàãðóçêà ïåðåâîçîê");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -129,5 +145,15 @@ namespace TransportCompany
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CheckBoxSorted_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//dataGridView. Sort(dataGridView.Columns[7], ListSortDirection.Ascending);
|
||||
}
|
||||
}
|
||||
}
|
103
TransportCompany/TransportCompany/SortableBindingList.cs
Normal file
103
TransportCompany/TransportCompany/SortableBindingList.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TransportCompany
|
||||
{
|
||||
public class SortableBindingList<T> : BindingList<T>
|
||||
{
|
||||
private bool IsSorted { get; set; }
|
||||
|
||||
private ListSortDirection SortDirection { get; set; }
|
||||
|
||||
private PropertyDescriptor SortProperty { get; set; }
|
||||
|
||||
protected override bool SupportsSortingCore
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override ListSortDirection SortDirectionCore
|
||||
{
|
||||
get
|
||||
{
|
||||
return SortDirection;
|
||||
}
|
||||
}
|
||||
|
||||
protected override PropertyDescriptor SortPropertyCore
|
||||
{
|
||||
get
|
||||
{
|
||||
return SortProperty;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ApplySortCore(PropertyDescriptor PDsc, ListSortDirection Direction)
|
||||
{
|
||||
List<T> items = Items as List<T>;
|
||||
if (items is null)
|
||||
{
|
||||
IsSorted = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var PCom = new PCompare<T>(PDsc.Name, Direction);
|
||||
items.Sort(PCom);
|
||||
IsSorted = true;
|
||||
SortDirection = Direction;
|
||||
SortProperty = PDsc;
|
||||
}
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
}
|
||||
|
||||
protected override bool IsSortedCore
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsSorted;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RemoveSortCore()
|
||||
{
|
||||
IsSorted = false;
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
public SortableBindingList(ICollection<T> list) : base((IList<T>)list)
|
||||
{
|
||||
}
|
||||
public SortableBindingList() : base()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Property comparer
|
||||
private class PCompare<T> : IComparer<T>
|
||||
{
|
||||
private PropertyInfo PropInfo { get; set; }
|
||||
private ListSortDirection SortDir { get; set; }
|
||||
internal PCompare(string SortProperty, ListSortDirection SortDirection)
|
||||
{
|
||||
PropInfo = typeof(T).GetProperty(SortProperty);
|
||||
SortDir = SortDirection;
|
||||
}
|
||||
internal int Compare(T x, T y)
|
||||
{
|
||||
return SortDir == ListSortDirection.Ascending ? Comparer.Default.Compare(PropInfo.GetValue(x, null), PropInfo.GetValue(y, null)) : Comparer.Default.Compare(PropInfo.GetValue(y, null), PropInfo.GetValue(x, null));
|
||||
}
|
||||
|
||||
int IComparer<T>.Compare(T x, T y) => Compare(x, y);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -92,13 +92,25 @@ public partial class ElegevContext : DbContext
|
||||
|
||||
entity.ToTable("trucking");
|
||||
|
||||
entity.HasIndex(e => e.CargoId, "IX_trucking_cargo_id");
|
||||
|
||||
entity.HasIndex(e => e.ClientId, "IX_trucking_client_id");
|
||||
|
||||
entity.HasIndex(e => e.TransportId, "IX_trucking_transport_id");
|
||||
|
||||
entity.HasIndex(e => e.TransportationId, "IX_trucking_transportation_id");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.CargoId).HasColumnName("cargo_id");
|
||||
entity.Property(e => e.ClientId).HasColumnName("client_id");
|
||||
entity.Property(e => e.DateEnd).HasColumnName("date_end");
|
||||
entity.Property(e => e.DateStart).HasColumnName("date_start");
|
||||
entity.Property(e => e.DateEnd)
|
||||
.HasColumnType("timestamp without time zone")
|
||||
.HasColumnName("date_end");
|
||||
entity.Property(e => e.DateStart)
|
||||
.HasColumnType("timestamp without time zone")
|
||||
.HasColumnName("date_start");
|
||||
entity.Property(e => e.Price).HasColumnName("price");
|
||||
entity.Property(e => e.TransportId).HasColumnName("transport_id");
|
||||
entity.Property(e => e.TransportationId).HasColumnName("transportation_id");
|
||||
@ -118,7 +130,7 @@ public partial class ElegevContext : DbContext
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("transport_id");
|
||||
|
||||
entity.HasOne(d => d.TypeTransportation).WithMany(p => p.Truckings)
|
||||
entity.HasOne(d => d.Transportation).WithMany(p => p.Truckings)
|
||||
.HasForeignKey(d => d.TransportationId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("type_transportation_id");
|
||||
|
@ -66,6 +66,10 @@ namespace TransportCompanyDatabaseImplements.Implements
|
||||
using var context = new ElegevContext();
|
||||
|
||||
return context.Truckings
|
||||
.Include(x => x.Transport)
|
||||
.Include(x => x.Cargo)
|
||||
.Include(x => x.Transportation)
|
||||
.Include(x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -89,10 +93,10 @@ namespace TransportCompanyDatabaseImplements.Implements
|
||||
return context.Truckings
|
||||
.Include(x => x.Transport)
|
||||
.Include(x => x.Cargo)
|
||||
.Include(x => x.TypeTransportation)
|
||||
.Include (x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
.Include(x => x.Transportation)
|
||||
.Include(x => x.Client)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public TruckingViewModel? Update(TruckingBindingModel model)
|
||||
|
@ -1,239 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using TransportCompanyDatabaseImplements;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(ElegevContext))]
|
||||
[Migration("20230412195202_StartMigration")]
|
||||
partial class StartMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.HasSequence("seq_cargo");
|
||||
|
||||
modelBuilder.HasSequence("seq_client");
|
||||
|
||||
modelBuilder.HasSequence("seq_trucking");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transport");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transportation");
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TypeCargo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("type_cargo");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("cargo_pkey");
|
||||
|
||||
b.ToTable("cargo", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("patronymic");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("surname");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("telephone");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("client_pkey");
|
||||
|
||||
b.ToTable("client", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transport_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("transport_pkey");
|
||||
|
||||
b.ToTable("transport", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("CargoId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("cargo_id");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("client_id");
|
||||
|
||||
b.Property<DateOnly>("DateEnd")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("date_end");
|
||||
|
||||
b.Property<DateOnly>("DateStart")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("date_start");
|
||||
|
||||
b.Property<int>("Price")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<int>("TransportId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transport_id");
|
||||
|
||||
b.Property<int>("TypeTransportationId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("type_transportation_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("trucking_pkey");
|
||||
|
||||
b.HasIndex("CargoId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("TransportId");
|
||||
|
||||
b.HasIndex("TypeTransportationId");
|
||||
|
||||
b.ToTable("trucking", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportationType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transportation_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("type_transportation_pkey");
|
||||
|
||||
b.ToTable("type_transportation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Cargo", "Cargo")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("CargoId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("cargo_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Client", "Client")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("ClientId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("client_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Transport", "Transport")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("transport_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.TypeTransportation", "TypeTransportation")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TypeTransportationId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("type_transportation_id");
|
||||
|
||||
b.Navigation("Cargo");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Transport");
|
||||
|
||||
b.Navigation("TypeTransportation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class StartMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_trucking_cargo_id",
|
||||
table: "trucking",
|
||||
column: "cargo_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_trucking_client_id",
|
||||
table: "trucking",
|
||||
column: "client_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_trucking_transport_id",
|
||||
table: "trucking",
|
||||
column: "transport_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_trucking_type_transportation_id",
|
||||
table: "trucking",
|
||||
column: "type_transportation_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "trucking");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "cargo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "client");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "transport");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "type_transportation");
|
||||
|
||||
migrationBuilder.DropSequence(
|
||||
name: "seq_cargo");
|
||||
|
||||
migrationBuilder.DropSequence(
|
||||
name: "seq_client");
|
||||
|
||||
migrationBuilder.DropSequence(
|
||||
name: "seq_trucking");
|
||||
|
||||
migrationBuilder.DropSequence(
|
||||
name: "seq_type_transport");
|
||||
|
||||
migrationBuilder.DropSequence(
|
||||
name: "seq_type_transportation");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,239 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using TransportCompanyDatabaseImplements;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(ElegevContext))]
|
||||
[Migration("20230412213501_FirstMigra")]
|
||||
partial class FirstMigra
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.HasSequence("seq_cargo");
|
||||
|
||||
modelBuilder.HasSequence("seq_client");
|
||||
|
||||
modelBuilder.HasSequence("seq_trucking");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transport");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transportation");
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TypeCargo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("type_cargo");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("cargo_pkey");
|
||||
|
||||
b.ToTable("cargo", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("patronymic");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("surname");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("telephone");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("client_pkey");
|
||||
|
||||
b.ToTable("client", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transport_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("transport_pkey");
|
||||
|
||||
b.ToTable("transport", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("CargoId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("cargo_id");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("client_id");
|
||||
|
||||
b.Property<DateTime>("DateEnd")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_end");
|
||||
|
||||
b.Property<DateTime>("DateStart")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_start");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<int>("TransportId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transport_id");
|
||||
|
||||
b.Property<int>("TransportationId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transportation_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("trucking_pkey");
|
||||
|
||||
b.HasIndex("CargoId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("TransportId");
|
||||
|
||||
b.HasIndex("TransportationId");
|
||||
|
||||
b.ToTable("trucking", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportationType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transportation_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("type_transportation_pkey");
|
||||
|
||||
b.ToTable("type_transportation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Cargo", "Cargo")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("CargoId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("cargo_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Client", "Client")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("ClientId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("client_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Transport", "Transport")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("transport_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.TypeTransportation", "TypeTransportation")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportationId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("type_transportation_id");
|
||||
|
||||
b.Navigation("Cargo");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Transport");
|
||||
|
||||
b.Navigation("TypeTransportation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FirstMigra : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "type_transportation_id",
|
||||
table: "trucking",
|
||||
newName: "transportation_id");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_trucking_type_transportation_id",
|
||||
table: "trucking",
|
||||
newName: "IX_trucking_transportation_id");
|
||||
|
||||
migrationBuilder.AlterColumn<double>(
|
||||
name: "price",
|
||||
table: "trucking",
|
||||
type: "double precision",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "date_start",
|
||||
table: "trucking",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "date_end",
|
||||
table: "trucking",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "transportation_id",
|
||||
table: "trucking",
|
||||
newName: "type_transportation_id");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_trucking_transportation_id",
|
||||
table: "trucking",
|
||||
newName: "IX_trucking_type_transportation_id");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "price",
|
||||
table: "trucking",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
oldClrType: typeof(double),
|
||||
oldType: "double precision");
|
||||
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "date_start",
|
||||
table: "trucking",
|
||||
type: "date",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "date_end",
|
||||
table: "trucking",
|
||||
type: "date",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,239 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using TransportCompanyDatabaseImplements;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(ElegevContext))]
|
||||
[Migration("20230413092204_ClearClients")]
|
||||
partial class ClearClients
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.HasSequence("seq_cargo");
|
||||
|
||||
modelBuilder.HasSequence("seq_client");
|
||||
|
||||
modelBuilder.HasSequence("seq_trucking");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transport");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transportation");
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TypeCargo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("type_cargo");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("cargo_pkey");
|
||||
|
||||
b.ToTable("cargo", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("patronymic");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("surname");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("telephone");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("client_pkey");
|
||||
|
||||
b.ToTable("client", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transport_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("transport_pkey");
|
||||
|
||||
b.ToTable("transport", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("CargoId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("cargo_id");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("client_id");
|
||||
|
||||
b.Property<DateTime>("DateEnd")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_end");
|
||||
|
||||
b.Property<DateTime>("DateStart")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_start");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<int>("TransportId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transport_id");
|
||||
|
||||
b.Property<int>("TransportationId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transportation_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("trucking_pkey");
|
||||
|
||||
b.HasIndex("CargoId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("TransportId");
|
||||
|
||||
b.HasIndex("TransportationId");
|
||||
|
||||
b.ToTable("trucking", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportationType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transportation_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("type_transportation_pkey");
|
||||
|
||||
b.ToTable("type_transportation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Cargo", "Cargo")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("CargoId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("cargo_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Client", "Client")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("ClientId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("client_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Transport", "Transport")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("transport_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.TypeTransportation", "TypeTransportation")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportationId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("type_transportation_id");
|
||||
|
||||
b.Navigation("Cargo");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Transport");
|
||||
|
||||
b.Navigation("TypeTransportation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ClearClients : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,236 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using TransportCompanyDatabaseImplements;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(ElegevContext))]
|
||||
partial class ElegevContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.HasSequence("seq_cargo");
|
||||
|
||||
modelBuilder.HasSequence("seq_client");
|
||||
|
||||
modelBuilder.HasSequence("seq_trucking");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transport");
|
||||
|
||||
modelBuilder.HasSequence("seq_type_transportation");
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TypeCargo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("type_cargo");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("cargo_pkey");
|
||||
|
||||
b.ToTable("cargo", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("patronymic");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("surname");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("telephone");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("client_pkey");
|
||||
|
||||
b.ToTable("client", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transport_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("transport_pkey");
|
||||
|
||||
b.ToTable("transport", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("CargoId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("cargo_id");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("client_id");
|
||||
|
||||
b.Property<DateTime>("DateEnd")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_end");
|
||||
|
||||
b.Property<DateTime>("DateStart")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_start");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<int>("TransportId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transport_id");
|
||||
|
||||
b.Property<int>("TransportationId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("transportation_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("trucking_pkey");
|
||||
|
||||
b.HasIndex("CargoId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("TransportId");
|
||||
|
||||
b.HasIndex("TransportationId");
|
||||
|
||||
b.ToTable("trucking", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("TransportationType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("transportation_type");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("type_transportation_pkey");
|
||||
|
||||
b.ToTable("type_transportation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
|
||||
{
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Cargo", "Cargo")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("CargoId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("cargo_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Client", "Client")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("ClientId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("client_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.Transport", "Transport")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("transport_id");
|
||||
|
||||
b.HasOne("TransportCompanyDatabaseImplements.Models.TypeTransportation", "TypeTransportation")
|
||||
.WithMany("Truckings")
|
||||
.HasForeignKey("TransportationId")
|
||||
.IsRequired()
|
||||
.HasConstraintName("type_transportation_id");
|
||||
|
||||
b.Navigation("Cargo");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Transport");
|
||||
|
||||
b.Navigation("TypeTransportation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
|
||||
{
|
||||
b.Navigation("Truckings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using TransportCompanyContracts.BindingModels;
|
||||
using TransportCompanyContracts.ViewModels;
|
||||
|
||||
@ -33,5 +32,4 @@ public partial class Cargo
|
||||
Id = Id,
|
||||
TypeCargo = TypeCargo
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using TransportCompanyContracts.BindingModels;
|
||||
using TransportCompanyContracts.ViewModels;
|
||||
using TransportCompanyDataModels.Models;
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Models;
|
||||
|
||||
public partial class Client : IClientModel
|
||||
public partial class Client
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using TransportCompanyContracts.BindingModels;
|
||||
using TransportCompanyContracts.ViewModels;
|
||||
|
||||
|
@ -2,11 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using TransportCompanyContracts.BindingModels;
|
||||
using TransportCompanyContracts.ViewModels;
|
||||
using TransportCompanyDataModels.Models;
|
||||
|
||||
namespace TransportCompanyDatabaseImplements.Models;
|
||||
|
||||
public partial class Trucking : ITruckingModel
|
||||
public partial class Trucking
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
@ -30,7 +29,7 @@ public partial class Trucking : ITruckingModel
|
||||
|
||||
public virtual Transport Transport { get; set; } = null!;
|
||||
|
||||
public virtual TypeTransportation TypeTransportation { get; set; } = null!;
|
||||
public virtual TypeTransportation Transportation { get; set; } = null!;
|
||||
|
||||
public static Trucking? Create(TruckingBindingModel model)
|
||||
{
|
||||
@ -79,11 +78,11 @@ public partial class Trucking : ITruckingModel
|
||||
DateEnd = DateEnd,
|
||||
TransportationId = TransportationId,
|
||||
TransportId = TransportId,
|
||||
ClientName = Client.Name,
|
||||
ClientSurname = Client.Surname,
|
||||
ClientPatronymic = Client.Patronymic,
|
||||
TypeTransportation = TypeTransportation.TransportationType,
|
||||
TransportName = Transport.TransportType,
|
||||
Cargo = Cargo.TypeCargo
|
||||
ClientName = Client == null ? string.Empty : Client.Name,
|
||||
ClientSurname = Client == null ? string.Empty : Client.Surname,
|
||||
ClientPatronymic = Client == null ? string.Empty : Client.Patronymic,
|
||||
TypeTransportation = Transportation == null ? string.Empty : Transportation.TransportationType,
|
||||
TransportName = Transport == null ? string.Empty : Transport.TransportType,
|
||||
Cargo = Cargo == null ? string.Empty : Cargo.TypeCargo
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user