Change Logic To Generate Sort Order of Org
This commit is contained in:
parent
36aa14d7c7
commit
129733b608
1 changed files with 11 additions and 7 deletions
|
|
@ -129,7 +129,7 @@ namespace BMA.EHR.Report.Service.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<OrganizationItem>> GetAllOcItemByRootAsync(Guid id, int level = 1)
|
private async Task<List<OrganizationItem>> GetAllOcItemByRootAsync(Guid id, string level = "1")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -138,16 +138,20 @@ namespace BMA.EHR.Report.Service.Services
|
||||||
var oc = await _context.Organizations.FirstOrDefaultAsync(x => x.Id == id);
|
var oc = await _context.Organizations.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (oc == null)
|
if (oc == null)
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
var thisLevel = (level * 10) + oc.OrganizationOrder.Value;
|
var thisLevel = level;
|
||||||
|
//var thisLevel = oc.OrganizationOrder.Value;
|
||||||
ret.Add(new OrganizationItem { Id = oc.Id, Order = thisLevel.ToString() });
|
ret.Add(new OrganizationItem { Id = oc.Id, Order = thisLevel.ToString() });
|
||||||
|
|
||||||
var child = await _context.Organizations.AsQueryable().Where(x => x.ParentId == id).ToListAsync();
|
var child = await _context.Organizations.AsQueryable().Where(x => x.ParentId == id).ToListAsync();
|
||||||
if (child.Any())
|
if (child.Any())
|
||||||
{
|
{
|
||||||
|
var c = 1;
|
||||||
foreach (var item in child)
|
foreach (var item in child)
|
||||||
{
|
{
|
||||||
ret.AddRange(await GetAllOcItemByRootAsync(item.Id, thisLevel));
|
ret.AddRange(await GetAllOcItemByRootAsync(item.Id, $"{thisLevel}-{c}"));
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -438,7 +442,7 @@ namespace BMA.EHR.Report.Service.Services
|
||||||
|
|
||||||
Salary = salaryRecord == null || salaryRecord.Amount == null ? 0 : (int)salaryRecord.Amount!.Value,
|
Salary = salaryRecord == null || salaryRecord.Amount == null ? 0 : (int)salaryRecord.Amount!.Value,
|
||||||
SalaryPosition = salaryRecord == null || salaryRecord.PositionSalaryAmount == null ? 0 : (int)salaryRecord.PositionSalaryAmount!.Value,
|
SalaryPosition = salaryRecord == null || salaryRecord.PositionSalaryAmount == null ? 0 : (int)salaryRecord.PositionSalaryAmount!.Value,
|
||||||
OcOrder = orgWithOrder.Where(x => x.Id == r.ocIdNew).FirstOrDefault() == null ? 0 : orgWithOrder.Where(x => x.Id == r.ocIdNew).FirstOrDefault().Order
|
OcOrder = orgWithOrder.Where(x => x.Id == r.ocIdNew).FirstOrDefault() == null ? "0" : orgWithOrder.Where(x => x.Id == r.ocIdNew).FirstOrDefault().Order
|
||||||
};
|
};
|
||||||
results.Add(data);
|
results.Add(data);
|
||||||
}
|
}
|
||||||
|
|
@ -721,7 +725,7 @@ namespace BMA.EHR.Report.Service.Services
|
||||||
PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n",
|
PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n",
|
||||||
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
||||||
Remark = op.PositionUserNote,
|
Remark = op.PositionUserNote,
|
||||||
OcOrder = oc.OrganizationOrder.Value,
|
OcOrder = oc.OrganizationOrder.Value.ToString(),
|
||||||
PositionType = pt.Name,
|
PositionType = pt.Name,
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -792,7 +796,7 @@ namespace BMA.EHR.Report.Service.Services
|
||||||
|
|
||||||
public string Remark { get; set; } = string.Empty;
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int OcOrder { get; set; } = 0;
|
public string OcOrder { get; set; } = "0";
|
||||||
|
|
||||||
public int PositionNumberInt { get; set; } = 0;
|
public int PositionNumberInt { get; set; } = 0;
|
||||||
|
|
||||||
|
|
@ -833,7 +837,7 @@ namespace BMA.EHR.Report.Service.Services
|
||||||
|
|
||||||
public string Remark { get; set; } = string.Empty;
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int OcOrder { get; set; } = 0;
|
public string OcOrder { get; set; } = "0";
|
||||||
|
|
||||||
public int PositionNumberInt { get; set; } = 0;
|
public int PositionNumberInt { get; set; } = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue