66 lines
2.5 KiB
C#
66 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using _0_Framework.Application;
|
|
using Company.Domain.InsuranceEmployeeInfoAgg;
|
|
using CompanyManagment.App.Contracts.InsuranceEmployeeInfo;
|
|
|
|
namespace CompanyManagment.Application;
|
|
|
|
public class InsuranceEmployeeInfoApplication : IInsuranceEmployeeInfoApplication
|
|
{
|
|
private readonly IInsuranceEmployeeInfoRepository _insuranceEmployeeInfoRepository;
|
|
|
|
public InsuranceEmployeeInfoApplication(IInsuranceEmployeeInfoRepository insuranceEmployeeInfoRepository)
|
|
{
|
|
_insuranceEmployeeInfoRepository = insuranceEmployeeInfoRepository;
|
|
}
|
|
|
|
|
|
public OperationResult Create(CreateInsuranceEmployeeInfo command)
|
|
{
|
|
var operation = new OperationResult();
|
|
|
|
if (command == null)
|
|
return operation.Failed("لطفا اطلاعات ورودی را تکمیل نمایید!");
|
|
|
|
var insuranceEmployeeInfo = new InsuranceEmployeeInfo(command.EmployeeId, command.FName, command.LName, command.FatherName, command.DateOfBirthGr,command.DateOfIssueGr,command.PlaceOfIssue ,command.NationalCode,command.IdNumber, command.Gender, command.InsuranceCode);
|
|
_insuranceEmployeeInfoRepository.Create(insuranceEmployeeInfo);
|
|
_insuranceEmployeeInfoRepository.SaveChanges();
|
|
return operation.Succcedded();
|
|
}
|
|
|
|
public OperationResult Edit(EditInsuranceEmployeeInfo command)
|
|
{
|
|
var operation = new OperationResult();
|
|
|
|
if (command == null)
|
|
return operation.Failed("لطفا اطلاعات ورودی را تکمیل نمایید!");
|
|
|
|
|
|
|
|
var editInsuranceEmployeeInfo = _insuranceEmployeeInfoRepository.Get(command.Id);
|
|
if (editInsuranceEmployeeInfo == null)
|
|
operation.Failed("رکورد مورد نظر وجود ندارد");
|
|
|
|
|
|
editInsuranceEmployeeInfo.Edit(command.FName,command.LName,command.FatherName,command.DateOfBirthGr,command.DateOfIssueGr,command.PlaceOfIssue,command.NationalCode,command.IdNumber,command.Gender,command.InsuranceCode);
|
|
_insuranceEmployeeInfoRepository.SaveChanges();
|
|
|
|
return operation.Succcedded();
|
|
}
|
|
|
|
public DetailsInsuranceEmployeeInfo GetDetails(long id)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public List<InsuranceEmployeeInfoViewModel> Search(InsuranceEmployeeInfoSearchModel searchModel)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public DetailsInsuranceEmployeeInfo GetDetailsByEmployeeId(long employeeId)
|
|
{
|
|
return _insuranceEmployeeInfoRepository.GetDetailsByEmployeeId(employeeId);
|
|
}
|
|
} |