TemporaryClient - WorkshopTemp and WorkshopServicesTemp
This commit is contained in:
@@ -91,6 +91,10 @@ public class ContractingPartyTemp : EntityBase
|
||||
/// </summary>
|
||||
public string Address { get; private set; }
|
||||
|
||||
|
||||
|
||||
public void UpdateAddress(string state, string city, string address)
|
||||
{
|
||||
this.State = state;
|
||||
this.City = city;
|
||||
this.Address = address;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IWorkshopServicesTempRepository : IRepository<long, WorkshopServicesTemp>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IWorkshopTempRepository : IRepository<long, WorkshopTemp>
|
||||
{
|
||||
/// <summary>
|
||||
/// دریافت کارگاه های ذخیره شده
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTemp"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public class WorkshopServicesTemp : EntityBase
|
||||
{
|
||||
public WorkshopServicesTemp(string serviceName, int countPerson, long workshopTempId)
|
||||
{
|
||||
ServiceName = serviceName;
|
||||
CountPerson = countPerson;
|
||||
WorkshopTempId = workshopTempId;
|
||||
}
|
||||
/// <summary>
|
||||
/// نام سرویس
|
||||
/// </summary>
|
||||
public string ServiceName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کارگاه موقت
|
||||
/// </summary>
|
||||
public long WorkshopTempId { get; private set; }
|
||||
|
||||
public WorkshopTemp WorkshopTemp { get; private set; }
|
||||
|
||||
public void UpdateService(int countPerson)
|
||||
{
|
||||
this.CountPerson = countPerson;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public class WorkshopTemp : EntityBase
|
||||
{
|
||||
public WorkshopTemp(string workshopName, int countPerson, long contractingPartyTempId, double workshopServicesAmount)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractingPartyTempId = contractingPartyTempId;
|
||||
WorkshopServicesAmount = workshopServicesAmount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// ای دی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyTempId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; private set; }
|
||||
|
||||
public List<WorkshopServicesTemp> WorkshopServicesTemps { get; private set; }
|
||||
|
||||
|
||||
|
||||
public void Edit(string workshopName, int countPerson, double workshopServicesAmount)
|
||||
{
|
||||
this.WorkshopName = workshopName;
|
||||
this.CountPerson = countPerson;
|
||||
this.WorkshopServicesAmount = workshopServicesAmount;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class CreateWorkshopServicesTemp
|
||||
{
|
||||
/// <summary>
|
||||
/// نام سرویس
|
||||
/// </summary>
|
||||
public string ServiceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کارگاه موقت
|
||||
/// </summary>
|
||||
public long WorkshopTempId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class CreateWorkshopTemp
|
||||
{
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ای دی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyTempId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// فارسی
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmountStr { get; set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool InsurancePercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCallPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckoutPercent { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// خدمات حضوری قرداد و تصفیه
|
||||
///// </summary>
|
||||
//public bool ContractAndCheckoutInPersonPercent { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// خدمات حضوری بیمه
|
||||
///// </summary>
|
||||
//public bool InsuranceInPersonPercent { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,9 +1,34 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public interface ITemporaryClientRegistrationApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// احراز هویت
|
||||
/// </summary>
|
||||
/// <param name="nationalCode"></param>
|
||||
/// <param name="dateOfBirth"></param>
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile);
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل اطلاعات
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="city"></param>
|
||||
/// <param name="address"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> UpdateAddress(long id, string state, string city, string address);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت کارگاه های ذخیره شده
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTemp"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class WorkshopServicesTempViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class WorkshopTempViewModel : CreateWorkshopTemp
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
@@ -21,6 +22,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
_uidService = uidService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// احراز هویت
|
||||
/// </summary>
|
||||
/// <param name="nationalCode"></param>
|
||||
/// <param name="dateOfBirth"></param>
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode , string dateOfBirth, string mobile)
|
||||
{
|
||||
var op = new OperationResult<ContractingPartyTempViewModel>();
|
||||
@@ -58,6 +66,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
|
||||
|
||||
|
||||
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
|
||||
if (getExistTemp != null)
|
||||
{
|
||||
|
||||
@@ -107,5 +117,28 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
return op.Succcedded(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> UpdateAddress(long id, string state, string city, string address)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var contractingPartyTemp = _contractingPartyTempRepository.Get(id);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(state) || string.IsNullOrWhiteSpace(city) || string.IsNullOrWhiteSpace(address))
|
||||
return op.Failed("اطلاعات ادرس را تکمیل کنید");
|
||||
|
||||
contractingPartyTemp.UpdateAddress(state,city,address);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,8 @@ public class CompanyContext : DbContext
|
||||
#region TemporaryClientRegisteration
|
||||
|
||||
public DbSet<ContractingPartyTemp> ContractingPartyTemps { get; set; }
|
||||
|
||||
public DbSet<WorkshopTemp> WorkshopTemps { get; set; }
|
||||
public DbSet<WorkshopServicesTemp> WorkshopServicesTemps { get; set; }
|
||||
#endregion
|
||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class WorkshopServicesTempMapping : IEntityTypeConfiguration<WorkshopServicesTemp>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<WorkshopServicesTemp> builder)
|
||||
{
|
||||
builder.ToTable("WorkshopServicesTemps");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.ServiceName).HasMaxLength(40);
|
||||
|
||||
builder.HasOne(x => x.WorkshopTemp)
|
||||
.WithMany(x => x.WorkshopServicesTemps)
|
||||
.HasForeignKey(x => x.WorkshopTempId);
|
||||
}
|
||||
}
|
||||
20
CompanyManagment.EFCore/Mapping/WorkshopTempMapping.cs
Normal file
20
CompanyManagment.EFCore/Mapping/WorkshopTempMapping.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class WorkshopTempMapping : IEntityTypeConfiguration<WorkshopTemp>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<WorkshopTemp> builder)
|
||||
{
|
||||
builder.ToTable("WorkshopTemps");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.WorkshopName).HasMaxLength(255);
|
||||
|
||||
builder.HasMany(x => x.WorkshopServicesTemps)
|
||||
.WithOne(x => x.WorkshopTemp)
|
||||
.HasForeignKey(x => x.WorkshopTempId);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ public class ContractingPartyTempRepository : RepositoryBase<long, ContractingPa
|
||||
{
|
||||
Id = x.id,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
DateOfBirthFa = x.DateOfBirth.ToFarsi(),
|
||||
IdNumberSeri = x.IdNumberSeri,
|
||||
IdNumberSerial = x.IdNumberSerial,
|
||||
Address = x.Address,
|
||||
|
||||
33
CompanyManagment.EFCore/Repository/WorkshopTempRepository.cs
Normal file
33
CompanyManagment.EFCore/Repository/WorkshopTempRepository.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class WorkshopTempRepository : RepositoryBase<long, WorkshopTemp>, IWorkshopTempRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public WorkshopTempRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp)
|
||||
{
|
||||
var result =_context.WorkshopTemps
|
||||
.Where(x => x.ContractingPartyTempId == contractingPartyTemp)
|
||||
.Include(x => x.WorkshopServicesTemps)
|
||||
.Select(x => new WorkshopTempViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopName = x.WorkshopName
|
||||
|
||||
});
|
||||
|
||||
return new List<WorkshopTempViewModel>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user