This commit is contained in:
kamilia 2024-05-18 13:01:50 +04:00
parent 843569550f
commit 81a061363e
14 changed files with 42 additions and 41 deletions

View File

@ -27,7 +27,7 @@ namespace RouteDirectoryContracts.BindingModels
/// <summary>
/// Периодичность движения транспорта
/// </summary>
public DateTime TrafficInterval { get; set; } = DateTime.MinValue;
public int TrafficInterval { get; set; }
/// <summary>
/// Идентификатор маршрута

View File

@ -36,6 +36,11 @@ namespace RouteDirectoryContracts.ViewModels
/// </summary>
public int TransportId { get; set; }
public RouteViewModel()
{
Fare = 30;
}
/// <summary>
/// Коллекция остановок маршрута
/// </summary>

View File

@ -31,7 +31,7 @@ namespace RouteDirectoryContracts.ViewModels
/// Периодичность движения транспорта
/// </summary>
[DisplayName("Периодичность движения транспорта")]
public DateTime TrafficInterval { get; set; } = DateTime.MinValue;
public int TrafficInterval { get; set; }
/// <summary>
/// Идентификатор маршрута

View File

@ -21,7 +21,7 @@ namespace RouteDirectoryDataModels.Models
/// <summary>
/// Периодичность движения транспорта
/// </summary>
DateTime TrafficInterval { get; }
int TrafficInterval { get; }
/// <summary>
/// Идентификатор маршрута

View File

@ -12,7 +12,7 @@ using RouteDirectoryDatabaseImplement;
namespace RouteDirectoryDatabaseImplement.Migrations
{
[DbContext(typeof(RouteDirectoryDatabase))]
[Migration("20240514183729_InitMigration")]
[Migration("20240515054308_InitMigration")]
partial class InitMigration
{
/// <inheritdoc />
@ -96,8 +96,8 @@ namespace RouteDirectoryDatabaseImplement.Migrations
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<DateTime>("TrafficInterval")
.HasColumnType("datetime2");
b.Property<int>("TrafficInterval")
.HasColumnType("int");
b.HasKey("Id");

View File

@ -97,7 +97,7 @@ namespace RouteDirectoryDatabaseImplement.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
EndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
TrafficInterval = table.Column<DateTime>(type: "datetime2", nullable: false),
TrafficInterval = table.Column<int>(type: "int", nullable: false),
RouteId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>

View File

@ -93,8 +93,8 @@ namespace RouteDirectoryDatabaseImplement.Migrations
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<DateTime>("TrafficInterval")
.HasColumnType("datetime2");
b.Property<int>("TrafficInterval")
.HasColumnType("int");
b.HasKey("Id");

View File

@ -37,7 +37,7 @@ namespace RouteDirectoryDatabaseImplement.Models
/// Периодичность движения транспорта
/// </summary>
[Required]
public DateTime TrafficInterval { get; private set; } = DateTime.MinValue;
public int TrafficInterval { get; private set; }
/// <summary>
/// Идентификатор маршрута

View File

@ -8,22 +8,13 @@ using System.Threading.Tasks;
namespace RouteDirectoryDatabaseImplement
{
public class RouteGuideDatabase : DbContext
public class RouteDirectoryDatabase : DbContext
{
/// <summary>
/// Параметры подключения к базе данных
/// </summary>
private string _dbConnectionString = "Host=192.168.56.102;Port=5432;Database=postgres;Username=postgres;Password=зщыепкуы";
/// <summary>
/// Подключение к базе данных
/// </summary>
/// <param name="optionsBuilder"></param>
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(_dbConnectionString);
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-6QDRI0N\SQLEXPRESS;Initial Catalog=NewRouteDirectoryDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}

View File

@ -67,21 +67,21 @@
// транспортToolStripMenuItem
//
транспортToolStripMenuItem.Name = ранспортToolStripMenuItem";
транспортToolStripMenuItem.Size = new Size(224, 26);
транспортToolStripMenuItem.Size = new Size(167, 26);
транспортToolStripMenuItem.Text = "Транспорт";
транспортToolStripMenuItem.Click += TransportToolStripMenuItem_Click;
//
// маршрутыToolStripMenuItem
//
маршрутыToolStripMenuItem.Name = аршрутыToolStripMenuItem";
маршрутыToolStripMenuItem.Size = new Size(224, 26);
маршрутыToolStripMenuItem.Size = new Size(167, 26);
маршрутыToolStripMenuItem.Text = "Маршруты";
маршрутыToolStripMenuItem.Click += RoutesToolStripMenuItem_Click;
//
// остановкиToolStripMenuItem
//
остановкиToolStripMenuItem.Name = "остановкиToolStripMenuItem";
остановкиToolStripMenuItem.Size = new Size(224, 26);
остановкиToolStripMenuItem.Size = new Size(167, 26);
остановкиToolStripMenuItem.Text = "Остановки";
остановкиToolStripMenuItem.Click += StopsToolStripMenuItem_Click;
//
@ -95,28 +95,28 @@
// транспортToolStripMenuItem1
//
транспортToolStripMenuItem1.Name = ранспортToolStripMenuItem1";
транспортToolStripMenuItem1.Size = new Size(224, 26);
транспортToolStripMenuItem1.Size = new Size(174, 26);
транспортToolStripMenuItem1.Text = "Транспорт";
транспортToolStripMenuItem1.Click += TransportTestsToolStripMenuItem_Click;
//
// маршрутыToolStripMenuItem1
//
маршрутыToolStripMenuItem1.Name = аршрутыToolStripMenuItem1";
маршрутыToolStripMenuItem1.Size = new Size(224, 26);
маршрутыToolStripMenuItem1.Size = new Size(174, 26);
маршрутыToolStripMenuItem1.Text = "Маршруты";
маршрутыToolStripMenuItem1.Click += RoutesTestsToolStripMenuItem_Click;
//
// остановкиToolStripMenuItem1
//
остановкиToolStripMenuItem1.Name = "остановкиToolStripMenuItem1";
остановкиToolStripMenuItem1.Size = new Size(224, 26);
остановкиToolStripMenuItem1.Size = new Size(174, 26);
остановкиToolStripMenuItem1.Text = "Остановки";
остановкиToolStripMenuItem1.Click += StopsTestsToolStripMenuItem_Click;
//
// расписанияToolStripMenuItem
//
расписанияToolStripMenuItem.Name = "расписанияToolStripMenuItem";
расписанияToolStripMenuItem.Size = new Size(224, 26);
расписанияToolStripMenuItem.Size = new Size(174, 26);
расписанияToolStripMenuItem.Text = "Расписания";
расписанияToolStripMenuItem.Click += SchedulesTestsToolStripMenuItem_Click;
//

View File

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

View File

@ -35,9 +35,10 @@
comboBoxRoute = new ComboBox();
dateTimePickerStart = new DateTimePicker();
dateTimePickerEnd = new DateTimePicker();
dateTimePickerTrafficInterval = new DateTimePicker();
buttonSave = new Button();
buttonCancel = new Button();
numericUpDown = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numericUpDown).BeginInit();
SuspendLayout();
//
// labelRoute
@ -98,13 +99,6 @@
dateTimePickerEnd.Size = new Size(250, 27);
dateTimePickerEnd.TabIndex = 6;
//
// dateTimePickerTrafficInterval
//
dateTimePickerTrafficInterval.Location = new Point(200, 179);
dateTimePickerTrafficInterval.Name = "dateTimePickerTrafficInterval";
dateTimePickerTrafficInterval.Size = new Size(250, 27);
dateTimePickerTrafficInterval.TabIndex = 7;
//
// buttonSave
//
buttonSave.Location = new Point(243, 235);
@ -125,14 +119,21 @@
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// numericUpDown
//
numericUpDown.Location = new Point(200, 179);
numericUpDown.Name = "numericUpDown";
numericUpDown.Size = new Size(250, 27);
numericUpDown.TabIndex = 10;
//
// FormSchedule
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(469, 275);
Controls.Add(numericUpDown);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(dateTimePickerTrafficInterval);
Controls.Add(dateTimePickerEnd);
Controls.Add(dateTimePickerStart);
Controls.Add(comboBoxRoute);
@ -143,6 +144,7 @@
Name = "FormSchedule";
Text = "FormSchedule";
Load += FormSchedule_Load;
((System.ComponentModel.ISupportInitialize)numericUpDown).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -156,8 +158,8 @@
private ComboBox comboBoxRoute;
private DateTimePicker dateTimePickerStart;
private DateTimePicker dateTimePickerEnd;
private DateTimePicker dateTimePickerTrafficInterval;
private Button buttonSave;
private Button buttonCancel;
private NumericUpDown numericUpDown;
}
}

View File

@ -99,7 +99,7 @@ namespace RouteDirectoryView
comboBoxRoute.SelectedItem = view.RouteId;
dateTimePickerStart.Value = view.StartTime;
dateTimePickerEnd.Value = view.EndTime;
dateTimePickerTrafficInterval.Value = view.TrafficInterval;
numericUpDown.Value = view.TrafficInterval;
}
}
catch (Exception ex1)
@ -135,7 +135,7 @@ namespace RouteDirectoryView
Id = _id ?? 0,
StartTime = dateTimePickerStart.Value,
EndTime = dateTimePickerEnd.Value,
TrafficInterval = dateTimePickerTrafficInterval.Value,
TrafficInterval = (int)numericUpDown.Value,
RouteId = Convert.ToInt32(comboBoxRoute.SelectedValue)
};

View File

@ -75,7 +75,7 @@ namespace RouteDirectoryView
Id = 0,
StartTime = DateTime.MinValue,
EndTime = DateTime.MaxValue,
TrafficInterval = DateTime.MinValue,
TrafficInterval = int.MinValue,
RouteId = routeId
};