ИСЭбд-22. Парамонова И.А. Лабораторная работа №2 #3

Closed
ikswi wants to merge 2 commits from LabWork2 into LabWork1
4 changed files with 54 additions and 8 deletions
Showing only changes of commit 3259ac446b - Show all commits

View File

@ -14,13 +14,13 @@ public class Trip
public int Route_Id { get; private set; }
public int Bus_Id { get; private set; }
public static Trip CreateOperation(int id, int route_Id, int bus_Id)
public static Trip CreateOperation(int id, int route_Id, int bus_Id, DateTime departure, DateTime arrival)
{
return new Trip
{
Id = id,
Departure = DateTime.Now,
Arrival = DateTime.Now,
Departure = departure,
Arrival = arrival,
Route_Id = route_Id,
Bus_Id = bus_Id
};

View File

@ -34,6 +34,10 @@
labelRoute = new Label();
buttonSave = new Button();
buttonCancel = new Button();
label2 = new Label();
label1 = new Label();
dateTimePickerEnd = new DateTimePicker();
dateTimePickerStart = new DateTimePicker();
SuspendLayout();
//
// comboBoxRoute
@ -72,7 +76,7 @@
//
// buttonSave
//
buttonSave.Location = new Point(43, 225);
buttonSave.Location = new Point(41, 260);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 6;
@ -82,7 +86,7 @@
//
// buttonCancel
//
buttonCancel.Location = new Point(214, 225);
buttonCancel.Location = new Point(212, 260);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 7;
@ -90,11 +94,49 @@
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(21, 212);
label2.Name = "label2";
label2.Size = new Size(115, 20);
label2.TabIndex = 15;
label2.Text = "Дата прибытия";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(21, 159);
label1.Name = "label1";
label1.Size = new Size(110, 20);
label1.TabIndex = 14;
label1.Text = "Дата отправки";
//
// dateTimePickerEnd
//
dateTimePickerEnd.Location = new Point(168, 204);
dateTimePickerEnd.Margin = new Padding(3, 4, 3, 4);
dateTimePickerEnd.Name = "dateTimePickerEnd";
dateTimePickerEnd.Size = new Size(177, 27);
dateTimePickerEnd.TabIndex = 13;
//
// dateTimePickerStart
//
dateTimePickerStart.Location = new Point(168, 151);
dateTimePickerStart.Margin = new Padding(3, 4, 3, 4);
dateTimePickerStart.Name = "dateTimePickerStart";
dateTimePickerStart.Size = new Size(177, 27);
dateTimePickerStart.TabIndex = 12;
//
// FormTrip
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(418, 315);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(dateTimePickerEnd);
Controls.Add(dateTimePickerStart);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelRoute);
@ -115,5 +157,9 @@
private Label labelRoute;
private Button buttonSave;
private Button buttonCancel;
private Label label2;
private Label label1;
private DateTimePicker dateTimePickerEnd;
private DateTimePicker dateTimePickerStart;
}
}

View File

@ -35,7 +35,7 @@ namespace ProjectPassengerTransfers.Forms
{
throw new Exception("Имеются незаполненные поля");
}
_tripRepository.CreateTrip(Trip.CreateOperation(0, (int)comboBoxRoute.SelectedValue!, (int)comboBoxBus.SelectedValue!));
_tripRepository.CreateTrip(Trip.CreateOperation(0, (int)comboBoxRoute.SelectedValue!, (int)comboBoxBus.SelectedValue!, dateTimePickerStart.Value.Date, dateTimePickerEnd.Value.Date));
Close();
}
catch (Exception ex)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
@ -48,7 +48,7 @@
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter