Сделали подписи для все справочников, сделали все с операцией пополнения счета

This commit is contained in:
Tonb73 2024-12-06 12:17:31 +03:00
parent 914aa3c596
commit e697397462
6 changed files with 50 additions and 4 deletions

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,10 +9,21 @@ namespace ProjectTourAgency.Enities
{ {
public class AddMoney public class AddMoney
{ {
[Browsable(false)]
public int Id { get; private set; } public int Id { get; private set; }
[DisplayName("ID Клиента")]
public int ClientId { get; private set; } public int ClientId { get; private set; }
[DisplayName("Дата")]
public DateTime Date { get; private set; } 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, public static AddMoney CreateEntity(int id,int cId,
DateTime date, int money) DateTime date, int money)

View File

@ -1,6 +1,7 @@
using ProjectTourAgency.Enities.Enums; using ProjectTourAgency.Enities.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -9,11 +10,22 @@ namespace ProjectTourAgency.Enities;
public class Client public class Client
{ {
public int Id { get; private set; } public int Id { get; private set; }
[DisplayName("Полное имя")]
public string FullName { get; private set; } = string.Empty; public string FullName { get; private set; } = string.Empty;
[DisplayName("Дата рождения")]
public DateTime BirthDate { get; private set; } public DateTime BirthDate { get; private set; }
[DisplayName("Номер телефона")]
public string PhoneNumber { get; private set; } = string.Empty; public string PhoneNumber { get; private set; } = string.Empty;
[DisplayName("Статус клиента")]
public ClientStatus ClientStatus { get; private set; } public ClientStatus ClientStatus { get; private set; }
[DisplayName("Баланс")]
public int Money { get; private set; } public int Money { get; private set; }
public static Client CreateEntity(int id, string fullName, public static Client CreateEntity(int id, string fullName,

View File

@ -1,6 +1,7 @@
using ProjectTourAgency.Enities.Enums; using ProjectTourAgency.Enities.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -10,10 +11,16 @@ namespace ProjectTourAgency.Enities;
public class Employee public class Employee
{ {
public int Id { get; private set; } public int Id { get; private set; }
[DisplayName("Полное имя")]
public string FullName { get; private set; } = string.Empty; public string FullName { get; private set; } = string.Empty;
public string EmployeeName => $"{EmployeeJob} {FullName}";
[DisplayName("Должность")]
public EmpoyeeJob EmployeeJob { get; private set; } public EmpoyeeJob EmployeeJob { get; private set; }
public static Employee CreateEntity(int id, string fullName, public static Employee CreateEntity(int id, string fullName,
EmpoyeeJob job) EmpoyeeJob job)
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -9,9 +10,17 @@ namespace ProjectTourAgency.Enities;
public class Route public class Route
{ {
public int Id { get; private set; } public int Id { get; private set; }
[DisplayName("Место назначения")]
public string Destination { get; private set; } = string.Empty; public string Destination { get; private set; } = string.Empty;
[DisplayName("Место отбытия")]
public string Departure { get; private set; } = string.Empty; public string Departure { get; private set; } = string.Empty;
[DisplayName("Продолжительность")]
public int Duration { get; private set; } public int Duration { get; private set; }
public string DepartureDestination => $"{Departure} - {Destination}";
public static Route CreateEntity(int id, string destination, public static Route CreateEntity(int id, string destination,
string departure, int duration) string departure, int duration)
{ {

View File

@ -25,11 +25,11 @@ namespace ProjectTourAgency.Forms
_tourRepository = tourRepository ?? _tourRepository = tourRepository ??
throw new ArgumentNullException(nameof(tourRepository)); throw new ArgumentNullException(nameof(tourRepository));
comboBoxEmployeeId.DataSource = employeeRepository.ReadEmployees(); comboBoxEmployeeId.DataSource = employeeRepository.ReadEmployees();
comboBoxEmployeeId.DisplayMember = "FullName"; comboBoxEmployeeId.DisplayMember = "EmployeeName";
comboBoxEmployeeId.ValueMember = "Id"; comboBoxEmployeeId.ValueMember = "Id";
comboBoxRouteId.DataSource = routeRepository.ReadRoutes(); comboBoxRouteId.DataSource = routeRepository.ReadRoutes();
comboBoxRouteId.DisplayMember = "Destination"; comboBoxRouteId.DisplayMember = "DepartureDestination";
comboBoxRouteId.ValueMember = "Id"; comboBoxRouteId.ValueMember = "Id";
ColumnClient.DataSource = clientRepository.ReadClients(); ColumnClient.DataSource = clientRepository.ReadClients();

View File

@ -109,7 +109,13 @@ WHERE Id = @Id";
try try
{ {
using var connection = new NpgsqlConnection(_connectionString.ConnectionString); 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<AddMoney>(querySelect); var AddMoneys = connection.Query<AddMoney>(querySelect);
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(AddMoneys)); _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(AddMoneys));
return AddMoneys; return AddMoneys;