юль,я сделала

This commit is contained in:
trofimova.05 2024-04-28 20:34:43 +03:00
parent a9369fb1cc
commit fe336f3387
21 changed files with 246 additions and 91 deletions

View File

@ -6,7 +6,20 @@ using System.Threading.Tasks;
namespace BankContracts.BindingModels
{
internal class ClientBindingModel
internal class ClientBindingModel : IClientModel
{
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string? MiddleName { get; set; }
public string PhoneNumber { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public int Id { get; set; }
public string Email { get; set; } = string.Empty;
}
}

View File

@ -6,7 +6,14 @@ using System.Threading.Tasks;
namespace BankContracts.BindingModels
{
internal class PaymentBindingModel
internal class PaymentBindingModel : IPaymentModel
{
public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now);
public double PaidPrice { get; set; }
public int Id { get; set; }
public int OperationByPurchaseId { get; set; }
}
}

View File

@ -6,7 +6,13 @@ using System.Threading.Tasks;
namespace BankContracts.BindingModels
{
internal class PurchaseBindingModel
internal class PurchaseBindingModel : IPurchaseModel
{
public int ClientId { get; set; }
public DateOnly DatePurchase { get; set; }
public Dictionary<int, OperationByPurchaseModel> OperationsModel { get; set; } = new();
public List<CostByPurchaseModel> CostsModel { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
using BankContracts.BindingModels;
namespace BankContracts.BusinessLogicContracts
{
internal class IClientLogic
public interface IClientLogic
{
ClientViewModel ReadElement(ClientSearchModel model);
bool Create(ClientBindingModel model);
}
}

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.BusinessLogicContracts
{
internal class ICostLogic
public interface ICostLogic
{
List<CostViewModel> ReadList(CostSearchModel? model = null);
CostViewModel ReadElement(CostSearchModel model);
bool Create(CostBindingModel model);
bool Update(CostBindingModel model);
bool Delete(CostBindingModel model);
}
}

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.BusinessLogicContracts
{
internal class IOperationLogic
public interface IOperationLogic
{
List<OperationViewModel> ReadList(OperationSearchModel? model = null);
OperationViewModel ReadElement(OperationSearchModel model);
bool Create(OperationBindingModel model);
bool Update(OperationBindingModel model);
bool Delete(OperationBindingModel model);
}
}

View File

@ -1,12 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.BusinessLogicContracts
{
internal class IPaymentLogic
public interface IPaymentLogic
{
List<PaymentViewModel> ReadList(PaymentSearchModel model);
PaymentViewModel ReadElement(PaymentSearchModel model);
bool Create(PaymentBindingModel model);
/// <summary>
/// Получение полной и оплаченной стоимости в бизнес логике, по обследованию и талону
/// </summary>
bool GetPaymentInfo(PaymentSearchModel model, out double fullPrice, out double paidPrice);
}
}

View File

@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.BusinessLogicContracts
{
internal class IPurchaseLogic
public interface IPurchaseLogic
{
List<PurchaseViewModel> ReadList(PurchaseSearchModel? model = null);
PurchaseViewModel ReadElement(PurchaseSearchModel model);
bool Create(PurchaseBindingModel model);
bool Update(PurchaseBindingModel model);
bool Delete(PurchaseBindingModel model);
}
}

View File

@ -8,5 +8,8 @@ namespace BankContracts.SearchModels
{
internal class ClientSearchModel
{
public int? Id { get; set; }
public string? PhoneNumber { get; set; }
public string? Password { get; set; }
}
}

View File

@ -8,5 +8,11 @@ namespace BankContracts.SearchModels
{
internal class PaymentSearchModel
{
public int? Id { get; set; }
public int? OperationId { get; set; }
public int? PurchaseId { get; set; }
public DateOnly? DateFrom { get; set; }
public DateOnly? DateTo { get; set; }
}
}

View File

@ -8,5 +8,11 @@ namespace BankContracts.SearchModels
{
internal class PurchaseSearchModel
{
public int? Id { get; set; }
public DateOnly? DateTo { get; set; }
public DateOnly? DateFrom { get; set; }
public int? ClientId { get; set; }
public List<int>? OperationsIds { get; set; }
}
}

View File

@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.StoragesContracts
{
internal class IClientStorage
public interface IClientStorage
{
ClientViewModel? GetElement(ClientSearchModel model);
ClientViewModel? Insert(ClientBindingModel model);
}
}

View File

@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.StoragesContracts
{
internal class ICostStorage
public interface ICostStorage
{
List<CostViewModel> GetFullList();
List<CostViewModel> GetFilteredList(CostSearchModel model);
CostViewModel? GetElement(CostSearchModel model);
CostViewModel? Insert(CostBindingModel model);
CostViewModel? Update(CostBindingModel model);
CostViewModel? Delete(CostBindingModel model);
}
}

View File

@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.StoragesContracts
{
internal class IOperationStorage
public interface IOperationStorage
{
List<OperationViewModel> GetFullList();
List<OperationViewModel> GetFilteredList(OperationSearchModel model);
OperationViewModel? GetElement(OperationSearchModel model);
OperationViewModel? Insert(OperationBindingModel model);
OperationViewModel? Update(OperationBindingModel model);
OperationViewModel? Delete(OperationBindingModel model);
}
}

View File

@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.StoragesContracts
{
internal class IPaymentStorage
public interface IPaymentStorage
{
List<PaymentViewModel> GetFullList();
List<PaymentViewModel> GetFilteredList(PaymentSearchModel model);
PaymentViewModel? GetElement(PaymentSearchModel model);
PaymentViewModel? Insert(PaymentBindingModel model);
}
}

View File

@ -1,12 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankContracts.BindingModels;
using BankContracts.SearchModels;
using BankContracts.ViewModels;
namespace BankContracts.StoragesContracts
{
internal class IPurchaseStorage
public interface IPurchaseStorage
{
List<PurchaseViewModel> GetFullList();
List<PurchaseViewModel> GetFilteredList(PurchaseSearchModel model);
PurchaseViewModel? GetElement(PurchaseSearchModel model);
PurchaseViewModel? Insert(PurchaseBindingModel model);
PurchaseViewModel? Update(PurchaseBindingModel model);
PurchaseViewModel? Delete(PurchaseBindingModel model);
List<PaymentViewModel> GetPaymentsFromPurchaseAndOperation(PurchaseSearchModel modelPurchase, OperationSearchModel modelOperation);
}
}

View File

@ -1,12 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankDataModels;
using BankDataModels.HelperInterfaces;
using System.ComponentModel;
namespace BankContracts.ViewModels
{
internal class ClientViewModel
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("Фамилия")]
public string LastName { get; set; } = string.Empty;
[DisplayName("Имя")]
public string FirstName { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string? MiddleName { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
}

View File

@ -1,12 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankDataModels.ProxyModels;
using BankDataModels;
using System.ComponentModel;
namespace BankContracts.ViewModels
{
internal class CostViewModel
public class CostViewModel : ICostModel
{
public int Id { get; set; }
public int EmployeeId { get; set; }
[DisplayName("Номер телефона сотрудника")]
public string PhoneNumber { get; set; } = string.Empty;
[DisplayName("Наименование")]
public string NameOfCost { get; set; } = string.Empty;
[DisplayName("Стоимость")]
public double Price { get; set; }
public Dictionary<int, CostByPurchaseModel> PurchaseModels { get; set; } = new();
}
}

View File

@ -1,12 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BankDataModels;
using System.ComponentModel;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json.Serialization;
namespace BankContracts.ViewModels
{
internal class OperationViewModel
public class OperationViewModel : IOperationModel
{
public int Id { get; set; }
public int EmployeeId { get; set; }
[DisplayName("Номер телефона сотрудника")]
public string EmployeePhoneNumber { get; set; } = string.Empty;
[DisplayName("Стоимость")]
public double Price { get; set; }
[DisplayName("Вид операции")]
public string Model { get; set; } = string.Empty;
[DisplayName("Тип операции")]
public string Mark { get; set; } = string.Empty;
[JsonIgnore]
public List<PurchaseViewModel> Purchases { get; set; } = new();
public override string ToString()
{
var result = new StringBuilder();
foreach (var purchase in Purchases)
{
result.Append($"Операция вида {Model},Типа {Mark}, Купленная {purchase.DatePurchase.ToShortDateString()}," +
$"в покупе c id: {purchase.Id}\n");
}
return result.ToString();
}
}
}

View File

@ -1,12 +1,28 @@
using System;
using BankDataModels;
using BankDataModels.ProxyModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankContracts.ViewModels
{
internal class PaymentViewModel
public class PaymentViewModel : IPaymentModel
{
public int Id { get; set; }
public int OperationByPurchaseModelId { get; set; }
[DisplayName("Стоимость")]
public double FullPrice { get; set; }
[DisplayName("Оплаченная стоимость")]
public double PaidPrice { get; set; }
public int OperationByPurchaseId { get; set; }
[DisplayName("Дата оплаты")]
public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now);
public OperationByPurchaseModel OperationByPurchase { get; set; }
// Машины для отчета за период
public OperationViewModel Operation { get; set; }
}
}

View File

@ -1,12 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BankDataModels;
using System.ComponentModel;
using BankDataModels.ProxyModels;
using System.Text;
using System.Threading.Tasks;
namespace BankContracts.ViewModels
{
internal class PurchaseViewModel
public class PurchaseViewModel : IPurchaseModel
{
public int Id { get; set; }
public int ClientId { get; set; }
[DisplayName("Логин клиента")]
public string ClientPhoneNumber { get; set; } = string.Empty;
[DisplayName("Дата Покупки")]
public DateOnly DatePurchase { get; set; } = DateOnly.FromDateTime(DateTime.Now);
public Dictionary<int, OperationByPurchaseModel> OperationsModel { get; set; } = new();
public List<CostViewModel> CostViewModels { get; set; } = new();
public List<OperationViewModel> OperationViewModels { get; set; } = new();
public override string ToString()
{
var result = new StringBuilder(
$"Сделка, созданная {DatePurchase}, включает в себя операции:");
for (int i = 0; i < OperationViewModels.Count; i++)
{
var car = OperationViewModels[i];
if (car == null)
{
break;
}
result.Append($"\n\t{i + 1}. {car.Mark} {car.Model} стоимостью {car.Price}");
}
return result.ToString();
}
}
}