add fname and lname
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -238,6 +239,7 @@ public class InstitutionContratVerificationParty
|
||||
public string Address { get; set; }
|
||||
public string PostalCode { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public LegalType LegalType { get; set; }
|
||||
}
|
||||
|
||||
public class GetInstitutionVerificationDetailsWorkshopsViewModel
|
||||
|
||||
@@ -131,7 +131,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
|
||||
command.Nationalcode, command.IdNumber, "*", "*",
|
||||
"حقیقی",
|
||||
command.Phone, command.AgentPhone, command.Address,command.RepresentativeId,representative.FullName,command.ArchiveCode,
|
||||
command.State,command.City,command.Zone,command.SureName);
|
||||
command.State,command.City,command.Zone,command.SureName,null,null);
|
||||
|
||||
|
||||
_personalContractingPartyRepository.Create(personalContractingParty);
|
||||
@@ -203,7 +203,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
|
||||
"*", "*", command.RegisterId, command.NationalId,
|
||||
"حقوقی",
|
||||
command.Phone, command.AgentPhone, command.Address,command.RepresentativeId, representative.FullName,command.ArchiveCode,
|
||||
command.State, command.City, command.Zone,command.SureName);
|
||||
command.State, command.City, command.Zone,command.SureName,null,null);
|
||||
|
||||
|
||||
_personalContractingPartyRepository.Create(legalContractingParty);
|
||||
@@ -554,7 +554,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
|
||||
command.NationalCode, command.IdNumber, "*", "*",
|
||||
"حقیقی",
|
||||
command.PhoneNumber, command.AgentPhone, command.Address, command.RepresentativeId, representative.FullName, command.ArchiveCode,
|
||||
command.State, command.City, command.Zone, command.SureName);
|
||||
command.State, command.City, command.Zone, command.SureName, null, null);
|
||||
|
||||
|
||||
await _personalContractingPartyRepository.CreateAsync(personalContractingParty);
|
||||
@@ -607,7 +607,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
|
||||
"حقوقی",
|
||||
command.PhoneNumber, command.AgentPhone, command.Address, command.RepresentativeId, representative.FullName,
|
||||
command.ArchiveCode,
|
||||
command.State, command.City, command.Zone, command.SureName);
|
||||
command.State, command.City, command.Zone, command.SureName,null,null);
|
||||
|
||||
|
||||
await _personalContractingPartyRepository.CreateAsync(legalContractingParty);
|
||||
|
||||
@@ -893,7 +893,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
temp.NationalCode, temp.IdNumber, "*", "*",
|
||||
"حقیقی",
|
||||
temp.Phone, null, temp.Address, 1, "-", lastArchiveCode,
|
||||
temp.State, temp.City, null, null);
|
||||
temp.State, temp.City, null, null, null, null);
|
||||
_personalContractingPartyRepository.Create(personalContractingParty);
|
||||
_personalContractingPartyRepository.SaveChanges();
|
||||
|
||||
|
||||
10809
CompanyManagment.EFCore/Migrations/20250924104043_Add CEO FName and LName.Designer.cs
generated
Normal file
10809
CompanyManagment.EFCore/Migrations/20250924104043_Add CEO FName and LName.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCEOFNameandLName : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CeoFName",
|
||||
table: "PersonalContractingParties",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CeoLName",
|
||||
table: "PersonalContractingParties",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CeoFName",
|
||||
table: "PersonalContractingParties");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CeoLName",
|
||||
table: "PersonalContractingParties");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -702,6 +702,12 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<int>("BlockTimes")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CeoFName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CeoLName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("City")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Exceptions;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
@@ -1016,8 +1017,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
InstitutionContractListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.WorkshopDetails)
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.WorkshopDetails)
|
||||
.Include(x => x.ContactInfoList);
|
||||
|
||||
var now = DateTime.Today;
|
||||
@@ -1123,7 +1124,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (searchModel.IsActive != null)
|
||||
{
|
||||
var isActiveStr = searchModel.IsActive == true ? "true" : "false";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr || x.contract.IsActiveString == "blue");
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.IsActiveString == isActiveStr || x.contract.IsActiveString == "blue");
|
||||
}
|
||||
|
||||
if (searchModel.Type != null)
|
||||
@@ -1169,14 +1171,14 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
case InstitutionContractListStatus.Active:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Active);
|
||||
break;
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
|
||||
case InstitutionContractListStatus.PendingForVerify:
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
|
||||
case InstitutionContractListStatus.PendingForVerify:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1231,31 +1233,31 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var archiveCode = minArchiveCode == 10000000 ? 0 : minArchiveCode;
|
||||
var status = Enum.Parse<InstitutionContractListStatus>(x.StatusPriority.ToString());
|
||||
var workshopDetails = x.contract.WorkshopGroup?.WorkshopDetails
|
||||
.Where(w=>w.DetailType == WorkshopDetailType.Current).Select(w=>
|
||||
{
|
||||
Workshop workshopSelected = null;
|
||||
Console.WriteLine(w.WorkshopId);
|
||||
if (w.WorkshopId != null && workshops.Select(ww => ww.id).Contains(w.WorkshopId.Value))
|
||||
.Where(w => w.DetailType == WorkshopDetailType.Current).Select(w =>
|
||||
{
|
||||
workshopSelected = workshops.First(ww => ww.id == w.WorkshopId.Value);
|
||||
}
|
||||
|
||||
return new InstitutionContractListWorkshop()
|
||||
{
|
||||
EmployeeCount = w.PersonnelCount,
|
||||
WorkshopName = workshopSelected?.WorkshopName??w.WorkshopName,
|
||||
WorkshopServices = new WorkshopServicesViewModel()
|
||||
Workshop workshopSelected = null;
|
||||
Console.WriteLine(w.WorkshopId);
|
||||
if (w.WorkshopId != null && workshops.Select(ww => ww.id).Contains(w.WorkshopId.Value))
|
||||
{
|
||||
Contract =w.Services.Contract,
|
||||
ContractInPerson = w.Services.ContractInPerson,
|
||||
CustomizeCheckout = w.Services.CustomizeCheckout,
|
||||
Insurance = w.Services.Insurance,
|
||||
InsuranceInPerson = w.Services.InsuranceInPerson,
|
||||
RollCall = w.Services.RollCall,
|
||||
RollCallInPerson = w.Services.RollCallInPerson
|
||||
workshopSelected = workshops.First(ww => ww.id == w.WorkshopId.Value);
|
||||
}
|
||||
};
|
||||
}).ToList()??[];
|
||||
|
||||
return new InstitutionContractListWorkshop()
|
||||
{
|
||||
EmployeeCount = w.PersonnelCount,
|
||||
WorkshopName = workshopSelected?.WorkshopName ?? w.WorkshopName,
|
||||
WorkshopServices = new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = w.Services.Contract,
|
||||
ContractInPerson = w.Services.ContractInPerson,
|
||||
CustomizeCheckout = w.Services.CustomizeCheckout,
|
||||
Insurance = w.Services.Insurance,
|
||||
InsuranceInPerson = w.Services.InsuranceInPerson,
|
||||
RollCall = w.Services.RollCall,
|
||||
RollCallInPerson = w.Services.RollCallInPerson
|
||||
}
|
||||
};
|
||||
}).ToList() ?? [];
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
@@ -1283,11 +1285,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public async Task<GetInstitutionContractListStatsViewModel> GetListStats(
|
||||
InstitutionContractListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.InstitutionContractSet
|
||||
var query = _context.InstitutionContractSet
|
||||
.Include(x => x.ContactInfoList);
|
||||
|
||||
var now = DateTime.Today;
|
||||
@@ -1393,7 +1395,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (searchModel.IsActive != null)
|
||||
{
|
||||
var isActiveStr = searchModel.IsActive == true ? "true" : "false";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr || x.contract.IsActiveString == "blue");
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.IsActiveString == isActiveStr || x.contract.IsActiveString == "blue");
|
||||
}
|
||||
|
||||
if (searchModel.Type != null)
|
||||
@@ -1439,9 +1442,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
case InstitutionContractListStatus.Active:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Active);
|
||||
break;
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1480,7 +1483,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return await _context.InstitutionContractSet
|
||||
.Where(x => x.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.WorkshopDetails)
|
||||
.ThenInclude(x => x.WorkshopDetails)
|
||||
.Join(_context.PersonalContractingParties,
|
||||
institutionContract => institutionContract.ContractingPartyId,
|
||||
contractingParty => contractingParty.id,
|
||||
@@ -1492,10 +1495,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Phone = x.contractingParty.Phone,
|
||||
Amount = x.institutionContract.TotalAmount,
|
||||
DoneWorkshops = x.institutionContract.WorkshopGroup.WorkshopDetails
|
||||
.Where(w=>w.DetailType == WorkshopDetailType.Initial).Count(w => w.WorkshopCreated),
|
||||
TotalWorkshops = x.institutionContract.WorkshopGroup.WorkshopDetails.Count(w => w.DetailType == WorkshopDetailType.Initial),
|
||||
.Where(w => w.DetailType == WorkshopDetailType.Initial).Count(w => w.WorkshopCreated),
|
||||
TotalWorkshops =
|
||||
x.institutionContract.WorkshopGroup.WorkshopDetails.Count(w =>
|
||||
w.DetailType == WorkshopDetailType.Initial),
|
||||
UnDoneWorkshops = x.institutionContract.WorkshopGroup.WorkshopDetails
|
||||
.Where(w=>w.DetailType == WorkshopDetailType.Initial).Count(w => !w.WorkshopCreated),
|
||||
.Where(w => w.DetailType == WorkshopDetailType.Initial).Count(w => !w.WorkshopCreated),
|
||||
ContractingPartyId = x.contractingParty.id
|
||||
}).ToListAsync();
|
||||
}
|
||||
@@ -1519,7 +1524,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
// استخراج شناسههای کارگاههایی که ایجاد شدهاند
|
||||
var workshopIds = institutionContract.WorkshopGroup.WorkshopDetails
|
||||
.Where(w=>w.DetailType == WorkshopDetailType.Initial)
|
||||
.Where(w => w.DetailType == WorkshopDetailType.Initial)
|
||||
.Where(x => x.WorkshopId != null)
|
||||
.Select(x => x.WorkshopId.Value)
|
||||
.ToList();
|
||||
@@ -1531,7 +1536,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
// استخراج تمامی شناسههای کارفرمایان از جزئیات کارگاهها
|
||||
var allEmployerIds = institutionContract.WorkshopGroup.WorkshopDetails
|
||||
.Where(w=>w.DetailType == WorkshopDetailType.Initial)
|
||||
.Where(w => w.DetailType == WorkshopDetailType.Initial)
|
||||
.SelectMany(x => x.Employers.Select(e => e.EmployerId))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -1545,31 +1550,31 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
// ساخت نتیجه نهایی با استفاده از دادههای از پیش بارگذاری شده
|
||||
var items = institutionContract.WorkshopGroup
|
||||
.WorkshopDetails.Where(w=>w.DetailType == WorkshopDetailType.Initial).Select(workshopDetail =>
|
||||
{
|
||||
// پیدا کردن کارگاه مرتبط
|
||||
var workshop = workshops.FirstOrDefault(w => w.id == workshopDetail.WorkshopId);
|
||||
|
||||
// ساخت لیست کارفرمایان این جزئیات کارگاه
|
||||
var employers = workshopDetail.Employers
|
||||
.Where(e => employersDict.ContainsKey(e.EmployerId))
|
||||
.Select(e => new RegistrationWorkflowItemsEmployerViewModel
|
||||
{
|
||||
Id = e.EmployerId,
|
||||
FullName = employersDict[e.EmployerId].FullName
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new RegistrationWorkflowItemsViewModel
|
||||
.WorkshopDetails.Where(w => w.DetailType == WorkshopDetailType.Initial).Select(workshopDetail =>
|
||||
{
|
||||
Price = workshopDetail.Price,
|
||||
IsDone = workshop != null,
|
||||
PersonnelCount = workshopDetail.PersonnelCount,
|
||||
WorkshopName = workshopDetail.WorkshopName,
|
||||
Employers = employers,
|
||||
WorkshopDetailsId = workshopDetail.id
|
||||
};
|
||||
}).ToList();
|
||||
// پیدا کردن کارگاه مرتبط
|
||||
var workshop = workshops.FirstOrDefault(w => w.id == workshopDetail.WorkshopId);
|
||||
|
||||
// ساخت لیست کارفرمایان این جزئیات کارگاه
|
||||
var employers = workshopDetail.Employers
|
||||
.Where(e => employersDict.ContainsKey(e.EmployerId))
|
||||
.Select(e => new RegistrationWorkflowItemsEmployerViewModel
|
||||
{
|
||||
Id = e.EmployerId,
|
||||
FullName = employersDict[e.EmployerId].FullName
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new RegistrationWorkflowItemsViewModel
|
||||
{
|
||||
Price = workshopDetail.Price,
|
||||
IsDone = workshop != null,
|
||||
PersonnelCount = workshopDetail.PersonnelCount,
|
||||
WorkshopName = workshopDetail.WorkshopName,
|
||||
Employers = employers,
|
||||
WorkshopDetailsId = workshopDetail.id
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return items;
|
||||
}
|
||||
@@ -1633,14 +1638,14 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
public async Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(
|
||||
long institutionWorkshopDetailsId)
|
||||
{
|
||||
var group= await _context.InstitutionContractWorkshopGroups.Include(institutionContractWorkshopGroup =>
|
||||
var group = await _context.InstitutionContractWorkshopGroups.Include(institutionContractWorkshopGroup =>
|
||||
institutionContractWorkshopGroup.WorkshopDetails)
|
||||
.FirstOrDefaultAsync(x => x.WorkshopDetails
|
||||
.Where(w=>w.DetailType == WorkshopDetailType.Current)
|
||||
.Any(a=>a.id == institutionWorkshopDetailsId));
|
||||
|
||||
.Where(w => w.DetailType == WorkshopDetailType.Current)
|
||||
.Any(a => a.id == institutionWorkshopDetailsId));
|
||||
|
||||
return group.WorkshopDetails
|
||||
.Where(x=>x.DetailType == WorkshopDetailType.Current)
|
||||
.Where(x => x.DetailType == WorkshopDetailType.Current)
|
||||
.FirstOrDefault(x => x.id == institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
@@ -1663,7 +1668,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
return;
|
||||
if (institutionContract.WorkshopGroup.WorkshopDetails
|
||||
.Where(x=>x.DetailType == WorkshopDetailType.Initial)
|
||||
.Where(x => x.DetailType == WorkshopDetailType.Initial)
|
||||
.All(x => x.WorkshopCreated))
|
||||
institutionContract.Verified();
|
||||
|
||||
@@ -1672,17 +1677,17 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
public async Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id)
|
||||
{
|
||||
var query =await _context.InstitutionContractSet.Where(x => x.PublicId == id &&
|
||||
x.VerificationStatus ==
|
||||
InstitutionContractVerificationStatus
|
||||
.PendingForVerify)
|
||||
var query = await _context.InstitutionContractSet.Where(x => x.PublicId == id &&
|
||||
x.VerificationStatus ==
|
||||
InstitutionContractVerificationStatus
|
||||
.PendingForVerify)
|
||||
.Include(x => x.WorkshopGroup).ThenInclude(institutionContractWorkshopGroup =>
|
||||
institutionContractWorkshopGroup.WorkshopDetails)
|
||||
.Include(institutionContract => institutionContract.Installments)
|
||||
.Join(_context.PersonalContractingParties,
|
||||
institutionContract => institutionContract.ContractingPartyId,
|
||||
contractingParty =>contractingParty.id,
|
||||
(contract, party) => new {contract,party}).FirstOrDefaultAsync();
|
||||
contractingParty => contractingParty.id,
|
||||
(contract, party) => new { contract, party }).FirstOrDefaultAsync();
|
||||
|
||||
if (query == null)
|
||||
{
|
||||
@@ -1729,18 +1734,26 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
Address = query.contract.Address,
|
||||
PhoneNumber = query.party.Phone,
|
||||
CeoName = query.party.
|
||||
CeoName = query.party.IsLegal == "حقیقی"
|
||||
? $"{query.party.FName} {query.party.LName}"
|
||||
: $"{query.party.CeoFName} {query.party.CeoLName}",
|
||||
CompanyNameOrFullName = query.party.IsLegal == "حقیقی"
|
||||
? $"{query.party.FName} {query.party.LName}"
|
||||
: query.party.LName,
|
||||
NationalCodeOrNationalId =
|
||||
query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId,
|
||||
LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InstitutionContract> GetByPublicIdAsync(Guid id)
|
||||
{
|
||||
return await _context.InstitutionContractSet.FirstOrDefaultAsync(x=>x.PublicId == id);
|
||||
return await _context.InstitutionContractSet.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user