Правки сущностей "Кассир" и "Выдача наличных со счёта".
This commit is contained in:
parent
dbeaf0e380
commit
10d97c1ff8
@ -11,8 +11,12 @@ namespace BankYouBankruptContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int DebitingId { get; set; }
|
||||||
|
|
||||||
public int AccountId { get; set; }
|
public int AccountId { get; set; }
|
||||||
|
|
||||||
|
public int CashierId { get; set; }
|
||||||
|
|
||||||
public int Sum { get; set; }
|
public int Sum { get; set; }
|
||||||
|
|
||||||
public DateTime DateOperation { get; set; } = DateTime.Now;
|
public DateTime DateOperation { get; set; } = DateTime.Now;
|
||||||
|
@ -10,8 +10,12 @@ namespace BankYouBankruptContracts.SearchModels
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public int? DebitingId { get; set; }
|
||||||
|
|
||||||
public int? AccountId { get; set; }
|
public int? AccountId { get; set; }
|
||||||
|
|
||||||
|
public int? CashierId { get; set; }
|
||||||
|
|
||||||
public int? Sum { get; set; }
|
public int? Sum { get; set; }
|
||||||
|
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
|
@ -12,11 +12,21 @@ namespace BankYouBankruptContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int DebitingId { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Номер заявки на снятие средств")]
|
||||||
|
public int DebbitingNumber { get; set; }
|
||||||
|
|
||||||
public int AccountId { get; set; }
|
public int AccountId { get; set; }
|
||||||
|
|
||||||
[DisplayName("Номер счёта")]
|
[DisplayName("Номер счёта")]
|
||||||
public int AccountNumber { get; set; }
|
public int AccountNumber { get; set; }
|
||||||
|
|
||||||
|
public int CashierId { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Кассир")]
|
||||||
|
public string SurmaneCashier { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Сумма выданных наличных")]
|
[DisplayName("Сумма выданных наличных")]
|
||||||
public int Sum { get; set; }
|
public int Sum { get; set; }
|
||||||
|
|
||||||
|
@ -9,8 +9,12 @@ namespace BankYouBankruptDataModels.Models
|
|||||||
//выдача наличных
|
//выдача наличных
|
||||||
public interface ICashWithdrawalModel : IId
|
public interface ICashWithdrawalModel : IId
|
||||||
{
|
{
|
||||||
|
int DebitingId { get; }
|
||||||
|
|
||||||
int AccountId { get; }
|
int AccountId { get; }
|
||||||
|
|
||||||
|
int CashierId { get; }
|
||||||
|
|
||||||
int Sum { get; }
|
int Sum { get; }
|
||||||
|
|
||||||
DateTime DateOperation { get; }
|
DateTime DateOperation { get; }
|
||||||
|
@ -19,6 +19,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.Accounts
|
return context.Accounts
|
||||||
|
.Include(x => x.Client)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -70,6 +71,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.Accounts
|
return context.Accounts
|
||||||
|
.Include(x => x.Client)
|
||||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.AccountNumber) && x.AccountNumber == model.AccountNumber) ||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.AccountNumber) && x.AccountNumber == model.AccountNumber) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
|
@ -37,6 +37,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.Cards
|
return context.Cards
|
||||||
|
.Include(x => x.Client)
|
||||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Number) && x.Number == model.Number) ||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Number) && x.Number == model.Number) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
@ -75,6 +76,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.Cards
|
return context.Cards
|
||||||
|
.Include(x => x.Client)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.CashWithdrawals
|
return context.CashWithdrawals
|
||||||
|
.Include(x => x.Cashier)
|
||||||
|
.Include(x => x.Debiting)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -32,7 +34,19 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
|
|
||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
|
if (model.CashierId.HasValue)
|
||||||
|
{
|
||||||
return context.CashWithdrawals
|
return context.CashWithdrawals
|
||||||
|
.Include(x => x.Cashier)
|
||||||
|
.Include(x => x.Debiting)
|
||||||
|
.Where(x => x.CashierId == model.CashierId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.CashWithdrawals
|
||||||
|
.Include(x => x.Cashier)
|
||||||
|
.Include(x => x.Debiting)
|
||||||
.Where(x => x.AccountId == model.AccountId)
|
.Where(x => x.AccountId == model.AccountId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -48,6 +62,8 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.CashWithdrawals
|
return context.CashWithdrawals
|
||||||
|
.Include(x => x.Cashier)
|
||||||
|
.Include(x => x.Debiting)
|
||||||
.FirstOrDefault(x => (!(model.AccountId < 0) && x.AccountId == model.AccountId) ||
|
.FirstOrDefault(x => (!(model.AccountId < 0) && x.AccountId == model.AccountId) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
|
@ -15,12 +15,24 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int DebitingId { get; set; }
|
||||||
|
|
||||||
|
//для передачи номера заявки
|
||||||
|
public virtual Debiting Debiting { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int AccountId { get; set; }
|
public int AccountId { get; set; }
|
||||||
|
|
||||||
//для передачи названия изделия
|
//для передачи названия изделия
|
||||||
public virtual Account Account { get; set; }
|
public virtual Account Account { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int CashierId { get; set; }
|
||||||
|
|
||||||
|
//для передачи фамилии кассира
|
||||||
|
public virtual Cashier Cashier { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Sum { get; set; }
|
public int Sum { get; set; }
|
||||||
|
|
||||||
@ -33,7 +45,6 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
AccountId = model.AccountId,
|
AccountId = model.AccountId,
|
||||||
Account = context.Accounts.First(x => x.Id == model.AccountId),
|
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
DateOperation = model.DateOperation
|
DateOperation = model.DateOperation
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,10 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
[ForeignKey("CashierId")]
|
[ForeignKey("CashierId")]
|
||||||
public virtual List<Account> Accounts { get; set; } = new();
|
public virtual List<Account> Accounts { get; set; } = new();
|
||||||
|
|
||||||
|
//для реализации связи один ко многим с заявками на снятие наличных со счёта
|
||||||
|
[ForeignKey("CashierId")]
|
||||||
|
public virtual List<CashWithdrawal> CashWithdrawals { get; set; } = new();
|
||||||
|
|
||||||
public static Cashier Create(BankYouBancruptDatabase context, CashierBindingModel model)
|
public static Cashier Create(BankYouBancruptDatabase context, CashierBindingModel model)
|
||||||
{
|
{
|
||||||
return new Cashier()
|
return new Cashier()
|
||||||
|
Loading…
Reference in New Issue
Block a user