Merge branch 'master' into Feature/BgService/init
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -361,4 +361,4 @@ MigrationBackup/
|
||||
|
||||
# # Fody - auto-generated XML schema
|
||||
# FodyWeavers.xsd
|
||||
|
||||
.idea
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ServiceHost;
|
||||
namespace _0_Framework.Application;
|
||||
|
||||
public class AppSettingConfiguration
|
||||
{
|
||||
@@ -8,36 +8,43 @@ using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace _0_Framework.Application.PaymentGateway;
|
||||
|
||||
public class AqayePardakhtPaymentGateway:IPaymentGateway
|
||||
{
|
||||
private const string Pin = "86EAF2C4D052F7D8759F";
|
||||
private static string _pin = "86EAF2C4D052F7D8759F";
|
||||
private const string AccountNumber = "AP.1042276242";
|
||||
private const string EncryptedKey = "130D2@D2923";
|
||||
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
public AqayePardakhtPaymentGateway(IHttpClientFactory httpClientFactory)
|
||||
public AqayePardakhtPaymentGateway(IHttpClientFactory httpClientFactory,IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_httpClient = httpClientFactory.CreateClient();
|
||||
|
||||
if (appSetting.Value.Domain == ".dad-mehr.ir")
|
||||
{
|
||||
_pin = "7349F84E81AB584862D9";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<PaymentGatewayResponse> Create(CreatePaymentGatewayRequest command,CancellationToken cancellationToken =default)
|
||||
{
|
||||
var response = await _httpClient.PostAsJsonAsync("https://panel.aqayepardakht.ir/api/v2/create", new
|
||||
{
|
||||
pin = Pin,
|
||||
pin = _pin,
|
||||
amount = command.Amount,
|
||||
callback = command.CallBackUrl,
|
||||
card_number = command.CardNumber,
|
||||
invoice_id = command.InvoiceId,
|
||||
mobile = command.Mobile,
|
||||
email = command.Email,
|
||||
mobile = command.Mobile,
|
||||
email = command.Email??"",
|
||||
description = command.Description,
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
var resStr = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
var result = await response.Content.ReadFromJsonAsync<PaymentGatewayResponse>(cancellationToken: cancellationToken);
|
||||
return result;
|
||||
}
|
||||
@@ -49,7 +56,7 @@ public class AqayePardakhtPaymentGateway:IPaymentGateway
|
||||
{
|
||||
var response = await _httpClient.PostAsJsonAsync("https://panel.aqayepardakht.ir/api/v2/verify", new
|
||||
{
|
||||
pin = Pin,
|
||||
pin = _pin,
|
||||
amount = command.Amount,
|
||||
transid = command.TransactionId,
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
@@ -23,13 +23,15 @@ public interface IPaymentGateway
|
||||
public class PaymentGatewayResponse
|
||||
{
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; }
|
||||
public string Status { get; set; }
|
||||
|
||||
[JsonPropertyName("code")]
|
||||
public int? ErrorCode { get; set; }
|
||||
|
||||
[JsonPropertyName("transid")]
|
||||
public string TransactionId { get; set; }
|
||||
|
||||
public bool IsSuccess => Status == "success";
|
||||
}
|
||||
|
||||
public class WalletAmountResponse
|
||||
|
||||
22
0_Framework/InfraStructure/QueryableExtensions.cs
Normal file
22
0_Framework/InfraStructure/QueryableExtensions.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace _0_Framework.InfraStructure;
|
||||
|
||||
public static class QueryableExtensions
|
||||
{
|
||||
public static IQueryable<T> ApplyPagination<T>(this IQueryable<T> query, int page, int pageSize)
|
||||
{
|
||||
if (page <= 0) page = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
|
||||
return query.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
}
|
||||
public static IEnumerable<T> ApplyPagination<T>(this IEnumerable<T> source, int page, int pageSize)
|
||||
{
|
||||
if (page <= 0) page = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
|
||||
return source.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
}
|
||||
}
|
||||
@@ -53,8 +53,9 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
|
||||
/// <summary>
|
||||
/// لیست طرف حساب برای سلکت لیست سرچ
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<ContractingPartySelectListViewModel>> GetSelectList();
|
||||
Task<List<ContractingPartySelectListViewModel>> GetSelectList(string search,long id);
|
||||
|
||||
/// <summary>
|
||||
/// لیستی از شماره ملی یا شناسه ملی بر اساس حقیقی یا حقوقی بودن
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText);
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id);
|
||||
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,7 +16,7 @@ public class FinancialStatment : EntityBase
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
|
||||
PublicId = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public FinancialStatment()
|
||||
@@ -24,9 +25,16 @@ public class FinancialStatment : EntityBase
|
||||
}
|
||||
public long ContractingPartyId { get; private set; }
|
||||
public string ContractingPartyName { get; private set; }
|
||||
public Guid PublicId { get; private set; }
|
||||
|
||||
[NotMapped]
|
||||
public string PublicIdStr => PublicId.ToString("N");
|
||||
|
||||
public List<FinancialTransaction> FinancialTransactionList { get; set; }
|
||||
|
||||
|
||||
|
||||
public void SetPublicId()
|
||||
{
|
||||
PublicId = Guid.NewGuid();
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.Domain.FinancialStatmentAgg;
|
||||
|
||||
@@ -15,4 +17,8 @@ public interface IFinancialStatmentRepository : IRepository<long, FinancialStatm
|
||||
List<FinancialStatmentViewModel> Search(FinancialStatmentSearchModel searchModel);
|
||||
Task<ClientFinancialStatementViewModel> GetClientFinancialStatement(long accountId,
|
||||
ClientFinancialStatementSearchModel searchModel);
|
||||
|
||||
Task<OperationResult<ClientFinancialStatementViewModel>> GetDetailsByPublicId(string publicId);
|
||||
Task<GetFinancialStatementBalanceAmount> GetBalanceAmount(long id);
|
||||
Task<double> GetClientDebtAmount(long accountId);
|
||||
}
|
||||
@@ -9,4 +9,6 @@ public interface IPaymentTransactionRepository:IRepository<long,PaymentTransacti
|
||||
{
|
||||
Task<List<GetPaymentTransactionListViewModel>> GetPaymentTransactionList(
|
||||
GetPaymentTransactionListSearchModel searchModel);
|
||||
|
||||
Task<PaymentTransactionDetailsViewModel> GetDetails(long id);
|
||||
}
|
||||
@@ -2,103 +2,87 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace Company.Domain.PaymentTransactionAgg
|
||||
namespace Company.Domain.PaymentTransactionAgg;
|
||||
|
||||
/// <summary>
|
||||
/// نمایانگر یک تراکنش پرداخت شامل جزئیات طرف قرارداد، اطلاعات بانکی، وضعیت تراکنش و مبلغ.
|
||||
/// </summary>
|
||||
public class PaymentTransaction:EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// نمایانگر یک تراکنش پرداخت شامل جزئیات طرف قرارداد، اطلاعات بانکی، وضعیت تراکنش و مبلغ.
|
||||
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
|
||||
/// </summary>
|
||||
public class PaymentTransaction:EntityBase
|
||||
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
|
||||
/// <param name="amount">مبلغ تراکنش</param>
|
||||
/// <param name="contractingPartyName"></param>
|
||||
/// <param name="callBackUrl"></param>
|
||||
public PaymentTransaction(long contractingPartyId,
|
||||
double amount,
|
||||
string contractingPartyName,string callBackUrl)
|
||||
{
|
||||
/// <summary>
|
||||
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
|
||||
/// <param name="bankAccountHolderName">نام صاحب حساب بانکی</param>
|
||||
/// <param name="bankName">نام بانک</param>
|
||||
/// <param name="cardNumber">شماره کارت</param>
|
||||
/// <param name="shebaNumber">شماره شبا</param>
|
||||
/// <param name="accountNumber">شماره حساب بانکی</param>
|
||||
/// <param name="status">وضعیت تراکنش پرداخت</param>
|
||||
/// <param name="amount">مبلغ تراکنش</param>
|
||||
/// <param name="transactionId">شناسه یکتای تراکنش</param>
|
||||
/// <param name="contractingPartyName"></param>
|
||||
public PaymentTransaction(long contractingPartyId,
|
||||
string bankAccountHolderName,
|
||||
string bankName,
|
||||
string cardNumber,
|
||||
string shebaNumber,
|
||||
string accountNumber,
|
||||
PaymentTransactionStatus status,
|
||||
double amount,
|
||||
string transactionId,
|
||||
string contractingPartyName)
|
||||
{
|
||||
TransactionDate = DateTime.Now;
|
||||
ContractingPartyId = contractingPartyId;
|
||||
BankAccountHolderName = bankAccountHolderName;
|
||||
BankName = bankName;
|
||||
CardNumber = cardNumber;
|
||||
ShebaNumber = shebaNumber;
|
||||
AccountNumber = accountNumber;
|
||||
Status = status;
|
||||
Amount = amount;
|
||||
TransactionId = transactionId;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
}
|
||||
ContractingPartyId = contractingPartyId;
|
||||
Status = PaymentTransactionStatus.Pending;
|
||||
Amount = amount;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
CallBackUrl = callBackUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ و زمان انجام پرداخت
|
||||
/// </summary>
|
||||
public DateTime TransactionDate { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ و زمان انجام پرداخت
|
||||
/// </summary>
|
||||
public DateTime TransactionDate { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
/// <summary>
|
||||
/// شناسه طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام صاحب حساب بانکی
|
||||
/// </summary>
|
||||
public string BankAccountHolderName { get; set; }
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش پرداخت
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus Status { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شبا
|
||||
/// </summary>
|
||||
public string ShebaNumber { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
/// </summary>
|
||||
public double Amount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره حساب بانکی
|
||||
/// </summary>
|
||||
public string AccountNumber { get; set; }
|
||||
/// <summary>
|
||||
/// شناسه یکتای تراکنش
|
||||
/// </summary>
|
||||
public string TransactionId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش پرداخت
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus Status { get; set; }
|
||||
public string CallBackUrl { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه یکتای تراکنش
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
public void SetPaid(string cardNumber,string bankName)
|
||||
{
|
||||
Status = PaymentTransactionStatus.Success;
|
||||
TransactionDate = DateTime.Now;
|
||||
CardNumber = cardNumber;
|
||||
BankName = bankName;
|
||||
}
|
||||
public void SetFailed()
|
||||
{
|
||||
Status = PaymentTransactionStatus.Failed;
|
||||
TransactionDate = DateTime.Now;
|
||||
}
|
||||
public void SetTransactionId(string transactionId)
|
||||
{
|
||||
TransactionId = transactionId;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
|
||||
Task<int> GetWorkshopsForEmployeeStartWorkCount(long accountId);
|
||||
Task<List<WorkshopWithLeftWorkTempEmployeesDto>> GetWorkshopsForLeftWorkTemp(long accountId);
|
||||
Task<int> GetWorkshopsForLeftWorkTempCount(long accountId);
|
||||
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search);
|
||||
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
|
||||
List<EmployerViewModel> GetEmployersHasWorkshop();
|
||||
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search);
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search,long id);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -81,12 +81,13 @@ public interface IEmployeeApplication
|
||||
|
||||
#region Api
|
||||
|
||||
/// <summary>
|
||||
/// لیست پرسنل برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText);
|
||||
/// <summary>
|
||||
/// لیست پرسنل برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText, long id);
|
||||
|
||||
/// <summary>
|
||||
/// لیست کل پرسنل
|
||||
|
||||
@@ -42,8 +42,9 @@ public interface IEmployerApplication
|
||||
/// لیست نام کارفرما ها برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search);
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id);
|
||||
|
||||
#endregion
|
||||
#region NewByHeydari
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace CompanyManagment.App.Contracts.FinancialStatment;
|
||||
|
||||
public class ClientFinancialStatementSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// از تاریخ
|
||||
/// </summary>
|
||||
public string FromDate { get; set; }
|
||||
/// <summary>
|
||||
/// تا تاریخ
|
||||
/// </summary>
|
||||
public string ToDate { get; set; }
|
||||
/// <summary>
|
||||
/// از مبلغ
|
||||
/// </summary>
|
||||
public double FromAmount { get; set; }
|
||||
/// <summary>
|
||||
/// تا مبلغ
|
||||
/// </summary>
|
||||
public double ToAmount { get; set; }
|
||||
/// <summary>
|
||||
/// نوع عملیات تراکنش
|
||||
/// </summary>
|
||||
public FinancialTransactionType? Type { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.FinancialStatment;
|
||||
|
||||
public class ClientFinancialStatementViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی FinancialStatement
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع بدهکاری
|
||||
/// </summary>
|
||||
public double TotalDebt { get; set; }
|
||||
/// <summary>
|
||||
/// جمع بستانکاری
|
||||
/// </summary>
|
||||
public double TotalCredit { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public double TotalAmountPayable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تراکنش ها
|
||||
/// </summary>
|
||||
public List<ClientFinancialTransactionViewModel> Transactions { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.FinancialStatment;
|
||||
|
||||
public class ClientFinancialTransactionViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// زمان و تاریخ میلادی
|
||||
/// </summary>
|
||||
public DateTime DateTimeGr { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ
|
||||
/// </summary>
|
||||
public string DateFa { get; set; }
|
||||
/// <summary>
|
||||
/// زمان
|
||||
/// </summary>
|
||||
public string TimeFa { get; set; }
|
||||
/// <summary>
|
||||
/// شرح
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// نوع عملیات پرداخت
|
||||
/// </summary>
|
||||
public FinancialTransactionType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع عملیات پرداخت به صورت استرینگ
|
||||
/// </summary>
|
||||
public string TypeStr { get; set; }
|
||||
/// <summary>
|
||||
/// بدهکار
|
||||
/// </summary>
|
||||
public double Debtor { get; set; }
|
||||
/// <summary>
|
||||
/// بستانکار
|
||||
/// </summary>
|
||||
public double Creditor { get; set; }
|
||||
/// <summary>
|
||||
/// باقی مانده
|
||||
/// </summary>
|
||||
public double Balance { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace CompanyManagment.App.Contracts.FinancialStatment;
|
||||
|
||||
public enum FinancialTransactionType
|
||||
{
|
||||
/// <summary>
|
||||
/// ایجاد درآمد
|
||||
/// </summary>
|
||||
Debt,
|
||||
/// <summary>
|
||||
/// دریافت درآمد
|
||||
/// </summary>
|
||||
Credit
|
||||
}
|
||||
@@ -1,15 +1,21 @@
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.FinancialStatment;
|
||||
|
||||
public interface IFinancialStatmentApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// ایجاد سند مالی از طریق درگاه بانکی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult CreateFromBankGateway(CreateFinancialStatment command);
|
||||
OperationResult Create(CreateFinancialStatment command);
|
||||
|
||||
List<FinancialStatmentViewModel> Search(FinancialStatmentSearchModel searchModel);
|
||||
@@ -23,114 +29,34 @@ public interface IFinancialStatmentApplication
|
||||
/// <returns>مدل صورت حساب مالی کلاینت</returns>
|
||||
Task<ClientFinancialStatementViewModel> GetClientFinancialStatement(ClientFinancialStatementSearchModel searchModel,
|
||||
long accountId);
|
||||
|
||||
/// <summary>
|
||||
/// نمایش اطلاعات صورت حساب مالی کلاینت بر اساس کد هش
|
||||
/// </summary>
|
||||
/// <param name="hashCode"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<ClientFinancialStatementViewModel>> GetDetailsByPublicId(string publicId);
|
||||
|
||||
/// <summary>
|
||||
/// مقدار مانده صورت حساب مالی را برمی گرداند
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetFinancialStatementBalanceAmount> GetBalanceAmount(long id);
|
||||
|
||||
/// <summary>
|
||||
/// مقدار بدهی کلاینت را برمی گرداند
|
||||
/// </summary>
|
||||
/// <param name="accountId"></param>
|
||||
/// <returns></returns>
|
||||
Task<double> GetClientDebtAmount(long accountId);
|
||||
}
|
||||
|
||||
public class ClientFinancialStatementSearchModel
|
||||
public class GetFinancialStatementBalanceAmount
|
||||
{
|
||||
/// <summary>
|
||||
/// از تاریخ
|
||||
/// مبلغ
|
||||
/// </summary>
|
||||
public string FromDate { get; set; }
|
||||
/// <summary>
|
||||
/// تا تاریخ
|
||||
/// </summary>
|
||||
public string ToDate { get; set; }
|
||||
/// <summary>
|
||||
/// از مبلغ
|
||||
/// </summary>
|
||||
public double FromAmount { get; set; }
|
||||
/// <summary>
|
||||
/// تا مبلغ
|
||||
/// </summary>
|
||||
public double ToAmount { get; set; }
|
||||
/// <summary>
|
||||
/// نوع عملیات تراکنش
|
||||
/// </summary>
|
||||
public FinancialTransactionType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// صفحه بندی
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; }
|
||||
|
||||
public double Amount { get; set; }
|
||||
public long ContractingPartyId { get; set; }
|
||||
}
|
||||
|
||||
public enum FinancialTransactionType
|
||||
{
|
||||
/// <summary>
|
||||
/// ایجاد درآمد
|
||||
/// </summary>
|
||||
Debt,
|
||||
/// <summary>
|
||||
/// دریافت درآمد
|
||||
/// </summary>
|
||||
Credit
|
||||
}
|
||||
|
||||
public class ClientFinancialStatementViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی FinancialStatement
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع بدهکاری
|
||||
/// </summary>
|
||||
public double TotalDebt { get; set; }
|
||||
/// <summary>
|
||||
/// جمع بستانکاری
|
||||
/// </summary>
|
||||
public double TotalCredit { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public double TotalAmountPayable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تراکنش ها
|
||||
/// </summary>
|
||||
public List<ClientFinancialTransactionViewModel> Transactions { get; set; }
|
||||
}
|
||||
|
||||
public class ClientFinancialTransactionViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// زمان و تاریخ میلادی
|
||||
/// </summary>
|
||||
public DateTime DateTimeGr { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ
|
||||
/// </summary>
|
||||
public string DateFa { get; set; }
|
||||
/// <summary>
|
||||
/// زمان
|
||||
/// </summary>
|
||||
public string TimeFa { get; set; }
|
||||
/// <summary>
|
||||
/// شرح
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// نوع عملیات پرداخت
|
||||
/// </summary>
|
||||
public FinancialTransactionType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع عملیات پرداخت به صورت استرینگ
|
||||
/// </summary>
|
||||
public string TypeStr { get; set; }
|
||||
/// <summary>
|
||||
/// بدهکار
|
||||
/// </summary>
|
||||
public double Debtor { get; set; }
|
||||
/// <summary>
|
||||
/// بستانکار
|
||||
/// </summary>
|
||||
public double Creditor { get; set; }
|
||||
/// <summary>
|
||||
/// باقی مانده
|
||||
/// </summary>
|
||||
public double Balance { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -7,35 +7,6 @@ public class CreatePaymentTransaction
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام صاحب حساب بانکی
|
||||
/// </summary>
|
||||
public string BankAccountHolderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شبا
|
||||
/// </summary>
|
||||
public string ShebaNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره حساب بانکی
|
||||
/// </summary>
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش پرداخت
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
@@ -43,12 +14,7 @@ public class CreatePaymentTransaction
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه یکتای تراکنش
|
||||
/// مسیر برگشت پس از پرداخت
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
public string CallBackUrl { get; set; }
|
||||
}
|
||||
@@ -7,9 +7,9 @@
|
||||
public class GetPaymentTransactionListSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// نام طرف قرارداد یا صاحب حساب بانکی جهت جستجو
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyOrAccountHolderName { get; set; }
|
||||
public long ContractingPartyId{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شروع بازه جستجو (به صورت رشته)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
@@ -26,5 +27,79 @@ public interface IPaymentTransactionApplication
|
||||
Task<OperationResult> Create(CreatePaymentTransaction command);
|
||||
|
||||
Task<WalletAmountResponse> GetWalletAmount(CancellationToken cancellationToken);
|
||||
/// <summary>
|
||||
/// گرفتن جزئیات تراکنش
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<PaymentTransactionDetailsViewModel> GetDetails(long id);
|
||||
|
||||
/// <summary>
|
||||
/// تغییر وضعیت تراکنش به ناموفق
|
||||
/// </summary>
|
||||
/// <param name="paymentTransactionId"></param>
|
||||
/// <param name="status"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult SetFailed(long paymentTransactionId);
|
||||
|
||||
/// <summary>
|
||||
/// تغییر وضعیت تراکنش به موفق
|
||||
/// </summary>
|
||||
/// <param name="paymentTransactionId"></param>
|
||||
/// <param name="cardNumber"></param>
|
||||
/// <param name="bankName"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
|
||||
|
||||
Task<OperationResult> SetTransactionId(long id, string transactionId);
|
||||
}
|
||||
|
||||
public class PaymentTransactionDetailsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ و زمان انجام پرداخت
|
||||
/// </summary>
|
||||
public DateTime TransactionDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش پرداخت
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه یکتای تراکنش
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
|
||||
public string CallBackUrl { get; set; }
|
||||
}
|
||||
@@ -5,6 +5,10 @@
|
||||
/// </summary>
|
||||
public enum PaymentTransactionStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// تراکنش در انتظار انجام است.
|
||||
/// </summary>
|
||||
Pending,
|
||||
/// <summary>
|
||||
/// تراکنش با شکست مواجه شد.
|
||||
/// </summary>
|
||||
|
||||
@@ -67,8 +67,10 @@ public interface IPersonalContractingPartyApp
|
||||
/// <summary>
|
||||
/// لیست طرف حساب برای سلکت لیست سرچ
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<ContractingPartySelectListViewModel>> GetSelectList();
|
||||
Task<List<ContractingPartySelectListViewModel>> GetSelectList(string search, long id);
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد طرف حساب حقیقی
|
||||
|
||||
@@ -85,7 +85,7 @@ public interface IWorkshopApplication
|
||||
|
||||
Task<List<WorkshopWithLeftWorkTempEmployeesDto>> GetWorkshopsForLeftWorkTemp(long accountId);
|
||||
Task<int> GetWorkshopsForLeftWorkTempCount(long accountId);
|
||||
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search);
|
||||
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1669,9 +1669,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
#region Api
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText)
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id)
|
||||
{
|
||||
return await _EmployeeRepository.GetSelectList(searchText);
|
||||
return await _EmployeeRepository.GetSelectList(searchText,id );
|
||||
}
|
||||
|
||||
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
||||
|
||||
@@ -1185,9 +1185,9 @@ public class EmployerApplication : IEmployerApplication
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search,long id)
|
||||
{
|
||||
return await _EmployerRepository.GetSelectList(search);
|
||||
return await _EmployerRepository.GetSelectList(search,id);
|
||||
}
|
||||
|
||||
async Task<OperationResult<string>> IEmployerApplication.Remove(long id)
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.FinancialStatmentAgg;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -11,11 +15,70 @@ public class FinancialStatmentApplication : IFinancialStatmentApplication
|
||||
{
|
||||
private readonly IFinancialStatmentRepository _financialStatmentRepository;
|
||||
private readonly IFinancialTransactionApplication _financialTransactionApplication;
|
||||
private readonly IPersonalContractingPartyRepository _contractingPartyRepository;
|
||||
|
||||
public FinancialStatmentApplication(IFinancialStatmentRepository financialStatmentRepository, IFinancialTransactionApplication financialTransactionApplication)
|
||||
public FinancialStatmentApplication(IFinancialStatmentRepository financialStatmentRepository, IFinancialTransactionApplication financialTransactionApplication, IPersonalContractingPartyRepository contractingPartyRepository)
|
||||
{
|
||||
_financialStatmentRepository = financialStatmentRepository;
|
||||
_financialTransactionApplication = financialTransactionApplication;
|
||||
_contractingPartyRepository = contractingPartyRepository;
|
||||
}
|
||||
|
||||
public OperationResult CreateFromBankGateway(CreateFinancialStatment command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
if (command.Creditor == 0)
|
||||
return op.Failed("فیلد بدهکار خالیاست");
|
||||
|
||||
if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == command.ContractingPartyId))
|
||||
{
|
||||
var financialStatment =
|
||||
_financialStatmentRepository.GetDetailsByContractingPartyId(command.ContractingPartyId);
|
||||
var transaction = new CreateFinancialTransaction()
|
||||
{
|
||||
FinancialStatementId = financialStatment.Id,
|
||||
TdateGr = DateTime.Now,
|
||||
TdateFa = DateTime.Now.ToFarsi(),
|
||||
Description = command.Description,
|
||||
Deptor = 0,
|
||||
Creditor = command.Creditor,
|
||||
TypeOfTransaction = command.TypeOfTransaction,
|
||||
DescriptionOption = command.DescriptionOption
|
||||
};
|
||||
|
||||
var createTransaction = _financialTransactionApplication.Create(transaction);
|
||||
if (createTransaction.IsSuccedded)
|
||||
return op.Succcedded();
|
||||
return op.Failed("خطا در انجام عملیات");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var contractingPartyName = _contractingPartyRepository.GetFullName(command.ContractingPartyId);
|
||||
var statement = new FinancialStatment(command.ContractingPartyId, contractingPartyName);
|
||||
_financialStatmentRepository.Create(statement);
|
||||
_financialStatmentRepository.SaveChanges();
|
||||
|
||||
var transaction = new CreateFinancialTransaction()
|
||||
{
|
||||
FinancialStatementId = statement.id,
|
||||
TdateGr = DateTime.Now,
|
||||
TdateFa = DateTime.Now.ToFarsi(),
|
||||
Description = command.Description,
|
||||
Deptor = 0,
|
||||
Creditor = command.Creditor,
|
||||
Balance = 0,
|
||||
TypeOfTransaction = command.TypeOfTransaction,
|
||||
DescriptionOption = command.DescriptionOption
|
||||
|
||||
|
||||
};
|
||||
var createTransaction = _financialTransactionApplication.Create(transaction);
|
||||
if (createTransaction.IsSuccedded)
|
||||
return op.Succcedded();
|
||||
return op.Failed("خطا در انجام عملیات");
|
||||
}
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateFinancialStatment command)
|
||||
@@ -117,4 +180,20 @@ public class FinancialStatmentApplication : IFinancialStatmentApplication
|
||||
{
|
||||
return await _financialStatmentRepository.GetClientFinancialStatement(accountId, searchModel);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<ClientFinancialStatementViewModel>> GetDetailsByPublicId(
|
||||
string publicId)
|
||||
{
|
||||
return await _financialStatmentRepository.GetDetailsByPublicId(publicId);
|
||||
}
|
||||
|
||||
public Task<GetFinancialStatementBalanceAmount> GetBalanceAmount(long id)
|
||||
{
|
||||
return _financialStatmentRepository.GetBalanceAmount(id);
|
||||
}
|
||||
|
||||
public Task<double> GetClientDebtAmount(long accountId)
|
||||
{
|
||||
return _financialStatmentRepository.GetClientDebtAmount(accountId);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
@@ -14,11 +20,13 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
{
|
||||
private readonly IPaymentTransactionRepository _paymentTransactionRepository;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IPersonalContractingPartyRepository _personalContractingPartyRepository;
|
||||
|
||||
public PaymentTransactionApplication(IPaymentTransactionRepository paymentTransactionRepository,IHttpClientFactory httpClientFactory)
|
||||
public PaymentTransactionApplication(IPaymentTransactionRepository paymentTransactionRepository,IHttpClientFactory httpClientFactory, IOptions<AppSettingConfiguration> appSetting, IPersonalContractingPartyRepository personalContractingPartyRepository)
|
||||
{
|
||||
_paymentTransactionRepository = paymentTransactionRepository;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory);
|
||||
_personalContractingPartyRepository = personalContractingPartyRepository;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
public async Task<List<GetPaymentTransactionListViewModel>> GetPaymentTransactionList(
|
||||
@@ -30,21 +38,23 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
public async Task<OperationResult> Create(CreatePaymentTransaction command)
|
||||
{
|
||||
var operationResult = new OperationResult();
|
||||
|
||||
var contractingPartyName = _personalContractingPartyRepository.GetFullName(command.ContractingPartyId);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(contractingPartyName))
|
||||
{
|
||||
return operationResult.Failed("مشتری مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
var entity = new PaymentTransaction(
|
||||
command.ContractingPartyId,
|
||||
command.BankAccountHolderName,
|
||||
command.BankName,
|
||||
command.CardNumber,
|
||||
command.ShebaNumber,
|
||||
command.AccountNumber,
|
||||
command.Status,
|
||||
command.Amount,
|
||||
command.TransactionId,
|
||||
command.ContractingPartyName);
|
||||
contractingPartyName,
|
||||
command.CallBackUrl);
|
||||
|
||||
await _paymentTransactionRepository.CreateAsync(entity);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
return operationResult.Succcedded();
|
||||
return operationResult.Succcedded(entity.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,4 +64,50 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
var result = await _paymentGateway.GetWalletAmount(cancellationToken);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<PaymentTransactionDetailsViewModel> GetDetails(long id)
|
||||
{
|
||||
var result = await _paymentTransactionRepository.GetDetails(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
public OperationResult SetFailed(long paymentTransactionId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
var paymentTransaction = _paymentTransactionRepository.Get(paymentTransactionId);
|
||||
|
||||
if (paymentTransaction == null)
|
||||
{
|
||||
return op.Failed("تراکنش مورد نظر یافت نشد");
|
||||
}
|
||||
paymentTransaction.SetFailed();
|
||||
_paymentTransactionRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult SetSuccess(long paymentTransactionId,string cardNumber, string bankName)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
var paymentTransaction = _paymentTransactionRepository.Get(paymentTransactionId);
|
||||
|
||||
if (paymentTransaction == null)
|
||||
{
|
||||
return op.Failed("تراکنش مورد نظر یافت نشد");
|
||||
}
|
||||
paymentTransaction.SetPaid(cardNumber, bankName);
|
||||
_paymentTransactionRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> SetTransactionId(long id, string transactionId)
|
||||
{
|
||||
var paymentTransaction = _paymentTransactionRepository.Get(id);
|
||||
paymentTransaction.SetTransactionId(transactionId);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
}
|
||||
@@ -518,9 +518,9 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
|
||||
return await _personalContractingPartyRepository.GetList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<List<ContractingPartySelectListViewModel>> GetSelectList()
|
||||
public async Task<List<ContractingPartySelectListViewModel>> GetSelectList(string search,long id)
|
||||
{
|
||||
return await _personalContractingPartyRepository.GetSelectList();
|
||||
return await _personalContractingPartyRepository.GetSelectList(search,id);
|
||||
}
|
||||
public async Task<OperationResult> CreateReal(CreateRealContractingParty command)
|
||||
{
|
||||
|
||||
@@ -920,9 +920,9 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
return _workshopRepository.GetWorkshopsForLeftWorkTempCount(accountId);
|
||||
}
|
||||
|
||||
public async Task<List<WorkshopSelectListViewModel>> GetSelectList(string search)
|
||||
public async Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id)
|
||||
{
|
||||
return await _workshopRepository.GetSelectList(search);
|
||||
return await _workshopRepository.GetSelectList(search, id);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,10 @@ public class PaymentTransactionMapping:IEntityTypeConfiguration<PaymentTransacti
|
||||
|
||||
builder.Property(x => x.TransactionId).HasMaxLength(60);
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(25);
|
||||
builder.Property(x => x.AccountNumber).HasMaxLength(25);
|
||||
builder.Property(x => x.BankName).HasMaxLength(50);
|
||||
builder.Property(x => x.BankAccountHolderName).HasMaxLength(255);
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.ShebaNumber).HasMaxLength(30);
|
||||
builder.Property(x => x.ContractingPartyName).HasMaxLength(255);
|
||||
builder.Property(x => x.CallBackUrl).HasMaxLength(500);
|
||||
|
||||
}
|
||||
}
|
||||
10054
CompanyManagment.EFCore/Migrations/20250717093812_add call back url to paymenttransaction.Designer.cs
generated
Normal file
10054
CompanyManagment.EFCore/Migrations/20250717093812_add call back url to paymenttransaction.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addcallbackurltopaymenttransaction : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AccountNumber",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BankAccountHolderName",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ShebaNumber",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CallBackUrl",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(500)",
|
||||
maxLength: 500,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CallBackUrl",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AccountNumber",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(25)",
|
||||
maxLength: 25,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "BankAccountHolderName",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(255)",
|
||||
maxLength: 255,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ShebaNumber",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(30)",
|
||||
maxLength: 30,
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
10065
CompanyManagment.EFCore/Migrations/20250721101031_add public id to financialstatement.Designer.cs
generated
Normal file
10065
CompanyManagment.EFCore/Migrations/20250721101031_add public id to financialstatement.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addpublicidtofinancialstatement : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PublicId",
|
||||
table: "FinancialStatments",
|
||||
type: "uniqueidentifier",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PublicId",
|
||||
table: "FinancialStatments");
|
||||
}
|
||||
}
|
||||
}
|
||||
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")
|
||||
@@ -2629,6 +2669,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("PublicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("FinancialStatments", (string)null);
|
||||
@@ -4347,21 +4390,17 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("BankAccountHolderName")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<string>("BankName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("CallBackUrl")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<string>("CardNumber")
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
@@ -4376,10 +4415,6 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ShebaNumber")
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
@@ -6609,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")
|
||||
@@ -9764,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());
|
||||
}
|
||||
}
|
||||
@@ -950,22 +950,35 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
|
||||
#region Api
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText)
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id)
|
||||
{
|
||||
var query = _context.Employees.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
EmployeeSelectListViewModel idSelected = null;
|
||||
if (id > 0)
|
||||
{
|
||||
idSelected = await query.Select(x => new EmployeeSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FName + " " + x.LName
|
||||
}).FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
query = query.Where(x => (x.FName + " " + x.LName).Contains(searchText));
|
||||
}
|
||||
|
||||
return await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
||||
var list = await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FName + " " + x.LName
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
if (idSelected != null)
|
||||
list.Add(idSelected);
|
||||
|
||||
return list.DistinctBy(x=>x.Id).ToList();
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
||||
{
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.EmployerAccountAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -582,19 +583,30 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search,long id)
|
||||
{
|
||||
var query = _context.Employers.Select(x => new EmployerSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Name = x.FullName
|
||||
});
|
||||
EmployerSelectListViewModel idSelected = null;
|
||||
|
||||
if (id > 0)
|
||||
{
|
||||
idSelected = await query.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
query = query.Where(x => x.Name.Contains(search));
|
||||
}
|
||||
|
||||
return await query.Take(100).ToListAsync();
|
||||
var list = await query.Take(100).ToListAsync();
|
||||
|
||||
if (idSelected != null)
|
||||
list.Add(idSelected);
|
||||
|
||||
return list.DistinctBy(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -71,6 +71,8 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
public async Task<ClientFinancialStatementViewModel> GetClientFinancialStatement(long accountId,
|
||||
ClientFinancialStatementSearchModel searchModel)
|
||||
{
|
||||
bool searched = false;
|
||||
|
||||
var contractingPartyId = _context.ContractingPartyAccounts.Any(x => x.AccountId == accountId) ?
|
||||
_context.ContractingPartyAccounts.FirstOrDefault(x => x.AccountId == accountId)!.PersonalContractingPartyId : 0;
|
||||
|
||||
@@ -86,28 +88,32 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
var resTransaction = resStatement.FinancialTransactionList.ToList();
|
||||
|
||||
#region Search
|
||||
|
||||
|
||||
//if (searchModel.FromAmount > 0 || searchModel.ToAmount > 0)
|
||||
//{
|
||||
// if (searchModel.FromAmount > 0 && searchModel.ToAmount > 0)
|
||||
// {
|
||||
// resTransaction = resTransaction.Where(x => x.>= searchModel.FromAmount && x.Amount <= searchModel);
|
||||
// }
|
||||
// else if (searchModel.FromAmount > 0)
|
||||
// {
|
||||
// query = query.Where(x => x.Amount >= searchModel.FromAmount);
|
||||
// }
|
||||
// else if (searchModel.ToAmount > 0)
|
||||
// {
|
||||
// query = query.Where(x => x.Amount <= searchModel.ToAmount);
|
||||
// }
|
||||
//}
|
||||
if (searchModel.FromAmount > 0 || searchModel.ToAmount > 0)
|
||||
{
|
||||
searched = true;
|
||||
if (searchModel.FromAmount > 0 && searchModel.ToAmount > 0)
|
||||
{
|
||||
resTransaction = resTransaction.Where(x => (x.Deptor >= searchModel.FromAmount && x.Deptor <= searchModel.FromAmount) || (x.Creditor >= searchModel.FromAmount && x.Creditor <= searchModel.FromAmount)).ToList();
|
||||
}
|
||||
else if (searchModel.FromAmount > 0)
|
||||
{
|
||||
resTransaction = resTransaction.Where(x => x.Deptor >= searchModel.FromAmount || x.Creditor >= searchModel.FromAmount).ToList();
|
||||
}
|
||||
else if (searchModel.ToAmount > 0)
|
||||
{
|
||||
resTransaction = resTransaction.Where(x => x.Deptor <= searchModel.ToAmount || x.Creditor <= searchModel.ToAmount).ToList();
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.FromDate) && !string.IsNullOrWhiteSpace(searchModel.ToDate))
|
||||
{
|
||||
searched = true;
|
||||
|
||||
if (searchModel.FromDate.TryToGeorgianDateTime(out var fromDate) == false)
|
||||
throw new BadRequestException("تاریخ وارد شده نامعتبر است");
|
||||
|
||||
if (searchModel.ToDate.TryToGeorgianDateTime(out var toDate) == false)
|
||||
if (searchModel.FromDate.TryToGeorgianDateTime(out var toDate) == false)
|
||||
throw new BadRequestException("تاریخ وارد شده نامعتبر است");
|
||||
|
||||
resTransaction = resTransaction.Where(x => x.TdateGr >= fromDate && x.TdateGr <= toDate).ToList();
|
||||
@@ -115,6 +121,8 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
|
||||
if (searchModel.Type != null)
|
||||
{
|
||||
searched = true;
|
||||
|
||||
var type = searchModel.Type switch
|
||||
{
|
||||
FinancialTransactionType.Credit => "credit",
|
||||
@@ -124,14 +132,69 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
resTransaction = resTransaction.Where(x => x.TypeOfTransaction == type).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
double balance = 0;
|
||||
return new ClientFinancialStatementViewModel()
|
||||
{
|
||||
Id = resStatement.id,
|
||||
TotalAmountPayable = resStatement.FinancialTransactionList.Sum(x=>x.Deptor) - resStatement.FinancialTransactionList.Sum(x=>x.Creditor),
|
||||
TotalCredit = resTransaction.Sum(x=>x.Creditor),
|
||||
TotalDebt = resTransaction.Sum(x=>x.Deptor),
|
||||
Transactions = resTransaction.Select(t => new ClientFinancialTransactionViewModel()
|
||||
TotalAmountPayable = resStatement.FinancialTransactionList.Sum(x => x.Deptor) - resStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalCredit = resTransaction.Sum(x => x.Creditor),
|
||||
TotalDebt = resTransaction.Sum(x => x.Deptor),
|
||||
Transactions = resTransaction.OrderBy(t => t.TdateGr).Select(t =>
|
||||
{
|
||||
if (!searched)
|
||||
{
|
||||
if (t.TypeOfTransaction == "debt")
|
||||
{
|
||||
balance += t.Deptor;
|
||||
}
|
||||
else
|
||||
{
|
||||
balance -= t.Creditor;
|
||||
}
|
||||
}
|
||||
|
||||
return new ClientFinancialTransactionViewModel()
|
||||
{
|
||||
DateTimeGr = t.TdateGr,
|
||||
DateFa = t.TdateGr.ToFarsi(),
|
||||
TimeFa = $"{t.TdateGr:HH:mm}",
|
||||
Description = t.DescriptionOption + " " + t.Description,
|
||||
Debtor = t.Deptor,
|
||||
Creditor = t.Creditor,
|
||||
Balance = balance,
|
||||
Type = t.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
};
|
||||
}).OrderByDescending(x=>x.DateTimeGr).ToList(),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public async Task<OperationResult<ClientFinancialStatementViewModel>> GetDetailsByPublicId(string publicId)
|
||||
{
|
||||
var op = new OperationResult<ClientFinancialStatementViewModel>();
|
||||
if(!Guid.TryParse(publicId,out var publicIdGuid))
|
||||
return op.Failed("شناسه ارسال شده نامعتبر است");
|
||||
|
||||
var financialStatement = await _context.FinancialStatments
|
||||
.Include(x=>x.FinancialTransactionList)
|
||||
.FirstOrDefaultAsync(x=>x.PublicId == publicIdGuid );
|
||||
|
||||
if (financialStatement == null)
|
||||
{
|
||||
return op.Failed("شناسه ارسال شده نامعتبر است");
|
||||
}
|
||||
|
||||
var res = new ClientFinancialStatementViewModel()
|
||||
{
|
||||
Id = financialStatement.id,
|
||||
TotalAmountPayable = financialStatement.FinancialTransactionList.Sum(x => x.Deptor) - financialStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalCredit = financialStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor),
|
||||
ContractingPartyName = financialStatement.ContractingPartyName,
|
||||
Transactions = financialStatement.FinancialTransactionList.Select(t => new ClientFinancialTransactionViewModel()
|
||||
{
|
||||
DateTimeGr = t.TdateGr,
|
||||
DateFa = t.TdateGr.ToFarsi(),
|
||||
@@ -140,10 +203,50 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
Debtor = t.Deptor,
|
||||
Creditor = t.Creditor,
|
||||
Balance = t.Balance,
|
||||
Type = t.TypeOfTransaction =="debt"? FinancialTransactionType.Debt :FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction =="debt"? "ایجاد درآمد" : "دریافت درآمد"
|
||||
Type = t.TypeOfTransaction == "debt" ? FinancialTransactionType.Debt : FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
}).OrderByDescending(t => t.DateTimeGr).ToList(),
|
||||
};
|
||||
return op.Succcedded(res);
|
||||
|
||||
}
|
||||
|
||||
public async Task<GetFinancialStatementBalanceAmount> GetBalanceAmount(long id)
|
||||
{
|
||||
var financialTransactions = _context.FinancialTransactions.Where(x => x.FinancialStatementId == id);
|
||||
|
||||
if (!financialTransactions.Any())
|
||||
throw new BadRequestException("تراکنش مالی یافت نشد");
|
||||
var totalCredit = await financialTransactions.SumAsync(x => x.Creditor);
|
||||
var totalDebt = await financialTransactions.SumAsync(x => x.Deptor);
|
||||
var balance = totalDebt - totalCredit;
|
||||
|
||||
var contractingPartyId = await _context.FinancialStatments
|
||||
.Where(x => x.id == id)
|
||||
.Select(x => x.ContractingPartyId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return new GetFinancialStatementBalanceAmount
|
||||
{
|
||||
Amount = balance,
|
||||
ContractingPartyId = contractingPartyId
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<double> GetClientDebtAmount(long accountId)
|
||||
{
|
||||
var contractingPartyId = (await _context.ContractingPartyAccounts.FirstOrDefaultAsync(x => x.AccountId == accountId))?.PersonalContractingPartyId ?? 0;
|
||||
|
||||
var resStatement = await _context.FinancialStatments.Include(x => x.FinancialTransactionList)
|
||||
.FirstOrDefaultAsync(x => x.ContractingPartyId == contractingPartyId);
|
||||
|
||||
if (resStatement == null)
|
||||
return 0;
|
||||
|
||||
return resStatement.FinancialTransactionList.Sum(x => x.Deptor) -
|
||||
resStatement.FinancialTransactionList.Sum(x => x.Creditor);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransaction>,IPaymentTransactionRepository
|
||||
public class PaymentTransactionRepository : RepositoryBase<long, PaymentTransaction>, IPaymentTransactionRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
public PaymentTransactionRepository(CompanyContext companyContext) : base(companyContext)
|
||||
@@ -22,10 +22,9 @@ public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransactio
|
||||
{
|
||||
var query = _companyContext.PaymentTransactions.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractingPartyOrAccountHolderName))
|
||||
if (searchModel.ContractingPartyId > 0)
|
||||
{
|
||||
query = query.Where(x=>searchModel.ContractingPartyOrAccountHolderName.Contains(x.ContractingPartyName)||
|
||||
searchModel.ContractingPartyOrAccountHolderName.Contains(x.BankAccountHolderName));
|
||||
query = query.Where(x => x.ContractingPartyId == searchModel.ContractingPartyId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.FromDate) && !string.IsNullOrWhiteSpace(searchModel.ToDate))
|
||||
@@ -67,11 +66,8 @@ public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransactio
|
||||
{
|
||||
Id = x.id,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
BankAccountHolderName = x.BankAccountHolderName,
|
||||
BankName = x.BankName,
|
||||
CardNumber = x.CardNumber,
|
||||
ShebaNumber = x.ShebaNumber,
|
||||
AccountNumber = x.AccountNumber,
|
||||
Status = x.Status switch
|
||||
{
|
||||
PaymentTransactionStatus.Failed => "ناموفق",
|
||||
@@ -89,4 +85,28 @@ public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransactio
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public async Task<PaymentTransactionDetailsViewModel> GetDetails(long id)
|
||||
{
|
||||
var transaction = await _companyContext.PaymentTransactions.FirstOrDefaultAsync(x => x.id == id);
|
||||
|
||||
if (transaction == null)
|
||||
return null;
|
||||
|
||||
var result = new PaymentTransactionDetailsViewModel()
|
||||
{
|
||||
Id = transaction.id,
|
||||
Amount = transaction.Amount,
|
||||
CallBackUrl = transaction.CallBackUrl,
|
||||
ContractingPartyId = transaction.ContractingPartyId,
|
||||
CardNumber = transaction.CardNumber,
|
||||
TransactionId = transaction.TransactionId,
|
||||
Status = transaction.Status,
|
||||
ContractingPartyName = transaction.ContractingPartyName,
|
||||
BankName = transaction.BankName,
|
||||
TransactionDate = transaction.TransactionDate
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
IsLegal = x.IsLegal,
|
||||
//Phone = x.Phone,
|
||||
//AgentPhone = x.AgentPhone,
|
||||
|
||||
|
||||
|
||||
}).ToList();
|
||||
res = res.Select(x => new PersonalContractingPartyViewModel()
|
||||
@@ -51,7 +51,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
FName = x.FName,
|
||||
LName = !string.IsNullOrWhiteSpace(x.SureName) ? $"{x.LName} ({x.SureName})" : $"{x.LName}",
|
||||
SureName = x.SureName,
|
||||
FullName = !string.IsNullOrWhiteSpace(x.SureName) ? (x.LName+" "+ x.SureName) : $"{x.LName}",
|
||||
FullName = !string.IsNullOrWhiteSpace(x.SureName) ? (x.LName + " " + x.SureName) : $"{x.LName}",
|
||||
//Nationalcode = x.Nationalcode,
|
||||
//IdNumber = x.IdNumber,
|
||||
//RegisterId = x.RegisterId,
|
||||
@@ -74,32 +74,32 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
public EditPersonalContractingParty GetDetails(long id)
|
||||
{
|
||||
var res = _context.PersonalContractingParties.Select(x => new EditPersonalContractingParty()
|
||||
{
|
||||
Id = x.id,
|
||||
|
||||
FName = x.FName,
|
||||
LName = x.IsLegal == "حقیقی" ? $"{x.FName} {x.LName}" : $"{x.LName}",
|
||||
SureName = x.SureName,
|
||||
Nationalcode = x.Nationalcode,
|
||||
IdNumber = x.IdNumber,
|
||||
RegisterId = x.RegisterId,
|
||||
NationalId = x.NationalId,
|
||||
IsLegal = x.IsLegal,
|
||||
Phone = x.Phone,
|
||||
AgentPhone = x.AgentPhone,
|
||||
Address = x.Address,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
RepresentativeFullName = x.RepresentativeFullName,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Zone = x.Zone,
|
||||
IsActiveString = x.IsActiveString,
|
||||
IsBlock = x.IsBlock,
|
||||
BlockTimes = x.BlockTimes,
|
||||
{
|
||||
Id = x.id,
|
||||
|
||||
FName = x.FName,
|
||||
LName = x.IsLegal == "حقیقی" ? $"{x.FName} {x.LName}" : $"{x.LName}",
|
||||
SureName = x.SureName,
|
||||
Nationalcode = x.Nationalcode,
|
||||
IdNumber = x.IdNumber,
|
||||
RegisterId = x.RegisterId,
|
||||
NationalId = x.NationalId,
|
||||
IsLegal = x.IsLegal,
|
||||
Phone = x.Phone,
|
||||
AgentPhone = x.AgentPhone,
|
||||
Address = x.Address,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
RepresentativeFullName = x.RepresentativeFullName,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Zone = x.Zone,
|
||||
IsActiveString = x.IsActiveString,
|
||||
IsBlock = x.IsBlock,
|
||||
BlockTimes = x.BlockTimes,
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
.FirstOrDefault(x => x.Id == id);
|
||||
|
||||
if (res != null)
|
||||
@@ -112,32 +112,32 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
public EditPersonalContractingParty GetDetailsToEdit(long id)
|
||||
{
|
||||
return _context.PersonalContractingParties.Select(x => new EditPersonalContractingParty()
|
||||
{
|
||||
Id = x.id,
|
||||
{
|
||||
Id = x.id,
|
||||
|
||||
FName = x.FName,
|
||||
LName = x.LName,
|
||||
SureName = x.SureName,
|
||||
Nationalcode = x.Nationalcode,
|
||||
IdNumber = x.IdNumber,
|
||||
RegisterId = x.RegisterId,
|
||||
NationalId = x.NationalId,
|
||||
IsLegal = x.IsLegal,
|
||||
Phone = x.Phone,
|
||||
AgentPhone = x.AgentPhone,
|
||||
Address = x.Address,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
RepresentativeFullName = x.RepresentativeFullName,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Zone = x.Zone,
|
||||
IsActiveString = x.IsActiveString,
|
||||
IsBlock = x.IsBlock,
|
||||
BlockTimes = x.BlockTimes,
|
||||
FName = x.FName,
|
||||
LName = x.LName,
|
||||
SureName = x.SureName,
|
||||
Nationalcode = x.Nationalcode,
|
||||
IdNumber = x.IdNumber,
|
||||
RegisterId = x.RegisterId,
|
||||
NationalId = x.NationalId,
|
||||
IsLegal = x.IsLegal,
|
||||
Phone = x.Phone,
|
||||
AgentPhone = x.AgentPhone,
|
||||
Address = x.Address,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
RepresentativeFullName = x.RepresentativeFullName,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Zone = x.Zone,
|
||||
IsActiveString = x.IsActiveString,
|
||||
IsBlock = x.IsBlock,
|
||||
BlockTimes = x.BlockTimes,
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
.FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
|
||||
|
||||
}).FirstOrDefault(x => x.id == id);
|
||||
|
||||
|
||||
if (res != null)
|
||||
{
|
||||
|
||||
@@ -167,8 +167,8 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
var query = _context.PersonalContractingParties.Select(x => new PersonalContractingPartyViewModel
|
||||
{
|
||||
id = x.id,
|
||||
|
||||
|
||||
FName = x.FName,
|
||||
LName = !string.IsNullOrWhiteSpace(x.SureName) ? $"{x.LName} ({x.SureName})" : $"{x.LName}",
|
||||
SureName = x.SureName,
|
||||
@@ -224,7 +224,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
|
||||
if (res > 0)
|
||||
{
|
||||
|
||||
|
||||
res += 1;
|
||||
return res;
|
||||
}
|
||||
@@ -237,13 +237,13 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
|
||||
#region Mahan
|
||||
public List<string> SearchByName(string name)
|
||||
{
|
||||
var contractingParties = _context.PersonalContractingParties.Select(x => new PersonalContractingPartyViewModel()
|
||||
{
|
||||
FullName = x.IsLegal == "حقوقی" ? x.LName : $"{x.FName} {x.LName}"
|
||||
}).ToList();
|
||||
return contractingParties.Select(x => x.FullName).ToList();
|
||||
}
|
||||
{
|
||||
var contractingParties = _context.PersonalContractingParties.Select(x => new PersonalContractingPartyViewModel()
|
||||
{
|
||||
FullName = x.IsLegal == "حقوقی" ? x.LName : $"{x.FName} {x.LName}"
|
||||
}).ToList();
|
||||
return contractingParties.Select(x => x.FullName).ToList();
|
||||
}
|
||||
|
||||
public AccountViewModel GetAccountByPersonalContractingParty(long contractingPartyId)
|
||||
{
|
||||
@@ -268,7 +268,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
#region NewByHeydari
|
||||
public List<PersonalContractingPartyViewModel> GetPersonalContractingPartiesForNationalcode(string searchText)
|
||||
{
|
||||
var result = _context.PersonalContractingParties.Where(x => (!string.IsNullOrEmpty(x.Nationalcode) && x.Nationalcode.StartsWith(searchText)) )
|
||||
var result = _context.PersonalContractingParties.Where(x => (!string.IsNullOrEmpty(x.Nationalcode) && x.Nationalcode.StartsWith(searchText)))
|
||||
.Select(x => new PersonalContractingPartyViewModel
|
||||
{
|
||||
id = x.id,
|
||||
@@ -280,7 +280,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
}
|
||||
public List<PersonalContractingPartyViewModel> SearchForMain(PersonalContractingPartySearchModel searchModel2)
|
||||
{
|
||||
var query = _context.PersonalContractingParties.Include(x=>x.Employers).Select(x => new PersonalContractingPartyViewModel
|
||||
var query = _context.PersonalContractingParties.Include(x => x.Employers).Select(x => new PersonalContractingPartyViewModel
|
||||
{
|
||||
id = x.id,
|
||||
|
||||
@@ -293,7 +293,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
NationalId = x.NationalId,
|
||||
IsLegal = x.IsLegal,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
FullName = x.FName+ " "+x.LName,
|
||||
FullName = x.FName + " " + x.LName,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Zone = x.Zone,
|
||||
@@ -302,32 +302,32 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
BlockTimes = x.BlockTimes,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
CreationDate = x.CreationDate.ToString(),
|
||||
EmployerList = x.Employers.Select(y => new EmployerViewModel() { Id = y.id, FullName = y.FullName}).ToList()
|
||||
EmployerList = x.Employers.Select(y => new EmployerViewModel() { Id = y.id, FullName = y.FullName }).ToList()
|
||||
|
||||
});
|
||||
if (searchModel2.id > 0)
|
||||
query = query.Where(x => x.id == searchModel2.id);
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel2.Nationalcode) && searchModel2.Nationalcode != "0")
|
||||
query = query.Where(x => x.Nationalcode.Contains(searchModel2.Nationalcode));
|
||||
|
||||
if (searchModel2.RepresentativeId > 0)
|
||||
query = query.Where(x => x.RepresentativeId== searchModel2.RepresentativeId);
|
||||
query = query.Where(x => x.RepresentativeId == searchModel2.RepresentativeId);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel2.IsLegal))
|
||||
query = query.Where(x => x.IsLegal==searchModel2.IsLegal);
|
||||
query = query.Where(x => x.IsLegal == searchModel2.IsLegal);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel2.IsActiveString)&& searchModel2.IsActiveString!="both")
|
||||
query = query.Where(x => x.IsActiveString==searchModel2.IsActiveString);
|
||||
if (!string.IsNullOrWhiteSpace(searchModel2.IsActiveString) && searchModel2.IsActiveString != "both")
|
||||
query = query.Where(x => x.IsActiveString == searchModel2.IsActiveString);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel2.RepresentativeName))
|
||||
{
|
||||
var representativeIds = _context.RepresentativeSet.Where(x => !string.IsNullOrEmpty(x.FullName) && x.FullName.Contains(searchModel2.RepresentativeName)).Select(x=>x.id).ToList();
|
||||
query = query.Where(x => representativeIds.Contains( x.RepresentativeId));
|
||||
var representativeIds = _context.RepresentativeSet.Where(x => !string.IsNullOrEmpty(x.FullName) && x.FullName.Contains(searchModel2.RepresentativeName)).Select(x => x.id).ToList();
|
||||
query = query.Where(x => representativeIds.Contains(x.RepresentativeId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(searchModel2.EmployeeName))
|
||||
{
|
||||
query = query.Where(x => (x.IsLegal == "حقیقی" &&
|
||||
query = query.Where(x => (x.IsLegal == "حقیقی" &&
|
||||
((!string.IsNullOrWhiteSpace(x.FName) && x.FName.StartsWith(searchModel2.EmployeeName)) ||
|
||||
(!string.IsNullOrWhiteSpace(x.LName) && x.LName.StartsWith(searchModel2.EmployeeName))))
|
||||
|| (x.IsLegal == "حقوقی" && (!string.IsNullOrWhiteSpace(x.LName) && x.LName.Contains(searchModel2.EmployeeName))));
|
||||
@@ -351,10 +351,10 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
return op.Failed("حذف با خطا مواجه شد.");
|
||||
}
|
||||
|
||||
}
|
||||
public bool GetHasContract(long id)
|
||||
}
|
||||
public bool GetHasContract(long id)
|
||||
{
|
||||
return _context.InstitutionContractSet.Any(x =>x.IsActiveString== "true" && x.ContractingPartyId == id);
|
||||
return _context.InstitutionContractSet.Any(x => x.IsActiveString == "true" && x.ContractingPartyId == id);
|
||||
}
|
||||
|
||||
public OperationResult DeActiveAll(long id)
|
||||
@@ -368,10 +368,10 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
personel.DeActive();
|
||||
|
||||
var employers = _context.Employers.Where(x => x.ContractingPartyId == id).ToList();
|
||||
employers.ForEach(x=>x.DeActive());
|
||||
employers.ForEach(x => x.DeActive());
|
||||
|
||||
var employerIds= employers.Select(x=>x.id).ToList();
|
||||
var workshopIds=_context.WorkshopEmployers.Where(x=> employerIds.Contains(x.EmployerId)).Select(x=>x.WorkshopId).ToList();
|
||||
var employerIds = employers.Select(x => x.id).ToList();
|
||||
var workshopIds = _context.WorkshopEmployers.Where(x => employerIds.Contains(x.EmployerId)).Select(x => x.WorkshopId).ToList();
|
||||
var workshops = _context.Workshops.Where(x => workshopIds.Contains(x.id)).ToList();
|
||||
workshops.ForEach(x => x.DeActive(x.ArchiveCode));
|
||||
|
||||
@@ -443,7 +443,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
var res = _context.PersonalContractingParties.FirstOrDefault(x => x.id == emp.ContractingPartyId);
|
||||
if (res != null)
|
||||
return res.IsBlock;
|
||||
|
||||
|
||||
return $"NotFound";
|
||||
}
|
||||
|
||||
@@ -459,14 +459,14 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
.ThenInclude(x => x.ContractingParty)
|
||||
.Select(c => c.Employer.ContractingParty);
|
||||
return e.Any(x => x.IsBlock == "true");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ForClients
|
||||
|
||||
public ContractingPartyAndStatmentIdViewModel GetContractingpartyIdByAccountId(long accountId)
|
||||
{
|
||||
var contractingPartId = _context.ContractingPartyAccounts.Any(x => x.AccountId == accountId) ?
|
||||
var contractingPartId = _context.ContractingPartyAccounts.Any(x => x.AccountId == accountId) ?
|
||||
_context.ContractingPartyAccounts.FirstOrDefault(x => x.AccountId == accountId)!.PersonalContractingPartyId : 0;
|
||||
var financialStatmentId = _context.FinancialStatments
|
||||
.Any(x => x.ContractingPartyId == contractingPartId) ? _context.FinancialStatments
|
||||
@@ -572,18 +572,33 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<ContractingPartySelectListViewModel>> GetSelectList()
|
||||
public async Task<List<ContractingPartySelectListViewModel>> GetSelectList(string search,long id)
|
||||
{
|
||||
return await _context.PersonalContractingParties.Select(x => new ContractingPartySelectListViewModel
|
||||
var query = _context.PersonalContractingParties.Select(x => new ContractingPartySelectListViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
Text = x.IsLegal == "حقیقی" ? x.SureName == null
|
||||
? $"{x.FName} {x.LName}"
|
||||
: $"{x.FName} {x.LName} {x.SureName}"
|
||||
: x.SureName == null ? $"{x.LName}"
|
||||
: $"{x.LName} {x.SureName}",
|
||||
? x.FName + " " + x.LName
|
||||
: x.FName + " " + x.LName + " " + x.SureName
|
||||
: x.SureName == null ? x.LName
|
||||
: x.LName + " " + x.SureName
|
||||
|
||||
}).ToListAsync();
|
||||
});
|
||||
ContractingPartySelectListViewModel idSelected = null;
|
||||
if (id > 0)
|
||||
{
|
||||
idSelected = await query.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
query = query.Where(x => x.Text.Contains(search));
|
||||
}
|
||||
|
||||
var list = await query.Take(100).ToListAsync();
|
||||
if (idSelected != null)
|
||||
list.Add(idSelected);
|
||||
|
||||
return list.DistinctBy(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<GetContractingPartyNationalCodeOrNationalIdViewModel>> GetNationalCodeOrNationalId()
|
||||
|
||||
@@ -206,7 +206,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
RotatingShiftCompute = x.RotatingShiftCompute,
|
||||
IsStaticCheckout = x.IsStaticCheckout,
|
||||
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
public List<long> GetRelation(long workshopid)
|
||||
@@ -1155,7 +1155,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<WorkshopSelectListViewModel>> GetSelectList(string search)
|
||||
public async Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id)
|
||||
{
|
||||
var query = _context.Workshops.Select(x => new WorkshopSelectListViewModel()
|
||||
{
|
||||
@@ -1163,14 +1163,23 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
Id = x.id,
|
||||
Name = x.WorkshopFullName
|
||||
});
|
||||
WorkshopSelectListViewModel idSelected = null;
|
||||
if (id > 0)
|
||||
{
|
||||
idSelected = await query.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
query = query.Where(x => x.Name.Contains(search));
|
||||
}
|
||||
|
||||
return await query.Take(100).ToListAsync();
|
||||
}
|
||||
var list = await query.Take(100).ToListAsync();
|
||||
|
||||
if (idSelected != null)
|
||||
list.Add(idSelected);
|
||||
|
||||
return list.DistinctBy(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region NewByHeydari
|
||||
@@ -1616,7 +1625,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
item.HasBlockContractingParty = blockContractingPartyIds.Intersect(empContractingPartyIds).Any();
|
||||
}
|
||||
|
||||
return list.OrderBy(x=>x.ArchiveCodeInt).ToList();
|
||||
return list.OrderBy(x => x.ArchiveCodeInt).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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,64 @@
|
||||
using _0_Framework.Application;
|
||||
using Bogus;
|
||||
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;
|
||||
}
|
||||
|
||||
[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>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<OperationResult> Create([FromBody] CreateContractingPartyBankAccounts command)
|
||||
{
|
||||
var operationResult = await _contractingPartyBankAccountsApplication.Create(command);
|
||||
return operationResult;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,9 +140,9 @@ public class ContractingPartyController : AdminBaseController
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("selectList")]
|
||||
public async Task<ActionResult<List<ContractingPartySelectListViewModel>>> GetSelectList()
|
||||
public async Task<ActionResult<List<ContractingPartySelectListViewModel>>> GetSelectList(string search, long id)
|
||||
{
|
||||
return await _contractingPartyApplication.GetSelectList();
|
||||
return await _contractingPartyApplication.GetSelectList(search, id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -16,16 +16,16 @@ public class EmployeesController:AdminBaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست پرسنل برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetSelectList(string search)
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetSelectList(string search, long id)
|
||||
{
|
||||
var data = await _employeeApplication.GetSelectList(search);
|
||||
var data = await _employeeApplication.GetSelectList(search, id);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ public class EmployerController : AdminBaseController
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id)
|
||||
{
|
||||
return await _employerApplication.GetSelectList(search);
|
||||
return await _employerApplication.GetSelectList(search, id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using ServiceHost.BaseControllers;
|
||||
using ServiceHost.Controllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName, List<int> Permissions, long? PositionValue);
|
||||
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName, List<int> Permissions, long? PositionValue,UserType UserType);
|
||||
|
||||
public class LoginController:AdminBaseController
|
||||
{
|
||||
@@ -32,7 +32,8 @@ public class LoginController:AdminBaseController
|
||||
return NotFound("کاربر یافت نشد");
|
||||
}
|
||||
|
||||
if (_authHelper.GetUserTypeWithId().userType is not UserType.Admin)
|
||||
var userTypeWithId = _authHelper.GetUserTypeWithId();
|
||||
if (userTypeWithId.userType is not UserType.Admin)
|
||||
return Unauthorized();
|
||||
|
||||
var details = new GetAdminProfileDetails(
|
||||
@@ -41,7 +42,8 @@ public class LoginController:AdminBaseController
|
||||
data.Mobile,
|
||||
data.RoleName,
|
||||
data.Permissions,
|
||||
data.PositionValue
|
||||
data.PositionValue,
|
||||
userTypeWithId.userType
|
||||
);
|
||||
return details;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,13 @@ public class WorkshopController: AdminBaseController
|
||||
/// لیست کارگاه برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<ActionResult<List<WorkshopSelectListViewModel>>> GetSelectList(string search)
|
||||
public async Task<ActionResult<List<WorkshopSelectListViewModel>>> GetSelectList(string search, long id)
|
||||
{
|
||||
var data = await _workshopApplication.GetSelectList(search);
|
||||
var data = await _workshopApplication.GetSelectList(search,id);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@{
|
||||
}
|
||||
@{
|
||||
<!--suppress CssInvalidPropertyValue -->
|
||||
<style>
|
||||
|
||||
.ui-autocomplete-input {
|
||||
@@ -81,7 +82,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label"> مرحله رسیدگی :</label>
|
||||
|
||||
<!--<select class="form-control select-city" asp-for="ProcessingStage" asp-items='new SelectList(Model.drProcessingStage, "Value", "Text")' id="ProcessingStage_Id">-->
|
||||
<!--<select class="form-control select-city" asp-for="ProcessingStage" asp-items='new SelectList(Model.ProcessingStage, "Value", "Text")' id="ProcessingStage_Id">-->
|
||||
@*<option value="0"> انتخاب موکل:</option>*@
|
||||
<!--</select>-->
|
||||
|
||||
|
||||
@@ -208,27 +208,45 @@
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<input asp-for="EditEmployeChildrenList[index].DateOfBirth" class="items childInput persianDateInput ltr text-center childBirth col-md-12 col-lg-12 col-sm-12 col-xs-12" type="text" placeholder="" maxlength="10">
|
||||
</div>
|
||||
<div>
|
||||
@if (index == 0)
|
||||
{
|
||||
<a>
|
||||
<i class="fa fa-trash trash" aria-hidden="true" style="color: #818181;">
|
||||
</i>
|
||||
@* <input type="checkbox" style="display:none" asp-for="EditEmployeChildrenList[0].IsRemoved"/> *@
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a id="delete_@index" class="delete">
|
||||
<i class="fa fa-trash trash trash-icon" aria-hidden="true">
|
||||
</i>
|
||||
@*<input type="checkbox" style="display:none" asp-for="EditEmployeChildrenList[index].IsRemoved"/> *@
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<input type="checkbox" style="display:none" asp-for="EditEmployeChildrenList[index].IsRemoved"/>
|
||||
<input type="hidden" asp-for="EditEmployeChildrenList[index].Id"/>
|
||||
</td>
|
||||
<div>
|
||||
@if (index == 0)
|
||||
{
|
||||
<a>
|
||||
<i class="fa fa-trash trash" aria-hidden="true" style="color: #818181;">
|
||||
</i>
|
||||
@* <input type="checkbox" style="display:none" asp-for="EditEmployeChildrenList[0].IsRemoved"/> *@
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a id="delete_@index" class="delete" >
|
||||
<i class="fa fa-trash trash trash-icon" aria-hidden="true">
|
||||
</i>
|
||||
@*<input type="checkbox" style="display:none" asp-for="EditEmployeChildrenList[index].IsRemoved"/> *@
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<script>
|
||||
$(document).on("click", ".delete", function () {
|
||||
// پیدا کردن نزدیکترین tr به آیکون حذف کلیک شده
|
||||
var row = $(this).closest("tr");
|
||||
|
||||
// پیدا کردن input checkbox داخل این سطر
|
||||
var checkbox = row.find("input[type='checkbox']");
|
||||
|
||||
// تنظیم مقدار آن به true (یعنی checked)
|
||||
checkbox.prop("checked", true);
|
||||
|
||||
// اختیاری: حذف ظاهری سطر از جدول
|
||||
row.hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
<input type="checkbox" del-data="EditEmployeChildrenList[index].Id" style="display:none" asp-for="EditEmployeChildrenList[index].IsRemoved" />
|
||||
<input type="hidden" asp-for="EditEmployeChildrenList[index].Id"/>
|
||||
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<input asp-for="EditEmployeChildrenList[index].FName" class=" items1 childInput childName col-md-12 col-lg-12 col-sm-12 col-xs-12" type="text" placeholder="" pattern="[\u0600-\u06FF\s]*">
|
||||
@@ -430,6 +448,11 @@
|
||||
<script src="~/lib/select2/js/i18n/fa.js"></script>
|
||||
<script>
|
||||
|
||||
function delChildren(deleteChildrenId){
|
||||
alert(deleteChildrenId);
|
||||
var sel = $(`input[del-data=${deleteChildrenId}]`).val();
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#divEdit #close").click(function() {
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
</select>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset style="border: 1px solid #999797; border-radius: 10px; padding: revert; margin: 15px">
|
||||
<legend style="margin-bottom: 5px; font-size: large; border-bottom: 0px; color: #505458; width: 140px; text-align: center;"> جزئیات مدارک </legend>
|
||||
@@ -159,7 +160,7 @@
|
||||
@if (i != 0)
|
||||
{
|
||||
<div class="col-md-1" onclick="removeRow(this, 'evideceDetails', 'evideceDetails');">
|
||||
<i class="fa fa-minus-circle fa-2x" style="color: red; position: absolute; top: 4px cursor: pointer;"></i>
|
||||
<i class="fa fa-minus-circle fa-2x" style="color: red; position: absolute; top: 4px; cursor: pointer;"></i>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -98,7 +98,9 @@ else
|
||||
<span asp-validation-for="MasterName" class="error"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset style="border: 1px solid #999797; border-radius: 10px; padding: revert; margin: 15px">
|
||||
<legend style="margin-bottom: 5px; font-size: large; border-bottom: 0px; color: #505458; width: 220px; text-align: center;"> جزئیات پرداخت کارشناسی </legend>
|
||||
<div id="penaltyTitles" class="row m-t-15">
|
||||
@@ -175,7 +177,7 @@ else
|
||||
@if (i != 0)
|
||||
{
|
||||
<div class="col-md-1" onclick="removeRow(this, 'penaltyTitles', 'penaltyTitles');">
|
||||
<i class="fa fa-minus-circle fa-2x" style="color: red; position: absolute; top: 4px cursor: pointer;"></i>
|
||||
<i class="fa fa-minus-circle fa-2x" style="color: red; position: absolute; top: 4px; cursor: pointer;"></i>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -256,7 +258,7 @@ else
|
||||
@if (i != 0)
|
||||
{
|
||||
<div class="col-md-1" onclick="removeRow(this, 'recordVerification', 'recordVerification');">
|
||||
<i class="fa fa-minus-circle fa-2x" style="color: red; position: absolute; top: 4px cursor: pointer;"></i>
|
||||
<i class="fa fa-minus-circle fa-2x" style="color: red; position: absolute; top: 4px; cursor: pointer;"></i>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -485,7 +485,13 @@
|
||||
$(this).parentsUntil("#sidebar-menu > ul > li > a").addClass('active');
|
||||
};
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('.clik10').filter(function () {
|
||||
if (this.href == url || this.href == url2) {
|
||||
$(".sdf10").slideDown(350);
|
||||
/*$(".wav").addClass("subdrop");*/
|
||||
$(this).parentsUntil("#sidebar-menu > ul > li > a").addClass('active');
|
||||
};
|
||||
}); $(document).ready(function () {
|
||||
$(document).on('click', function (e) {
|
||||
var $target = $(e.target);
|
||||
if (!$target.closest('.dropdown').length &&
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using AccountManagement.Domain.TicketAccessAccountAgg
|
||||
@using _0_Framework.Application
|
||||
@using AccountManagement.Domain.TicketAccessAccountAgg
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject _0_Framework.Application.IAuthHelper AuthHelper;
|
||||
@@ -168,12 +169,12 @@
|
||||
</span>
|
||||
</a>
|
||||
<ul class="list-unstyled sdf3">
|
||||
<li permission="307"><a class="clik3" asp-page="/Company/InstitutionContracts/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
قراردادهای موسسه</a>
|
||||
</li>
|
||||
@* <li permission="307"><a class="clik3" asp-page="/Company/InstitutionContracts/Index"> *@
|
||||
@* <svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;"> *@
|
||||
@* <circle cx="6.5" cy="6.5" r="6.5" fill="white"/> *@
|
||||
@* </svg> *@
|
||||
@* قراردادهای موسسه</a> *@
|
||||
@* </li> *@
|
||||
<li permission="308">
|
||||
<a class="clik3" asp-area="AdminNew" asp-page="/Company/RollCall/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
@@ -472,6 +473,36 @@
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="has_sub" permission="307">
|
||||
|
||||
<a class="waves-effect MainMenuItem">
|
||||
<div class="menuTitle">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
<span> حسابداری </span>
|
||||
</div>
|
||||
<span class="pull-right">
|
||||
<i class="md md-add"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="list-unstyled sdf10">
|
||||
<li permission="307"><a class="clik10" asp-page="/Company/InstitutionContracts/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
قراردادهای موسسه</a>
|
||||
</li>
|
||||
|
||||
<li permission="307" style=";white-space: nowrap">
|
||||
<a class="clik10 " href="https://admin@(AppSetting.Value.Domain)/payment-gateway-deposits" style="width: 7px;margin: 0 6px;">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
لیست تراکنش های درگاه پرداخت
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
@@ -15,6 +15,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json.Serialization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Microsoft.Extensions.Options;
|
||||
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
@@ -32,13 +33,13 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory)
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory);
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
@@ -97,7 +98,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
//Console.WriteLine("endStep 1 ============");
|
||||
//SetRollCall(r1);
|
||||
|
||||
await ChangeFridayWorkToWeeklyDayOfWeek();
|
||||
//await ChangeFridayWorkToWeeklyDayOfWeek();
|
||||
//await SetPublicId();
|
||||
ViewData["message"] = "تومام دو";
|
||||
return Page();
|
||||
}
|
||||
@@ -109,15 +111,13 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
Email = "mahanch83@gmail.com",
|
||||
CallBackUrl = Url.Page("/CallBack/Index", null, null, Request.Scheme, Request.Host.Value),
|
||||
InvoiceId = "{C771E841-B810-413D-9D4C-9F659575B8CC}",
|
||||
|
||||
|
||||
};
|
||||
var createResponse = await _paymentGateway.CreateSandBox(command, cancellationToken);
|
||||
var createResponse = await _paymentGateway.Create(command, cancellationToken);
|
||||
|
||||
|
||||
if (createResponse.Status == "success")
|
||||
{
|
||||
return Redirect(_paymentGateway.GetStartPaySandBoxUrl(createResponse.TransactionId));
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(createResponse.TransactionId));
|
||||
}
|
||||
|
||||
//TranslateCode(result?.ErrorCode);
|
||||
@@ -617,6 +617,16 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task SetPublicId()
|
||||
{
|
||||
var financialStatements = await _context.FinancialStatments.Where(x=>x.PublicId ==Guid.Empty).ToListAsync();
|
||||
foreach (var financialStatement in financialStatements)
|
||||
{
|
||||
financialStatement.SetPublicId();
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
public class IndexModel2 : PageModel
|
||||
{
|
||||
|
||||
@@ -87,17 +87,17 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.MonthlyOverview
|
||||
return new JsonResult(counter);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployerSelectList(string search)
|
||||
public async Task<IActionResult> OnGetEmployerSelectList(string search, long id)
|
||||
{
|
||||
var res = await _employerApplication.GetSelectList(search);
|
||||
var res = await _employerApplication.GetSelectList(search, id);
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = res
|
||||
});
|
||||
}
|
||||
public async Task<IActionResult> OnGetWorkshopSelectList(string search)
|
||||
public async Task<IActionResult> OnGetWorkshopSelectList(string search, long id)
|
||||
{
|
||||
var res = await _workshopApplication.GetSelectList(search);
|
||||
var res = await _workshopApplication.GetSelectList(search, id);
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = res
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<script src="~/assetsadminnew/assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/AssetsClient/libs/select2/js/select2.js"></script>
|
||||
<script src="~/AssetsClient/libs/select2/js/i18n/fa.js"></script>
|
||||
<script src="~/assetsadminnew/assets/js/jquery.mask_1.14.16.min.js"></script>
|
||||
<script src="~/assetsadminnew/assets/js/jquery-mask-v1.13.4.js"></script>
|
||||
<script src="~/assetsadminnew/assets/js/datevalidation.js"></script>
|
||||
|
||||
|
||||
@@ -299,6 +299,7 @@
|
||||
activateLink('.clik7', '.sdf7');
|
||||
activateLink('.clik8', '.sdf8');
|
||||
activateLink('.clik9', '.sdf9');
|
||||
activateLink('.clik10', '.sdf10');
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using AccountManagement.Domain.TicketAccessAccountAgg
|
||||
@using _0_Framework.Application
|
||||
@using AccountManagement.Domain.TicketAccessAccountAgg
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject ITicketAccessAccountRepository TicketAccessAccount;
|
||||
@@ -228,14 +229,14 @@
|
||||
</span>
|
||||
</a>
|
||||
<ul class="list-unstyled sdf3">
|
||||
<li permission="307">
|
||||
<a class="clik3" asp-area="Admin" asp-page="/Company/InstitutionContracts/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white" />
|
||||
</svg>
|
||||
قراردادهای موسسه
|
||||
</a>
|
||||
</li>
|
||||
@* <li permission="307"> *@
|
||||
@* <a class="clik3" asp-area="Admin" asp-page="/Company/InstitutionContracts/Index"> *@
|
||||
@* <svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;"> *@
|
||||
@* <circle cx="6.5" cy="6.5" r="6.5" fill="white" /> *@
|
||||
@* </svg> *@
|
||||
@* قراردادهای موسسه *@
|
||||
@* </a> *@
|
||||
@* </li> *@
|
||||
<li permission="308">
|
||||
<a class="clik3" asp-area="AdminNew" asp-page="/Company/RollCall/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
@@ -620,6 +621,36 @@
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="has_sub" permission="307">
|
||||
|
||||
<a class="waves-effect MainMenuItem">
|
||||
<div class="menuTitle">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
<span> حسابداری </span>
|
||||
</div>
|
||||
<span class="pull-right">
|
||||
<i class="md md-add"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="list-unstyled sdf10">
|
||||
<li permission="307"><a class="clik10" asp-area="Admin" asp-page="/Company/InstitutionContracts/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
قراردادهای موسسه</a>
|
||||
</li>
|
||||
|
||||
<li permission="307" style=";white-space: nowrap">
|
||||
<a class="clik10" href="https://admin@(AppSetting.Value.Domain)/payment-gateway-deposits" style="width: 7px;margin: 0 6px;">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
لیست تراکنش های درگاه پرداخت
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,29 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public record CreateFinancialPayRequest(long Id, string BaseUrl);
|
||||
public class FinancialController : ClientBaseController
|
||||
{
|
||||
private readonly IFinancialStatmentApplication _financialStatementApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
|
||||
public FinancialController(IFinancialStatmentApplication financialStatementApplication, IAuthHelper authHelper)
|
||||
public FinancialController(IFinancialStatmentApplication financialStatementApplication, IAuthHelper authHelper,IHttpClientFactory httpClientFactory, IPaymentTransactionApplication paymentTransactionApplication,IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_financialStatementApplication = financialStatementApplication;
|
||||
_authHelper = authHelper;
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -23,4 +33,75 @@ public class FinancialController : ClientBaseController
|
||||
var result =await _financialStatementApplication.GetClientFinancialStatement(searchModel,accountId);
|
||||
return result;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("preview/{id}")]
|
||||
public async Task<ActionResult<OperationResult<ClientFinancialStatementViewModel>>> GetStatementDetails(string id)
|
||||
{
|
||||
if(!Guid.TryParseExact(id,"N",out _))
|
||||
return new OperationResult<ClientFinancialStatementViewModel>().Failed("شناسه ارسال شده نامعتبر است");
|
||||
|
||||
var result = await _financialStatementApplication.GetDetailsByPublicId(id);
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// ساخت
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="baseUrl"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreatePay")]
|
||||
public async Task<ActionResult<OperationResult<string>>> CreatePay([FromForm] CreateFinancialPayRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
var op = new OperationResult<string>();
|
||||
var balanceAmount = await _financialStatementApplication.GetBalanceAmount(request.Id);
|
||||
if (balanceAmount.Amount<=0)
|
||||
{
|
||||
return op.Failed("موجودی حساب شما صفر است");
|
||||
}
|
||||
|
||||
var callbackUrl = Url.Action(
|
||||
action: "OnGetCallBack",
|
||||
controller: "General", // نام کنترلر بدون کلمهی "Controller"
|
||||
values: null,
|
||||
protocol: Request.Scheme); // http یا https
|
||||
|
||||
var transactionCommand = new CreatePaymentTransaction()
|
||||
{
|
||||
Amount = balanceAmount.Amount,
|
||||
ContractingPartyId = balanceAmount.ContractingPartyId,
|
||||
CallBackUrl = request.BaseUrl
|
||||
};
|
||||
|
||||
var transaction = await _paymentTransactionApplication.Create(transactionCommand);
|
||||
|
||||
if (!transaction.IsSuccedded)
|
||||
{
|
||||
return op.Failed(transaction.Message);
|
||||
}
|
||||
|
||||
var command = new CreatePaymentGatewayRequest()
|
||||
{
|
||||
CallBackUrl = callbackUrl,
|
||||
Amount = balanceAmount.Amount/10,
|
||||
InvoiceId = transaction.SendId.ToString(),
|
||||
};
|
||||
|
||||
var gatewayResponse = await _paymentGateway.Create(command, cancellationToken);
|
||||
|
||||
if (gatewayResponse.IsSuccess)
|
||||
{
|
||||
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.TransactionId);
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(gatewayResponse.TransactionId));
|
||||
}
|
||||
|
||||
if (gatewayResponse.ErrorCode.HasValue)
|
||||
{
|
||||
return op.Failed($"خطا در ایجاد درگاه پرداخت: {gatewayResponse.ErrorCode.Value}");
|
||||
}
|
||||
|
||||
return op.Failed("خطا در ایجاد درگاه پرداخت");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,81 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public record GetClientProfileDetails(long Id, string Fullname, string Mobile, List<int> Permissions,List<WorkshopClaim> Workshops);
|
||||
public record GetClientProfileDetails(long Id, string Fullname, string Mobile, List<int> Permissions, List<WorkshopClaim> Workshops, string WorkshopSlug, double DebtAmount,UserType UserType);
|
||||
|
||||
public class LoginController: ClientBaseController
|
||||
public class LoginController : ClientBaseController
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IFinancialStatmentApplication _financialStatmentApplication;
|
||||
|
||||
public LoginController(IAuthHelper authHelper)
|
||||
public LoginController(IAuthHelper authHelper, IFinancialStatmentApplication financialStatmentApplication)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_financialStatmentApplication = financialStatmentApplication;
|
||||
}
|
||||
/// <summary>
|
||||
/// جزئیات پروفایل کاربر کلاینت را برمی گرداند
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Profile")]
|
||||
public ActionResult<GetClientProfileDetails> GetProfile()
|
||||
public async Task<ActionResult<GetClientProfileDetails>> GetProfile()
|
||||
{
|
||||
if (!_authHelper.IsAuthenticated())
|
||||
return Unauthorized();
|
||||
var data = _authHelper.CurrentAccountInfo();
|
||||
|
||||
if (data == null )
|
||||
if (data == null)
|
||||
return Unauthorized();
|
||||
|
||||
if (_authHelper.GetUserTypeWithId().userType is not UserType.Client and not UserType.SubAccount)
|
||||
var userTypeWithId = _authHelper.GetUserTypeWithId();
|
||||
if (userTypeWithId.userType is not UserType.Client and not UserType.SubAccount)
|
||||
return Unauthorized();
|
||||
|
||||
|
||||
var debtAmount = await _financialStatmentApplication.GetClientDebtAmount(data.Id);
|
||||
var details = new GetClientProfileDetails(
|
||||
data.Id,
|
||||
data.Fullname,
|
||||
data.Mobile,
|
||||
data.Permissions,
|
||||
data.WorkshopList
|
||||
data.WorkshopList,
|
||||
data.WorkshopSlug,
|
||||
debtAmount,
|
||||
userTypeWithId.userType
|
||||
);
|
||||
return details;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// انتخاب کارگاه
|
||||
/// </summary>
|
||||
/// <param name="slug"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("select-workshop")]
|
||||
public IActionResult SelectWorkshop(string slug)
|
||||
{
|
||||
var selectedWorkshop = _authHelper.CurrentAccountInfo().WorkshopList.FirstOrDefault(x => x.Slug == slug);
|
||||
if (selectedWorkshop != null)
|
||||
{
|
||||
_authHelper.UpdateWorkshopSlugClaim(selectedWorkshop.Slug, selectedWorkshop.Name);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = true,
|
||||
message = "کارگاه مورد نظر شما انتخاب شد"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = false,
|
||||
message = "کارگاه مورد نظر شما یافت نشد"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class PaymentController:ClientBaseController
|
||||
{
|
||||
|
||||
}
|
||||
41
ServiceHost/Areas/Client/Controllers/WorkflowController.cs
Normal file
41
ServiceHost/Areas/Client/Controllers/WorkflowController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
using WorkFlow.Application.Contracts.WorkFlow;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class WorkflowController:ClientBaseController
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IWorkFlowApplication _workFlowApplication;
|
||||
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
|
||||
public WorkflowController(IAuthHelper authHelper, IWorkFlowApplication workFlowApplication,IPasswordHasher passwordHasher, IEmployeeDocumentsApplication employeeDocumentsApplication)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_workFlowApplication = workFlowApplication;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
var workshopHash = _authHelper.GetWorkshopSlug();
|
||||
_workshopId = passwordHasher.SlugDecrypt(workshopHash);
|
||||
}
|
||||
|
||||
[HttpGet("menu-count")]
|
||||
public async Task<IActionResult> OnGetCountWorkFlowLayout()
|
||||
{
|
||||
var currentAccountId = _authHelper.CurrentAccountId();
|
||||
int countWorkFlowResult = await _workFlowApplication.GetCountAllWorkFlows(_workshopId, currentAccountId);
|
||||
int countWorkflowRollCallResult = await _workFlowApplication.GetAllRollCallCount(_workshopId);
|
||||
int countWorkflowUploadDocument = await _workFlowApplication.GetAllEmployeeDocuments(_workshopId, currentAccountId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
countWorkFlow = countWorkFlowResult,
|
||||
countWorkflowRollCall = countWorkflowRollCallResult,
|
||||
countWorkflowUploadDocument = countWorkflowUploadDocument
|
||||
});
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
namespace ServiceHost.BaseControllers;
|
||||
|
||||
//[Authorize(Policy = "AdminArea")]
|
||||
[Authorize(Policy = "AdminArea")]
|
||||
[Area("Admin")]
|
||||
[ApiExplorerSettings(GroupName = "Admin")]
|
||||
[Route("api/[area]/[controller]")]
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
using System.Globalization;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
using System.Globalization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Microsoft.Extensions.Options;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
|
||||
namespace ServiceHost.Controllers;
|
||||
|
||||
public class GeneralController:GeneralBaseController
|
||||
public class GeneralController : GeneralBaseController
|
||||
{
|
||||
|
||||
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IFinancialStatmentApplication _financialStatmentApplication;
|
||||
|
||||
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(clientFactory, appSetting);
|
||||
_financialStatmentApplication = financialStatmentApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// نمایش اطلاعات عمومی مانند تاریخ ها و سال ها
|
||||
@@ -26,9 +41,94 @@ public class GeneralController:GeneralBaseController
|
||||
var currentDate = new { Year = currentYear, Month = pc.GetMonth(now), Day = pc.GetDayOfMonth(now) };
|
||||
return new JsonResult(new
|
||||
{
|
||||
years,months,currentDate
|
||||
years,
|
||||
months,
|
||||
currentDate
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("/api/callback")]
|
||||
public async Task<IActionResult> OnGetCallBack(string? transid, string? cardnumber, string? tracking_number,
|
||||
string bank, string invoice_id, string? status,CancellationToken cancellationToken)
|
||||
{
|
||||
if (!long.TryParse(invoice_id, out var paymentTransactionId))
|
||||
{
|
||||
return BadRequest("Invalid invoice_id");
|
||||
}
|
||||
|
||||
var transaction = await _paymentTransactionApplication.GetDetails(paymentTransactionId);
|
||||
if (transaction == null)
|
||||
{
|
||||
return NotFound("Transaction not found");
|
||||
}
|
||||
|
||||
if (transaction.Status != PaymentTransactionStatus.Pending)
|
||||
{
|
||||
return BadRequest("این تراکنش قبلا پرداخت شده است");
|
||||
}
|
||||
|
||||
// اگر شماره کارت یا شماره پیگیری خالی باشد، تراکنش ناموفق است
|
||||
if (string.IsNullOrWhiteSpace(cardnumber) || string.IsNullOrWhiteSpace(tracking_number))
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
var verifyCommand = new VerifyPaymentGateWayRequest()
|
||||
{
|
||||
Amount = transaction.Amount/10,
|
||||
TransactionId = transid
|
||||
};
|
||||
var verifyRes =await _paymentGateway.Verify(verifyCommand, cancellationToken);
|
||||
|
||||
// اگر استاتوس 1 باشد، تراکنش موفق است
|
||||
if (verifyRes.IsSuccess)
|
||||
{
|
||||
var command = new CreateFinancialStatment()
|
||||
{
|
||||
ContractingPartyId = transaction.ContractingPartyId,
|
||||
Deptor = 0,
|
||||
Creditor = transaction.Amount,
|
||||
DeptorString = "0",
|
||||
TypeOfTransaction = "credit",
|
||||
DescriptionOption = "بابت قرارداد مابین (روابط کار)",
|
||||
Description = "درگاه بانکی",
|
||||
|
||||
};
|
||||
var statementResult = _financialStatmentApplication.CreateFromBankGateway(command);
|
||||
if (!statementResult.IsSuccedded)
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank);
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(setSuccessResult);
|
||||
}
|
||||
return Redirect(BuildCallbackUrl(transaction.CallBackUrl, true, transaction.Id));
|
||||
}
|
||||
|
||||
// در غیر این صورت تراکنش ناموفق است
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
private async Task<IActionResult> HandleFailedTransaction(PaymentTransactionDetailsViewModel transaction, long transactionId)
|
||||
{
|
||||
var result = _paymentTransactionApplication.SetFailed(transactionId);
|
||||
if (!result.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
return Redirect(BuildCallbackUrl(transaction.CallBackUrl, false, transaction.Id));
|
||||
}
|
||||
|
||||
private string BuildCallbackUrl(string baseUrl, bool isSuccess, long transactionId)
|
||||
{
|
||||
var statusCode = isSuccess ? "1" : "0";
|
||||
return $"{baseUrl}/callback?Status={statusCode}&transactionId={transactionId}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace ServiceHost.Pages.CallBack
|
||||
{
|
||||
@@ -9,10 +12,13 @@ namespace ServiceHost.Pages.CallBack
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
|
||||
public IndexModel(IPaymentTransactionApplication paymentTransactionApplication)
|
||||
|
||||
public IndexModel(IPaymentTransactionApplication paymentTransactionApplication, IHttpClientFactory httpClientFactory, IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
public void OnGet(string? transid, string? cardnumber, string? tracking_number, string status)
|
||||
@@ -29,39 +35,39 @@ namespace ServiceHost.Pages.CallBack
|
||||
|
||||
}
|
||||
}
|
||||
public void OnPost(string? transid, string? cardnumber, string? tracking_number, string? status)
|
||||
public async Task OnPost(string? transid, string? cardnumber, string? tracking_number, string bank, string invoice_id, string? status)
|
||||
{
|
||||
var command = new CreatePaymentTransaction()
|
||||
{
|
||||
CardNumber = cardnumber,
|
||||
Amount = 10000,
|
||||
BankAccountHolderName = "تست",
|
||||
ShebaNumber = "",
|
||||
TransactionId = transid,
|
||||
ContractingPartyId = 0,
|
||||
ContractingPartyName = "نام طرف حساب",
|
||||
AccountNumber = "",
|
||||
BankName = "سامان"
|
||||
//var command = new CreatePaymentTransaction()
|
||||
//{
|
||||
// CardNumber = cardnumber,
|
||||
// Amount = 10000,
|
||||
// BankAccountHolderName = "تست",
|
||||
// ShebaNumber = "",
|
||||
// TransactionId = transid,
|
||||
// ContractingPartyId = 0,
|
||||
// ContractingPartyName = "نام طرف حساب",
|
||||
// AccountNumber = "",
|
||||
// BankName = "سامان"
|
||||
|
||||
};
|
||||
if (string.IsNullOrEmpty(cardnumber) || string.IsNullOrEmpty(tracking_number))
|
||||
{
|
||||
ViewData["message"] = "پرداخت ناموفق بوده است";
|
||||
command.Status = PaymentTransactionStatus.Failed;
|
||||
}
|
||||
else if (status == "1")
|
||||
{
|
||||
ViewData["message"] = "پرداخت موفق بوده است";
|
||||
command.Status = PaymentTransactionStatus.Success;
|
||||
//};
|
||||
//if (string.IsNullOrEmpty(cardnumber) || string.IsNullOrEmpty(tracking_number))
|
||||
//{
|
||||
// ViewData["message"] = "پرداخت ناموفق بوده است";
|
||||
// command.Status = PaymentTransactionStatus.Failed;
|
||||
//}
|
||||
//else if (status == "1")
|
||||
//{
|
||||
// ViewData["message"] = "پرداخت موفق بوده است";
|
||||
// command.Status = PaymentTransactionStatus.Success;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewData["message"] = "پرداخت ناموفق بوده است";
|
||||
command.Status = PaymentTransactionStatus.Failed;
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ViewData["message"] = "پرداخت ناموفق بوده است";
|
||||
// command.Status = PaymentTransactionStatus.Failed;
|
||||
//}
|
||||
|
||||
_paymentTransactionApplication.Create(command);
|
||||
//_paymentTransactionApplication.Create(command);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,534 +1,33 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using AccountManagement.Domain.AccountAgg;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System.Security.Claims;
|
||||
using _0_Framework.Application.UID;
|
||||
using AccountManagement.Application.Contracts.CameraAccount;
|
||||
using CompanyManagment.EFCore;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.EmployeeComputeOptionsAgg;
|
||||
using Company.Domain.ReportAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using Company.Domain.YearlySalaryAgg;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.App.Contracts.File1;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using IUidService = _0_Framework.Application.UID.IUidService;
|
||||
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
|
||||
namespace ServiceHost.Pages
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
|
||||
public string Mess { get; set; }
|
||||
[BindProperty]
|
||||
public string Username { get; set; }
|
||||
[BindProperty]
|
||||
public string Password { get; set; }
|
||||
[BindProperty]
|
||||
public string CaptchaResponse { get; set; }
|
||||
|
||||
public bool HasApkToDownload { get; set; }
|
||||
|
||||
private static Timer aTimer;
|
||||
public Login login;
|
||||
public AccountViewModel Search;
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
private readonly IGoogleRecaptcha _googleRecaptcha;
|
||||
private readonly ISmsService _smsService;
|
||||
private readonly IWorker _worker;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly ICameraAccountApplication _cameraAccountApplication;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IAndroidApkVersionApplication _androidApkVersionApplication;
|
||||
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
|
||||
private readonly IYearlySalaryRepository _yearlySalaryRepository;
|
||||
private readonly IEmployeeComputeOptionsRepository _computeOptions;
|
||||
private readonly IFileApplication _fileApplication;
|
||||
|
||||
|
||||
|
||||
|
||||
public IndexModel(ILogger<IndexModel> logger, IAccountApplication accountApplication, IGoogleRecaptcha googleRecaptcha, ISmsService smsService, IWorker worker,
|
||||
IAuthHelper authHelper, ICameraAccountApplication cameraAccountApplication, IWebHostEnvironment webHostEnvironment,
|
||||
IAndroidApkVersionApplication androidApkVersionApplication, ITemporaryClientRegistrationApplication clientRegistrationApplication, IYearlySalaryRepository yearlySalaryRepository, IEmployeeComputeOptionsRepository computeOptions, IFileApplication fileApplication)
|
||||
{
|
||||
_logger = logger;
|
||||
_accountApplication = accountApplication;
|
||||
_googleRecaptcha = googleRecaptcha;
|
||||
_smsService = smsService;
|
||||
_worker = worker;
|
||||
_authHelper = authHelper;
|
||||
_cameraAccountApplication = cameraAccountApplication;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_androidApkVersionApplication = androidApkVersionApplication;
|
||||
_clientRegistrationApplication = clientRegistrationApplication;
|
||||
_yearlySalaryRepository = yearlySalaryRepository;
|
||||
_computeOptions = computeOptions;
|
||||
_fileApplication = fileApplication;
|
||||
public IndexModel(IAuthHelper authHelper, IAccountApplication accountApplication)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_accountApplication = accountApplication;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGet()
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
//اصلاحات محاسبه عیدی در فیش حقوقی
|
||||
// _computeOptions.GetAllByWorkshopId(170);
|
||||
//اصلاحات محاصبه پایه سنوات در فیش حقوقی
|
||||
//_yearlySalaryRepository.TestDayliFeeCompute();
|
||||
bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
// Console.WriteLine("enter National code ... ");
|
||||
// var nationalCode = Console.ReadLine();
|
||||
// Console.WriteLine("enter DateOfBirth ... ");
|
||||
// var dateOfBirth = Console.ReadLine();
|
||||
// Console.WriteLine("enter phoneNumber ... ");
|
||||
// var phone = Console.ReadLine();
|
||||
// var res = await _clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth,
|
||||
// phone);
|
||||
// if (res.IsSuccedded)
|
||||
// {
|
||||
// var updateAddress =await
|
||||
// _clientRegistrationApplication.UpdateAddress(res.Data.Id, "gilan", "rasht", "hajiabad");
|
||||
// if (updateAddress.IsSuccedded)
|
||||
// {
|
||||
// var workshopSelected = _clientRegistrationApplication.GetWorkshopTemp(res.Data.Id).GetAwaiter().GetResult();
|
||||
// if (workshopSelected.Count > 0)
|
||||
// {
|
||||
// var result = await
|
||||
// _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(res.Data.Id, "12",
|
||||
// "OneTime");
|
||||
// Console.WriteLine("sumOfWorkshopPayment : " + result.SumOfWorkshopsPaymentDouble);
|
||||
// Console.WriteLine("TotalPaymentDouble : " + result.TotalPaymentDouble);
|
||||
// var createInstitutionContract = await
|
||||
// _clientRegistrationApplication.CreateOrUpdateInstitutionContractTemp(res.Data.Id, null,
|
||||
// null, result.TotalPaymentDouble, 0);
|
||||
// if (createInstitutionContract.IsSuccedded)
|
||||
// {
|
||||
// var sendVerfyCode =await _clientRegistrationApplication.ReceivedCodeFromServer(res.Data.Id);
|
||||
// if (sendVerfyCode.IsSuccedded)
|
||||
// {
|
||||
// Console.WriteLine("enter the code ... ");
|
||||
// var codeReceived = Console.ReadLine();
|
||||
if(_authHelper.IsAuthenticated())
|
||||
return Redirect("/login");
|
||||
return Page();
|
||||
}
|
||||
|
||||
// var completeSms = await
|
||||
// _clientRegistrationApplication.CheckVerifyCodeIsTrue(res.Data.Id, codeReceived);
|
||||
// if (completeSms.IsSuccedded)
|
||||
// {
|
||||
// var payOffCompleted =
|
||||
// await _clientRegistrationApplication.PayOffCompleted(res.Data.Id);
|
||||
// if (payOffCompleted.IsSuccedded)
|
||||
// {
|
||||
// Console.WriteLine("finaly completed");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine(payOffCompleted.Message);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var workshops = new List<WorkshopTempViewModel>();
|
||||
// workshops.Add(new WorkshopTempViewModel
|
||||
// {
|
||||
// ContractAndCheckout = true,
|
||||
// ContractingPartyTempId = res.Data.Id,
|
||||
// CountPerson = 10,
|
||||
// CustomizeCheckout = true,
|
||||
// Insurance = true,
|
||||
// RollCall = true,
|
||||
// WorkshopName = "dadmehr",
|
||||
|
||||
// });
|
||||
// workshops.Add(new WorkshopTempViewModel
|
||||
// {
|
||||
// ContractAndCheckout = true,
|
||||
// ContractingPartyTempId = res.Data.Id,
|
||||
// CountPerson = 20,
|
||||
// CustomizeCheckout = true,
|
||||
// Insurance = true,
|
||||
// RollCall = true,
|
||||
// WorkshopName = "kababMahdi",
|
||||
|
||||
// });
|
||||
// var creteWorkshops = _clientRegistrationApplication.CreateOrUpdateWorkshopTemp(workshops)
|
||||
// .GetAwaiter().GetResult();
|
||||
|
||||
// if (creteWorkshops.IsSuccedded)
|
||||
// {
|
||||
// var result = _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(res.Data.Id).GetAwaiter().GetResult();
|
||||
// Console.WriteLine("sumOfWorkshopPayment : " + result.SumOfWorkshopsPaymentDouble);
|
||||
// Console.WriteLine("TotalPaymentDouble : " + result.TotalPaymentDouble);
|
||||
|
||||
// var createInstitutionContract = await
|
||||
// _clientRegistrationApplication.CreateOrUpdateInstitutionContractTemp(res.Data.Id, null,
|
||||
// null, result.TotalPaymentDouble, 0);
|
||||
// if (createInstitutionContract.IsSuccedded)
|
||||
// {
|
||||
// var sendVerfyCode = await _clientRegistrationApplication.ReceivedCodeFromServer(res.Data.Id);
|
||||
// if (sendVerfyCode.IsSuccedded)
|
||||
// {
|
||||
// Console.WriteLine("enter the code ... ");
|
||||
// var codeReceived = Console.ReadLine();
|
||||
|
||||
// var completeSms = await
|
||||
// _clientRegistrationApplication.CheckVerifyCodeIsTrue(res.Data.Id, codeReceived);
|
||||
// if (completeSms.IsSuccedded)
|
||||
// {
|
||||
// var payOffCompleted =
|
||||
// await _clientRegistrationApplication.PayOffCompleted(res.Data.Id);
|
||||
// if (payOffCompleted.IsSuccedded)
|
||||
// {
|
||||
// Console.WriteLine("finaly completed");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine(payOffCompleted.Message);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "y")
|
||||
// ex = true;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// while (!ex)
|
||||
// {
|
||||
// var onGet = _institutionPlanApplication.GetByFirst();
|
||||
// Console.WriteLine("enter ContractAndCheckoutInPersonPercent ... " + onGet.ContractAndCheckoutInPersonPercent);
|
||||
// var ContractAndCheckoutInPersonPercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter ContractAndCheckoutPercent ... " + onGet.ContractAndCheckoutPercent);
|
||||
// var ContractAndCheckoutPercent = Console.ReadLine();
|
||||
|
||||
// Console.WriteLine("enter InsurancePercent ... " + onGet.InsurancePercent);
|
||||
// var InsurancePercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter InsuranceInPersonPercent ... " + onGet.InsuranceInPersonPercent);
|
||||
// var InsuranceInPersonPercent = Console.ReadLine();
|
||||
|
||||
// Console.WriteLine("enter CustomizeCheckoutPercent ... " + onGet.CustomizeCheckoutPercent);
|
||||
// var CustomizeCheckoutPercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter RollCallPercent ... " + onGet.RollCallPercent);
|
||||
// var RollCallPercent = Console.ReadLine();
|
||||
// //var res = _institutionPlanApplication.GetInstitutionPlanList(Convert.ToInt32(pageIndex),
|
||||
// // Convert.ToInt32(countPerson));
|
||||
|
||||
// var res = _institutionPlanApplication.CreateInstitutionPlanPercentage(new CreateInstitutionPlanPercentage()
|
||||
// {
|
||||
// ContractAndCheckoutInPersonPercentStr = ContractAndCheckoutInPersonPercent,
|
||||
// ContractAndCheckoutPercentStr = ContractAndCheckoutPercent,
|
||||
// InsurancePercentStr = InsurancePercent,
|
||||
// InsuranceInPersonPercentStr = InsuranceInPersonPercent,
|
||||
// CustomizeCheckoutPercentStr = CustomizeCheckoutPercent,
|
||||
// RollCallPercentStr = RollCallPercent
|
||||
// });
|
||||
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "y")
|
||||
// ex = true;
|
||||
//}
|
||||
// _reportRepository.GetAllActiveWorkshopsNew("1403", "12");
|
||||
|
||||
//var test = _uidService.GetPersonalInfo("2669318622", "1363/02/25");
|
||||
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
|
||||
if (User.Identity is { IsAuthenticated: true })
|
||||
{
|
||||
if (User.FindFirstValue("IsCamera") == "true")
|
||||
{
|
||||
return Redirect("/Camera");
|
||||
}
|
||||
else if ((User.FindFirstValue("ClientAriaPermission") == "true") && (User.FindFirstValue("AdminAreaPermission") == "false"))
|
||||
{
|
||||
return Redirect("/Client");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect("/Admin");
|
||||
}
|
||||
}
|
||||
_authHelper.SignOut();
|
||||
return Page();
|
||||
}
|
||||
|
||||
|
||||
public IActionResult OnPostLogin(Login command)
|
||||
{
|
||||
|
||||
var result = _accountApplication.Login(command);
|
||||
if (result.IsSuccedded)
|
||||
return RedirectToPage("/Admin");
|
||||
|
||||
|
||||
ModelState.AddModelError("Username", "اطلاعات وارد شده اشتباه است");
|
||||
TempData["h"] = "n";
|
||||
Mess = result.Message;
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public IActionResult OnPostEnter(Login command)
|
||||
public IActionResult OnGetLogout()
|
||||
{
|
||||
|
||||
bool captchaResult = true;
|
||||
//if (!_webHostEnvironment.IsDevelopment())
|
||||
// captchaResult = _googleRecaptcha.IsSatisfy(CaptchaResponse).Result;
|
||||
|
||||
|
||||
if (captchaResult)
|
||||
{
|
||||
var result = _accountApplication.Login(command);
|
||||
if (result.IsSuccedded)
|
||||
{
|
||||
switch (result.SendId)
|
||||
{
|
||||
case 1:
|
||||
return Redirect("/Admin");
|
||||
break;
|
||||
case 2:
|
||||
return Redirect("/Client");
|
||||
break;
|
||||
case 3:
|
||||
return Redirect("/Camera");
|
||||
//return
|
||||
// var verfiyResult = _accountApplication.GetByVerifyCode(code);
|
||||
break;
|
||||
case 0:
|
||||
result.Message = "امکان ورود با این حساب کاربری وجود ندارد";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Mess = result.Message;
|
||||
}
|
||||
else
|
||||
{
|
||||
Mess = "دستگاه شما ربات تشخیص داده شد";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ModelState.AddModelError("Username", "اطلاعات وارد شده اشتباه است");
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<JsonResult> OnPostCheckCaptcha(string response)
|
||||
{
|
||||
var result = await _googleRecaptcha.IsSatisfy(response);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
isNotRobot = result,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnPostRegisterClient(string name, string user, string pass, string phone, string nationalcode)
|
||||
{
|
||||
var command = new RegisterAccount()
|
||||
{
|
||||
Fullname = name,
|
||||
Username = user,
|
||||
Password = pass,
|
||||
Mobile = phone,
|
||||
NationalCode = nationalcode,
|
||||
};
|
||||
var result = _accountApplication.RegisterClient(command);
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSucceded = result.IsSuccedded,
|
||||
message = result.Message
|
||||
});
|
||||
}
|
||||
public IActionResult OnGetLogout()
|
||||
{
|
||||
_accountApplication.Logout();
|
||||
return RedirectToPage("/Index");
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> OnPostCheckPhoneValid(string phone)
|
||||
{
|
||||
var result = _accountApplication.Search(new AccountSearchModel() { Mobile = phone }).FirstOrDefault();
|
||||
if (result == null)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = false,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
SendSms(phone);
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = true,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void SendSms(string phone)
|
||||
{
|
||||
|
||||
var result = _accountApplication.Search(new AccountSearchModel() { Mobile = phone }).FirstOrDefault();
|
||||
if (result != null)
|
||||
{
|
||||
_accountApplication.SetVerifyCode(phone, result.Id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnPostWithMobile(string code, string phone)
|
||||
{
|
||||
//bool captchaResult = true;
|
||||
//if (!_webHostEnvironment.IsDevelopment())
|
||||
// captchaResult = _googleRecaptcha.IsSatisfy(CaptchaResponse).Result;
|
||||
//if (captchaResult)
|
||||
//{
|
||||
var verfiyResult = _accountApplication.GetByVerifyCode(code, phone);
|
||||
if (verfiyResult != null)
|
||||
{
|
||||
|
||||
var result = _accountApplication.LoginWithMobile(verfiyResult.Id);
|
||||
if (result.IsSuccedded && result.SendId == 1)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = true,
|
||||
url = "/Admin",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (result.IsSuccedded && result.SendId == 2)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = true,
|
||||
url = "/Client",
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Mess = "دستگاه شما ربات تشخیص داده شد";
|
||||
//}
|
||||
|
||||
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = false,
|
||||
});
|
||||
|
||||
}
|
||||
public IActionResult OnPostVerify(string code, string phone)
|
||||
{
|
||||
var result = _accountApplication.GetByVerifyCode(code, phone);
|
||||
if (result != null)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = true,
|
||||
user = result.Username,
|
||||
verfyId = result.Id
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnPostChangePass(long id, string username, string newpass)
|
||||
{
|
||||
var result = _accountApplication.GetByUserNameAndId(id, username);
|
||||
if (result != null)
|
||||
{
|
||||
var command = new ChangePassword()
|
||||
{
|
||||
Id = id,
|
||||
Password = newpass,
|
||||
RePassword = newpass
|
||||
};
|
||||
var finalResult = _accountApplication.ChangePassword(command);
|
||||
if (finalResult.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = true,
|
||||
changed = true
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = true,
|
||||
changed = false
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
exist = false,
|
||||
changed = false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RecaptchaResponse
|
||||
{
|
||||
[JsonProperty("success")]
|
||||
public bool Success { get; set; }
|
||||
|
||||
[JsonProperty("challenge_ts")]
|
||||
public DateTimeOffset ChallengeTs { get; set; }
|
||||
|
||||
[JsonProperty("hostname")]
|
||||
public string HostName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
_accountApplication.Logout();
|
||||
return RedirectToPage("/Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ namespace ServiceHost.Pages.register
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
Redirect("/");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostCreateContractingPartyTemp(string nationalCode, string birthDate, string mobile)
|
||||
|
||||
@@ -219,9 +219,10 @@
|
||||
<a asp-page="/login/Index" class="py-[0.54rem] w-[5.1rem] px-1 text-[0.8rem] font-[500] text-center bg-white border-2 border-[#2DBCBC] text-[#138F8F] rounded-md duration-500 ease-in-out hover:bg-[#2DBCBC] hover:text-white">
|
||||
<span>ورود</span>
|
||||
</a>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-[5.1rem] px-1 text-[0.8rem] font-[500] text-center bg-white border-2 border-[#2DBCBC] text-[#138F8F] rounded-md duration-500 ease-in-out hover:bg-[#2DBCBC] hover:text-white">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a $1$asp-page="/register/Index"#1# class="py-[0.54rem] w-[5.1rem] px-1 text-[0.8rem] font-[500] text-center bg-white border-2 border-[#2DBCBC] text-[#138F8F] rounded-md duration-500 ease-in-out hover:bg-[#2DBCBC] hover:text-white disable"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -337,11 +338,12 @@
|
||||
<span>ورود</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="authBgLog dark:authBgLog">
|
||||
<a asp-page="/register/Index" class="px-1 text-[0.8rem] font-[500] text-center rounded-md duration-500 ease-in-out">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
</div>
|
||||
@* <div class="authBgLog dark:authBgLog"> *@
|
||||
@* <a $1$asp-page="/register/Index"#1# class="px-1 text-[0.8rem] font-[500] text-center rounded-md duration-500 ease-in-out"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
@* </div> *@
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<button class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out">
|
||||
<span>تماس با فروش</span>
|
||||
</button>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:flex justify-end gap-6 w-6/12 opacity-100 z-1">
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<button class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out">
|
||||
<span>تماس با فروش</span>
|
||||
</button>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:flex justify-end gap-6 w-6/12 opacity-100 z-1">
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<button class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out">
|
||||
<span>تماس با فروش</span>
|
||||
</button>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:flex justify-end gap-6 w-6/12 opacity-100 z-1">
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<button class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out">
|
||||
<span>تماس با فروش</span>
|
||||
</button>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:flex justify-end gap-6 w-6/12 opacity-100 z-1">
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<button class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out">
|
||||
<span>تماس با فروش</span>
|
||||
</button>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:flex justify-end gap-6 w-6/12 opacity-100 z-1">
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<button class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out">
|
||||
<span>تماس با فروش</span>
|
||||
</button>
|
||||
<a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer">
|
||||
<span>ثبت نام</span>
|
||||
</a>
|
||||
@* <a asp-page="/register/Index" class="py-[0.54rem] w-full md:w-[8rem] px-3 text-[0.8rem] font-[500] text-center bg-white hover:bg-[#2DBCBC] border-2 border-[#2DBCBC] text-[#138F8F] hover:text-white rounded-md duration-500 ease-in-out cursor-pointer"> *@
|
||||
@* <span>ثبت نام</span> *@
|
||||
@* </a> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden md:flex justify-end gap-6 w-6/12 opacity-100 z-1">
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bogus" Version="35.6.3" />
|
||||
<PackageReference Include="IPE.SmsIR" Version="1.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.4" />
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
|
||||
//server
|
||||
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
|
||||
|
||||
|
||||
|
||||
//local
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
//dad-mehr
|
||||
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;"
|
||||
|
||||
//mahan Docker
|
||||
|
||||
@@ -26,5 +26,7 @@
|
||||
"Faces": "c://labels//20//"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
//"Domain": ".dad-mehr.ir"
|
||||
"Domain": ".gozareshgir.ir"
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user