diff --git a/RouteDirectory/RouteDirectoryContracts/BindingModels/ScheduleBindingModel.cs b/RouteDirectory/RouteDirectoryContracts/BindingModels/ScheduleBindingModel.cs
index 76de491..46e740e 100644
--- a/RouteDirectory/RouteDirectoryContracts/BindingModels/ScheduleBindingModel.cs
+++ b/RouteDirectory/RouteDirectoryContracts/BindingModels/ScheduleBindingModel.cs
@@ -27,7 +27,7 @@ namespace RouteDirectoryContracts.BindingModels
///
/// Периодичность движения транспорта
///
- public DateTime TrafficInterval { get; set; } = DateTime.MinValue;
+ public int TrafficInterval { get; set; }
///
/// Идентификатор маршрута
diff --git a/RouteDirectory/RouteDirectoryContracts/ViewModels/RouteViewModel.cs b/RouteDirectory/RouteDirectoryContracts/ViewModels/RouteViewModel.cs
index d5a9f68..4f1af3d 100644
--- a/RouteDirectory/RouteDirectoryContracts/ViewModels/RouteViewModel.cs
+++ b/RouteDirectory/RouteDirectoryContracts/ViewModels/RouteViewModel.cs
@@ -36,6 +36,11 @@ namespace RouteDirectoryContracts.ViewModels
///
public int TransportId { get; set; }
+ public RouteViewModel()
+ {
+ Fare = 30;
+ }
+
///
/// Коллекция остановок маршрута
///
diff --git a/RouteDirectory/RouteDirectoryContracts/ViewModels/ScheduleViewModel.cs b/RouteDirectory/RouteDirectoryContracts/ViewModels/ScheduleViewModel.cs
index b41835d..a61a17c 100644
--- a/RouteDirectory/RouteDirectoryContracts/ViewModels/ScheduleViewModel.cs
+++ b/RouteDirectory/RouteDirectoryContracts/ViewModels/ScheduleViewModel.cs
@@ -31,7 +31,7 @@ namespace RouteDirectoryContracts.ViewModels
/// Периодичность движения транспорта
///
[DisplayName("Периодичность движения транспорта")]
- public DateTime TrafficInterval { get; set; } = DateTime.MinValue;
+ public int TrafficInterval { get; set; }
///
/// Идентификатор маршрута
diff --git a/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IScheduleModel.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IScheduleModel.cs
index d674483..ec4274d 100644
--- a/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IScheduleModel.cs
+++ b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IScheduleModel.cs
@@ -21,7 +21,7 @@ namespace RouteDirectoryDataModels.Models
///
/// Периодичность движения транспорта
///
- DateTime TrafficInterval { get; }
+ int TrafficInterval { get; }
///
/// Идентификатор маршрута
diff --git a/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240514183729_InitMigration.Designer.cs b/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240515054308_InitMigration.Designer.cs
similarity index 97%
rename from RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240514183729_InitMigration.Designer.cs
rename to RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240515054308_InitMigration.Designer.cs
index 419d549..bb34e6e 100644
--- a/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240514183729_InitMigration.Designer.cs
+++ b/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240515054308_InitMigration.Designer.cs
@@ -12,7 +12,7 @@ using RouteDirectoryDatabaseImplement;
namespace RouteDirectoryDatabaseImplement.Migrations
{
[DbContext(typeof(RouteDirectoryDatabase))]
- [Migration("20240514183729_InitMigration")]
+ [Migration("20240515054308_InitMigration")]
partial class InitMigration
{
///
@@ -96,8 +96,8 @@ namespace RouteDirectoryDatabaseImplement.Migrations
b.Property("StartTime")
.HasColumnType("datetime2");
- b.Property("TrafficInterval")
- .HasColumnType("datetime2");
+ b.Property("TrafficInterval")
+ .HasColumnType("int");
b.HasKey("Id");
diff --git a/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240514183729_InitMigration.cs b/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240515054308_InitMigration.cs
similarity index 98%
rename from RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240514183729_InitMigration.cs
rename to RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240515054308_InitMigration.cs
index 41efd80..83b0bdb 100644
--- a/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240514183729_InitMigration.cs
+++ b/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/20240515054308_InitMigration.cs
@@ -97,7 +97,7 @@ namespace RouteDirectoryDatabaseImplement.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column(type: "datetime2", nullable: false),
EndTime = table.Column(type: "datetime2", nullable: false),
- TrafficInterval = table.Column(type: "datetime2", nullable: false),
+ TrafficInterval = table.Column(type: "int", nullable: false),
RouteId = table.Column(type: "int", nullable: false)
},
constraints: table =>
diff --git a/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/RouteDirectoryDatabaseModelSnapshot.cs b/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/RouteDirectoryDatabaseModelSnapshot.cs
index 9873f1a..2ad4329 100644
--- a/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/RouteDirectoryDatabaseModelSnapshot.cs
+++ b/RouteDirectory/RouteDirectoryDatabaseImplement/Migrations/RouteDirectoryDatabaseModelSnapshot.cs
@@ -93,8 +93,8 @@ namespace RouteDirectoryDatabaseImplement.Migrations
b.Property("StartTime")
.HasColumnType("datetime2");
- b.Property("TrafficInterval")
- .HasColumnType("datetime2");
+ b.Property("TrafficInterval")
+ .HasColumnType("int");
b.HasKey("Id");
diff --git a/RouteDirectory/RouteDirectoryDatabaseImplement/Models/Schedule.cs b/RouteDirectory/RouteDirectoryDatabaseImplement/Models/Schedule.cs
index 619196c..665d130 100644
--- a/RouteDirectory/RouteDirectoryDatabaseImplement/Models/Schedule.cs
+++ b/RouteDirectory/RouteDirectoryDatabaseImplement/Models/Schedule.cs
@@ -37,7 +37,7 @@ namespace RouteDirectoryDatabaseImplement.Models
/// Периодичность движения транспорта
///
[Required]
- public DateTime TrafficInterval { get; private set; } = DateTime.MinValue;
+ public int TrafficInterval { get; private set; }
///
/// Идентификатор маршрута
diff --git a/RouteDirectory/RouteDirectoryDatabaseImplement/RouteGuideDatabase.cs b/RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabase.cs
similarity index 71%
rename from RouteDirectory/RouteDirectoryDatabaseImplement/RouteGuideDatabase.cs
rename to RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabase.cs
index ca4c696..0e2c580 100644
--- a/RouteDirectory/RouteDirectoryDatabaseImplement/RouteGuideDatabase.cs
+++ b/RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabase.cs
@@ -8,22 +8,13 @@ using System.Threading.Tasks;
namespace RouteDirectoryDatabaseImplement
{
- public class RouteGuideDatabase : DbContext
+ public class RouteDirectoryDatabase : DbContext
{
- ///
- /// Параметры подключения к базе данных
- ///
- private string _dbConnectionString = "Host=192.168.56.102;Port=5432;Database=postgres;Username=postgres;Password=зщыепкуы";
-
- ///
- /// Подключение к базе данных
- ///
- ///
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);
}
diff --git a/RouteDirectory/RouteDirectoryForms/FormMain.Designer.cs b/RouteDirectory/RouteDirectoryForms/FormMain.Designer.cs
index b5426d2..79cbed1 100644
--- a/RouteDirectory/RouteDirectoryForms/FormMain.Designer.cs
+++ b/RouteDirectory/RouteDirectoryForms/FormMain.Designer.cs
@@ -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;
//
diff --git a/RouteDirectory/RouteDirectoryForms/FormMain.resx b/RouteDirectory/RouteDirectoryForms/FormMain.resx
index a0623c8..a39c409 100644
--- a/RouteDirectory/RouteDirectoryForms/FormMain.resx
+++ b/RouteDirectory/RouteDirectoryForms/FormMain.resx
@@ -120,4 +120,7 @@
17, 17
+
+ 25
+
\ No newline at end of file
diff --git a/RouteDirectory/RouteDirectoryForms/FormSchedule.Designer.cs b/RouteDirectory/RouteDirectoryForms/FormSchedule.Designer.cs
index d39aa76..ec021ac 100644
--- a/RouteDirectory/RouteDirectoryForms/FormSchedule.Designer.cs
+++ b/RouteDirectory/RouteDirectoryForms/FormSchedule.Designer.cs
@@ -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;
}
}
\ No newline at end of file
diff --git a/RouteDirectory/RouteDirectoryForms/FormSchedule.cs b/RouteDirectory/RouteDirectoryForms/FormSchedule.cs
index 2144c28..64446bc 100644
--- a/RouteDirectory/RouteDirectoryForms/FormSchedule.cs
+++ b/RouteDirectory/RouteDirectoryForms/FormSchedule.cs
@@ -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)
};
diff --git a/RouteDirectory/RouteDirectoryForms/FormSchedulesTests.cs b/RouteDirectory/RouteDirectoryForms/FormSchedulesTests.cs
index ffd45ba..aa7a1e1 100644
--- a/RouteDirectory/RouteDirectoryForms/FormSchedulesTests.cs
+++ b/RouteDirectory/RouteDirectoryForms/FormSchedulesTests.cs
@@ -75,7 +75,7 @@ namespace RouteDirectoryView
Id = 0,
StartTime = DateTime.MinValue,
EndTime = DateTime.MaxValue,
- TrafficInterval = DateTime.MinValue,
+ TrafficInterval = int.MinValue,
RouteId = routeId
};