теперь вывод дат красивее

This commit is contained in:
Timourka 2024-04-23 20:02:42 +04:00
parent 4338bf6608
commit ed872cb31c

View File

@ -62,7 +62,7 @@ namespace Forms
bd.GetCarModelById(bd.GetCarById(rental.CarId).ModelId).Brand + " " + bd.GetCarModelById(bd.GetCarById(rental.CarId).ModelId).Model + " " + bd.GetCarById(rental.CarId).Year.ToString(),
rental.ClientId,
bd.GetClientById(rental.ClientId).Name + " " + bd.GetClientById(rental.ClientId).Surname,
rental.StartDate, rental.EndDate, rental.Cost);
rental.StartDate.ToString().Split(" ")[0], rental.EndDate.ToString().Split(" ")[0], rental.Cost);
}
}
@ -73,8 +73,8 @@ namespace Forms
Rental newRental = new Rental
{
Cost = decimal.Parse(textBoxCost.Text),
StartDate = DateTime.Parse(textBoxStartDate.Text),
EndDate = DateTime.Parse(textBoxEndDate.Text),
StartDate = DateTime.Parse(textBoxStartDate.Text + " 00:00:00"),
EndDate = DateTime.Parse(textBoxEndDate.Text + " 00:00:00"),
CarId = ((helpCombobox)comboBoxCar.SelectedItem).Id,
ClientId = ((helpCombobox)comboBoxClient.SelectedItem).Id
};
@ -101,8 +101,8 @@ namespace Forms
{
Id = rentalId,
Cost = decimal.Parse(textBoxCost.Text),
StartDate = DateTime.Parse(textBoxStartDate.Text),
EndDate = DateTime.Parse(textBoxEndDate.Text),
StartDate = DateTime.Parse(textBoxStartDate.Text + " 00:00:00"),
EndDate = DateTime.Parse(textBoxEndDate.Text + " 00:00:00"),
CarId = ((helpCombobox)comboBoxCar.SelectedItem).Id,
ClientId = ((helpCombobox)comboBoxClient.SelectedItem).Id
};
@ -141,8 +141,8 @@ namespace Forms
// Заполняем текстовые поля данными из выбранной строки
textBoxCost.Text = row.Cells["Cost"].Value.ToString();
textBoxStartDate.Text = row.Cells["StartDate"].Value.ToString();
textBoxEndDate.Text = row.Cells["EndDate"].Value.ToString();
textBoxStartDate.Text = row.Cells["StartDate"].Value.ToString().Split(" ")[0];
textBoxEndDate.Text = row.Cells["EndDate"].Value.ToString().Split(" ")[0];
// Получаем значения для комбо-боксов из выбранной строки
int carId = Convert.ToInt32(row.Cells["CarId"].Value);