Merge branch 'refs/heads/Feature/ContractingPartyBankAccount/Init' into Api
# Conflicts: # .gitignore
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.RepresentativeAgg;
|
||||
|
||||
@@ -83,6 +84,7 @@ public class PersonalContractingParty : EntityBase
|
||||
|
||||
public List<Employer> Employers { get; private set; }
|
||||
public Representative Representative { get; set; }
|
||||
public List<ContractingPartyBankAccount> ContractingPartyBankAccounts { get; set; }
|
||||
|
||||
public PersonalContractingParty()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
|
||||
namespace Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
|
||||
public class ContractingPartyBankAccount : EntityBase
|
||||
{
|
||||
public long ContractingPartyId { get; private set; }
|
||||
|
||||
public PersonalContractingParty ContractingParty { get; private set; }
|
||||
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 bool IsAuth { get; private set; }
|
||||
|
||||
public ContractingPartyBankAccount(long contractingPartyId, string cardNumber, string accountHolderName,
|
||||
string accountNumber, string iBan , bool isAuth)
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
CardNumber = cardNumber;
|
||||
AccountHolderName = accountHolderName;
|
||||
AccountNumber = accountNumber;
|
||||
IBan = iBan;
|
||||
IsAuth = isAuth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
|
||||
namespace Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
|
||||
public interface IContractingPartyBankAccountsRepository:IRepository<long,ContractingPartyBankAccount>
|
||||
{
|
||||
Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(ContractingPartyBankAccountSearchModel searchModel);
|
||||
Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search, string selected);
|
||||
Task<OperationResult<List<string>>> IBanSelectList(string search, string selected);
|
||||
|
||||
Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected);
|
||||
Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
|
||||
/// <summary>
|
||||
/// جستجوی لیست اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
public class ContractingPartyBankAccountSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// نام طرف حساب / نام صاحب حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyOrAccountHolderName { 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>
|
||||
/// شمارش page
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
public class CreateContractingPartyBankAccounts
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام صاحب حساب
|
||||
/// </summary>
|
||||
public string AccountHolderName { 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,54 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
|
||||
/// <summary>
|
||||
/// لیست اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
public class GetContractingPartyBankAccountViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// لیست حساب های بانکی
|
||||
/// </summary>
|
||||
public List<ContractingPartyBankAccountsItemViewModel> BankAccountsItems { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// حساب بانکی طرف حساب
|
||||
/// </summary>
|
||||
public class ContractingPartyBankAccountsItemViewModel
|
||||
{
|
||||
/// <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; }
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.OriginalTitle;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
|
||||
/// <summary>
|
||||
/// اپلیکیشن اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
public interface IContractingPartyBankAccountsApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// ایجاد اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> Create(CreateContractingPartyBankAccounts command);
|
||||
|
||||
/// <summary>
|
||||
/// لیست اطلاعات طرف حساب بانکی
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
||||
ContractingPartyBankAccountSearchModel searchModel);
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست جستجو برای نام طرف حساب / صاحب حساب
|
||||
/// </summary>
|
||||
/// <param name="search">نام جستجو</param>
|
||||
/// <param name="selected">نام سلکت شده</param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search, string selected);
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست شماره کارت
|
||||
/// </summary>
|
||||
/// <param name="search">نام جستجو</param>
|
||||
/// <param name="selected">نام سلکت شده</param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected);
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست شماره شبا
|
||||
/// </summary>
|
||||
/// <param name="search">نام جستجو</param>
|
||||
/// <param name="selected">نام سلکت شده</param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<List<string>>> IBanSelectList(string search, string selected);
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست شماره حساب
|
||||
/// </summary>
|
||||
/// <param name="search">نام جستجو</param>
|
||||
/// <param name="selected">نام سلکت شده</param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class ContractingPartyBankAccountsApplication:IContractingPartyBankAccountsApplication
|
||||
{
|
||||
private readonly IContractingPartyBankAccountsRepository _contractingPartyBankAccountsRepository;
|
||||
private readonly IPersonalContractingPartyRepository _personalContractingPartyRepository;
|
||||
|
||||
public ContractingPartyBankAccountsApplication(IContractingPartyBankAccountsRepository contractingPartyBankAccountsRepository,
|
||||
IPersonalContractingPartyRepository personalContractingPartyRepository)
|
||||
{
|
||||
_contractingPartyBankAccountsRepository = contractingPartyBankAccountsRepository;
|
||||
_personalContractingPartyRepository = personalContractingPartyRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Create(CreateContractingPartyBankAccounts command)
|
||||
{
|
||||
var operationResult = new OperationResult();
|
||||
|
||||
if (!_personalContractingPartyRepository.Exists(x => x.id == command.ContractingPartyId))
|
||||
return operationResult.Failed("طرف حساب مورد نظر یافت نشد");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.CardNumber))
|
||||
return operationResult.Failed("شماره کارت خود را وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.AccountNumber))
|
||||
return operationResult.Failed("شماره حساب خود را وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.IBan))
|
||||
return operationResult.Failed("شماره شبا خود را وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.AccountHolderName))
|
||||
return operationResult.Failed("نام صاحب حساب را وارد کنید");
|
||||
|
||||
var entity = new ContractingPartyBankAccount(command.ContractingPartyId, command.CardNumber,
|
||||
command.AccountHolderName,command.AccountNumber, command.IBan,command.IsAuth);
|
||||
|
||||
await _contractingPartyBankAccountsRepository.CreateAsync(entity);
|
||||
|
||||
await _contractingPartyBankAccountsRepository.SaveChangesAsync();
|
||||
|
||||
return operationResult.Succcedded();
|
||||
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
||||
ContractingPartyBankAccountSearchModel searchModel)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.GetList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search,
|
||||
string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.ContractingPartyOrAccountHolderNameSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.CardNumberSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> IBanSelectList(string search, string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.IBanSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.AccountNumberSelectList(search, selected);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ using Company.Domain.ContactUsAgg;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractAgg;
|
||||
using Company.Domain.ContractingPartyAccountAgg;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using Company.Domain.CrossJobAgg;
|
||||
using Company.Domain.CrossJobGuildAgg;
|
||||
using Company.Domain.CrossJobItemsAgg;
|
||||
@@ -115,6 +116,7 @@ using Company.Domain.YearlySalaryItemsAgg;
|
||||
using Company.Domain.YearlysSalaryTitleAgg;
|
||||
using CompanyManagment.EFCore.Mapping;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||
using Evidence = Company.Domain.Evidence.Evidence;
|
||||
using Zone = Company.Domain.ZoneAgg.Zone;
|
||||
|
||||
@@ -183,6 +185,8 @@ public class CompanyContext : DbContext
|
||||
public DbSet<EmployeeAuthorizeTemp> EmployeeAuthorizeTemps { get; set; }
|
||||
public DbSet<AdminMonthlyOverview> AdminMonthlyOverviews { get; set; }
|
||||
public DbSet<PaymentTransaction> PaymentTransactions{ get; set; }
|
||||
|
||||
public DbSet<ContractingPartyBankAccount> ContractingPartyBankAccounts { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class ContractingPartyBankAccountMapping:IEntityTypeConfiguration<ContractingPartyBankAccount>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ContractingPartyBankAccount> builder)
|
||||
{
|
||||
builder.ToTable("ContractingPartyBankAccounts");
|
||||
builder.Property(x => x.AccountHolderName).HasMaxLength(200);
|
||||
builder.Property(x => x.AccountNumber).HasMaxLength(50);
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(50);
|
||||
builder.Property(x=>x.IBan).HasMaxLength(50);
|
||||
|
||||
builder.HasOne(x=>x.ContractingParty)
|
||||
.WithMany(x=>x.ContractingPartyBankAccounts)
|
||||
.HasForeignKey(x=>x.ContractingPartyId);
|
||||
}
|
||||
}
|
||||
10110
CompanyManagment.EFCore/Migrations/20250726105745_initial contracitngpartybank accounts.Designer.cs
generated
Normal file
10110
CompanyManagment.EFCore/Migrations/20250726105745_initial contracitngpartybank accounts.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class initialcontracitngpartybankaccounts : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ContractingPartyBankAccounts",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ContractingPartyId = table.Column<long>(type: "bigint", nullable: false),
|
||||
CardNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
AccountHolderName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
||||
AccountNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
IBan = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
IsAuth = table.Column<bool>(type: "bit", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ContractingPartyBankAccounts", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ContractingPartyBankAccounts_PersonalContractingParties_ContractingPartyId",
|
||||
column: x => x.ContractingPartyId,
|
||||
principalTable: "PersonalContractingParties",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ContractingPartyBankAccounts_ContractingPartyId",
|
||||
table: "ContractingPartyBankAccounts",
|
||||
column: "ContractingPartyId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ContractingPartyBankAccounts");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -872,6 +872,46 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("ContractingPartyAccount", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ContractingPartyBankAccountsAgg.ContractingPartyBankAccounts", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("AccountHolderName")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("CardNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<long>("ContractingPartyId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("IBan")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<bool>("IsAuth")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("ContractingPartyId");
|
||||
|
||||
b.ToTable("ContractingPartyBankAccounts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CrossJobAgg.CrossJob", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -6604,6 +6644,17 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("PersonalContractingParty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ContractingPartyBankAccountsAgg.ContractingPartyBankAccounts", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", "ContractingParty")
|
||||
.WithMany("ContractingPartyBankAccounts")
|
||||
.HasForeignKey("ContractingPartyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ContractingParty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CrossJobAgg.CrossJob", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.CrossJobGuildAgg.CrossJobGuild", "CrossJobGuild")
|
||||
@@ -9759,6 +9810,8 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b =>
|
||||
{
|
||||
b.Navigation("ContractingPartyBankAccounts");
|
||||
|
||||
b.Navigation("Employers");
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class ContractingPartyBankAccountsRepository : RepositoryBase<long, ContractingPartyBankAccount>,
|
||||
IContractingPartyBankAccountsRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
|
||||
public ContractingPartyBankAccountsRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
||||
ContractingPartyBankAccountSearchModel searchModel)
|
||||
{
|
||||
var query = _context.ContractingPartyBankAccounts.AsQueryable();
|
||||
if (!string.IsNullOrEmpty(searchModel.CardNumber))
|
||||
query = query.Where(x => x.CardNumber.Contains(searchModel.CardNumber));
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.AccountNumber))
|
||||
query = query.Where(x => x.AccountNumber.Contains(searchModel.AccountNumber));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.IBan))
|
||||
query = query.Where(x => x.IBan.Contains(searchModel.IBan));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractingPartyOrAccountHolderName))
|
||||
query = query.Where(x => x.AccountHolderName
|
||||
.Contains(searchModel.ContractingPartyOrAccountHolderName) ||
|
||||
(x.ContractingParty.FName + " " + x.ContractingParty.LName).Contains(searchModel
|
||||
.ContractingPartyOrAccountHolderName));
|
||||
|
||||
var grouped = query
|
||||
.GroupBy(x => new { x.ContractingPartyId, x.ContractingParty.FName, x.ContractingParty.LName })
|
||||
.Select(g => new GetContractingPartyBankAccountViewModel()
|
||||
{
|
||||
ContractingPartyId = g.Key.ContractingPartyId,
|
||||
ContractingPartyName = g.Key.FName + " " + g.Key.LName,
|
||||
BankAccountsItems = g.Select(x => new ContractingPartyBankAccountsItemViewModel
|
||||
{
|
||||
AccountHolderName = x.AccountHolderName,
|
||||
AccountNumber = x.AccountNumber,
|
||||
CardNumber = x.CardNumber,
|
||||
IBan = x.IBan,
|
||||
}).ToList()
|
||||
});
|
||||
|
||||
var result = await grouped
|
||||
.Skip(searchModel.PageIndex)
|
||||
.Take(30)
|
||||
.ToListAsync();
|
||||
|
||||
return new OperationResult<List<GetContractingPartyBankAccountViewModel>>().Succcedded(result);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search,
|
||||
string selected)
|
||||
{
|
||||
var accountHolderQuery = _context.ContractingPartyBankAccounts.Select(x => x.AccountHolderName);
|
||||
var contractingPartyNameQuery = _context.ContractingPartyBankAccounts.Select(x=>x.ContractingParty.FName + " " + x.ContractingParty.LName);
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
accountHolderQuery = accountHolderQuery.Where(x=>x.Contains(search));
|
||||
contractingPartyNameQuery = contractingPartyNameQuery.Where(x => x.Contains(search));
|
||||
}
|
||||
|
||||
var result = await accountHolderQuery.Union(contractingPartyNameQuery).Take(50).ToListAsync();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(selected))
|
||||
{
|
||||
result.Add(selected);
|
||||
}
|
||||
|
||||
return new OperationResult<List<string>>().Succcedded(result.Distinct().ToList());
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> IBanSelectList(string search, string selected)
|
||||
{
|
||||
var iBanQuery = _context.ContractingPartyBankAccounts.Select(x=>x.IBan);
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
iBanQuery = iBanQuery.Where(x => x.Contains(search));
|
||||
}
|
||||
|
||||
var result = await iBanQuery.Take(50).ToListAsync();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(selected))
|
||||
{
|
||||
result.Add(selected);
|
||||
}
|
||||
|
||||
return new OperationResult<List<string>>().Succcedded(result.Distinct().ToList());
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected)
|
||||
{
|
||||
var cardNumberQuery = _context.ContractingPartyBankAccounts.Select(x=>x.CardNumber);
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
cardNumberQuery = cardNumberQuery.Where(x => x.Contains(search));
|
||||
}
|
||||
|
||||
var result = await cardNumberQuery.Take(50).ToListAsync();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(selected))
|
||||
{
|
||||
result.Add(selected);
|
||||
}
|
||||
|
||||
return new OperationResult<List<string>>().Succcedded(result.Distinct().ToList());
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected)
|
||||
{
|
||||
var accountNumberQuery = _context.ContractingPartyBankAccounts.Select(x=>x.IBan);
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
accountNumberQuery = accountNumberQuery.Where(x => x.Contains(search));
|
||||
}
|
||||
|
||||
var result = await accountNumberQuery.Take(50).ToListAsync();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(selected))
|
||||
{
|
||||
result.Add(selected);
|
||||
}
|
||||
|
||||
return new OperationResult<List<string>>().Succcedded(result.Distinct().ToList());
|
||||
}
|
||||
}
|
||||
@@ -209,8 +209,10 @@ using Company.Domain.ContactUsAgg;
|
||||
using CompanyManagment.App.Contracts.ContactUs;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace PersonalContractingParty.Config;
|
||||
@@ -440,7 +442,10 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<IAdminMonthlyOverviewApplication, AdminMonthlyOverviewApplication>();
|
||||
|
||||
services.AddTransient<IPaymentTransactionRepository, PaymentTransactionRepository>();
|
||||
services.AddTransient<IPaymentTransactionApplication, PaymentTransactionApplication>();
|
||||
services.AddTransient<IPaymentTransactionApplication, PaymentTransactionApplication>();
|
||||
|
||||
services.AddTransient<IContractingPartyBankAccountsApplication, ContractingPartyBankAccountsApplication>();
|
||||
services.AddTransient<IContractingPartyBankAccountsRepository, ContractingPartyBankAccountsRepository>();
|
||||
#endregion
|
||||
#region Pooya
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// کنترلر بانک اطلاعات شماره حساب
|
||||
/// </summary>
|
||||
public class ContractingPartyBankAccountController : AdminBaseController
|
||||
{
|
||||
private readonly IContractingPartyBankAccountsApplication _contractingPartyBankAccountsApplication;
|
||||
|
||||
public ContractingPartyBankAccountController(IContractingPartyBankAccountsApplication contractingPartyBankAccountsApplication)
|
||||
{
|
||||
_contractingPartyBankAccountsApplication = contractingPartyBankAccountsApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیست اطلاعات بانک اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
/// <param name="searchModel">سرچ</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(ContractingPartyBankAccountSearchModel searchModel)
|
||||
{
|
||||
var res =await _contractingPartyBankAccountsApplication.GetList(searchModel);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<OperationResult> Create([FromBody] CreateContractingPartyBankAccounts command)
|
||||
{
|
||||
var operationResult = await _contractingPartyBankAccountsApplication.Create(command);
|
||||
return operationResult;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user