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);
|
checkedListBoxSport.SetItemChecked(checkedListBoxSport.Items.IndexOf(elem), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_athleteId = value;
|
||||||
textBoxFirstName.Text = athlete.FirstName;
|
textBoxFirstName.Text = athlete.FirstName;
|
||||||
textBoxLastName.Text = athlete.LastName;
|
textBoxLastName.Text = athlete.LastName;
|
||||||
textBoxFatherName.Text = athlete.FatherName;
|
textBoxFatherName.Text = athlete.FatherName;
|
||||||
|
@ -38,8 +38,10 @@
|
|||||||
buttonCancel = new Button();
|
buttonCancel = new Button();
|
||||||
buttonSave = new Button();
|
buttonSave = new Button();
|
||||||
comboBoxHotel = new ComboBox();
|
comboBoxHotel = new ComboBox();
|
||||||
|
hotelBindingSource1 = new BindingSource(components);
|
||||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource).BeginInit();
|
((System.ComponentModel.ISupportInitialize)hotelBindingSource).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)hotelBindingSource1).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelHotelName
|
// labelHotelName
|
||||||
@ -114,6 +116,10 @@
|
|||||||
comboBoxHotel.Size = new Size(197, 23);
|
comboBoxHotel.Size = new Size(197, 23);
|
||||||
comboBoxHotel.TabIndex = 9;
|
comboBoxHotel.TabIndex = 9;
|
||||||
//
|
//
|
||||||
|
// hotelBindingSource1
|
||||||
|
//
|
||||||
|
hotelBindingSource1.DataSource = typeof(Entities.Hotel);
|
||||||
|
//
|
||||||
// FormRoom
|
// FormRoom
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
@ -132,6 +138,7 @@
|
|||||||
Text = "Комната";
|
Text = "Комната";
|
||||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource).EndInit();
|
((System.ComponentModel.ISupportInitialize)hotelBindingSource).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)hotelBindingSource1).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -146,5 +153,6 @@
|
|||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
private ComboBox comboBoxHotel;
|
private ComboBox comboBoxHotel;
|
||||||
|
private BindingSource hotelBindingSource1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,6 +30,7 @@ namespace ProjectHotel.Forms
|
|||||||
}
|
}
|
||||||
textBoxRoomName.Text = room.Name;
|
textBoxRoomName.Text = room.Name;
|
||||||
numericUpDownCapacity.Value = room.Capacity;
|
numericUpDownCapacity.Value = room.Capacity;
|
||||||
|
comboBoxHotel.SelectedValue = room.HotelId;
|
||||||
_roomId = value;
|
_roomId = value;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -141,6 +141,9 @@
|
|||||||
<metadata name="buttonSave.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="buttonSave.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</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">
|
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
@ -114,7 +114,7 @@ public class AthleteRepository : IAthleteRepository
|
|||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
var queryUpdate = @"
|
var queryUpdate = @"
|
||||||
UPDATE Athletes
|
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;
|
WHERE Id = @Id;
|
||||||
";
|
";
|
||||||
connection.Execute(queryUpdate, athlete);
|
connection.Execute(queryUpdate, athlete);
|
||||||
|
@ -83,7 +83,24 @@ namespace ProjectHotel.Repositories.Implementations
|
|||||||
}
|
}
|
||||||
public void UpdateRoom(Room rooms)
|
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)
|
public void DeleteRoom(int id)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user