Textbausteine an die neue Version angepasst
This commit is contained in:
@@ -640,9 +640,10 @@ namespace BeWoPlanerMobil.Controllers
|
||||
{
|
||||
if (tm.Text == null)
|
||||
{
|
||||
tm.Text = "";
|
||||
tm.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
if(!MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen))
|
||||
{
|
||||
textbausteine = textbausteine.Where(w => w.Employee.EmployeeOid == Model.Employee.EmployeeOid).ToList();
|
||||
@@ -659,13 +660,25 @@ namespace BeWoPlanerMobil.Controllers
|
||||
if(item.ParentOid != null)
|
||||
{
|
||||
var parent = displayItems.FirstOrDefault(f => f.Oid == item.ParentOid);
|
||||
parent?.nodes.AddIfNotIn(item);
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
if (parent.nodes == null)
|
||||
{
|
||||
parent.nodes = new List<TextbausteinDisplayItem>();
|
||||
}
|
||||
|
||||
parent.nodes.AddIfNotIn(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
displayItems = displayItems.Where(w => w.ParentOid == null).ToList();
|
||||
|
||||
return SerializeObject(displayItems);
|
||||
return JsonConvert.SerializeObject(displayItems, Formatting.None, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
|
||||
@@ -5,14 +5,13 @@ namespace BeWoPlanerMobil.Util
|
||||
{
|
||||
public class TextbausteinDisplayItem
|
||||
{
|
||||
// selectable, text (name), nodes (child elements)
|
||||
public bool selectable => false;
|
||||
public bool selectable { get; }
|
||||
|
||||
public string text { get; set; }
|
||||
|
||||
public List<TextbausteinDisplayItem> nodes { get; set; } = new List<TextbausteinDisplayItem>();
|
||||
public List<TextbausteinDisplayItem> nodes { get; set; }
|
||||
|
||||
public List<string> tags { get; set; } = new List<string>();
|
||||
public List<string> tags { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string Name { get; set; }
|
||||
@@ -28,23 +27,13 @@ namespace BeWoPlanerMobil.Util
|
||||
[JsonIgnore]
|
||||
public List<TextbausteinDisplayItem> Children { get; set; }
|
||||
|
||||
public TextbausteinDisplayItem(long pOid, string pName, long? pParentOid, bool pIsParent, string pText)
|
||||
{
|
||||
Oid = pOid;
|
||||
Name = pName;
|
||||
ParentOid = pParentOid;
|
||||
IsParent = pIsParent;
|
||||
Text = pText;
|
||||
|
||||
Children = new List<TextbausteinDisplayItem>();
|
||||
}
|
||||
|
||||
public TextbausteinDisplayItem(string pText, List<string> pTags, long? pParentOid, long pOid)
|
||||
{
|
||||
text = pText;
|
||||
tags = pTags;
|
||||
ParentOid = pParentOid;
|
||||
Oid = pOid;
|
||||
selectable = pParentOid.HasValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user