исправление ошибок
This commit is contained in:
parent
c9057af05a
commit
a52015a455
@ -8,6 +8,7 @@ namespace ProjectHorseRacing.Entities.Enums;
|
||||
|
||||
public enum HorseGender
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Женский = 1,
|
||||
|
||||
|
@ -9,6 +9,7 @@ namespace ProjectHorseRacing.Entities.Enums;
|
||||
|
||||
public enum RacePlaceEvent
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Ипподром_1 = 1,
|
||||
|
||||
|
@ -19,32 +19,32 @@ public partial class FormRace : Form
|
||||
private readonly IRaceRepository _raceRepository;
|
||||
|
||||
|
||||
private int? _raceId;
|
||||
private int? _raceId;
|
||||
|
||||
public int Id
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
set
|
||||
try
|
||||
{
|
||||
try
|
||||
var race = _raceRepository.ReadRaceById(value);
|
||||
if (race == null)
|
||||
{
|
||||
var race = _raceRepository.ReadRaceById(value);
|
||||
if (race == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(race));
|
||||
}
|
||||
|
||||
dateTimePicker.Value = race.DateTime;
|
||||
comboBoxPlaceEvent.SelectedItem = race.RacePlaceEvent;
|
||||
|
||||
_raceId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
throw new InvalidDataException(nameof(race));
|
||||
}
|
||||
|
||||
dateTimePicker1.Value = race.DateTime.Date;
|
||||
comboBoxPlaceEvent.SelectedItem = race.RacePlaceEvent;
|
||||
|
||||
_raceId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormRace(IRaceRepository raceRepository)
|
||||
{
|
||||
@ -82,6 +82,6 @@ public partial class FormRace : Form
|
||||
|
||||
private void CancelButtonHorse_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Race CreateRace(int id) => Race.CreateOperation(id, dateTimePicker.Value, (RacePlaceEvent)comboBoxPlaceEvent.SelectedItem!);
|
||||
private Race CreateRace(int id) => Race.CreateOperation(id, dateTimePicker1.Value, (RacePlaceEvent)comboBoxPlaceEvent.SelectedItem!);
|
||||
|
||||
}
|
||||
|
@ -45,11 +45,7 @@ public class BuyHorseRepository : IBuyHorseRepository
|
||||
|
||||
foreach (var elem in buyHorse.BuyHorseHorses)
|
||||
{
|
||||
connection.Execute(queryBuyInsert, new
|
||||
{
|
||||
buyHorseId,
|
||||
elem.HorseId
|
||||
}, transaction);
|
||||
connection.Execute(queryBuyInsert, new {buyHorseId, elem.HorseId}, transaction);
|
||||
}
|
||||
transaction.Commit();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class JockeyRepository : IJockeyRepository
|
||||
FirstName= @FirstName,
|
||||
LastName= @LastName,
|
||||
Age= @Age,
|
||||
Rating= @Rating,
|
||||
Rating= @Rating
|
||||
WHERE Id= @Id";
|
||||
connection.Execute(queryUpdate, jockey);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user