no message

This commit is contained in:
Kittapath 2023-10-13 17:33:51 +07:00
parent a03533c75e
commit 8b70c8e853
3 changed files with 22 additions and 15 deletions

View file

@ -59,6 +59,7 @@ namespace BMA.EHR.Application.Repositories.Reports
var monthDiff = 0;
var dayDiff = 0;
var sb = new StringBuilder();
var zxc = new List<dynamic>();
foreach (var career in careers)
{
if (career.DurationEnd < career.DurationStart)
@ -67,6 +68,7 @@ namespace BMA.EHR.Application.Repositories.Reports
yearDiff = yearDiff + rangeObj.years;
monthDiff = monthDiff + rangeObj.months;
dayDiff = dayDiff + rangeObj.days;
zxc.Add(rangeObj);
}
else
{
@ -74,6 +76,7 @@ namespace BMA.EHR.Application.Repositories.Reports
yearDiff = yearDiff + rangeObj.years;
monthDiff = monthDiff + rangeObj.months;
dayDiff = dayDiff + rangeObj.days;
zxc.Add(rangeObj);
}
if (dayDiff >= 30)
{
@ -90,7 +93,6 @@ namespace BMA.EHR.Application.Repositories.Reports
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
}
var data = await _dbExamContext.Set<Candidate>().AsQueryable()
.Where(x => x.Id == id)
.Select(p => new
@ -120,7 +122,7 @@ namespace BMA.EHR.Application.Repositories.Reports
EducationType = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationType,
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelHighName,
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "perm" ? "ลูกจ้างประจำ" : "-")),
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-")),
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition,
OccupationSalary = p.OccupationSalary == null ? "-" : p.OccupationSalary.ToString(),
OccupationGroup = p.OccupationGroup == null ? "-" : p.OccupationGroup,
@ -143,11 +145,11 @@ namespace BMA.EHR.Application.Repositories.Reports
RegistDistrictName = p.RegistDistrictName == null ? "-" : p.RegistDistrictName,
RegistSubDistrictName = p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName,
RegistZipCode = p.RegistZipCode == null ? "-" : p.RegistZipCode,
CurrentAddress = p.CurrentAddress == null ? "-" : p.CurrentAddress,
CurrentProvinceName = p.CurrentProvinceName == null ? "-" : p.CurrentProvinceName,
CurrentSubDistrictName = p.CurrentSubDistrictName == null ? "-" : p.CurrentSubDistrictName,
CurrentDistrictName = p.CurrentDistrictName == null ? "-" : p.CurrentDistrictName,
CurrentZipCode = p.CurrentZipCode == null ? "-" : p.CurrentZipCode,
CurrentAddress = p.CurrentAddress == null ? (p.RegistAddress == null ? "-" : p.RegistAddress) : p.CurrentAddress,
CurrentProvinceName = p.CurrentProvinceName == null ? (p.RegistProvinceName == null ? "-" : p.RegistProvinceName) : p.CurrentProvinceName,
CurrentSubDistrictName = p.CurrentSubDistrictName == null ? (p.RegistDistrictName == null ? "-" : p.RegistDistrictName) : p.CurrentSubDistrictName,
CurrentDistrictName = p.CurrentDistrictName == null ? (p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName) : p.CurrentDistrictName,
CurrentZipCode = p.CurrentZipCode == null ? (p.RegistZipCode == null ? "-" : p.RegistZipCode) : p.CurrentZipCode,
Telephone = p.Telephone == null ? "-" : p.Telephone,
Email = p.Email == null ? "-" : p.Email,

View file

@ -334,14 +334,8 @@ namespace BMA.EHR.Domain.Extensions
{
// if (startDate == null || endDate == null)
// return null;
DateTime today = endDate;
DateTime birthDate = Convert.ToDateTime(startDate).AddDays(-1);
var years1 = birthDate;
var years2 = endDate;
var years3 = endDate.Subtract(birthDate);
var years4 = endDate.Subtract(birthDate).Ticks;
var years5 = new DateTime(endDate.Subtract(birthDate).Ticks);
var years6 = new DateTime(endDate.Subtract(birthDate).Ticks).Year;
DateTime today = endDate.AddDays(1);
DateTime birthDate = startDate;
int years = new DateTime(endDate.Subtract(birthDate).Ticks).Year - 1;
DateTime pastYearDate = birthDate.AddYears(years);
int months = 0;
@ -370,6 +364,17 @@ namespace BMA.EHR.Domain.Extensions
days -= 1;
}
}
if (days >= 30)
{
months = months + 1;
days = 0;
if (months >= 12)
{
years = years + 1;
months = 0;
}
}
var sb = new StringBuilder();
sb.Clear();
sb.Append(years == 0 ? "" : $"{years} ปี ");