ow
This commit is contained in:
1 parent
b26bcfcd3b
commit
8285fb4090
9 files changed
+1372
-20
No files matched your search
@@ -25,6 +25,39 @@ namespace CloudBuilder.Master.Service
|
||||
this.service = service;
|
||||
repository = service.GetRepository<IRepository<FamilyTreeEntity>>();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Find)]
|
||||
public FamilyTreeData FindAllByTreeId(string treeId)
|
||||
{
|
||||
FamilyTreeData data = new FamilyTreeData();
|
||||
if (string.IsNullOrEmpty(treeId)) return data;
|
||||
|
||||
FamilyTreeEntity d = repository.DetachedEntities.Where(x => x.TreeId == treeId).FirstOrDefault();
|
||||
|
||||
if (d == null) return data;
|
||||
|
||||
data.FamilyTree = new FamilyTreeDisplayData(d);
|
||||
data.CurrentPerson = new FamilyPersonData();
|
||||
|
||||
IRepository<FamilyPersonEntity> repositoryFamilyPerson = repository.GetRepository<IRepository<FamilyPersonEntity>>();
|
||||
|
||||
var currentPerson = d.AncestorPersonId;
|
||||
|
||||
data.CurrentPerson.FamilyPerson = new FamilyPersonDisplayData(repositoryFamilyPerson.DetachedEntities.Where(x => x.PersonId == currentPerson).FirstOrDefault()!);
|
||||
|
||||
data.FamilyTree.AncestorPersonGenealogyName = data.CurrentPerson.FamilyPerson.GenealogyName;
|
||||
|
||||
IRepository<FamilyTreeChildrenMapViewEntity> repositoryChildrenMap = repository.GetRepository<IRepository<FamilyTreeChildrenMapViewEntity>>();
|
||||
|
||||
IRepository<FamilyTreeSpouseMapViewEntity> repositorySpouseMap = repository.GetRepository<IRepository<FamilyTreeSpouseMapViewEntity>>();
|
||||
|
||||
data.CurrentPerson.FamilyTreeSpouseMaps = repositorySpouseMap.GetRepository<IRepository<FamilyTreeSpouseMapViewEntity>>().DetachedEntities.Where(x => x.TreeId == treeId).OrderBy(x => x.Orderby).ToArray();
|
||||
|
||||
data.CurrentPerson.FamilyTreeChildrenMaps = repositoryChildrenMap.GetRepository<IRepository<FamilyTreeChildrenMapViewEntity>>().DetachedEntities.Where(x => x.TreeId == treeId).OrderBy(x => x.Orderby).ToArray();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Find)]
|
||||
public FamilyTreeData FindByKey(string key)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace CloudBuilder.Master.Service
|
||||
{
|
||||
public interface IFamilyTreeService : IServiceBase<FamilyTreeData, string, FamilyTreeSearchCriteria>
|
||||
{
|
||||
FamilyTreeData FindAllByTreeId(string treeId);
|
||||
FamilyTreeData FindByCurrentPerson(string key, string personId);
|
||||
FamilyTreeResultData FindBySearchCriteria(FamilyTreeSearchCriteria tc);
|
||||
dynamic PrintBySearchCriteria(FamilyTreeSearchCriteria tc);
|
||||
|
||||
@@ -22,7 +22,11 @@ public FamilyTreeRequest(IServiceRequest serviceRequest)
|
||||
this.serviceRequest = serviceRequest;
|
||||
}
|
||||
|
||||
public FamilyTreeData FindByKey(string key)
|
||||
public FamilyTreeData FindAllByTreeId(string treeId)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyTreeData>("/FamilyTree/FindAllByTreeId?treeId=" + treeId.ToString())).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyTreeData FindByKey(string key)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyTreeData>("/FamilyTree/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
|
||||
|
||||
|
||||
@@ -29,6 +29,26 @@ this.familyTreeService= familyTreeService;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "FamilyTree", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindAllByTreeId(string treeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = familyTreeService.FindAllByTreeId(treeId);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "FamilyTree", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindByKey(string key)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user