final
This commit is contained in:
parent
adc93488c9
commit
c870a04204
@ -38,7 +38,7 @@ public partial class FormAthlete : Form
|
||||
checkedListBoxSport.SetItemChecked(checkedListBoxSport.Items.IndexOf(elem), true);
|
||||
}
|
||||
}
|
||||
|
||||
_athleteId = value;
|
||||
textBoxFirstName.Text = athlete.FirstName;
|
||||
textBoxLastName.Text = athlete.LastName;
|
||||
textBoxFatherName.Text = athlete.FatherName;
|
||||
|
@ -38,8 +38,10 @@
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
comboBoxHotel = new ComboBox();
|
||||
hotelBindingSource1 = new BindingSource(components);
|
||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelHotelName
|
||||
@ -114,6 +116,10 @@
|
||||
comboBoxHotel.Size = new Size(197, 23);
|
||||
comboBoxHotel.TabIndex = 9;
|
||||
//
|
||||
// hotelBindingSource1
|
||||
//
|
||||
hotelBindingSource1.DataSource = typeof(Entities.Hotel);
|
||||
//
|
||||
// FormRoom
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
@ -132,6 +138,7 @@
|
||||
Text = "Комната";
|
||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource1).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -146,5 +153,6 @@
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private ComboBox comboBoxHotel;
|
||||
private BindingSource hotelBindingSource1;
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ namespace ProjectHotel.Forms
|
||||
}
|
||||
textBoxRoomName.Text = room.Name;
|
||||
numericUpDownCapacity.Value = room.Capacity;
|
||||
comboBoxHotel.SelectedValue = room.HotelId;
|
||||
_roomId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -141,6 +141,9 @@
|
||||
<metadata name="buttonSave.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="hotelBindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>175, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -114,7 +114,7 @@ public class AthleteRepository : IAthleteRepository
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"
|
||||
UPDATE Athletes
|
||||
SET FirstName = @FirstName, LastName = @LastName, FatherName = @FatherName, @Sport = Sport, @AthleteClass = AthleteClass
|
||||
SET FirstName = @FirstName, LastName = @LastName, FatherName = @FatherName, Sport = @Sport, AthleteClass = @AthleteClass
|
||||
WHERE Id = @Id;
|
||||
";
|
||||
connection.Execute(queryUpdate, athlete);
|
||||
|
@ -83,7 +83,24 @@ namespace ProjectHotel.Repositories.Implementations
|
||||
}
|
||||
public void UpdateRoom(Room rooms)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(rooms));
|
||||
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"
|
||||
UPDATE Rooms
|
||||
SET HotelId = @HotelId, Name = @Name, Capacity = @Capacity
|
||||
WHERE Id = @Id;
|
||||
";
|
||||
connection.Execute(queryUpdate, rooms);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void DeleteRoom(int id)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user