Лабараторная 2

This commit is contained in:
RomaEredavkin 2024-12-18 15:16:56 +04:00
parent ba0ecef360
commit f46afd5646
2 changed files with 3 additions and 3 deletions

View File

@ -18,14 +18,14 @@ public class To
public double Cost { get; private set; } public double Cost { get; private set; }
public DateTime DateTo { get; private set; } public DateTime DateTo { get; private set; }
public static To CreatOperation(int id, string discription, double cost, int busid, int staffid) public static To CreatOperation(int id, string discription, double cost, DateTime dateTo, int busid, int staffid)
{ {
return new To() return new To()
{ {
Id = id, Id = id,
Discription = discription ?? string.Empty, Discription = discription ?? string.Empty,
Cost = cost, Cost = cost,
DateTo = DateTime.Now, DateTo = dateTo,
BusID = busid, BusID = busid,
StaffID = staffid StaffID = staffid
}; };

View File

@ -31,7 +31,7 @@ public partial class FormTO : Form
{ {
throw new Exception("Имеются не заполненые поля"); throw new Exception("Имеются не заполненые поля");
} }
_toRepository.CreateTo(To.CreatOperation(0, textBoxDescription.Text, Convert.ToDouble(numericUpDownCost.Value), (int)comboBoxBus.SelectedValue!, _toRepository.CreateTo(To.CreatOperation(0, textBoxDescription.Text, Convert.ToDouble(numericUpDownCost.Value), dateTimePicker1.Value, (int)comboBoxBus.SelectedValue!,
(int)comboBoxStaff.SelectedValue!)); (int)comboBoxStaff.SelectedValue!));
Close(); Close();
} }