Merge branch 'Feature/InstitutionContract/add-registration-style' into Main
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
|
||||
namespace Company.Domain.LawAgg
|
||||
{
|
||||
@@ -9,11 +10,13 @@ namespace Company.Domain.LawAgg
|
||||
public string Title { get; private set; }
|
||||
public bool IsActive { get; private set; }
|
||||
public List<LawItem> Items { get; private set; }
|
||||
|
||||
public string LawType { get; private set; }
|
||||
|
||||
public Law(string title)
|
||||
public Law(string title, string lawType)
|
||||
{
|
||||
Title = title;
|
||||
IsActive = false;
|
||||
IsActive = true;
|
||||
Items = new List<LawItem>();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace CompanyManagment.App.Contracts.Law
|
||||
OperationResult Deactivate(long id);
|
||||
EditLaw GetDetails(long id);
|
||||
List<LawViewModel> GetList();
|
||||
LawViewModel GetLawWithItems(long id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,16 @@ namespace CompanyManagment.App.Contracts.Law
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public List<LawItemViewModel> Items { get; set; }
|
||||
public string Type { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class EditLaw
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public List<LawItemViewModel> Items { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||
|
||||
public EmployerApplication(IEmployerRepository employerRepository, IWorkshopRepository workshopRepository,
|
||||
InstitutionContractRepository institutionContractRepository)
|
||||
IInstitutionContractRepository institutionContractRepository)
|
||||
{
|
||||
_EmployerRepository = employerRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
|
||||
@@ -18,8 +18,12 @@ namespace CompanyManagment.Application
|
||||
public OperationResult Create(CreateLaw command)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
if (_lawRepository.Exists(x=>x.LawType == command.Type))
|
||||
{
|
||||
return operation.Failed("این قانون قبلا ثبت شده است");
|
||||
}
|
||||
|
||||
var law = new Law(command.Title);
|
||||
var law = new Law(command.Title,command.Type);
|
||||
|
||||
if (command.Items != null && command.Items.Any())
|
||||
{
|
||||
@@ -43,7 +47,9 @@ namespace CompanyManagment.Application
|
||||
if (law == null)
|
||||
return operation.Failed(ApplicationMessages.RecordNotFound);
|
||||
|
||||
var lawItems = command.Items.Select(x=> new LawItem(x.Header, x.Details, x.OrderNumber)).ToList();
|
||||
law.Edit(command.Title);
|
||||
law.SetItem(lawItems);
|
||||
|
||||
_lawRepository.SaveChanges();
|
||||
return operation.Succcedded();
|
||||
@@ -82,6 +88,12 @@ namespace CompanyManagment.Application
|
||||
{
|
||||
Id = law.id,
|
||||
Title = law.Title,
|
||||
Items = law.Items.OrderBy(x=>x.OrderNumber).Select(x => new LawItemViewModel
|
||||
{
|
||||
Header = x.Header,
|
||||
Details = x.Details,
|
||||
OrderNumber = x.OrderNumber
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,14 +1046,17 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
|
||||
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
|
||||
var account = new AccountViewModel();
|
||||
var institutionContract = new InstitutionContract();
|
||||
|
||||
var institutionContract = _institutionContractRepository.Get(contractWorkshopDetail.InstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
{
|
||||
return operation.Failed("قرارداد مالی موسسه یافت نشد");
|
||||
}
|
||||
if (command.HasRollCallFreeVip == "true")
|
||||
{
|
||||
institutionContract = _institutionContractRepository.Get(contractWorkshopDetail.InstitutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
|
||||
// if (institutionContract == null)
|
||||
// return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
|
||||
|
||||
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
|
||||
.ContractingPartyId);
|
||||
@@ -1111,6 +1114,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
if (!op.IsSuccedded)
|
||||
return op;
|
||||
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace CompanyManagment.EFCore.Mapping
|
||||
|
||||
builder.Property(x => x.Title).HasMaxLength(255).IsRequired();
|
||||
builder.Property(x => x.IsActive).IsRequired();
|
||||
builder.Property(x => x.LawType).HasMaxLength(50);
|
||||
|
||||
builder.OwnsMany(x => x.Items, navigationBuilder =>
|
||||
{
|
||||
|
||||
10487
CompanyManagment.EFCore/Migrations/20250826071120_add LawType to law.Designer.cs
generated
Normal file
10487
CompanyManagment.EFCore/Migrations/20250826071120_add LawType to law.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addLawTypetolaw : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LawType",
|
||||
table: "Law",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "InstitutionContractTemps",
|
||||
type: "nvarchar(30)",
|
||||
maxLength: 30,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(30)",
|
||||
oldMaxLength: 30,
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LawType",
|
||||
table: "Law");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "InstitutionContractTemps",
|
||||
type: "nvarchar(30)",
|
||||
maxLength: 30,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(30)",
|
||||
oldMaxLength: 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3787,6 +3787,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("LawType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
@@ -5586,6 +5590,7 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("RegistrationStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user