diff --git a/project/ProjectTourAgency/Enities/AddMoney.cs b/project/ProjectTourAgency/Enities/AddMoney.cs index 3865dfe..fd04059 100644 --- a/project/ProjectTourAgency/Enities/AddMoney.cs +++ b/project/ProjectTourAgency/Enities/AddMoney.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,10 +9,21 @@ namespace ProjectTourAgency.Enities { public class AddMoney { + + [Browsable(false)] public int Id { get; private set; } + + [DisplayName("ID Клиента")] public int ClientId { get; private set; } + + [DisplayName("Дата")] public DateTime Date { get; private set; } - public int MoneyAmount{ get; private set; } + + [DisplayName("Размер Пополнение")] + public int MoneyAmount { get; private set; } + + [DisplayName("Клиент")] + public string ClientName { get; private set; } = string.Empty; public static AddMoney CreateEntity(int id,int cId, DateTime date, int money) diff --git a/project/ProjectTourAgency/Enities/Client.cs b/project/ProjectTourAgency/Enities/Client.cs index ab529c4..87c21dc 100644 --- a/project/ProjectTourAgency/Enities/Client.cs +++ b/project/ProjectTourAgency/Enities/Client.cs @@ -1,6 +1,7 @@ using ProjectTourAgency.Enities.Enums; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,11 +10,22 @@ namespace ProjectTourAgency.Enities; public class Client { + public int Id { get; private set; } + + [DisplayName("Полное имя")] public string FullName { get; private set; } = string.Empty; + + [DisplayName("Дата рождения")] public DateTime BirthDate { get; private set; } + + [DisplayName("Номер телефона")] public string PhoneNumber { get; private set; } = string.Empty; + + [DisplayName("Статус клиента")] public ClientStatus ClientStatus { get; private set; } + + [DisplayName("Баланс")] public int Money { get; private set; } public static Client CreateEntity(int id, string fullName, diff --git a/project/ProjectTourAgency/Enities/Employee.cs b/project/ProjectTourAgency/Enities/Employee.cs index 1ee2ff2..7f8a6e8 100644 --- a/project/ProjectTourAgency/Enities/Employee.cs +++ b/project/ProjectTourAgency/Enities/Employee.cs @@ -1,6 +1,7 @@ using ProjectTourAgency.Enities.Enums; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,10 +11,16 @@ namespace ProjectTourAgency.Enities; public class Employee { public int Id { get; private set; } + + [DisplayName("Полное имя")] public string FullName { get; private set; } = string.Empty; + public string EmployeeName => $"{EmployeeJob} {FullName}"; + + [DisplayName("Должность")] public EmpoyeeJob EmployeeJob { get; private set; } + public static Employee CreateEntity(int id, string fullName, EmpoyeeJob job) { diff --git a/project/ProjectTourAgency/Enities/Route.cs b/project/ProjectTourAgency/Enities/Route.cs index 09e80b9..fb8aab6 100644 --- a/project/ProjectTourAgency/Enities/Route.cs +++ b/project/ProjectTourAgency/Enities/Route.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,9 +10,17 @@ namespace ProjectTourAgency.Enities; public class Route { public int Id { get; private set; } + + [DisplayName("Место назначения")] public string Destination { get; private set; } = string.Empty; + + [DisplayName("Место отбытия")] public string Departure { get; private set; } = string.Empty; + + [DisplayName("Продолжительность")] public int Duration { get; private set; } + + public string DepartureDestination => $"{Departure} - {Destination}"; public static Route CreateEntity(int id, string destination, string departure, int duration) { diff --git a/project/ProjectTourAgency/Forms/FormClientTour.cs b/project/ProjectTourAgency/Forms/FormClientTour.cs index f1cfe34..472b343 100644 --- a/project/ProjectTourAgency/Forms/FormClientTour.cs +++ b/project/ProjectTourAgency/Forms/FormClientTour.cs @@ -25,11 +25,11 @@ namespace ProjectTourAgency.Forms _tourRepository = tourRepository ?? throw new ArgumentNullException(nameof(tourRepository)); comboBoxEmployeeId.DataSource = employeeRepository.ReadEmployees(); - comboBoxEmployeeId.DisplayMember = "FullName"; + comboBoxEmployeeId.DisplayMember = "EmployeeName"; comboBoxEmployeeId.ValueMember = "Id"; comboBoxRouteId.DataSource = routeRepository.ReadRoutes(); - comboBoxRouteId.DisplayMember = "Destination"; + comboBoxRouteId.DisplayMember = "DepartureDestination"; comboBoxRouteId.ValueMember = "Id"; ColumnClient.DataSource = clientRepository.ReadClients(); diff --git a/project/ProjectTourAgency/Implementations/AddMoneyRepository.cs b/project/ProjectTourAgency/Implementations/AddMoneyRepository.cs index 115c497..240ce36 100644 --- a/project/ProjectTourAgency/Implementations/AddMoneyRepository.cs +++ b/project/ProjectTourAgency/Implementations/AddMoneyRepository.cs @@ -109,7 +109,13 @@ WHERE Id = @Id"; try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = @"SELECT * FROM AddMoneys"; + var querySelect = @"SELECT + am.*, + c.FullName AS ClientName +FROM + AddMoneys am +LEFT JOIN + Clients c ON c.Id = am.ClientId"; var AddMoneys = connection.Query(querySelect); _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(AddMoneys)); return AddMoneys;