lab1
This commit is contained in:
parent
3435de98be
commit
1df413458a
0
.lab2.vpp.lck
Normal file
0
.lab2.vpp.lck
Normal file
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
using ProjectHotel.Entities.Enums;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -13,7 +14,9 @@ public class Athlete
|
|||||||
public string FirstName { get; private set; } = string.Empty;
|
public string FirstName { get; private set; } = string.Empty;
|
||||||
public string LastName { get; private set; } = string.Empty;
|
public string LastName { get; private set; } = string.Empty;
|
||||||
public string FatherName { get; private set; } = string.Empty;
|
public string FatherName { get; private set; } = string.Empty;
|
||||||
public static Athlete CreateEntity(int id, string first, string last, string father)
|
public Sport Sport { get; private set; }
|
||||||
|
public AthleteClass AthleteClass { get; private set; }
|
||||||
|
public static Athlete CreateEntity(int id, string first, string last, string father, Sport sport, AthleteClass athleteClass)
|
||||||
{
|
{
|
||||||
return new Athlete
|
return new Athlete
|
||||||
{
|
{
|
||||||
|
@ -10,14 +10,14 @@ public class AthletePlacingAthlete
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int AthleteId { get; private set; }
|
public int AthleteId { get; private set; }
|
||||||
public int PlacingId { get; private set; }
|
public int LengthOfStay { get; private set; }
|
||||||
public static AthletePlacingAthlete CreateElement(int id, int athleteId, int placingId)
|
public static AthletePlacingAthlete CreateElement(int id, int athleteId, int lengthOfStay)
|
||||||
{
|
{
|
||||||
return new AthletePlacingAthlete
|
return new AthletePlacingAthlete
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
AthleteId = athleteId,
|
AthleteId = athleteId,
|
||||||
PlacingId = placingId
|
LengthOfStay = lengthOfStay
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
ProjectHotel/ProjectHotel/Entities/Enums/AthleteClass.cs
Normal file
16
ProjectHotel/ProjectHotel/Entities/Enums/AthleteClass.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Entities.Enums;
|
||||||
|
|
||||||
|
public enum AthleteClass
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
MSMK = 1,
|
||||||
|
MS = 2,
|
||||||
|
KMS = 3
|
||||||
|
|
||||||
|
}
|
23
ProjectHotel/ProjectHotel/Entities/Enums/Sport.cs
Normal file
23
ProjectHotel/ProjectHotel/Entities/Enums/Sport.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Entities.Enums;
|
||||||
|
[Flags]
|
||||||
|
public enum Sport
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Archery = 2,
|
||||||
|
Athletics = 4,
|
||||||
|
Badminton = 8,
|
||||||
|
Basketball = 16,
|
||||||
|
Boxing = 32,
|
||||||
|
Cycling = 64,
|
||||||
|
Fencing = 128,
|
||||||
|
Gymnastics = 256,
|
||||||
|
Rowing = 512,
|
||||||
|
Swimming = 1024
|
||||||
|
}
|
||||||
|
|
@ -9,16 +9,16 @@ namespace ProjectHotel.Entities;
|
|||||||
public class Hotel
|
public class Hotel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public string HotelName { get; private set; } = string.Empty;
|
public string Name { get; private set; } = string.Empty;
|
||||||
public string Adress { get; private set; } = string.Empty;
|
public string Adress { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
public static Hotel CreateEntity(int id, string hotelName, string adress)
|
public static Hotel CreateEntity(int id, string name, string adress)
|
||||||
{
|
{
|
||||||
return new Hotel
|
return new Hotel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
HotelName = hotelName,
|
Name = name,
|
||||||
Adress = adress
|
Adress = adress
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,15 +11,19 @@ public class PlacingAthlete
|
|||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public int RoomId { get; private set; }
|
public int RoomId { get; private set; }
|
||||||
public DateTime PlacingDate { get; private set; }
|
public DateTime PlacingDate { get; private set; }
|
||||||
public DateTime UnplacingDate { get; private set; }
|
public IEnumerable<AthletePlacingAthlete> AthletePlacingAthletes
|
||||||
public static PlacingAthlete CreateOpeartion(int id, int roomId, DateTime unplacing)
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
} = [];
|
||||||
|
public static PlacingAthlete CreateOpeartion(int id, int roomId, IEnumerable<AthletePlacingAthlete> athletePlacingAthletes)
|
||||||
{
|
{
|
||||||
return new PlacingAthlete
|
return new PlacingAthlete
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
RoomId = roomId,
|
RoomId = roomId,
|
||||||
PlacingDate = DateTime.Now,
|
PlacingDate = DateTime.Now,
|
||||||
UnplacingDate = unplacing,
|
AthletePlacingAthletes = athletePlacingAthletes
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,15 +7,15 @@ using static System.Runtime.InteropServices.JavaScript.JSType;
|
|||||||
|
|
||||||
namespace ProjectHotel.Entities;
|
namespace ProjectHotel.Entities;
|
||||||
|
|
||||||
public class Rooms
|
public class Room
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public int HotelId { get; private set; }
|
public int HotelId { get; private set; }
|
||||||
public string Name { get; private set; } = string.Empty;
|
public string Name { get; private set; } = string.Empty;
|
||||||
public int Capacity { get; private set; }
|
public int Capacity { get; private set; }
|
||||||
public static Rooms CreateEntity(int id, int hotel, string name, int capacity)
|
public static Room CreateEntity(int id, int hotel, string name, int capacity)
|
||||||
{
|
{
|
||||||
return new Rooms
|
return new Room
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
HotelId = hotel,
|
HotelId = hotel,
|
@ -34,6 +34,12 @@
|
|||||||
textBoxFirstName = new TextBox();
|
textBoxFirstName = new TextBox();
|
||||||
textBoxLastName = new TextBox();
|
textBoxLastName = new TextBox();
|
||||||
textBoxFatherName = new TextBox();
|
textBoxFatherName = new TextBox();
|
||||||
|
comboBoxClass = new ComboBox();
|
||||||
|
labelClass = new Label();
|
||||||
|
label1 = new Label();
|
||||||
|
checkedListBoxSport = new CheckedListBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelName
|
// labelName
|
||||||
@ -84,11 +90,72 @@
|
|||||||
textBoxFatherName.Size = new Size(207, 23);
|
textBoxFatherName.Size = new Size(207, 23);
|
||||||
textBoxFatherName.TabIndex = 5;
|
textBoxFatherName.TabIndex = 5;
|
||||||
//
|
//
|
||||||
|
// comboBoxClass
|
||||||
|
//
|
||||||
|
comboBoxClass.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxClass.FormattingEnabled = true;
|
||||||
|
comboBoxClass.Location = new Point(99, 144);
|
||||||
|
comboBoxClass.Name = "comboBoxClass";
|
||||||
|
comboBoxClass.Size = new Size(207, 23);
|
||||||
|
comboBoxClass.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// labelClass
|
||||||
|
//
|
||||||
|
labelClass.AutoSize = true;
|
||||||
|
labelClass.Location = new Point(12, 147);
|
||||||
|
labelClass.Name = "labelClass";
|
||||||
|
labelClass.Size = new Size(44, 15);
|
||||||
|
labelClass.TabIndex = 7;
|
||||||
|
labelClass.Text = "Разряд";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(12, 186);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(41, 15);
|
||||||
|
label1.TabIndex = 8;
|
||||||
|
label1.Text = "Спорт";
|
||||||
|
//
|
||||||
|
// checkedListBoxSport
|
||||||
|
//
|
||||||
|
checkedListBoxSport.FormattingEnabled = true;
|
||||||
|
checkedListBoxSport.Location = new Point(98, 193);
|
||||||
|
checkedListBoxSport.Name = "checkedListBoxSport";
|
||||||
|
checkedListBoxSport.Size = new Size(278, 112);
|
||||||
|
checkedListBoxSport.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(61, 324);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(75, 23);
|
||||||
|
buttonSave.TabIndex = 11;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(251, 324);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(75, 23);
|
||||||
|
buttonCancel.TabIndex = 10;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
// FormAthlete
|
// FormAthlete
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(318, 139);
|
ClientSize = new Size(388, 359);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(checkedListBoxSport);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(labelClass);
|
||||||
|
Controls.Add(comboBoxClass);
|
||||||
Controls.Add(textBoxFatherName);
|
Controls.Add(textBoxFatherName);
|
||||||
Controls.Add(textBoxLastName);
|
Controls.Add(textBoxLastName);
|
||||||
Controls.Add(textBoxFirstName);
|
Controls.Add(textBoxFirstName);
|
||||||
@ -110,5 +177,11 @@
|
|||||||
private TextBox textBoxFirstName;
|
private TextBox textBoxFirstName;
|
||||||
private TextBox textBoxLastName;
|
private TextBox textBoxLastName;
|
||||||
private TextBox textBoxFatherName;
|
private TextBox textBoxFatherName;
|
||||||
|
private ComboBox comboBoxClass;
|
||||||
|
private Label labelClass;
|
||||||
|
private Label label1;
|
||||||
|
private CheckedListBox checkedListBoxSport;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,7 @@
|
|||||||
using ProjectHotel.Repositories;
|
using Microsoft.VisualBasic.FileIO;
|
||||||
|
using ProjectHotel.Entities;
|
||||||
|
using ProjectHotel.Entities.Enums;
|
||||||
|
using ProjectHotel.Repositories;
|
||||||
using ProjectHotel.Repositories.Implementations;
|
using ProjectHotel.Repositories.Implementations;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -28,9 +31,18 @@ public partial class FormAthlete : Form
|
|||||||
throw new
|
throw new
|
||||||
InvalidDataException(nameof(athlete));
|
InvalidDataException(nameof(athlete));
|
||||||
}
|
}
|
||||||
|
foreach (Sport elem in Enum.GetValues(typeof(Sport)))
|
||||||
|
{
|
||||||
|
if ((elem & athlete.Sport) != 0)
|
||||||
|
{
|
||||||
|
checkedListBoxSport.SetItemChecked(checkedListBoxSport.Items.IndexOf(elem), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
textBoxFirstName.Text = athlete.FirstName;
|
textBoxFirstName.Text = athlete.FirstName;
|
||||||
textBoxLastName.Text = athlete.LastName;
|
textBoxLastName.Text = athlete.LastName;
|
||||||
textBoxFatherName.Text = athlete.FatherName;
|
textBoxFatherName.Text = athlete.FatherName;
|
||||||
|
comboBoxClass.SelectedItem = athlete.AthleteClass;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -43,20 +55,27 @@ public partial class FormAthlete : Form
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_athleteRepository = athleteRepository ??
|
_athleteRepository = athleteRepository ??
|
||||||
throw new
|
throw new ArgumentNullException(nameof(athleteRepository));
|
||||||
ArgumentNullException(nameof(athleteRepository));
|
foreach (var elem in Enum.GetValues(typeof(Sport)))
|
||||||
|
{
|
||||||
|
checkedListBoxSport.Items.Add(elem);
|
||||||
|
}
|
||||||
|
comboBoxClass.DataSource = Enum.GetValues(typeof(AthleteClass));
|
||||||
}
|
}
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || string.IsNullOrWhiteSpace(textBoxLastName.Text) || string.IsNullOrWhiteSpace(textBoxFatherName.Text))
|
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxLastName.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxFatherName.Text) ||
|
||||||
|
comboBoxClass.SelectedIndex < 0 || checkedListBoxSport.SelectedIndex < 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Имеются незаполненные поля");
|
throw new Exception("Имеются незаполненные поля");
|
||||||
}
|
}
|
||||||
if (_athleteId.HasValue)
|
if (_athleteId.HasValue)
|
||||||
{
|
{
|
||||||
_athleteRepository.UpdateAthlete(CreateEmployee(_athleteId.Value));
|
_athleteRepository.UpdateAthlete(CreateAthlete(_athleteId.Value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -70,10 +89,17 @@ public partial class FormAthlete : Form
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) =>
|
private void buttonCancel_Click(object sender, EventArgs e) =>
|
||||||
Close();
|
Close();
|
||||||
private Employee CreateEmployee(int id) =>
|
private Athlete CreateAthlete(int id)
|
||||||
Employee.CreateEntity(id, textBoxFirstName.Text,
|
{
|
||||||
textBoxLastName.Text,
|
Sport sport = Sport.None;
|
||||||
(EmployeePost)comboBoxPost.SelectedItem!);
|
foreach (var elem in checkedListBoxSport.CheckedItems)
|
||||||
|
{
|
||||||
|
sport |= (Sport)elem;
|
||||||
|
}
|
||||||
|
return Athlete.CreateEntity(id, textBoxFirstName.Text, textBoxLastName.Text,
|
||||||
|
textBoxFatherName.Text, sport, (AthleteClass)comboBoxClass.SelectedItem!);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
125
ProjectHotel/ProjectHotel/Forms/FormAthletes.Designer.cs
generated
Normal file
125
ProjectHotel/ProjectHotel/Forms/FormAthletes.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
namespace ProjectHotel.Forms
|
||||||
|
{
|
||||||
|
partial class FormAthletes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonChange = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonChange);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(632, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(168, 450);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = Properties.Resources.ImageDelete;
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonDelete.Location = new Point(24, 308);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(130, 130);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += ButtonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonChange
|
||||||
|
//
|
||||||
|
buttonChange.BackgroundImage = Properties.Resources.ImageChange;
|
||||||
|
buttonChange.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonChange.Location = new Point(24, 158);
|
||||||
|
buttonChange.Name = "buttonChange";
|
||||||
|
buttonChange.Size = new Size(130, 130);
|
||||||
|
buttonChange.TabIndex = 1;
|
||||||
|
buttonChange.UseVisualStyleBackColor = true;
|
||||||
|
buttonChange.Click += ButtonChange_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.AddImage;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonAdd.Location = new Point(24, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(130, 130);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(632, 450);
|
||||||
|
dataGridViewData.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// FormAthletes
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormAthletes";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "FormAthletes";
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonChange;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
}
|
||||||
|
}
|
104
ProjectHotel/ProjectHotel/Forms/FormAthletes.cs
Normal file
104
ProjectHotel/ProjectHotel/Forms/FormAthletes.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using ProjectHotel.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
|
public partial class FormAthletes : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IAthleteRepository _athleteRepository;
|
||||||
|
public FormAthletes(IUnityContainer container, IAthleteRepository athleteRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
_athleteRepository = athleteRepository ?? throw new ArgumentNullException(nameof(athleteRepository));
|
||||||
|
}
|
||||||
|
private void FormAthletes_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormAthlete>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonChange_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormAthlete>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_athleteRepository.DeleteAthlete(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _athleteRepository.ReadAthletes();
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridViewData.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
120
ProjectHotel/ProjectHotel/Forms/FormAthletes.resx
Normal file
120
ProjectHotel/ProjectHotel/Forms/FormAthletes.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
98
ProjectHotel/ProjectHotel/Forms/FormCleaningRoom.Designer.cs
generated
Normal file
98
ProjectHotel/ProjectHotel/Forms/FormCleaningRoom.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
namespace ProjectHotel.Forms
|
||||||
|
{
|
||||||
|
partial class FormCleaningRoom
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelRoom = new Label();
|
||||||
|
comboBoxRoom = new ComboBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelRoom
|
||||||
|
//
|
||||||
|
labelRoom.AutoSize = true;
|
||||||
|
labelRoom.Location = new Point(46, 54);
|
||||||
|
labelRoom.Name = "labelRoom";
|
||||||
|
labelRoom.Size = new Size(97, 15);
|
||||||
|
labelRoom.TabIndex = 0;
|
||||||
|
labelRoom.Text = "Номер комнаты";
|
||||||
|
//
|
||||||
|
// comboBoxRoom
|
||||||
|
//
|
||||||
|
comboBoxRoom.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxRoom.FormattingEnabled = true;
|
||||||
|
comboBoxRoom.Location = new Point(176, 51);
|
||||||
|
comboBoxRoom.Name = "comboBoxRoom";
|
||||||
|
comboBoxRoom.Size = new Size(161, 23);
|
||||||
|
comboBoxRoom.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(68, 149);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(75, 23);
|
||||||
|
buttonSave.TabIndex = 2;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(218, 149);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(75, 23);
|
||||||
|
buttonCancel.TabIndex = 3;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormCleaningRoom
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(364, 194);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(comboBoxRoom);
|
||||||
|
Controls.Add(labelRoom);
|
||||||
|
Name = "FormCleaningRoom";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "FormCleaningRoom";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelRoom;
|
||||||
|
private ComboBox comboBoxRoom;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
49
ProjectHotel/ProjectHotel/Forms/FormCleaningRoom.cs
Normal file
49
ProjectHotel/ProjectHotel/Forms/FormCleaningRoom.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using ProjectHotel.Entities.Enums;
|
||||||
|
using ProjectHotel.Entities;
|
||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
|
public partial class FormCleaningRoom : Form
|
||||||
|
{
|
||||||
|
private readonly ICleaningRoomRepository _cleaningRoomRepository;
|
||||||
|
|
||||||
|
public FormCleaningRoom(ICleaningRoomRepository cleaningRoomRepository, IRoomRepository roomRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_cleaningRoomRepository = cleaningRoomRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(cleaningRoomRepository));
|
||||||
|
comboBoxRoom.DataSource = roomRepository.ReadRooms();
|
||||||
|
comboBoxRoom.DisplayMember = "Name";
|
||||||
|
comboBoxRoom.ValueMember = "Id";
|
||||||
|
|
||||||
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxRoom.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
_cleaningRoomRepository.CreateCleaningRoom(CleaningRoom.CreateOperation(0, (int)comboBoxRoom.SelectedValue!));
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
}
|
120
ProjectHotel/ProjectHotel/Forms/FormCleaningRoom.resx
Normal file
120
ProjectHotel/ProjectHotel/Forms/FormCleaningRoom.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
97
ProjectHotel/ProjectHotel/Forms/FormCleaningRooms.Designer.cs
generated
Normal file
97
ProjectHotel/ProjectHotel/Forms/FormCleaningRooms.Designer.cs
generated
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
namespace ProjectHotel.Forms
|
||||||
|
{
|
||||||
|
partial class FormCleaningRooms
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(579, 445);
|
||||||
|
dataGridViewData.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(579, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(168, 445);
|
||||||
|
panel1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.AddImage;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonAdd.Location = new Point(26, 146);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(130, 130);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// FormCleaningRooms
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(747, 445);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormCleaningRooms";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "FormCleaningRooms";
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
54
ProjectHotel/ProjectHotel/Forms/FormCleaningRooms.cs
Normal file
54
ProjectHotel/ProjectHotel/Forms/FormCleaningRooms.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
|
public partial class FormCleaningRooms : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly ICleaningRoomRepository _cleaningRoomRepository;
|
||||||
|
public FormCleaningRooms(IUnityContainer container, ICleaningRoomRepository cleaningRoomRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_cleaningRoomRepository = cleaningRoomRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(cleaningRoomRepository));
|
||||||
|
}
|
||||||
|
private void FormCleaningRooms_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormCleaningRoom>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _cleaningRoomRepository.ReadCleaningRooms();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
120
ProjectHotel/ProjectHotel/Forms/FormCleaningRooms.resx
Normal file
120
ProjectHotel/ProjectHotel/Forms/FormCleaningRooms.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -31,7 +31,9 @@
|
|||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
textBoxHotelName = new TextBox();
|
textBoxHotelName = new TextBox();
|
||||||
textBoxHotelAdress = new TextBox();
|
textBoxHotelAddress = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -59,19 +61,41 @@
|
|||||||
textBoxHotelName.Size = new Size(390, 23);
|
textBoxHotelName.Size = new Size(390, 23);
|
||||||
textBoxHotelName.TabIndex = 2;
|
textBoxHotelName.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// textBoxHotelAdress
|
// textBoxHotelAddress
|
||||||
//
|
//
|
||||||
textBoxHotelAdress.Location = new Point(168, 90);
|
textBoxHotelAddress.Location = new Point(168, 90);
|
||||||
textBoxHotelAdress.Name = "textBoxHotelAdress";
|
textBoxHotelAddress.Name = "textBoxHotelAddress";
|
||||||
textBoxHotelAdress.Size = new Size(387, 23);
|
textBoxHotelAddress.Size = new Size(387, 23);
|
||||||
textBoxHotelAdress.TabIndex = 3;
|
textBoxHotelAddress.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(105, 136);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(75, 23);
|
||||||
|
buttonSave.TabIndex = 4;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(385, 136);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(75, 23);
|
||||||
|
buttonCancel.TabIndex = 5;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
//
|
//
|
||||||
// FormHotel
|
// FormHotel
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(570, 167);
|
ClientSize = new Size(570, 167);
|
||||||
Controls.Add(textBoxHotelAdress);
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxHotelAddress);
|
||||||
Controls.Add(textBoxHotelName);
|
Controls.Add(textBoxHotelName);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
@ -88,5 +112,8 @@
|
|||||||
private Label label2;
|
private Label label2;
|
||||||
private TextBox textBoxHotelName;
|
private TextBox textBoxHotelName;
|
||||||
private TextBox textBoxHotelAdress;
|
private TextBox textBoxHotelAdress;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private TextBox textBoxHotelAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,7 +30,7 @@ public partial class FormHotel : Form
|
|||||||
throw new
|
throw new
|
||||||
InvalidDataException(nameof(hotel));
|
InvalidDataException(nameof(hotel));
|
||||||
}
|
}
|
||||||
textBoxHotelName.Text = hotel.HotelName;
|
textBoxHotelName.Text = hotel.Name;
|
||||||
textBoxHotelAdress.Text =
|
textBoxHotelAdress.Text =
|
||||||
hotel.Adress;
|
hotel.Adress;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public partial class FormHotel : Form
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ public partial class FormHotel : Form
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(textBoxHotelName.Text)
|
if (string.IsNullOrWhiteSpace(textBoxHotelName.Text)
|
||||||
||
|
||
|
||||||
string.IsNullOrWhiteSpace(textBoxHotelName.Text))
|
string.IsNullOrWhiteSpace(textBoxHotelAddress.Text))
|
||||||
{
|
{
|
||||||
throw new Exception("Имеются незаполненные поля");
|
throw new Exception("Имеются незаполненные поля");
|
||||||
}
|
}
|
||||||
@ -78,5 +78,7 @@ public partial class FormHotel : Form
|
|||||||
}
|
}
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
private Hotel CreateHotel(int id) => Hotel.CreateEntity(id, textBoxHotelName.Text, textBoxHotelAdress.Text);
|
private Hotel CreateHotel(int id) => Hotel.CreateEntity(id, textBoxHotelName.Text, textBoxHotelAdress.Text);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,68 +29,80 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
menuStrip1 = new MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
DirectoriesToolStripMenuItem = new ToolStripMenuItem();
|
||||||
комнатыToolStripMenuItem = new ToolStripMenuItem();
|
RoomsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отелелиToolStripMenuItem = new ToolStripMenuItem();
|
HotelsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
спортсменыToolStripMenuItem = new ToolStripMenuItem();
|
AthletesToolStripMenuItem = new ToolStripMenuItem();
|
||||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
OperationsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
заселениеСпортсменаToolStripMenuItem = new ToolStripMenuItem();
|
PlacingAthleteToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
CleaningRoomToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
ReportsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
menuStrip1.Items.AddRange(new ToolStripItem[] { DirectoriesToolStripMenuItem, OperationsToolStripMenuItem, ReportsToolStripMenuItem });
|
||||||
menuStrip1.Location = new Point(0, 0);
|
menuStrip1.Location = new Point(0, 0);
|
||||||
menuStrip1.Name = "menuStrip1";
|
menuStrip1.Name = "menuStrip1";
|
||||||
menuStrip1.Size = new Size(800, 24);
|
menuStrip1.Size = new Size(800, 24);
|
||||||
menuStrip1.TabIndex = 0;
|
menuStrip1.TabIndex = 0;
|
||||||
menuStrip1.Text = "menuStrip1";
|
menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// DirectoriesToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { комнатыToolStripMenuItem, отелелиToolStripMenuItem, спортсменыToolStripMenuItem });
|
DirectoriesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { RoomsToolStripMenuItem, HotelsToolStripMenuItem, AthletesToolStripMenuItem });
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
DirectoriesToolStripMenuItem.Name = "DirectoriesToolStripMenuItem";
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
DirectoriesToolStripMenuItem.Size = new Size(94, 20);
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
DirectoriesToolStripMenuItem.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// комнатыToolStripMenuItem
|
// RoomsToolStripMenuItem
|
||||||
//
|
//
|
||||||
комнатыToolStripMenuItem.Name = "комнатыToolStripMenuItem";
|
RoomsToolStripMenuItem.Name = "RoomsToolStripMenuItem";
|
||||||
комнатыToolStripMenuItem.Size = new Size(145, 22);
|
RoomsToolStripMenuItem.Size = new Size(180, 22);
|
||||||
комнатыToolStripMenuItem.Text = "Комнаты";
|
RoomsToolStripMenuItem.Text = "Комнаты";
|
||||||
|
RoomsToolStripMenuItem.Click += RoomsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// отелелиToolStripMenuItem
|
// HotelsToolStripMenuItem
|
||||||
//
|
//
|
||||||
отелелиToolStripMenuItem.Name = "отелелиToolStripMenuItem";
|
HotelsToolStripMenuItem.Name = "HotelsToolStripMenuItem";
|
||||||
отелелиToolStripMenuItem.Size = new Size(145, 22);
|
HotelsToolStripMenuItem.Size = new Size(180, 22);
|
||||||
отелелиToolStripMenuItem.Text = "Отелели";
|
HotelsToolStripMenuItem.Text = "Отелели";
|
||||||
|
HotelsToolStripMenuItem.Click += HotelsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// спортсменыToolStripMenuItem
|
// AthletesToolStripMenuItem
|
||||||
//
|
//
|
||||||
спортсменыToolStripMenuItem.Name = "спортсменыToolStripMenuItem";
|
AthletesToolStripMenuItem.Name = "AthletesToolStripMenuItem";
|
||||||
спортсменыToolStripMenuItem.Size = new Size(145, 22);
|
AthletesToolStripMenuItem.Size = new Size(180, 22);
|
||||||
спортсменыToolStripMenuItem.Text = "Спортсмены";
|
AthletesToolStripMenuItem.Text = "Спортсмены";
|
||||||
|
AthletesToolStripMenuItem.Click += AthletesToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// операцииToolStripMenuItem
|
// OperationsToolStripMenuItem
|
||||||
//
|
//
|
||||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заселениеСпортсменаToolStripMenuItem });
|
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { PlacingAthleteToolStripMenuItem, CleaningRoomToolStripMenuItem });
|
||||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
|
||||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
OperationsToolStripMenuItem.Size = new Size(75, 20);
|
||||||
операцииToolStripMenuItem.Text = "Операции";
|
OperationsToolStripMenuItem.Text = "Операции";
|
||||||
//
|
//
|
||||||
// заселениеСпортсменаToolStripMenuItem
|
// PlacingAthleteToolStripMenuItem
|
||||||
//
|
//
|
||||||
заселениеСпортсменаToolStripMenuItem.Name = "заселениеСпортсменаToolStripMenuItem";
|
PlacingAthleteToolStripMenuItem.Name = "PlacingAthleteToolStripMenuItem";
|
||||||
заселениеСпортсменаToolStripMenuItem.Size = new Size(201, 22);
|
PlacingAthleteToolStripMenuItem.Size = new Size(201, 22);
|
||||||
заселениеСпортсменаToolStripMenuItem.Text = "Заселение спортсмена";
|
PlacingAthleteToolStripMenuItem.Text = "Заселение спортсмена";
|
||||||
|
PlacingAthleteToolStripMenuItem.Click += PlacingAthleteToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// отчетыToolStripMenuItem
|
// CleaningRoomToolStripMenuItem
|
||||||
//
|
//
|
||||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
CleaningRoomToolStripMenuItem.Name = "CleaningRoomToolStripMenuItem";
|
||||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
CleaningRoomToolStripMenuItem.Size = new Size(201, 22);
|
||||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
CleaningRoomToolStripMenuItem.Text = "Уборка комнаты";
|
||||||
|
CleaningRoomToolStripMenuItem.Click += CleaningRoomToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// ReportsToolStripMenuItem
|
||||||
|
//
|
||||||
|
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
|
||||||
|
ReportsToolStripMenuItem.Size = new Size(60, 20);
|
||||||
|
ReportsToolStripMenuItem.Text = "Отчеты";
|
||||||
//
|
//
|
||||||
// FormHotelForAthletes
|
// FormHotelForAthletes
|
||||||
//
|
//
|
||||||
@ -113,12 +125,13 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private MenuStrip menuStrip1;
|
private MenuStrip menuStrip1;
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
private ToolStripMenuItem DirectoriesToolStripMenuItem;
|
||||||
private ToolStripMenuItem комнатыToolStripMenuItem;
|
private ToolStripMenuItem RoomsToolStripMenuItem;
|
||||||
private ToolStripMenuItem отелелиToolStripMenuItem;
|
private ToolStripMenuItem HotelsToolStripMenuItem;
|
||||||
private ToolStripMenuItem спортсменыToolStripMenuItem;
|
private ToolStripMenuItem AthletesToolStripMenuItem;
|
||||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
private ToolStripMenuItem OperationsToolStripMenuItem;
|
||||||
private ToolStripMenuItem заселениеСпортсменаToolStripMenuItem;
|
private ToolStripMenuItem PlacingAthleteToolStripMenuItem;
|
||||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
private ToolStripMenuItem ReportsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem CleaningRoomToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,83 @@
|
|||||||
namespace ProjectHotel
|
using ProjectHotel.Forms;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectHotel;
|
||||||
|
|
||||||
|
public partial class FormHotelForAthletes : Form
|
||||||
{
|
{
|
||||||
public partial class FormHotelForAthletes : Form
|
private readonly IUnityContainer _container;
|
||||||
|
public FormHotelForAthletes(IUnityContainer container)
|
||||||
{
|
{
|
||||||
public FormHotelForAthletes()
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RoomsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
_container.Resolve<FormRooms>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HotelsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormHotels>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AthletesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormAthletes>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlacingAthleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormPlacingAthletes>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CleaningRoomToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormCleaningRoom>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace ProjectHotel.Forms
|
namespace ProjectHotel.Forms
|
||||||
{
|
{
|
||||||
partial class Отели
|
partial class FormHotels
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -57,6 +57,7 @@
|
|||||||
buttonDelete.Size = new Size(130, 130);
|
buttonDelete.Size = new Size(130, 130);
|
||||||
buttonDelete.TabIndex = 2;
|
buttonDelete.TabIndex = 2;
|
||||||
buttonDelete.UseVisualStyleBackColor = true;
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += ButtonDelete_Click;
|
||||||
//
|
//
|
||||||
// buttonChange
|
// buttonChange
|
||||||
//
|
//
|
||||||
@ -67,6 +68,7 @@
|
|||||||
buttonChange.Size = new Size(130, 130);
|
buttonChange.Size = new Size(130, 130);
|
||||||
buttonChange.TabIndex = 1;
|
buttonChange.TabIndex = 1;
|
||||||
buttonChange.UseVisualStyleBackColor = true;
|
buttonChange.UseVisualStyleBackColor = true;
|
||||||
|
buttonChange.Click += ButtonChange_Click;
|
||||||
//
|
//
|
||||||
// buttonAdd
|
// buttonAdd
|
||||||
//
|
//
|
||||||
@ -77,6 +79,7 @@
|
|||||||
buttonAdd.Size = new Size(130, 130);
|
buttonAdd.Size = new Size(130, 130);
|
||||||
buttonAdd.TabIndex = 0;
|
buttonAdd.TabIndex = 0;
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
//
|
//
|
||||||
// dataGridViewData
|
// dataGridViewData
|
||||||
//
|
//
|
||||||
@ -96,16 +99,16 @@
|
|||||||
dataGridViewData.Size = new Size(632, 450);
|
dataGridViewData.Size = new Size(632, 450);
|
||||||
dataGridViewData.TabIndex = 1;
|
dataGridViewData.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// Отели
|
// FormHotels
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
Controls.Add(dataGridViewData);
|
Controls.Add(dataGridViewData);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "Отели";
|
Name = "FormHotels";
|
||||||
StartPosition = FormStartPosition.CenterParent;
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "FormHotels";
|
Text = "Гостиницы";
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -13,12 +13,12 @@ using Unity;
|
|||||||
|
|
||||||
namespace ProjectHotel.Forms;
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
public partial class Отели : Form
|
public partial class FormHotels : Form
|
||||||
{
|
{
|
||||||
private readonly IUnityContainer _container;
|
private readonly IUnityContainer _container;
|
||||||
private readonly IHotelRepository _hotelRepository;
|
private readonly IHotelRepository _hotelRepository;
|
||||||
|
|
||||||
public Отели(IUnityContainer container, IHotelRepository hotelRepository)
|
public FormHotels(IUnityContainer container, IHotelRepository hotelRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_container = container ??
|
_container = container ??
|
||||||
@ -26,7 +26,7 @@ public partial class Отели : Form
|
|||||||
_hotelRepository = hotelRepository ??
|
_hotelRepository = hotelRepository ??
|
||||||
throw new ArgumentNullException(nameof(hotelRepository));
|
throw new ArgumentNullException(nameof(hotelRepository));
|
||||||
}
|
}
|
||||||
private void FormAnimals_Load(object sender, EventArgs e)
|
private void FormRoom_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ public partial class Отели : Form
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
private void ButtonChange_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
{
|
{
|
||||||
@ -104,6 +104,8 @@ public partial class Отели : Form
|
|||||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
166
ProjectHotel/ProjectHotel/Forms/FormPlacingAthlete.Designer.cs
generated
Normal file
166
ProjectHotel/ProjectHotel/Forms/FormPlacingAthlete.Designer.cs
generated
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
namespace ProjectHotel.Forms
|
||||||
|
{
|
||||||
|
partial class FormPlacingAthlete
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
comboBoxRoom = new ComboBox();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
ColumnAthlete = new DataGridViewComboBoxColumn();
|
||||||
|
ColumnLengthOfStay = new DataGridViewTextBoxColumn();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(58, 35);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(54, 15);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "Комната";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(58, 90);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(156, 15);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Длительность проживания";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonCancel.Location = new Point(304, 479);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(75, 23);
|
||||||
|
buttonCancel.TabIndex = 5;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonSave.Location = new Point(111, 479);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(75, 23);
|
||||||
|
buttonSave.TabIndex = 4;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// comboBoxRoom
|
||||||
|
//
|
||||||
|
comboBoxRoom.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxRoom.FormattingEnabled = true;
|
||||||
|
comboBoxRoom.Location = new Point(118, 32);
|
||||||
|
comboBoxRoom.Name = "comboBoxRoom";
|
||||||
|
comboBoxRoom.Size = new Size(382, 23);
|
||||||
|
comboBoxRoom.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
groupBox1.Controls.Add(dataGridView);
|
||||||
|
groupBox1.Location = new Point(12, 130);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(491, 329);
|
||||||
|
groupBox1.TabIndex = 7;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "Спортсмены";
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnAthlete, ColumnLengthOfStay });
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(3, 19);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||||
|
dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||||
|
dataGridView.Size = new Size(485, 307);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ColumnAthlete
|
||||||
|
//
|
||||||
|
ColumnAthlete.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
|
||||||
|
ColumnAthlete.HeaderText = "Спортсмен";
|
||||||
|
ColumnAthlete.Name = "ColumnAthlete";
|
||||||
|
//
|
||||||
|
// ColumnLengthOfStay
|
||||||
|
//
|
||||||
|
ColumnLengthOfStay.HeaderText = "Длительность проживания";
|
||||||
|
ColumnLengthOfStay.Name = "ColumnLengthOfStay";
|
||||||
|
//
|
||||||
|
// FormAthletePlacingAthlete
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(515, 534);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Controls.Add(comboBoxRoom);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Name = "FormAthletePlacingAthlete";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Размещение спортсмена";
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private ComboBox comboBoxRoom;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private DataGridViewComboBoxColumn ColumnAthlete;
|
||||||
|
private DataGridViewTextBoxColumn ColumnLengthOfStay;
|
||||||
|
}
|
||||||
|
}
|
73
ProjectHotel/ProjectHotel/Forms/FormPlacingAthlete.cs
Normal file
73
ProjectHotel/ProjectHotel/Forms/FormPlacingAthlete.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using ProjectHotel.Entities;
|
||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using ProjectHotel.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
|
public partial class FormPlacingAthlete : Form
|
||||||
|
{
|
||||||
|
private readonly IPlacingAthleteRepository _placingAthleteRepository;
|
||||||
|
public FormPlacingAthlete(IPlacingAthleteRepository placingAthleteRepository,
|
||||||
|
IRoomRepository roomRepository,
|
||||||
|
IAthleteRepository athleteRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_placingAthleteRepository = placingAthleteRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(placingAthleteRepository));
|
||||||
|
comboBoxRoom.DataSource = roomRepository.ReadRooms();
|
||||||
|
comboBoxRoom.DisplayMember = "Name";
|
||||||
|
comboBoxRoom.ValueMember = "Id";
|
||||||
|
ColumnAthlete.DataSource = athleteRepository.ReadAthletes();
|
||||||
|
ColumnAthlete.DisplayMember = "FirstName";
|
||||||
|
ColumnAthlete.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dataGridView.RowCount < 1 ||
|
||||||
|
comboBoxRoom.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
_placingAthleteRepository.CreatePlacingAthlete(PlacingAthlete.CreateOpeartion(0,(int)comboBoxRoom.SelectedValue!,
|
||||||
|
CreateListAthletePlacingAthleteFromDataGrid()));
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private List<AthletePlacingAthlete>
|
||||||
|
CreateListAthletePlacingAthleteFromDataGrid()
|
||||||
|
{
|
||||||
|
var list = new List<AthletePlacingAthlete>();
|
||||||
|
foreach (DataGridViewRow row in dataGridView.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["ColumnFeed"].Value == null ||
|
||||||
|
row.Cells["ColumnCount"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add(AthletePlacingAthlete.CreateElement(0,
|
||||||
|
Convert.ToInt32(row.Cells["ColumnAthlete"].Value),
|
||||||
|
Convert.ToInt32(row.Cells["ColumnLengthOfStay"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
123
ProjectHotel/ProjectHotel/Forms/FormPlacingAthlete.resx
Normal file
123
ProjectHotel/ProjectHotel/Forms/FormPlacingAthlete.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="ColumnLengthOfStay.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
110
ProjectHotel/ProjectHotel/Forms/FormPlacingAthletes.Designer.cs
generated
Normal file
110
ProjectHotel/ProjectHotel/Forms/FormPlacingAthletes.Designer.cs
generated
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
namespace ProjectHotel.Forms
|
||||||
|
{
|
||||||
|
partial class FormPlacingAthletes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(632, 450);
|
||||||
|
dataGridViewData.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(632, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(168, 450);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = Properties.Resources.ImageDelete;
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonDelete.Location = new Point(26, 248);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(130, 130);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += ButtonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.AddImage;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonAdd.Location = new Point(24, 51);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(130, 130);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// FormPlacingAthletes
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormPlacingAthletes";
|
||||||
|
Text = "FormPlacingAthletes";
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
89
ProjectHotel/ProjectHotel/Forms/FormPlacingAthletes.cs
Normal file
89
ProjectHotel/ProjectHotel/Forms/FormPlacingAthletes.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
|
public partial class FormPlacingAthletes : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IPlacingAthleteRepository _placingAthleteRepository;
|
||||||
|
public FormPlacingAthletes(IUnityContainer container, IPlacingAthleteRepository placingAthleteRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_placingAthleteRepository = placingAthleteRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(placingAthleteRepository));
|
||||||
|
}
|
||||||
|
private void FormPlacingAthletes_Load1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormPlacingAthlete>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||||
|
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_placingAthleteRepository.DeletePlacingAthlete(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource =
|
||||||
|
_placingAthleteRepository.ReadPlacingAthlete();
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridViewData.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
id =
|
||||||
|
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
120
ProjectHotel/ProjectHotel/Forms/FormPlacingAthletes.resx
Normal file
120
ProjectHotel/ProjectHotel/Forms/FormPlacingAthletes.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
109
ProjectHotel/ProjectHotel/Forms/FormRoom.Designer.cs
generated
109
ProjectHotel/ProjectHotel/Forms/FormRoom.Designer.cs
generated
@ -1,6 +1,6 @@
|
|||||||
namespace ProjectHotel.Forms
|
namespace ProjectHotel.Forms
|
||||||
{
|
{
|
||||||
partial class Комната
|
partial class FormRoom
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -30,26 +30,121 @@
|
|||||||
{
|
{
|
||||||
components = new System.ComponentModel.Container();
|
components = new System.ComponentModel.Container();
|
||||||
hotelBindingSource = new BindingSource(components);
|
hotelBindingSource = new BindingSource(components);
|
||||||
|
labelHotelName = new Label();
|
||||||
|
labelCapacity = new Label();
|
||||||
|
labelRoomName = new Label();
|
||||||
|
numericUpDownCapacity = new NumericUpDown();
|
||||||
|
textBoxRoomName = new TextBox();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
comboBoxHotel = new ComboBox();
|
||||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource).BeginInit();
|
((System.ComponentModel.ISupportInitialize)hotelBindingSource).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// hotelBindingSource
|
// labelHotelName
|
||||||
//
|
//
|
||||||
hotelBindingSource.DataSource = typeof(Entities.Hotel);
|
labelHotelName.AutoSize = true;
|
||||||
|
labelHotelName.Location = new Point(31, 55);
|
||||||
|
labelHotelName.Name = "labelHotelName";
|
||||||
|
labelHotelName.Size = new Size(93, 15);
|
||||||
|
labelHotelName.TabIndex = 0;
|
||||||
|
labelHotelName.Text = "Название отеля";
|
||||||
//
|
//
|
||||||
// Комната
|
// labelCapacity
|
||||||
|
//
|
||||||
|
labelCapacity.AutoSize = true;
|
||||||
|
labelCapacity.Location = new Point(31, 109);
|
||||||
|
labelCapacity.Name = "labelCapacity";
|
||||||
|
labelCapacity.Size = new Size(80, 15);
|
||||||
|
labelCapacity.TabIndex = 1;
|
||||||
|
labelCapacity.Text = "Вместимость";
|
||||||
|
//
|
||||||
|
// labelRoomName
|
||||||
|
//
|
||||||
|
labelRoomName.AutoSize = true;
|
||||||
|
labelRoomName.Location = new Point(31, 168);
|
||||||
|
labelRoomName.Name = "labelRoomName";
|
||||||
|
labelRoomName.Size = new Size(97, 15);
|
||||||
|
labelRoomName.TabIndex = 2;
|
||||||
|
labelRoomName.Text = "Номер комнаты";
|
||||||
|
//
|
||||||
|
// numericUpDownCapacity
|
||||||
|
//
|
||||||
|
numericUpDownCapacity.Location = new Point(153, 109);
|
||||||
|
numericUpDownCapacity.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
numericUpDownCapacity.Name = "numericUpDownCapacity";
|
||||||
|
numericUpDownCapacity.Size = new Size(55, 23);
|
||||||
|
numericUpDownCapacity.TabIndex = 3;
|
||||||
|
numericUpDownCapacity.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// textBoxRoomName
|
||||||
|
//
|
||||||
|
textBoxRoomName.Location = new Point(153, 160);
|
||||||
|
textBoxRoomName.Name = "textBoxRoomName";
|
||||||
|
textBoxRoomName.Size = new Size(185, 23);
|
||||||
|
textBoxRoomName.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(263, 251);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(75, 23);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(73, 251);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(75, 23);
|
||||||
|
buttonSave.TabIndex = 8;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// comboBoxHotel
|
||||||
|
//
|
||||||
|
comboBoxHotel.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxHotel.FormattingEnabled = true;
|
||||||
|
comboBoxHotel.Location = new Point(153, 47);
|
||||||
|
comboBoxHotel.Name = "comboBoxHotel";
|
||||||
|
comboBoxHotel.Size = new Size(197, 23);
|
||||||
|
comboBoxHotel.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// FormRoom
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(584, 389);
|
ClientSize = new Size(419, 309);
|
||||||
Name = "Комната";
|
Controls.Add(comboBoxHotel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(textBoxRoomName);
|
||||||
|
Controls.Add(numericUpDownCapacity);
|
||||||
|
Controls.Add(labelRoomName);
|
||||||
|
Controls.Add(labelCapacity);
|
||||||
|
Controls.Add(labelHotelName);
|
||||||
|
Name = "FormRoom";
|
||||||
StartPosition = FormStartPosition.CenterParent;
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "FormRoom";
|
Text = "Комната";
|
||||||
((System.ComponentModel.ISupportInitialize)hotelBindingSource).EndInit();
|
((System.ComponentModel.ISupportInitialize)hotelBindingSource).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
private BindingSource hotelBindingSource;
|
private BindingSource hotelBindingSource;
|
||||||
|
private Label labelHotelName;
|
||||||
|
private Label labelCapacity;
|
||||||
|
private Label labelRoomName;
|
||||||
|
private NumericUpDown numericUpDownCapacity;
|
||||||
|
private TextBox textBoxRoomName;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private ComboBox comboBoxHotel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using ProjectHotel.Entities;
|
||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -10,11 +12,75 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace ProjectHotel.Forms
|
namespace ProjectHotel.Forms
|
||||||
{
|
{
|
||||||
public partial class Комната : Form
|
public partial class FormRoom : Form
|
||||||
{
|
{
|
||||||
public Комната()
|
private readonly IRoomRepository _roomRepository;
|
||||||
|
private int? _roomId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var room = _roomRepository.ReadRoomById(value);
|
||||||
|
if (room == null || comboBoxHotel.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new
|
||||||
|
InvalidDataException(nameof(room));
|
||||||
|
}
|
||||||
|
textBoxRoomName.Text = room.Name;
|
||||||
|
numericUpDownCapacity.Value = room.Capacity;
|
||||||
|
_roomId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormRoom(IRoomRepository roomRepository, IHotelRepository hotelRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_roomRepository = roomRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(roomRepository));
|
||||||
|
comboBoxHotel.DataSource = hotelRepository.ReadHotels();
|
||||||
|
comboBoxHotel.DisplayMember = "Name";
|
||||||
|
comboBoxHotel.ValueMember = "Id";
|
||||||
}
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxRoomName.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_roomId.HasValue)
|
||||||
|
{
|
||||||
|
_roomRepository.UpdateRoom(CreateRoom(_roomId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_roomRepository.CreateRoom(CreateRoom(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Room CreateRoom(int id) => Room.CreateEntity(id, (int)comboBoxHotel.SelectedValue!, textBoxRoomName.Text, Convert.ToInt32(numericUpDownCapacity.Value));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,4 +120,28 @@
|
|||||||
<metadata name="hotelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="hotelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="labelHotelName.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="labelCapacity.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="labelRoomName.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="numericUpDownCapacity.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="textBoxRoomName.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="buttonCancel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="buttonSave.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
125
ProjectHotel/ProjectHotel/Forms/FormRooms.Designer.cs
generated
Normal file
125
ProjectHotel/ProjectHotel/Forms/FormRooms.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
namespace ProjectHotel.Forms
|
||||||
|
{
|
||||||
|
partial class FormRooms
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonChange = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(632, 450);
|
||||||
|
dataGridViewData.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonChange);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(632, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(168, 450);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = Properties.Resources.ImageDelete;
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonDelete.Location = new Point(24, 308);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(130, 130);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += ButtonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonChange
|
||||||
|
//
|
||||||
|
buttonChange.BackgroundImage = Properties.Resources.ImageChange;
|
||||||
|
buttonChange.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonChange.Location = new Point(24, 158);
|
||||||
|
buttonChange.Name = "buttonChange";
|
||||||
|
buttonChange.Size = new Size(130, 130);
|
||||||
|
buttonChange.TabIndex = 1;
|
||||||
|
buttonChange.UseVisualStyleBackColor = true;
|
||||||
|
buttonChange.Click += ButtonChange_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.AddImage;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonAdd.Location = new Point(24, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(130, 130);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// FormRooms
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormRooms";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "FormRooms";
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonChange;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
111
ProjectHotel/ProjectHotel/Forms/FormRooms.cs
Normal file
111
ProjectHotel/ProjectHotel/Forms/FormRooms.cs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using ProjectHotel.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectHotel.Forms;
|
||||||
|
|
||||||
|
public partial class FormRooms : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IRoomRepository _roomRepository;
|
||||||
|
|
||||||
|
public FormRooms(IUnityContainer container, IRoomRepository roomRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_roomRepository = roomRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(roomRepository));
|
||||||
|
}
|
||||||
|
private void FormRoom_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormRoom>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonChange_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormRoom>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_roomRepository.DeleteRoom(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _roomRepository.ReadRooms();
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridViewData.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
120
ProjectHotel/ProjectHotel/Forms/FormRooms.resx
Normal file
120
ProjectHotel/ProjectHotel/Forms/FormRooms.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,3 +1,8 @@
|
|||||||
|
using Unity.Lifetime;
|
||||||
|
using Unity;
|
||||||
|
using ProjectHotel.Repositories;
|
||||||
|
using ProjectHotel.Repositories.Implementations;
|
||||||
|
|
||||||
namespace ProjectHotel
|
namespace ProjectHotel
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +16,19 @@ namespace ProjectHotel
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormHotelForAthletes());
|
Application.Run(CreateContainer().Resolve<FormHotelForAthletes>());
|
||||||
|
}
|
||||||
|
private static IUnityContainer CreateContainer()
|
||||||
|
{
|
||||||
|
var container = new UnityContainer();
|
||||||
|
|
||||||
|
container.RegisterType<IAthleteRepository, AthleteRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<ICleaningRoomRepository, CleaningRoomRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IHotelRepository, HotelRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IPlacingAthleteRepository, PlacingAthleteRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IRoomRepository, RoomRepository>(new TransientLifetimeManager());
|
||||||
|
|
||||||
|
return container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,10 +23,6 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Entities\Enums\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Unity" Version="5.11.10" />
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
using ProjectHotel.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectHotel.Repositories;
|
|
||||||
|
|
||||||
internal interface IAthletePlacingAthleteRepository
|
|
||||||
{
|
|
||||||
IEnumerable<AthletePlacingAthlete> ReadAthletePlacingAthlete(int? id = null, int? athleteId = null, int? roomId = null);
|
|
||||||
void CreateAthletePlacingAthlete(AthletePlacingAthlete athletePlacingAthlete);
|
|
||||||
AthletePlacingAthlete ReadAthleteById(int id);
|
|
||||||
}
|
|
@ -7,10 +7,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ProjectHotel.Repositories;
|
namespace ProjectHotel.Repositories;
|
||||||
|
|
||||||
internal interface ICleaningRoomRepository
|
public interface ICleaningRoomRepository
|
||||||
{
|
{
|
||||||
IEnumerable<CleaningRoom> ReadCleaningRoom(int? id = null, int? roomId = null, int? athleteId = null);
|
IEnumerable<CleaningRoom> ReadCleaningRooms(int? id = null, int? roomId = null);
|
||||||
void CreateCleaningRoom(CleaningRoom cleaningRoom);
|
void CreateCleaningRoom(CleaningRoom cleaningRoom);
|
||||||
AthletePlacingAthlete ReadAthleteById(int id);
|
CleaningRoom ReadCleaningRoomById(int id);
|
||||||
}
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ namespace ProjectHotel.Repositories;
|
|||||||
|
|
||||||
public interface IPlacingAthleteRepository
|
public interface IPlacingAthleteRepository
|
||||||
{
|
{
|
||||||
IEnumerable<PlacingAthlete> ReadPlacingAthlete(DateTime? placing = null, DateTime? unplacing = null, int? roomId = null);
|
IEnumerable<PlacingAthlete> ReadPlacingAthlete(int? roomId = null, DateTime ? placing = null);
|
||||||
void CreatePlacingAthlete(PlacingAthlete placingAthlete);
|
void CreatePlacingAthlete(PlacingAthlete placingAthlete);
|
||||||
PlacingAthlete ReadPlacingAthleteById(int id);
|
void DeletePlacingAthlete(int id);
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ namespace ProjectHotel.Repositories;
|
|||||||
public interface IRoomRepository
|
public interface IRoomRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
IEnumerable<Rooms> ReadRooms();
|
IEnumerable<Room> ReadRooms();
|
||||||
Rooms ReadRoomById(int id);
|
Room ReadRoomById(int id);
|
||||||
void CreateRoom(Rooms rooms);
|
void CreateRoom(Room room);
|
||||||
void UpdateRoom(Rooms rooms);
|
void UpdateRoom(Room room);
|
||||||
void DeleteRoom(int id);
|
void DeleteRoom(int id);
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
using ProjectHotel.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectHotel.Repositories.Implementations;
|
|
||||||
|
|
||||||
internal class AthletePlacingAthleteRepository
|
|
||||||
{
|
|
||||||
public IEnumerable<AthletePlacingAthleteRepository> ReadAthletePlacingAthlete(int? id = null, int? athleteId = null, int? roomId = null)
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
public void CreateAthletePlacingAthlete(AthletePlacingAthleteRepository athletePlacingAthlete)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public AthletePlacingAthlete ReadAthleteById(int id)
|
|
||||||
{
|
|
||||||
return AthletePlacingAthlete.CreateElement(0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ internal class AthleteRepository : IAthleteRepository
|
|||||||
}
|
}
|
||||||
public Athlete ReadAthleteById(int id)
|
public Athlete ReadAthleteById(int id)
|
||||||
{
|
{
|
||||||
return Athlete.CreateEntity(0, string.Empty, string.Empty,string.Empty);
|
return Athlete.CreateEntity(0, string.Empty, string.Empty,string.Empty, Entities.Enums.Sport.None, Entities.Enums.AthleteClass.None);
|
||||||
}
|
}
|
||||||
public IEnumerable<Athlete> ReadAthletes()
|
public IEnumerable<Athlete> ReadAthletes()
|
||||||
{
|
{
|
||||||
|
@ -7,18 +7,18 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ProjectHotel.Repositories.Implementations;
|
namespace ProjectHotel.Repositories.Implementations;
|
||||||
|
|
||||||
internal class CleaningRoomRepository
|
internal class CleaningRoomRepository : ICleaningRoomRepository
|
||||||
{
|
{
|
||||||
IEnumerable<CleaningRoom> ReadCleaningRoom(int? id = null, int? roomId = null, int? athleteId = null)
|
public IEnumerable<CleaningRoom> ReadCleaningRooms(int? id = null, int? roomId = null)
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
void CreateCleaningRoom(CleaningRoom cleaningRoom)
|
public void CreateCleaningRoom(CleaningRoom cleaningRoom)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
AthletePlacingAthlete ReadAthleteById(int id)
|
public CleaningRoom ReadCleaningRoomById(int id)
|
||||||
{
|
{
|
||||||
return AthletePlacingAthlete.CreateElement(0, 0, 0);
|
return CleaningRoom.CreateOperation(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace ProjectHotel.Repositories.Implementations;
|
|||||||
|
|
||||||
internal class PlacingAthleteRepository : IPlacingAthleteRepository
|
internal class PlacingAthleteRepository : IPlacingAthleteRepository
|
||||||
{
|
{
|
||||||
public IEnumerable<PlacingAthlete> ReadPlacingAthlete(DateTime? plasing = null, DateTime? unplacing = null, int? roomId = null)
|
public IEnumerable<PlacingAthlete> ReadPlacingAthlete(int? roomId = null, DateTime? placing = null)
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -17,8 +17,8 @@ internal class PlacingAthleteRepository : IPlacingAthleteRepository
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public PlacingAthlete ReadPlacingAthleteById(int id)
|
public void DeletePlacingAthlete(int id)
|
||||||
{
|
{
|
||||||
return PlacingAthlete.CreateOpeartion(0, 0, DateTime.Now);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,19 +9,19 @@ namespace ProjectHotel.Repositories.Implementations
|
|||||||
{
|
{
|
||||||
internal class RoomRepository : IRoomRepository
|
internal class RoomRepository : IRoomRepository
|
||||||
{
|
{
|
||||||
public IEnumerable<Rooms> ReadRooms()
|
public IEnumerable<Room> ReadRooms()
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
public Rooms ReadRoomById(int id)
|
public Room ReadRoomById(int id)
|
||||||
{
|
{
|
||||||
return Rooms.CreateEntity(0, 0, string.Empty, 0);
|
return Room.CreateEntity(0, 0, string.Empty, 0);
|
||||||
}
|
}
|
||||||
public void CreateRoom(Rooms rooms)
|
public void CreateRoom(Room rooms)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public void UpdateRoom(Rooms rooms)
|
public void UpdateRoom(Room rooms)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
lab2.vpp.bak_000f
Normal file
BIN
lab2.vpp.bak_000f
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user