Merge branch 'Main' into Feature/InstitutionContract/Create-Api
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Company.Domain.ContractingPartyBankAccountsAgg;
|
|||||||
|
|
||||||
public interface IContractingPartyBankAccountsRepository:IRepository<long,ContractingPartyBankAccount>
|
public interface IContractingPartyBankAccountsRepository:IRepository<long,ContractingPartyBankAccount>
|
||||||
{
|
{
|
||||||
Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(ContractingPartyBankAccountSearchModel searchModel);
|
Task<GetContractingPartyBankAccountViewModel> GetList(ContractingPartyBankAccountSearchModel searchModel);
|
||||||
Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search, string selected);
|
Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search, string selected);
|
||||||
Task<OperationResult<List<string>>> IBanSelectList(string search, string selected);
|
Task<OperationResult<List<string>>> IBanSelectList(string search, string selected);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Domain;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
namespace Company.Domain.PaymentInstrumentAgg;
|
||||||
|
|
||||||
|
public interface IPaymentInstrumentGroupRepository:IRepository<long,PaymentInstrumentGroup>
|
||||||
|
{
|
||||||
|
void Remove(PaymentInstrumentGroup paymentInstrumentGroup);
|
||||||
|
Task<List<PaymentInstrumentGroupsViewModel>> GetList();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Domain;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
namespace Company.Domain.PaymentInstrumentAgg;
|
||||||
|
|
||||||
|
public interface IPaymentInstrumentRepository:IRepository<long,PaymentInstrument>
|
||||||
|
{
|
||||||
|
Task<GetPaymentInstrumentListViewModel> GetList(PaymentInstrumentSearchModel searchModel);
|
||||||
|
}
|
||||||
52
Company.Domain/PaymentInstrumentAgg/PaymentInstrument.cs
Normal file
52
Company.Domain/PaymentInstrumentAgg/PaymentInstrument.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using _0_Framework.Domain;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
namespace Company.Domain.PaymentInstrumentAgg;
|
||||||
|
|
||||||
|
public class PaymentInstrument:EntityBase
|
||||||
|
{
|
||||||
|
private PaymentInstrument(string cardNumber, string accountHolderName, string accountNumber,string iBan,bool isAuth,long paymentInstrumentGroupId)
|
||||||
|
{
|
||||||
|
CardNumber = cardNumber;
|
||||||
|
AccountHolderName = accountHolderName;
|
||||||
|
AccountNumber = accountNumber;
|
||||||
|
IBan = iBan;
|
||||||
|
IsAuth = isAuth;
|
||||||
|
PaymentInstrumentGroupId = paymentInstrumentGroupId;
|
||||||
|
Type = PaymentInstrumentType.BankAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PaymentInstrument(string posTerminalId , string description,long paymentInstrumentGroupId)
|
||||||
|
{
|
||||||
|
PosTerminalId = posTerminalId;
|
||||||
|
Description = description;
|
||||||
|
PaymentInstrumentGroupId = paymentInstrumentGroupId;
|
||||||
|
Type = PaymentInstrumentType.BankAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaymentInstrument CreatePosType(string posTerminalId, string description, long paymentInstrumentGroupId)
|
||||||
|
{
|
||||||
|
return new PaymentInstrument(posTerminalId, description, paymentInstrumentGroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaymentInstrument CreateBankAccount(string cardNumber, string accountHolderName, string accountNumber,
|
||||||
|
string iBan, bool isAuth, long paymentInstrumentGroupId)
|
||||||
|
{
|
||||||
|
return new PaymentInstrument(cardNumber, accountHolderName, accountNumber, iBan, isAuth, paymentInstrumentGroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CardNumber { get; private set; }
|
||||||
|
public string AccountHolderName { get; private set; }
|
||||||
|
public string AccountNumber { get; private set; }
|
||||||
|
public string IBan { get; private set; }
|
||||||
|
|
||||||
|
public string PosTerminalId { get; private set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public PaymentInstrumentType Type { get; private set; }
|
||||||
|
|
||||||
|
public bool IsAuth { get; private set; }
|
||||||
|
|
||||||
|
public long PaymentInstrumentGroupId { get; private set; }
|
||||||
|
public PaymentInstrumentGroup PaymentInstrumentGroup { get; private set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using _0_Framework.Domain;
|
||||||
|
|
||||||
|
namespace Company.Domain.PaymentInstrumentAgg;
|
||||||
|
|
||||||
|
public class PaymentInstrumentGroup:EntityBase
|
||||||
|
{
|
||||||
|
public PaymentInstrumentGroup(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; private set; }
|
||||||
|
public List<PaymentInstrument> PaymentInstruments { get; set; }
|
||||||
|
|
||||||
|
public void Edit(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,16 @@ namespace CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
|||||||
/// لیست اطلاعات بانکی طرف حساب
|
/// لیست اطلاعات بانکی طرف حساب
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetContractingPartyBankAccountViewModel
|
public class GetContractingPartyBankAccountViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// تعداد
|
||||||
|
/// </summary>
|
||||||
|
public int Count { get; set; }
|
||||||
|
public List<ContractingPartyBankAccountsGroupedViewModel> List { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ContractingPartyBankAccountsGroupedViewModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// لیست حساب های بانکی
|
/// لیست حساب های بانکی
|
||||||
@@ -27,6 +37,7 @@ public class GetContractingPartyBankAccountViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string WorkshopName { get; set; }
|
public string WorkshopName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// حساب بانکی طرف حساب
|
/// حساب بانکی طرف حساب
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ public interface IContractingPartyBankAccountsApplication
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="searchModel"></param>
|
/// <param name="searchModel"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
Task<GetContractingPartyBankAccountViewModel> GetList(ContractingPartyBankAccountSearchModel searchModel);
|
||||||
ContractingPartyBankAccountSearchModel searchModel);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// سلکت لیست جستجو برای نام طرف حساب / صاحب حساب
|
/// سلکت لیست جستجو برای نام طرف حساب / صاحب حساب
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد اطلاعات بانکی
|
||||||
|
/// </summary>
|
||||||
|
public class CreateBankPaymentInstrument
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// آیدی عنوان
|
||||||
|
/// </summary>
|
||||||
|
public long PaymentInstrumentGroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نام صاحب حساب
|
||||||
|
/// </summary>
|
||||||
|
public string AccountHolderName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره کارت
|
||||||
|
/// </summary>
|
||||||
|
public string CardNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره حساب
|
||||||
|
/// </summary>
|
||||||
|
public string AccountNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره حساب
|
||||||
|
/// </summary>
|
||||||
|
public string IBan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا احزار هویت شده است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAuth { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد عنوان
|
||||||
|
/// </summary>
|
||||||
|
public class CreateBankPaymentInstrumentGroup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// نام
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class CreatePosPaymentInstrument
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// آیدی عنوان
|
||||||
|
/// </summary>
|
||||||
|
public long PaymentInstrumentGroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شناسه دستگاه پوز
|
||||||
|
/// </summary>
|
||||||
|
public string PosTerminalId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// توضیحات
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ویرایش عنوان
|
||||||
|
/// </summary>
|
||||||
|
public class EditBankPaymentInstrumentGroup : CreateBankPaymentInstrumentGroup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// آیدی
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
public class GetPaymentInstrumentListViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// تعداد آیتم
|
||||||
|
/// </summary>
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// لیست گروهی
|
||||||
|
/// </summary>
|
||||||
|
public List<PaymentInstrumentGroupedViewModel> GropedViewModels { get; set; }
|
||||||
|
}
|
||||||
|
public class PaymentInstrumentGroupedViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// نام
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیتم های گروه
|
||||||
|
/// </summary>
|
||||||
|
public List<PaymentInstrumentItemsViewModel> Items { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class PaymentInstrumentItemsViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// آیدی
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره کارت
|
||||||
|
/// </summary>
|
||||||
|
public string CardNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره حساب
|
||||||
|
/// </summary>
|
||||||
|
public string AccountNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره شبا
|
||||||
|
/// </summary>
|
||||||
|
public string IBan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شناسه دستگاه
|
||||||
|
/// </summary>
|
||||||
|
public string PosTerminalId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// توضیحات
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Application;
|
||||||
|
|
||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// اپلیکیشن جاری شرکا
|
||||||
|
/// </summary>
|
||||||
|
public interface IPaymentInstrumentApplication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد حساب اطلاعات بانکی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<OperationResult> CreateBankAccount(CreateBankPaymentInstrument command);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد اطلاعات دستگاه پوز
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<OperationResult> CreatePos(CreatePosPaymentInstrument command);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// گرفتن لیست
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<GetPaymentInstrumentListViewModel> GetList(PaymentInstrumentSearchModel searchModel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد عنوان
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<OperationResult> CreateGroup(CreateBankPaymentInstrumentGroup command);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ویرایش عنوان
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<OperationResult> EditGroup(EditBankPaymentInstrumentGroup command);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// حذف عنوان
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<OperationResult> DeleteGroup(long id);
|
||||||
|
|
||||||
|
Task<List<PaymentInstrumentGroupsViewModel>> GetGroup();
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
public class PaymentInstrumentGroupsViewModel:EditBankPaymentInstrumentGroup
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// سرچ مدل
|
||||||
|
/// </summary>
|
||||||
|
public class PaymentInstrumentSearchModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// نام صاحب حساب
|
||||||
|
/// </summary>
|
||||||
|
public string AccountHolderName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شناسه دستگاه
|
||||||
|
/// </summary>
|
||||||
|
public string PosTerminalId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره کارت
|
||||||
|
/// </summary>
|
||||||
|
public string CardNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره حساب
|
||||||
|
/// </summary>
|
||||||
|
public string AccountNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره شبا
|
||||||
|
/// </summary>
|
||||||
|
public string IBan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ایندکس صفحه
|
||||||
|
/// </summary>
|
||||||
|
public int PageIndex { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
/// <summary>
|
||||||
|
/// نوع حساب های جاری شرکا
|
||||||
|
/// </summary>
|
||||||
|
public enum PaymentInstrumentType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// حساب بانکی
|
||||||
|
/// </summary>
|
||||||
|
BankAccount,
|
||||||
|
/// <summary>
|
||||||
|
/// دستگاه پوز
|
||||||
|
/// </summary>
|
||||||
|
Pos
|
||||||
|
}
|
||||||
@@ -50,7 +50,7 @@ public class ContractingPartyBankAccountsApplication:IContractingPartyBankAccoun
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
public async Task<GetContractingPartyBankAccountViewModel> GetList(
|
||||||
ContractingPartyBankAccountSearchModel searchModel)
|
ContractingPartyBankAccountSearchModel searchModel)
|
||||||
{
|
{
|
||||||
return await _contractingPartyBankAccountsRepository.GetList(searchModel);
|
return await _contractingPartyBankAccountsRepository.GetList(searchModel);
|
||||||
|
|||||||
123
CompanyManagment.Application/PaymentInstrumentApplication.cs
Normal file
123
CompanyManagment.Application/PaymentInstrumentApplication.cs
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Application;
|
||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
|
||||||
|
namespace CompanyManagment.Application;
|
||||||
|
|
||||||
|
public class PaymentInstrumentApplication:IPaymentInstrumentApplication
|
||||||
|
{
|
||||||
|
private readonly IPaymentInstrumentRepository _paymentInstrumentRepository;
|
||||||
|
private readonly IPaymentInstrumentGroupRepository _paymentInstrumentGroupRepository;
|
||||||
|
|
||||||
|
public PaymentInstrumentApplication(IPaymentInstrumentRepository paymentInstrumentRepository,
|
||||||
|
IPaymentInstrumentGroupRepository paymentInstrumentGroupRepository)
|
||||||
|
{
|
||||||
|
_paymentInstrumentRepository = paymentInstrumentRepository;
|
||||||
|
_paymentInstrumentGroupRepository = paymentInstrumentGroupRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> CreateBankAccount(CreateBankPaymentInstrument command)
|
||||||
|
{
|
||||||
|
var op = new OperationResult();
|
||||||
|
if (command.IsAuth)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(command.AccountNumber))
|
||||||
|
{
|
||||||
|
return op.Failed("شماره حساب نمیتواند خالی باشد");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(command.IBan))
|
||||||
|
{
|
||||||
|
return op.Failed("شماره شبا نمیتواند خالی باشد");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(command.CardNumber))
|
||||||
|
{
|
||||||
|
return op.Failed("شماره کارت نمیتواند خالی باشد");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(command.AccountHolderName))
|
||||||
|
{
|
||||||
|
return op.Failed("نام صاحب حساب نمیتواند خالی باشد");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var entity = PaymentInstrument.CreateBankAccount(command.CardNumber, command.AccountHolderName, command.AccountNumber,
|
||||||
|
command.IBan, command.IsAuth,command.PaymentInstrumentGroupId);
|
||||||
|
await _paymentInstrumentRepository.CreateAsync(entity);
|
||||||
|
await _paymentInstrumentRepository.SaveChangesAsync();
|
||||||
|
return op.Succcedded();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> CreatePos(CreatePosPaymentInstrument command)
|
||||||
|
{
|
||||||
|
var op = new OperationResult();
|
||||||
|
if (string.IsNullOrWhiteSpace(command.PosTerminalId))
|
||||||
|
{
|
||||||
|
return op.Failed("شناسه دستگاه یوزر نمیتواند خالی باشد");
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = PaymentInstrument.CreatePosType(command.PosTerminalId, command.Description,command.PaymentInstrumentGroupId);
|
||||||
|
await _paymentInstrumentRepository.CreateAsync(entity);
|
||||||
|
await _paymentInstrumentRepository.SaveChangesAsync();
|
||||||
|
return op.Succcedded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetPaymentInstrumentListViewModel> GetList(PaymentInstrumentSearchModel searchModel)
|
||||||
|
{
|
||||||
|
return await _paymentInstrumentRepository.GetList(searchModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> CreateGroup(CreateBankPaymentInstrumentGroup command)
|
||||||
|
{
|
||||||
|
var op = new OperationResult();
|
||||||
|
if (string.IsNullOrWhiteSpace(command.Name))
|
||||||
|
{
|
||||||
|
return op.Failed("لطفا عنوان خودرا وارد کنید");
|
||||||
|
}
|
||||||
|
|
||||||
|
var instrumentGroup = new PaymentInstrumentGroup(command.Name);
|
||||||
|
await _paymentInstrumentGroupRepository.CreateAsync(instrumentGroup);
|
||||||
|
await _paymentInstrumentGroupRepository.SaveChangesAsync();
|
||||||
|
return op.Succcedded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> EditGroup(EditBankPaymentInstrumentGroup command)
|
||||||
|
{
|
||||||
|
var op = new OperationResult();
|
||||||
|
if (string.IsNullOrWhiteSpace(command.Name))
|
||||||
|
{
|
||||||
|
return op.Failed("لطفا عنوان خودرا وارد کنید");
|
||||||
|
}
|
||||||
|
|
||||||
|
var paymentInstrumentGroup = _paymentInstrumentGroupRepository.Get(command.Id);
|
||||||
|
if (paymentInstrumentGroup == null)
|
||||||
|
{
|
||||||
|
return op.Failed("عنوان مورد نظر یافت نشد");
|
||||||
|
}
|
||||||
|
paymentInstrumentGroup.Edit(command.Name);
|
||||||
|
await _paymentInstrumentGroupRepository.SaveChangesAsync();
|
||||||
|
return op.Succcedded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> DeleteGroup(long id)
|
||||||
|
{
|
||||||
|
var op = new OperationResult();
|
||||||
|
|
||||||
|
var paymentInstrumentGroup = _paymentInstrumentGroupRepository.Get(id);
|
||||||
|
if (paymentInstrumentGroup == null)
|
||||||
|
{
|
||||||
|
return op.Failed("عنوان مورد نظر یافت نشد");
|
||||||
|
}
|
||||||
|
_paymentInstrumentGroupRepository.Remove(paymentInstrumentGroup);
|
||||||
|
await _paymentInstrumentGroupRepository.SaveChangesAsync();
|
||||||
|
return op.Succcedded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<PaymentInstrumentGroupsViewModel>> GetGroup()
|
||||||
|
{
|
||||||
|
return await _paymentInstrumentGroupRepository.GetList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,6 +77,7 @@ using Company.Domain.MasterWorkHistory;
|
|||||||
using Company.Domain.ModuleAgg;
|
using Company.Domain.ModuleAgg;
|
||||||
using Company.Domain.ModuleTextManagerAgg;
|
using Company.Domain.ModuleTextManagerAgg;
|
||||||
using Company.Domain.OriginalTitleAgg;
|
using Company.Domain.OriginalTitleAgg;
|
||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
using Company.Domain.PaymentToEmployeeAgg;
|
using Company.Domain.PaymentToEmployeeAgg;
|
||||||
using Company.Domain.PaymentToEmployeeItemAgg;
|
using Company.Domain.PaymentToEmployeeItemAgg;
|
||||||
using Company.Domain.PaymentTransactionAgg;
|
using Company.Domain.PaymentTransactionAgg;
|
||||||
@@ -132,7 +133,9 @@ public class CompanyContext : DbContext
|
|||||||
public DbSet<EntityModule> EntityModules { get; set; }
|
public DbSet<EntityModule> EntityModules { get; set; }
|
||||||
public DbSet<EntityModuleTextManager> EntityModuleTextManagers { get; set; }
|
public DbSet<EntityModuleTextManager> EntityModuleTextManagers { get; set; }
|
||||||
public DbSet<EntityBill> EntityBills { get; set; }
|
public DbSet<EntityBill> EntityBills { get; set; }
|
||||||
|
|
||||||
public DbSet<EntityContact> EntityContacts { get; set; }
|
public DbSet<EntityContact> EntityContacts { get; set; }
|
||||||
|
|
||||||
//---------Files------------------------------
|
//---------Files------------------------------
|
||||||
public DbSet<Board> Boards { get; set; }
|
public DbSet<Board> Boards { get; set; }
|
||||||
public DbSet<BoardType> BoardTypes { get; set; }
|
public DbSet<BoardType> BoardTypes { get; set; }
|
||||||
@@ -149,6 +152,7 @@ public class CompanyContext : DbContext
|
|||||||
public DbSet<FileTitle> FileTitles { get; set; }
|
public DbSet<FileTitle> FileTitles { get; set; }
|
||||||
public DbSet<FileTiming> FileTimings { get; set; }
|
public DbSet<FileTiming> FileTimings { get; set; }
|
||||||
public DbSet<FileState> FileStates { get; set; }
|
public DbSet<FileState> FileStates { get; set; }
|
||||||
|
|
||||||
public DbSet<FileAlert> FileAlerts { get; set; }
|
public DbSet<FileAlert> FileAlerts { get; set; }
|
||||||
//-------Task Manager----------------------------
|
//-------Task Manager----------------------------
|
||||||
//public DbSet<Task> Tasks { get; set; }
|
//public DbSet<Task> Tasks { get; set; }
|
||||||
@@ -184,9 +188,13 @@ public class CompanyContext : DbContext
|
|||||||
|
|
||||||
public DbSet<EmployeeAuthorizeTemp> EmployeeAuthorizeTemps { get; set; }
|
public DbSet<EmployeeAuthorizeTemp> EmployeeAuthorizeTemps { get; set; }
|
||||||
public DbSet<AdminMonthlyOverview> AdminMonthlyOverviews { get; set; }
|
public DbSet<AdminMonthlyOverview> AdminMonthlyOverviews { get; set; }
|
||||||
public DbSet<PaymentTransaction> PaymentTransactions{ get; set; }
|
public DbSet<PaymentTransaction> PaymentTransactions { get; set; }
|
||||||
|
|
||||||
public DbSet<ContractingPartyBankAccount> ContractingPartyBankAccounts { get; set; }
|
public DbSet<ContractingPartyBankAccount> ContractingPartyBankAccounts { get; set; }
|
||||||
|
|
||||||
|
public DbSet<PaymentInstrument> PaymentInstruments { get; set; }
|
||||||
|
public DbSet<PaymentInstrumentGroup> PaymentInstrumentGroups { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Pooya
|
#region Pooya
|
||||||
@@ -209,7 +217,9 @@ public class CompanyContext : DbContext
|
|||||||
public DbSet<WorkshopTemp> WorkshopTemps { get; set; }
|
public DbSet<WorkshopTemp> WorkshopTemps { get; set; }
|
||||||
public DbSet<WorkshopServicesTemp> WorkshopServicesTemps { get; set; }
|
public DbSet<WorkshopServicesTemp> WorkshopServicesTemps { get; set; }
|
||||||
public DbSet<InstitutionContractTemp> InstitutionContractTemps { get; set; }
|
public DbSet<InstitutionContractTemp> InstitutionContractTemps { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||||
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
|
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
|
||||||
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
|
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
|
||||||
@@ -291,15 +301,13 @@ public class CompanyContext : DbContext
|
|||||||
public DbSet<Employer> Employers { get; set; }
|
public DbSet<Employer> Employers { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public CompanyContext(DbContextOptions<CompanyContext> options) :base(options)
|
public CompanyContext(DbContextOptions<CompanyContext> options) : base(options)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CompanyContext()
|
public CompanyContext()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -309,6 +317,5 @@ public class CompanyContext : DbContext
|
|||||||
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
|
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
|
||||||
modelBuilder.Entity<RollCall>().HasQueryFilter(x => x.RollCallModifyType != RollCallModifyType.Undefined);
|
modelBuilder.Entity<RollCall>().HasQueryFilter(x => x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using OfficeOpenXml.Drawing.Chart;
|
||||||
|
|
||||||
|
namespace CompanyManagment.EFCore.Mapping;
|
||||||
|
|
||||||
|
public class PaymentInstrumentGroupMapping:IEntityTypeConfiguration<PaymentInstrumentGroup>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PaymentInstrumentGroup> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.id);
|
||||||
|
builder.Property(x => x.Name).IsRequired().HasMaxLength(120);
|
||||||
|
builder.HasMany(x => x.PaymentInstruments)
|
||||||
|
.WithOne(x=>x.PaymentInstrumentGroup)
|
||||||
|
.HasForeignKey(x=>x.PaymentInstrumentGroupId);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
24
CompanyManagment.EFCore/Mapping/PaymentInstrumentMapping.cs
Normal file
24
CompanyManagment.EFCore/Mapping/PaymentInstrumentMapping.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace CompanyManagment.EFCore.Mapping;
|
||||||
|
|
||||||
|
public class PaymentInstrumentMapping : IEntityTypeConfiguration<PaymentInstrument>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PaymentInstrument> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.id);
|
||||||
|
|
||||||
|
builder.Property(x => x.AccountHolderName).HasMaxLength(50);
|
||||||
|
builder.Property(x => x.AccountNumber).HasMaxLength(25);
|
||||||
|
builder.Property(x => x.PosTerminalId).HasMaxLength(25);
|
||||||
|
builder.Property(x => x.Description).HasMaxLength(200);
|
||||||
|
builder.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
|
||||||
|
builder.Property(x => x.CardNumber).HasMaxLength(50);
|
||||||
|
builder.Property(x => x.IBan).HasMaxLength(50);
|
||||||
|
builder.HasOne(x => x.PaymentInstrumentGroup)
|
||||||
|
.WithMany(x => x.PaymentInstruments)
|
||||||
|
.HasForeignKey(x => x.PaymentInstrumentGroupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
10200
CompanyManagment.EFCore/Migrations/20250730125439_create payment instruments and its groups.Designer.cs
generated
Normal file
10200
CompanyManagment.EFCore/Migrations/20250730125439_create payment instruments and its groups.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CompanyManagment.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class createpaymentinstrumentsanditsgroups : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PaymentInstrumentGroups",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PaymentInstrumentGroups", x => x.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PaymentInstruments",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CardNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||||
|
AccountHolderName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||||
|
AccountNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
|
||||||
|
IBan = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||||
|
PosTerminalId = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
|
||||||
|
Description = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
||||||
|
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||||
|
IsAuth = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
PaymentInstrumentGroupId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PaymentInstruments", x => x.id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PaymentInstruments_PaymentInstrumentGroups_PaymentInstrumentGroupId",
|
||||||
|
column: x => x.PaymentInstrumentGroupId,
|
||||||
|
principalTable: "PaymentInstrumentGroups",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PaymentInstruments_PaymentInstrumentGroupId",
|
||||||
|
table: "PaymentInstruments",
|
||||||
|
column: "PaymentInstrumentGroupId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PaymentInstruments");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PaymentInstrumentGroups");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -872,7 +872,7 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
b.ToTable("ContractingPartyAccount", (string)null);
|
b.ToTable("ContractingPartyAccount", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Company.Domain.ContractingPartyBankAccountsAgg.ContractingPartyBankAccounts", b =>
|
modelBuilder.Entity("Company.Domain.ContractingPartyBankAccountsAgg.ContractingPartyBankAccount", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("id")
|
b.Property<long>("id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@@ -4279,6 +4279,80 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
b.ToTable("TextManager_OriginalTitle", (string)null);
|
b.ToTable("TextManager_OriginalTitle", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Company.Domain.PaymentInstrumentAgg.PaymentInstrument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||||
|
|
||||||
|
b.Property<string>("AccountHolderName")
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("AccountNumber")
|
||||||
|
.HasMaxLength(25)
|
||||||
|
.HasColumnType("nvarchar(25)");
|
||||||
|
|
||||||
|
b.Property<string>("CardNumber")
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("IBan")
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsAuth")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<long>("PaymentInstrumentGroupId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("PosTerminalId")
|
||||||
|
.HasMaxLength(25)
|
||||||
|
.HasColumnType("nvarchar(25)");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.HasIndex("PaymentInstrumentGroupId");
|
||||||
|
|
||||||
|
b.ToTable("PaymentInstruments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Company.Domain.PaymentInstrumentAgg.PaymentInstrumentGroup", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(120)
|
||||||
|
.HasColumnType("nvarchar(120)");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.ToTable("PaymentInstrumentGroups");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", b =>
|
modelBuilder.Entity("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("id")
|
b.Property<long>("id")
|
||||||
@@ -6644,7 +6718,7 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
b.Navigation("PersonalContractingParty");
|
b.Navigation("PersonalContractingParty");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Company.Domain.ContractingPartyBankAccountsAgg.ContractingPartyBankAccounts", b =>
|
modelBuilder.Entity("Company.Domain.ContractingPartyBankAccountsAgg.ContractingPartyBankAccount", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", "ContractingParty")
|
b.HasOne("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", "ContractingParty")
|
||||||
.WithMany("ContractingPartyBankAccounts")
|
.WithMany("ContractingPartyBankAccounts")
|
||||||
@@ -9518,6 +9592,17 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
b.Navigation("TextManager");
|
b.Navigation("TextManager");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Company.Domain.PaymentInstrumentAgg.PaymentInstrument", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Company.Domain.PaymentInstrumentAgg.PaymentInstrumentGroup", "PaymentInstrumentGroup")
|
||||||
|
.WithMany("PaymentInstruments")
|
||||||
|
.HasForeignKey("PaymentInstrumentGroupId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("PaymentInstrumentGroup");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Company.Domain.PaymentToEmployeeItemAgg.PaymentToEmployeeItem", b =>
|
modelBuilder.Entity("Company.Domain.PaymentToEmployeeItemAgg.PaymentToEmployeeItem", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", "PaymentToEmployee")
|
b.HasOne("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", "PaymentToEmployee")
|
||||||
@@ -9983,6 +10068,11 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
b.Navigation("Subtitles");
|
b.Navigation("Subtitles");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Company.Domain.PaymentInstrumentAgg.PaymentInstrumentGroup", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PaymentInstruments");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", b =>
|
modelBuilder.Entity("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("PaymentToEmployeeItemList");
|
b.Navigation("PaymentToEmployeeItemList");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ContractingPartyBankAccountsRepository : RepositoryBase<long, Contr
|
|||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
public async Task<GetContractingPartyBankAccountViewModel> GetList(
|
||||||
ContractingPartyBankAccountSearchModel searchModel)
|
ContractingPartyBankAccountSearchModel searchModel)
|
||||||
{
|
{
|
||||||
var query = _context.ContractingPartyBankAccounts.AsQueryable();
|
var query = _context.ContractingPartyBankAccounts.AsQueryable();
|
||||||
@@ -38,38 +38,41 @@ public class ContractingPartyBankAccountsRepository : RepositoryBase<long, Contr
|
|||||||
.Contains(searchModel.ContractingPartyOrAccountHolderName) ||
|
.Contains(searchModel.ContractingPartyOrAccountHolderName) ||
|
||||||
(x.ContractingParty.FName + " " + x.ContractingParty.LName).Contains(searchModel
|
(x.ContractingParty.FName + " " + x.ContractingParty.LName).Contains(searchModel
|
||||||
.ContractingPartyOrAccountHolderName));
|
.ContractingPartyOrAccountHolderName));
|
||||||
|
var count = await query.CountAsync();
|
||||||
|
|
||||||
var grouped = query
|
var result = new GetContractingPartyBankAccountViewModel()
|
||||||
.GroupBy(x => new { x.ContractingPartyId, x.ContractingParty.FName, x.ContractingParty.LName })
|
{
|
||||||
.Select(g => new GetContractingPartyBankAccountViewModel()
|
Count = count,
|
||||||
{
|
List = await query
|
||||||
ContractingPartyId = g.Key.ContractingPartyId,
|
.GroupBy(x => new { x.ContractingPartyId, x.ContractingParty.FName, x.ContractingParty.LName })
|
||||||
ContractingPartyName = g.Key.FName + " " + g.Key.LName,
|
.Select(g => new ContractingPartyBankAccountsGroupedViewModel()
|
||||||
BankAccountsItems = g.Select(x => new ContractingPartyBankAccountsItemViewModel
|
|
||||||
{
|
{
|
||||||
AccountHolderName = x.AccountHolderName,
|
ContractingPartyId = g.Key.ContractingPartyId,
|
||||||
AccountNumber = x.AccountNumber,
|
ContractingPartyName = g.Key.FName + " " + g.Key.LName,
|
||||||
CardNumber = x.CardNumber,
|
BankAccountsItems = g.Select(x => new ContractingPartyBankAccountsItemViewModel
|
||||||
IBan = x.IBan,
|
{
|
||||||
}).ToList()
|
AccountHolderName = x.AccountHolderName,
|
||||||
});
|
AccountNumber = x.AccountNumber,
|
||||||
|
CardNumber = x.CardNumber,
|
||||||
|
IBan = x.IBan,
|
||||||
|
}).ToList()
|
||||||
|
}).Skip(searchModel.PageIndex)
|
||||||
|
.Take(30).ToListAsync()
|
||||||
|
};
|
||||||
|
|
||||||
var result = await grouped
|
return result;
|
||||||
.Skip(searchModel.PageIndex)
|
|
||||||
.Take(30)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return new OperationResult<List<GetContractingPartyBankAccountViewModel>>().Succcedded(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search,
|
public async Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search,
|
||||||
string selected)
|
string selected)
|
||||||
{
|
{
|
||||||
var accountHolderQuery = _context.ContractingPartyBankAccounts.Select(x => x.AccountHolderName);
|
var accountHolderQuery = _context.ContractingPartyBankAccounts.Select(x => x.AccountHolderName);
|
||||||
var contractingPartyNameQuery = _context.ContractingPartyBankAccounts.Select(x=>x.ContractingParty.FName + " " + x.ContractingParty.LName);
|
var contractingPartyNameQuery =
|
||||||
|
_context.ContractingPartyBankAccounts.Select(x =>
|
||||||
|
x.ContractingParty.FName + " " + x.ContractingParty.LName);
|
||||||
if (!string.IsNullOrWhiteSpace(search))
|
if (!string.IsNullOrWhiteSpace(search))
|
||||||
{
|
{
|
||||||
accountHolderQuery = accountHolderQuery.Where(x=>x.Contains(search));
|
accountHolderQuery = accountHolderQuery.Where(x => x.Contains(search));
|
||||||
contractingPartyNameQuery = contractingPartyNameQuery.Where(x => x.Contains(search));
|
contractingPartyNameQuery = contractingPartyNameQuery.Where(x => x.Contains(search));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +88,7 @@ public class ContractingPartyBankAccountsRepository : RepositoryBase<long, Contr
|
|||||||
|
|
||||||
public async Task<OperationResult<List<string>>> IBanSelectList(string search, string selected)
|
public async Task<OperationResult<List<string>>> IBanSelectList(string search, string selected)
|
||||||
{
|
{
|
||||||
var iBanQuery = _context.ContractingPartyBankAccounts.Select(x=>x.IBan);
|
var iBanQuery = _context.ContractingPartyBankAccounts.Select(x => x.IBan);
|
||||||
if (!string.IsNullOrWhiteSpace(search))
|
if (!string.IsNullOrWhiteSpace(search))
|
||||||
{
|
{
|
||||||
iBanQuery = iBanQuery.Where(x => x.Contains(search));
|
iBanQuery = iBanQuery.Where(x => x.Contains(search));
|
||||||
@@ -103,7 +106,7 @@ public class ContractingPartyBankAccountsRepository : RepositoryBase<long, Contr
|
|||||||
|
|
||||||
public async Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected)
|
public async Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected)
|
||||||
{
|
{
|
||||||
var cardNumberQuery = _context.ContractingPartyBankAccounts.Select(x=>x.CardNumber);
|
var cardNumberQuery = _context.ContractingPartyBankAccounts.Select(x => x.CardNumber);
|
||||||
if (!string.IsNullOrWhiteSpace(search))
|
if (!string.IsNullOrWhiteSpace(search))
|
||||||
{
|
{
|
||||||
cardNumberQuery = cardNumberQuery.Where(x => x.Contains(search));
|
cardNumberQuery = cardNumberQuery.Where(x => x.Contains(search));
|
||||||
@@ -121,7 +124,7 @@ public class ContractingPartyBankAccountsRepository : RepositoryBase<long, Contr
|
|||||||
|
|
||||||
public async Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected)
|
public async Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected)
|
||||||
{
|
{
|
||||||
var accountNumberQuery = _context.ContractingPartyBankAccounts.Select(x=>x.IBan);
|
var accountNumberQuery = _context.ContractingPartyBankAccounts.Select(x => x.IBan);
|
||||||
if (!string.IsNullOrWhiteSpace(search))
|
if (!string.IsNullOrWhiteSpace(search))
|
||||||
{
|
{
|
||||||
accountNumberQuery = accountNumberQuery.Where(x => x.Contains(search));
|
accountNumberQuery = accountNumberQuery.Where(x => x.Contains(search));
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.InfraStructure;
|
||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace CompanyManagment.EFCore.Repository;
|
||||||
|
|
||||||
|
public class PaymentInstrumentGroupRepository : RepositoryBase<long, PaymentInstrumentGroup>,
|
||||||
|
IPaymentInstrumentGroupRepository
|
||||||
|
{
|
||||||
|
private readonly CompanyContext _context;
|
||||||
|
|
||||||
|
public PaymentInstrumentGroupRepository(CompanyContext context) : base(context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<PaymentInstrumentGroupsViewModel>> GetList()
|
||||||
|
{
|
||||||
|
return await _context.PaymentInstrumentGroups.AsNoTracking()
|
||||||
|
.Select(x => new PaymentInstrumentGroupsViewModel()
|
||||||
|
{
|
||||||
|
Name = x.Name,
|
||||||
|
Id = x.id
|
||||||
|
}).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.InfraStructure;
|
||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace CompanyManagment.EFCore.Repository;
|
||||||
|
|
||||||
|
public class PaymentInstrumentRepository : RepositoryBase<long, PaymentInstrument>, IPaymentInstrumentRepository
|
||||||
|
{
|
||||||
|
private readonly CompanyContext _companyContext;
|
||||||
|
|
||||||
|
public PaymentInstrumentRepository(CompanyContext context) : base(context)
|
||||||
|
{
|
||||||
|
_companyContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetPaymentInstrumentListViewModel> GetList(PaymentInstrumentSearchModel searchModel)
|
||||||
|
{
|
||||||
|
var query = _companyContext.PaymentInstruments
|
||||||
|
.Include(x => x.PaymentInstrumentGroup)
|
||||||
|
.AsNoTracking();
|
||||||
|
|
||||||
|
#region Search
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.AccountHolderName))
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.AccountHolderName.Contains(searchModel.AccountHolderName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.AccountNumber))
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.AccountNumber.Contains(searchModel.AccountNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.PosTerminalId))
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.PosTerminalId.Contains(searchModel.PosTerminalId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.CardNumber))
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.CardNumber.Contains(searchModel.CardNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.IBan))
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.IBan.Contains(searchModel.IBan));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
var count = query.Count();
|
||||||
|
var list = new GetPaymentInstrumentListViewModel()
|
||||||
|
{
|
||||||
|
Count = count,
|
||||||
|
GropedViewModels = await query.GroupBy(x => x.PaymentInstrumentGroupId)
|
||||||
|
.OrderBy(x=>x.Key)
|
||||||
|
.Select(x => new PaymentInstrumentGroupedViewModel()
|
||||||
|
{
|
||||||
|
Name = x.First().PaymentInstrumentGroup.Name,
|
||||||
|
Items = x.Select(i => new PaymentInstrumentItemsViewModel()
|
||||||
|
{
|
||||||
|
Id = i.id,
|
||||||
|
Description = i.Description,
|
||||||
|
IBan = i.IBan,
|
||||||
|
PosTerminalId = i.PosTerminalId,
|
||||||
|
CardNumber = i.CardNumber,
|
||||||
|
AccountNumber = i.AccountNumber,
|
||||||
|
|
||||||
|
}).ToList()
|
||||||
|
}).Skip(searchModel.PageIndex).Take(30).ToListAsync()
|
||||||
|
};
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -210,9 +210,11 @@ using CompanyManagment.App.Contracts.ContactUs;
|
|||||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||||
|
using Company.Domain.PaymentInstrumentAgg;
|
||||||
using Company.Domain.PaymentTransactionAgg;
|
using Company.Domain.PaymentTransactionAgg;
|
||||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||||
|
|
||||||
namespace PersonalContractingParty.Config;
|
namespace PersonalContractingParty.Config;
|
||||||
@@ -446,6 +448,11 @@ public class PersonalBootstrapper
|
|||||||
|
|
||||||
services.AddTransient<IContractingPartyBankAccountsApplication, ContractingPartyBankAccountsApplication>();
|
services.AddTransient<IContractingPartyBankAccountsApplication, ContractingPartyBankAccountsApplication>();
|
||||||
services.AddTransient<IContractingPartyBankAccountsRepository, ContractingPartyBankAccountsRepository>();
|
services.AddTransient<IContractingPartyBankAccountsRepository, ContractingPartyBankAccountsRepository>();
|
||||||
|
|
||||||
|
services.AddTransient<IPaymentInstrumentRepository, PaymentInstrumentRepository>();
|
||||||
|
services.AddTransient<IPaymentInstrumentApplication, PaymentInstrumentApplication>();
|
||||||
|
services.AddTransient<IPaymentInstrumentGroupRepository, PaymentInstrumentGroupRepository>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Pooya
|
#region Pooya
|
||||||
|
|
||||||
|
|||||||
@@ -24,30 +24,12 @@ public class ContractingPartyBankAccountController : AdminBaseController
|
|||||||
/// <param name="searchModel">سرچ</param>
|
/// <param name="searchModel">سرچ</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(ContractingPartyBankAccountSearchModel searchModel)
|
public async Task<GetContractingPartyBankAccountViewModel> GetList(ContractingPartyBankAccountSearchModel searchModel)
|
||||||
{
|
{
|
||||||
var res =await _contractingPartyBankAccountsApplication.GetList(searchModel);
|
var res =await _contractingPartyBankAccountsApplication.GetList(searchModel);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("fake")]
|
|
||||||
public IActionResult GetFakeBankAccounts()
|
|
||||||
{
|
|
||||||
var bankAccountsFaker = new Faker<ContractingPartyBankAccountsItemViewModel>("fa")
|
|
||||||
.RuleFor(x => x.AccountHolderName, f => f.Name.FullName())
|
|
||||||
.RuleFor(x => x.CardNumber, f => f.Finance.CreditCardNumber())
|
|
||||||
.RuleFor(x => x.AccountNumber, f => f.Finance.Account())
|
|
||||||
.RuleFor(x => x.IBan, f => $"IR{f.Random.Number(10_000_000, 99_999_999)}{f.Random.Number(10_000_000, 99_999_999)}");
|
|
||||||
|
|
||||||
var viewModelFaker = new Faker<GetContractingPartyBankAccountViewModel>("fa")
|
|
||||||
.RuleFor(x => x.ContractingPartyId, f => f.Random.Long(1000, 9999))
|
|
||||||
.RuleFor(x => x.ContractingPartyName, f => f.Company.CompanyName())
|
|
||||||
.RuleFor(x => x.WorkshopName, f => f.Address.City())
|
|
||||||
.RuleFor(x => x.BankAccountsItems, f => bankAccountsFaker.Generate(f.Random.Int(1, 5)));
|
|
||||||
|
|
||||||
var fakeData = viewModelFaker.Generate(new Random().Next(1,35));
|
|
||||||
return Ok(fakeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ایجاد
|
/// ایجاد
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
using _0_Framework.Application;
|
||||||
|
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using ServiceHost.BaseControllers;
|
||||||
|
|
||||||
|
namespace ServiceHost.Areas.Admin.Controllers;
|
||||||
|
|
||||||
|
public class PaymentInstrumentController:AdminBaseController
|
||||||
|
{
|
||||||
|
private readonly IPaymentInstrumentApplication _paymentInstrumentApplication;
|
||||||
|
|
||||||
|
public PaymentInstrumentController(IPaymentInstrumentApplication paymentInstrumentApplication)
|
||||||
|
{
|
||||||
|
_paymentInstrumentApplication = paymentInstrumentApplication;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///لیست اطلاعات بانکی جاری شرکا
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<ActionResult<GetPaymentInstrumentListViewModel>> List(PaymentInstrumentSearchModel searchModel)
|
||||||
|
{
|
||||||
|
var list =await _paymentInstrumentApplication.GetList(searchModel);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد اطلاعات بانکی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("bankAccount")]
|
||||||
|
public async Task<ActionResult<OperationResult>> CreateBankAccount([FromBody] CreateBankPaymentInstrument command)
|
||||||
|
{
|
||||||
|
var result = await _paymentInstrumentApplication.CreateBankAccount(command);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد اطلاعات دستگاه پوز
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("pos")]
|
||||||
|
public async Task<ActionResult<OperationResult>> CreatePos([FromBody]CreatePosPaymentInstrument command)
|
||||||
|
{
|
||||||
|
var result =await _paymentInstrumentApplication.CreatePos(command);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// گرفتن عنوان ها
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("group")]
|
||||||
|
public async Task<ActionResult<List<PaymentInstrumentGroupsViewModel>>> GetGroups()
|
||||||
|
{
|
||||||
|
var result = await _paymentInstrumentApplication.GetGroup();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ایجاد عنوان
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("group")]
|
||||||
|
public async Task<ActionResult<OperationResult>> CreateGroup([FromBody]CreateBankPaymentInstrumentGroup command)
|
||||||
|
{
|
||||||
|
var result = await _paymentInstrumentApplication.CreateGroup(command);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// ویرایش عنوان
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut("group")]
|
||||||
|
public async Task<ActionResult<OperationResult>> EditGroup([FromBody]EditBankPaymentInstrumentGroup command)
|
||||||
|
{
|
||||||
|
var result = await _paymentInstrumentApplication.EditGroup(command);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// حذف عنوان
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("group/{id}")]
|
||||||
|
public async Task<ActionResult<OperationResult>> DeleteGroup(long id)
|
||||||
|
{
|
||||||
|
var result = await _paymentInstrumentApplication.DeleteGroup(id);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user