_employerApplication.InsuranceEmployerByWorkshopId(workshopId) added
This commit is contained in:
@@ -44,7 +44,13 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
OperationResult ActiveAll(long id);
|
||||
List<EmployerViewModel> GetAllEmployers();
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Insurance
|
||||
|
||||
(string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,12 @@ public interface IEmployerApplication
|
||||
OperationResult ActiveAll(long id);
|
||||
List<EmployerViewModel> GetAllEmployers();
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Insurance
|
||||
|
||||
(string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -939,5 +939,10 @@ public class EmployerApplication : IEmployerApplication
|
||||
return _EmployerRepository.GetAllEmployers();
|
||||
}
|
||||
|
||||
public (string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId)
|
||||
{
|
||||
return _EmployerRepository.InsuranceEmployerByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -724,5 +724,32 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
|
||||
IsLegal = x.IsLegal,
|
||||
}).ToList();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Insurance
|
||||
|
||||
/// <summary>
|
||||
/// نام کارفرما
|
||||
/// وضعیت حقیقی حقوقی
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
public (string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId)
|
||||
{
|
||||
var res = _context.WorkshopEmployers.Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.Employer).Select(x => new EmprViewModel
|
||||
{
|
||||
EmployerFullName = x.Employer.IsLegal == "حقوقی" ?
|
||||
(x.Employer.EmployerLName != "#" ? x.Employer.FName + " " + x.Employer.EmployerLName: x.Employer.LName) : x.Employer.FullName,
|
||||
IsLegal = x.Employer.IsLegal,
|
||||
}).FirstOrDefault();
|
||||
|
||||
|
||||
string employer = res.EmployerFullName;
|
||||
bool isLegal = res.IsLegal == "حقوقی";
|
||||
|
||||
return (employer,isLegal);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -143,31 +143,38 @@ public class IndexModel : PageModel
|
||||
//}
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات کارگاه وکارفرما برای نمایش در مودال ایجاد بیمه
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnPostGetEmployerName(int workshopId)
|
||||
{
|
||||
var names = "";
|
||||
var employerList = _employerApplication.GetEmployerByWorkshopId(workshopId);
|
||||
//var names = "";
|
||||
//var employerList = _employerApplication.GetEmployerByWorkshopId(workshopId);
|
||||
var workshopInfo = _insuranceWorkshopInfoApplication.GetDetails(workshopId);
|
||||
// var personelInfo = _employeeApplication.(workshopId);
|
||||
var employer = _employerApplication.InsuranceEmployerByWorkshopId(workshopId);
|
||||
//// var personelInfo = _employeeApplication.(workshopId);
|
||||
|
||||
var isLegal = employerList.FirstOrDefault().IsLegal;
|
||||
var boolIsLegal = isLegal == "حقوقی" ? true : false;
|
||||
//var isLegal = employerList.FirstOrDefault().IsLegal;
|
||||
//var boolIsLegal = isLegal == "حقوقی" ? true : false;
|
||||
|
||||
//foreach (var item in employerList)
|
||||
// if (boolIsLegal)
|
||||
// names = item.EmployerLName != "#" ? item.FName + " " + item.EmployerLName : item.LName;
|
||||
// else
|
||||
// names = names + item.EmployerFullName + ",";
|
||||
|
||||
//if (!boolIsLegal)
|
||||
// names = names.Substring(0, names.Length - 1);
|
||||
|
||||
foreach (var item in employerList)
|
||||
if (boolIsLegal)
|
||||
names = item.EmployerLName != "#" ? item.FName + " " + item.EmployerLName : item.LName;
|
||||
else
|
||||
names = names + item.EmployerFullName + ",";
|
||||
|
||||
if (!boolIsLegal)
|
||||
names = names.Substring(0, names.Length - 1);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
EmployerNames = names,
|
||||
EmployerNames = employer.employerName,
|
||||
WorkshopInfo = workshopInfo,
|
||||
IsLegal = boolIsLegal
|
||||
IsLegal = employer.isLegal
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user