Compare commits
1 Commits
Feature/fi
...
Feature/In
| Author | SHA1 | Date | |
|---|---|---|---|
| cae82ed702 |
@@ -1,17 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
@@ -80,11 +73,6 @@ public interface IInstitutionContractApplication
|
||||
|
||||
|
||||
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
|
||||
/// <summary>
|
||||
/// چاپ یک قرارداد
|
||||
/// </summary>
|
||||
/// <param name="id">شناسه قرارداد</param>
|
||||
/// <returns>اطلاعات قرارداد برای چاپ</returns>
|
||||
InstitutionContractViewModel PrintOne(long id);
|
||||
|
||||
/// <summary>
|
||||
@@ -164,6 +152,14 @@ public interface IInstitutionContractApplication
|
||||
|
||||
#region Api
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// غیر فعال کردن قرارداد - اگر بدهی داشته باشد حالت آبی میشود.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task DeActiveAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// لیست قرارداد های مالی
|
||||
/// </summary>
|
||||
|
||||
@@ -917,6 +917,26 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return _institutionContractRepository.GetcontractAmount(countPerson);
|
||||
}
|
||||
|
||||
public async Task DeActiveAsync(long id)
|
||||
{
|
||||
var institutionContract = _institutionContractRepository.Get(id);
|
||||
if (institutionContract == null)
|
||||
{
|
||||
throw new NotFoundException("رکورد مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
var financialStatement =await _financialStatmentRepository.GetByContractingPartyId(id);
|
||||
var balanceAmount =await _financialStatmentRepository.GetBalanceAmount(financialStatement.id);
|
||||
if (balanceAmount.Amount>0)
|
||||
{
|
||||
institutionContract.DeActiveBlue();
|
||||
}else
|
||||
{
|
||||
institutionContract.DeActive();
|
||||
}
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(
|
||||
InstitutionContractListSearchModel searchModel)
|
||||
{
|
||||
|
||||
@@ -167,8 +167,6 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
||||
var now = DateTime.Now;
|
||||
return _rollCallEmployeeStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id && x.StartDate < now && x.EndDate > now);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
||||
|
||||
@@ -413,6 +413,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
|
||||
public async Task<FinancialStatment> GetByContractingPartyId(long contractingPartyId)
|
||||
{
|
||||
return await _context.FinancialStatments.FirstOrDefaultAsync(x => x.ContractingPartyId == contractingPartyId);
|
||||
return await _context.FinancialStatments
|
||||
.FirstOrDefaultAsync(x => x.ContractingPartyId == contractingPartyId);
|
||||
}
|
||||
}
|
||||
@@ -210,37 +210,24 @@ public class institutionContractController : AdminBaseController
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// حذف قرارداد مالی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<ActionResult<OperationResult>> Remove(long id)
|
||||
{
|
||||
_institutionContractApplication.RemoveContract(id);
|
||||
return new OperationResult().Succcedded();
|
||||
|
||||
}
|
||||
// /// <summary>
|
||||
// /// حذف قرارداد مالی
|
||||
// /// </summary>
|
||||
// /// <param name="id"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpDelete("{id}")]
|
||||
// public async Task<ActionResult<OperationResult>> Remove(long id)
|
||||
// {
|
||||
// _institutionContractApplication.RemoveContract(id);
|
||||
// return new OperationResult().Succcedded();
|
||||
//
|
||||
// }
|
||||
|
||||
[HttpPost("deActive/{id}")]
|
||||
public ActionResult<OperationResult> DeActive(long id, string balance)
|
||||
public async Task<ActionResult> DeActive(long id)
|
||||
{
|
||||
var result = new OperationResult();
|
||||
if (balance == "0")
|
||||
{
|
||||
result = _institutionContractApplication.DeActive(id);
|
||||
if (result.IsSuccedded) result = _institutionContractApplication.DeActiveAllConnections(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = _institutionContractApplication.DeActiveBlue(id);
|
||||
if (result.IsSuccedded)
|
||||
result = _institutionContractApplication.DeActiveAllConnections(id);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
await _institutionContractApplication.DeActiveAsync(id);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user