before ugrade
This commit is contained in:
@@ -214,6 +214,27 @@ public partial class PersonRepository : IPerson
|
||||
Person rval = await _context.Persons.FindAsync(id);
|
||||
return rval;
|
||||
}
|
||||
|
||||
private string getStyleClass(string va)
|
||||
{
|
||||
string result = "";
|
||||
//result = "bg-indigo-500 text-black";
|
||||
|
||||
if (va == "T")
|
||||
{
|
||||
result = "bg-indigo-500 text-white";
|
||||
}
|
||||
else if (va == "P")
|
||||
{
|
||||
//result = "bg-purple-500 text-black";
|
||||
result = "bg-purple-500 text-black";
|
||||
}
|
||||
else if (va == "C")
|
||||
{
|
||||
result = "bg-teal-500 text-white";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public async Task<ResultModel<TreeNode<string>>> GetByFamilyAsync(int id)
|
||||
{
|
||||
int statuscode = 0;
|
||||
@@ -241,6 +262,8 @@ public partial class PersonRepository : IPerson
|
||||
node.Label = item.FirstName;
|
||||
node.Key = item.Id.ToString();
|
||||
node.Type = type;
|
||||
node.Icon = "T";
|
||||
node.StyleClass = getStyleClass(node.Icon);
|
||||
node.Expanded = true;
|
||||
node.Data = item.Sex;
|
||||
statuscode = 1;
|
||||
@@ -300,13 +323,13 @@ public partial class PersonRepository : IPerson
|
||||
{
|
||||
if (data == "M")
|
||||
{
|
||||
fatherId = relate.PersonId;
|
||||
motherId = relate.RelatePersonId;
|
||||
fatherId = relate.RelatePersonId;
|
||||
motherId = relate.PersonId;
|
||||
}
|
||||
else
|
||||
{
|
||||
fatherId = relate.RelatePersonId;
|
||||
motherId = relate.PersonId;
|
||||
fatherId = relate.PersonId;
|
||||
motherId = relate.RelatePersonId;
|
||||
}
|
||||
}
|
||||
//get children
|
||||
@@ -321,7 +344,7 @@ public partial class PersonRepository : IPerson
|
||||
pe = await GetPerson(motherId);
|
||||
pName = pe.FirstName;
|
||||
key = motherId.ToString();
|
||||
data = "F";
|
||||
data = pe.Sex;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -331,12 +354,14 @@ public partial class PersonRepository : IPerson
|
||||
pe = await GetPerson(fatherId);
|
||||
pName = pe.FirstName;
|
||||
key = fatherId.ToString();
|
||||
data = "M";
|
||||
data = pe.Sex;
|
||||
}
|
||||
}
|
||||
|
||||
citem = new TreeNode<string>();
|
||||
citem.Label = pName;
|
||||
citem.Icon = "P";
|
||||
citem.StyleClass = getStyleClass(citem.Icon);
|
||||
citem.Expanded = true;
|
||||
citem.Data = data;
|
||||
citem.Type = type;
|
||||
@@ -349,6 +374,8 @@ public partial class PersonRepository : IPerson
|
||||
child = new TreeNode<string>();
|
||||
child.Expanded = true;
|
||||
child.Type = type;
|
||||
child.Icon = "C";
|
||||
child.StyleClass = getStyleClass(child.Icon);
|
||||
child.Label = dto.FirstName;
|
||||
child.Key = dto.Id.ToString();
|
||||
child.Data = dto.Sex;
|
||||
|
||||
@@ -12,6 +12,7 @@ public partial class PersonRepository
|
||||
treeNode.Label = model.FirstName;
|
||||
treeNode.Data = model.Id.ToString();
|
||||
treeNode.Key = model.Id.ToString();
|
||||
treeNode.Expanded = false;
|
||||
treeNode.Children = new();
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user