Наработки

This commit is contained in:
Polina 2024-04-29 17:06:56 +04:00
parent 945f220b70
commit d0c8f5ac21
14 changed files with 248 additions and 4 deletions

View File

@ -0,0 +1,22 @@
using UniversityDataModels;
using UniversityDataModels.HelperInterfaces;
namespace UniversityContracts.BindingModels
{
public 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

@ -0,0 +1,15 @@
using UniversityDataModels;
using UniversityDataModels.HelperInterfaces;
namespace UniversityContracts.BindingModels
{
public class PurchaseBindingModel : IPurchaseModel
{
public int ClientId { get; set; }
public DateOnly DatePurchase { get; set; }
public Dictionary<int, ClassByPurchaseModel> ClassModel { get; set; } = new();
public List<CostByPurchaseModel> CostsModel { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace UniversityContracts.SearchModels
{
public class ClassSearchModel
{
public int? Id { get; set; }
public int? EmployeeId { get; set; }
public string Model { get; set; } = string.Empty;
public string Mark { get; set; } = string.Empty;
public int Price { get; set; }
public List<int>? PurchasesIds { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace UniversityContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? PhoneNumber { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace UniversityContracts.SearchModels
{
public class CostSearchModel
{
public int? Id { get; set; }
public int? EmployeeId { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace UniversityContracts.SearchModels
{
public class EmployeeSearchModel
{
public int? Id { get; set; }
public string? PhoneNumber { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.SearchModels
{
public 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

@ -0,0 +1,12 @@
namespace UniversityContracts.SearchModels
{
public 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

@ -6,8 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="SearchModels\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,33 @@
using UniversityDataModels;
using System.ComponentModel;
using System.Text;
using System.Text.Json.Serialization;
namespace UniversityContracts.ViewModels
{
public class ClassViewModel : IClassnModel
{
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

@ -0,0 +1,23 @@
using UnivesityDataModels;
using UniversityDataModels.HelperInterfaces;
using System.ComponentModel;
namespace UniversityContracts.ViewModels
{
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

@ -0,0 +1,20 @@
using UniversityDataModels.ProxyModels;
using UniverstyDataModels;
using System.ComponentModel;
namespace UniversityContracts.ViewModels
{
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

@ -0,0 +1,28 @@
using UniversityDataModels;
using UniversityDataModels.ProxyModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankContracts.ViewModels
{
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 ClassByPurchaseModel ClassByPurchase { get; set; }
// Машины для отчета за период
public ClassViewModel Operation { get; set; }
}
}

View File

@ -0,0 +1,39 @@
using UniversityDataModels;
using System.ComponentModel;
using UniversityDataModels.ProxyModels;
using System.Text;
namespace UniversityContracts.ViewModels
{
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, ClassByPurchaseModel> ClassModel { get; set; } = new();
public List<CostViewModel> CostViewModels { get; set; } = new();
public List<ClassViewModel> 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();
}
}
}