MH: DienstView und ICF Updates
This commit is contained in:
@@ -5062,6 +5062,11 @@ namespace BeWo.ServiceProxy
|
||||
public interface IOperationsService
|
||||
{
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetPlatzhalterForSupportConcept", ReplyAction="http://tempuri.org/IOperationsService/GetPlatzhalterForSupportConceptResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetPlatzhalterForSupportConceptBeWoFaultFau" +
|
||||
"lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.PlatzhalterDC> GetPlatzhalterForSupportConcept();
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetPlatzhalterForCustomer", ReplyAction="http://tempuri.org/IOperationsService/GetPlatzhalterForCustomerResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetPlatzhalterForCustomerBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.PlatzhalterDC> GetPlatzhalterForCustomer();
|
||||
@@ -5305,6 +5310,10 @@ namespace BeWo.ServiceProxy
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetWholeIcfBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.ValueListEntryDC> GetWholeIcf();
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetWholeIcfOhneImportierte", ReplyAction="http://tempuri.org/IOperationsService/GetWholeIcfOhneImportierteResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetWholeIcfOhneImportierteBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.ValueListEntryDC> GetWholeIcfOhneImportierte(System.Collections.Generic.List<BS.Shared.DataContracts.ValueListEntryDC> vorhandeneZiele);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetReportTemplates", ReplyAction="http://tempuri.org/IOperationsService/GetReportTemplatesResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetReportTemplatesBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.ReportTemplateDC> GetReportTemplates(string url);
|
||||
@@ -5531,11 +5540,6 @@ namespace BeWo.ServiceProxy
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertTemplateBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
BS.Shared.DataContracts.DokumentvorlageDC InsertTemplate(BS.Shared.DataContracts.DokumentvorlageDC dc);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetPlatzhalterForSupportConcept", ReplyAction="http://tempuri.org/IOperationsService/GetPlatzhalterForSupportConceptResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetPlatzhalterForSupportConceptBeWoFaultFau" +
|
||||
"lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.PlatzhalterDC> GetPlatzhalterForSupportConcept();
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/CreateNewChatMessagesDC", ReplyAction="http://tempuri.org/IOperationsService/CreateNewChatMessagesDCResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/CreateNewChatMessagesDCBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
BS.Shared.DataContracts.ChatMessageDC CreateNewChatMessagesDC(long senderOid, long empfängerOid, string message, bool isDeliverd, long teamid, string messageid);
|
||||
@@ -6436,6 +6440,11 @@ namespace BeWo.ServiceProxy
|
||||
{
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.PlatzhalterDC> GetPlatzhalterForSupportConcept()
|
||||
{
|
||||
return base.Channel.GetPlatzhalterForSupportConcept();
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.PlatzhalterDC> GetPlatzhalterForCustomer()
|
||||
{
|
||||
return base.Channel.GetPlatzhalterForCustomer();
|
||||
@@ -6686,6 +6695,11 @@ namespace BeWo.ServiceProxy
|
||||
return base.Channel.GetWholeIcf();
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.ValueListEntryDC> GetWholeIcfOhneImportierte(System.Collections.Generic.List<BS.Shared.DataContracts.ValueListEntryDC> vorhandeneZiele)
|
||||
{
|
||||
return base.Channel.GetWholeIcfOhneImportierte(vorhandeneZiele);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.ReportTemplateDC> GetReportTemplates(string url)
|
||||
{
|
||||
return base.Channel.GetReportTemplates(url);
|
||||
@@ -6936,11 +6950,6 @@ namespace BeWo.ServiceProxy
|
||||
return base.Channel.InsertTemplate(dc);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.PlatzhalterDC> GetPlatzhalterForSupportConcept()
|
||||
{
|
||||
return base.Channel.GetPlatzhalterForSupportConcept();
|
||||
}
|
||||
|
||||
public BS.Shared.DataContracts.ChatMessageDC CreateNewChatMessagesDC(long senderOid, long empfängerOid, string message, bool isDeliverd, long teamid, string messageid)
|
||||
{
|
||||
return base.Channel.CreateNewChatMessagesDC(senderOid, empfängerOid, message, isDeliverd, teamid, messageid);
|
||||
|
||||
@@ -96,7 +96,19 @@ namespace BeWo.View.Detail
|
||||
wh = itemssource.First(i => i.WohnheimOid == -1);
|
||||
}
|
||||
if (wh.WohnheimOid != -1)
|
||||
ViewModel.NewVM.Wohnheim = ServiceFacade.DoCustomerServiceSync(s => s.LoadWohnheim(wh.WohnheimOid));
|
||||
ViewModel.NewVM.Wohnheim = ServiceFacade.DoCustomerServiceSync(s => s.LoadWohnheim(wh.WohnheimOid));
|
||||
|
||||
if (ViewModel.NewVM.Farbe == null)
|
||||
{
|
||||
MessageBox.Show("Bitte wählen Sie für den Dienst eine Farbe aus.", "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
if (ViewModel.NewVM.Kurz == null)
|
||||
{
|
||||
MessageBox.Show("Bitte geben Sie für den Dienst ein Kürzel ein.", "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
ViewModel.AddNewVMToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,11 +189,17 @@ namespace BeWo.View.Detail
|
||||
|
||||
private void IcfImport_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var control = new IcfImportControl(ServiceFacade.DoOperationsServiceSync(x => x.GetIcf()));
|
||||
var vorhandeneZiele = new List<ValueListEntryDC>();
|
||||
|
||||
var control2 = new IcfImportControl(ServiceFacade.DoOperationsServiceSync(x => x.GetWholeIcf()), ViewModel.DCBackup.ToList());
|
||||
foreach (var item in GoalTree)
|
||||
{
|
||||
vorhandeneZiele.AddRange(GetAllChildren(item, null));
|
||||
}
|
||||
|
||||
var beWoWindow = new BeWoWindow
|
||||
//#if DEBUG
|
||||
var control2 = new IcfImportControl(ServiceFacade.DoOperationsServiceSync(x => x.GetWholeIcfOhneImportierte(vorhandeneZiele)));
|
||||
|
||||
var beWoWindow2 = new BeWoWindow
|
||||
{
|
||||
rootGroupBox = { Header = "Icf Importieren" },
|
||||
Height = 500,
|
||||
@@ -206,16 +212,77 @@ namespace BeWo.View.Detail
|
||||
control2.ButtonImportClicked += () =>
|
||||
{
|
||||
ImportIcf(control2.TreeViewGoalItem);
|
||||
beWoWindow.Close();
|
||||
beWoWindow2.Close();
|
||||
};
|
||||
|
||||
control2.ButtonCancelClicked += () =>
|
||||
{
|
||||
beWoWindow.Close();
|
||||
beWoWindow2.Close();
|
||||
};
|
||||
|
||||
beWoWindow.ShowDialog();
|
||||
beWoWindow2.ShowDialog();
|
||||
|
||||
return;
|
||||
//#endif
|
||||
//var control = new IcfImportControl(ServiceFacade.DoOperationsServiceSync(x => x.GetWholeIcf()));
|
||||
|
||||
//var beWoWindow = new BeWoWindow
|
||||
//{
|
||||
// rootGroupBox = { Header = "Icf Importieren" },
|
||||
// Height = 500,
|
||||
// Width = 500,
|
||||
// WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
// GroupBoxContent = control,
|
||||
// Owner = BeWoApp.CurrentBeWo.MainWindow
|
||||
//};
|
||||
|
||||
//control.ButtonImportClicked += () =>
|
||||
//{
|
||||
// ImportIcf(control.TreeViewGoalItem);
|
||||
// beWoWindow.Close();
|
||||
//};
|
||||
|
||||
//control.ButtonCancelClicked += () =>
|
||||
//{
|
||||
// beWoWindow.Close();
|
||||
//};
|
||||
|
||||
//beWoWindow.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
public List<ValueListEntryDC> GetAllChildren(SupportConceptGoalTreeItem treeItem, SupportConceptGoalDC dcItem)
|
||||
{
|
||||
List<ValueListEntryDC> returnThis = new List<ValueListEntryDC>();
|
||||
|
||||
if (dcItem == null)
|
||||
{
|
||||
returnThis.Add(treeItem.GoalEntryDC);
|
||||
|
||||
if (treeItem.Children.Count > 0)
|
||||
{
|
||||
foreach (var child in treeItem.Children)
|
||||
{
|
||||
returnThis.AddRange(GetAllChildren(null, child));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (treeItem == null)
|
||||
{
|
||||
returnThis.Add(dcItem.GoalEntryDC);
|
||||
|
||||
if (dcItem.Children.Count > 0)
|
||||
{
|
||||
foreach (var child in dcItem.Children)
|
||||
{
|
||||
returnThis.AddRange(GetAllChildren(null, child));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnThis;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsAllowedToEditGoals => BeWoApp.LoggedOnUser.HasRight(UserRightType.SupportConcept_AllowEditGoals);
|
||||
|
||||
|
||||
@@ -30,16 +30,19 @@ namespace BeWo.View.Detail.Report
|
||||
|
||||
public event Action ButtonImportClicked;
|
||||
public event Action ButtonCancelClicked;
|
||||
private List<ValueListEntryDC> _GanzerICF;
|
||||
private SupportConceptGoalDC _TreeViewGoalItem;
|
||||
|
||||
|
||||
public IcfImportControl(List<ValueListEntryDC> icfs)
|
||||
public IcfImportControl(List<ValueListEntryDC> icfNachAbzug)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this;
|
||||
|
||||
InitTreeView(icfs);
|
||||
//_GanzerICF = ServiceFacade.DoOperationsServiceSync(s => s.GetWholeIcf());
|
||||
|
||||
InitTreeView(icfNachAbzug);
|
||||
|
||||
}
|
||||
public IcfImportControl(List<ValueListEntryDC> icfs, List<ValueListEntryDC> vorhandeneKapitel)
|
||||
@@ -48,25 +51,10 @@ namespace BeWo.View.Detail.Report
|
||||
|
||||
DataContext = this;
|
||||
|
||||
icfs.RemoveRange(TestMethod(icfs, vorhandeneKapitel)); // KLAPPT NICHT
|
||||
|
||||
InitTreeView(icfs);
|
||||
|
||||
}
|
||||
|
||||
private List<ValueListEntryDC> TestMethod(List<ValueListEntryDC> icfs, List<ValueListEntryDC> vorhandeneKapitel)
|
||||
{
|
||||
var listeMitUeberschneidungen = new List<ValueListEntryDC>();
|
||||
|
||||
foreach (var chapter in icfs)
|
||||
{
|
||||
if (vorhandeneKapitel.Contains(chapter))
|
||||
listeMitUeberschneidungen.Add(chapter);
|
||||
}
|
||||
|
||||
return listeMitUeberschneidungen;
|
||||
}
|
||||
|
||||
private void ButtonImport_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ButtonImportClicked?.Invoke();
|
||||
@@ -121,13 +109,65 @@ namespace BeWo.View.Detail.Report
|
||||
|
||||
return goalItem;
|
||||
}
|
||||
|
||||
private void InitTreeView(List<ValueListEntryDC> icfs)
|
||||
// in icfNachAbzug stehen alle Ziele, die noch NICHT in die Ansicht importiert wurden, aber die Überkategorien sind noch vorhanden, auch wenn sie leer sind
|
||||
private static SupportConceptGoalDC GetSupportConceptGoalVersion2(SupportConceptGoalDC parent, ValueListEntryDC actual, List<ValueListEntryDC> icfNachAbzug,
|
||||
List<ValueListEntryDC> allIcfs)
|
||||
{
|
||||
if (icfs == null || icfs.All(x => x.ParentOid != -1))
|
||||
var goalItem = new SupportConceptGoalDC
|
||||
{
|
||||
GoalEntryDC = actual,
|
||||
ParentGoal = parent
|
||||
};
|
||||
if (parent == null)
|
||||
{
|
||||
goalItem.IsExpanded = true;
|
||||
}
|
||||
// Sucht nach Einträgen, wo die ParentID gleich der actual.Oid ist
|
||||
List<ValueListEntryDC> remaining = new List<ValueListEntryDC>();
|
||||
foreach (var item in icfNachAbzug)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
if (item.ParentOid == actual.ValueListEntryOid)
|
||||
remaining.Add(item);
|
||||
}
|
||||
}
|
||||
List<ValueListEntryDC> toRemove = new List<ValueListEntryDC>();
|
||||
|
||||
foreach (var chapter in remaining)
|
||||
{
|
||||
if (allIcfs.Any(i => i.ParentOid == chapter.ValueListEntryOid)) // Checken, ob das Kapitel EIGENTLICH Children hat
|
||||
{
|
||||
if (!icfNachAbzug.Any(c => c.ParentOid == chapter.ValueListEntryOid)) // Checken, ob die Children da sind und wenn nicht, aus remaining entfernen
|
||||
{
|
||||
icfNachAbzug.Remove(chapter);
|
||||
|
||||
if (remaining.Contains(chapter))
|
||||
toRemove.Add(chapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
remaining.RemoveRange(toRemove);
|
||||
|
||||
// Schaut, ob welche gefunden worden, sonst bleibt Children leer
|
||||
if (remaining.Any())
|
||||
{
|
||||
goalItem.Children = remaining.Select(x => GetSupportConceptGoalVersion2(goalItem, x, icfNachAbzug, allIcfs)).ToList();
|
||||
}
|
||||
|
||||
return goalItem;
|
||||
}
|
||||
|
||||
private void InitTreeView(List<ValueListEntryDC> icfNachAbzug)
|
||||
{
|
||||
if (icfNachAbzug == null || icfNachAbzug.All(x => x.ParentOid != -1))
|
||||
return;
|
||||
|
||||
TreeViewGoalItem = GetSupportConceptGoal(null, icfs.Find(x => x.ParentOid == -1), icfs);
|
||||
TreeViewGoalItem = GetSupportConceptGoal(null, icfNachAbzug.Find(x => x.ParentOid == -1), icfNachAbzug);
|
||||
//#if DEBUG
|
||||
// TreeViewGoalItem = GetSupportConceptGoalVersion2(null, icfNachAbzug.Find(x => x.ParentOid == -1), icfNachAbzug, _GanzerICF);
|
||||
//#endif
|
||||
// Hier müsste eigentlich alle ohne Children, die eigentlich welche haben, aussortiert werden..
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace BeWo.View.Detail
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Läuft durch aber ruft nichts auf
|
||||
CreateModalViewWindow(ViewModel.WohnheimTeamRelations);
|
||||
}
|
||||
private void popupedit_TeamRelations_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BeWo.Data.ICF
|
||||
var counter = 0;
|
||||
foreach (var list in returnvalueList)
|
||||
{
|
||||
if (listEntries.Count == 0)
|
||||
if (listEntries.Count == 0) // Im ersten Durchlauf ICF und 4 Klassifikationen einsetzen
|
||||
{
|
||||
listEntries.Add(list[0]);
|
||||
listEntries = AddKlassifikationen(listEntries);
|
||||
@@ -119,7 +119,7 @@ namespace BeWo.Data.ICF
|
||||
|
||||
if (item.DisplayName != "ICF")
|
||||
{
|
||||
if (item.ParentOid == null)
|
||||
if (item.ParentOid == -999)
|
||||
item.ParentOid = (int)parentOid;
|
||||
listEntries.Add(item);
|
||||
}
|
||||
@@ -137,25 +137,25 @@ namespace BeWo.Data.ICF
|
||||
listEntries.Add(new ValueListEntryDC()
|
||||
{
|
||||
TypeDescription = "Klassifikation der Körperfunktionen (Komponente b)",
|
||||
ParentOid = null,
|
||||
ParentOid = -999,
|
||||
ValueListEntryOid = -2
|
||||
});
|
||||
listEntries.Add(new ValueListEntryDC()
|
||||
{
|
||||
TypeDescription = "Klassifikation der Körperstrukturen (Komponente s)",
|
||||
ParentOid = null,
|
||||
ParentOid = -999,
|
||||
ValueListEntryOid = -3
|
||||
});
|
||||
listEntries.Add(new ValueListEntryDC()
|
||||
{
|
||||
TypeDescription = "Klassifikation der Aktivitäten und Partizipationen (Komponente d)",
|
||||
ParentOid = null,
|
||||
ParentOid = -999,
|
||||
ValueListEntryOid = -4
|
||||
});
|
||||
listEntries.Add(new ValueListEntryDC()
|
||||
{
|
||||
TypeDescription = "Klassifikation der Umweltfaktoren (Komponente e)",
|
||||
ParentOid = null,
|
||||
ParentOid = -999,
|
||||
ValueListEntryOid = -5
|
||||
});
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace BeWo.Data.ICF
|
||||
public static IList<ValueListEntryDC> GetChildren(XElement xElement, long? parentId, ref long id)
|
||||
{
|
||||
var icfs = new List<ValueListEntryDC>();
|
||||
var actualEntry = GenerateValueListEntryDC(xElement, parentId, ref id); // "s": Hier beim ersten Element nach "ICF" Fehler
|
||||
var actualEntry = GenerateValueListEntryDC(xElement, parentId, ref id);
|
||||
|
||||
icfs.Add(actualEntry);
|
||||
|
||||
@@ -175,12 +175,11 @@ namespace BeWo.Data.ICF
|
||||
var xElementSubClassesCodes = xElementSubClasses.Select(x => x.Attribute("code").Value);
|
||||
var allClasses = _File.Descendants("Class");
|
||||
var subClasses = allClasses.Where(x => xElementSubClassesCodes.Contains(x.Attribute("code").Value));
|
||||
// "s": Bis hierher alles normal gefüllt
|
||||
|
||||
if (subClasses.Any())
|
||||
{
|
||||
foreach (var subClass in subClasses)
|
||||
{ // Hier Fehler bei 2. Kategorie
|
||||
{
|
||||
icfs.AddRange(GetChildren(subClass, actualEntry.ValueListEntryOid, ref id));
|
||||
}
|
||||
}
|
||||
@@ -201,7 +200,7 @@ namespace BeWo.Data.ICF
|
||||
switch (xElement.Attribute("kind").Value)
|
||||
{
|
||||
case "component":
|
||||
return new ValueListEntryDC() { ParentOid = -1, TypeDescription = "ICF" };
|
||||
return new ValueListEntryDC() { ParentOid = -1, TypeDescription = "ICF", ValueListEntryOid = -999 };
|
||||
case "chapter": // Hier Fehler bei "s"
|
||||
|
||||
// Notice ist das Problem
|
||||
|
||||
@@ -866,6 +866,10 @@ namespace BeWo.Service.ServiceContracts
|
||||
[OperationContract]
|
||||
List<ValueListEntryDC> GetWholeIcf();
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
List<ValueListEntryDC> GetWholeIcfOhneImportierte(List<ValueListEntryDC> vorhandeneZiele);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
IList<ReportTemplateDC> GetReportTemplates(string url);
|
||||
|
||||
@@ -5702,6 +5702,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
#region auskommentiert
|
||||
//string key = "2BT%eGprU\"E$!\"5Flq@l^^KZaYa\"u/icq@MMSWsy$XFo@#q3Arbnx@Plzv7s\\+$a";
|
||||
|
||||
//string url = "https://support.bewoplaner.de/api/geticf.php?k=[TENANT]";
|
||||
@@ -5753,7 +5754,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
//}));
|
||||
|
||||
//var wholeICF = ICFDAO.GetWholeIcf();
|
||||
|
||||
#endregion
|
||||
|
||||
return ICFDAO.GetIcf();
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -5772,6 +5774,126 @@ namespace BeWo.Service.ServiceImplementations
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
public List<ValueListEntryDC> GetWholeIcfOhneImportierte(List<ValueListEntryDC> vorhandeneZiele)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ValueListEntryDC> listeMitUeberschneidungen = new List<ValueListEntryDC>();
|
||||
var icf = ICFDAO.GetWholeIcf();
|
||||
|
||||
foreach (var chapter in icf)
|
||||
{
|
||||
foreach (var vorhandenesKapitel in vorhandeneZiele)
|
||||
{
|
||||
// TEMPORÄR ZUM TESTEN; Richtiger Ansatz, aber muss differenzieren, ob es oberkapitel sind
|
||||
if (vorhandenesKapitel != null && vorhandenesKapitel.DisplayName == chapter.DisplayName && !vorhandenesKapitel.DisplayName.Contains("ICF") &&
|
||||
!vorhandenesKapitel.DisplayName.Contains("Komponente") && !vorhandenesKapitel.DisplayName.Contains("Kapitel"))
|
||||
{
|
||||
if (!icf.Any(c => c.ParentOid == vorhandenesKapitel.ValueListEntryOid))
|
||||
{
|
||||
listeMitUeberschneidungen.Add(chapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Statt Parent-Objekten vllt eher Children zusammensuchen?
|
||||
List<ValueListEntryDC> parentObjekte = new List<ValueListEntryDC>();
|
||||
foreach (var item in listeMitUeberschneidungen)
|
||||
{
|
||||
if (item.ValueListEntryOid == 85)
|
||||
Console.WriteLine("hallo");
|
||||
if (item.ParentOid != null)
|
||||
{
|
||||
var parent = listeMitUeberschneidungen.FirstOrDefault(i => i.ValueListEntryOid == item.ParentOid);
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
parentObjekte.Add(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
//listeMitUeberschneidungen.RemoveRange(parentObjekte);
|
||||
|
||||
Dictionary<long?, List<ValueListEntryDC>> alleKinderDerVadderOid = new Dictionary<long?, List<ValueListEntryDC>>();
|
||||
foreach (var item in icf)
|
||||
{
|
||||
if (item.ParentOid.HasValue && !alleKinderDerVadderOid.ContainsKey(item.ParentOid.Value))
|
||||
{
|
||||
alleKinderDerVadderOid.Add(item.ParentOid.Value, new List<ValueListEntryDC>());
|
||||
}
|
||||
if (alleKinderDerVadderOid.ContainsKey(item.ParentOid.Value))
|
||||
{
|
||||
alleKinderDerVadderOid[item.ParentOid.Value].Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//icf.RemoveRange(listeMitUeberschneidungen);
|
||||
|
||||
icf = EntferneParentOhneKinder(listeMitUeberschneidungen, alleKinderDerVadderOid, icf);
|
||||
|
||||
var funktionenDesBewusstseins = icf.Where(i => i.DisplayName.Contains("Funktionen des Bewusstseins")).ToList();
|
||||
|
||||
return icf;
|
||||
|
||||
// Komplett importiertes verschwindet jetzt, außer alles, wo "Kapitel", "Komponente" oder "ICF" enthalten ist (if-Bedingungen weiter oben)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
// enthält alles, außer das, was gebraucht wird
|
||||
private List<ValueListEntryDC> EntferneParentOhneKinder(List<ValueListEntryDC> listeMitUeberschneidungen, Dictionary<long?, List<ValueListEntryDC>> alleKinderDerVadderOid, List<ValueListEntryDC> icf)
|
||||
{
|
||||
// Zum Zeitpunkt des Aufrufens dieser Methode sind alle Ziele, die bereits importiert wurden, aus dem ICF entfernt, sofern diese keine Kinder mehr haben
|
||||
// (also alle "Blätter" des Baums. Die leeren Äste sind allerdings noch da. Jeder Ast muss jetzt geprüft werden, und zwar darauf, ob er noch mindestens ein Blatt hat)
|
||||
List<ValueListEntryDC> toRemove = new List<ValueListEntryDC>();
|
||||
|
||||
foreach (var item in listeMitUeberschneidungen)
|
||||
{
|
||||
var kinderlisteFuerCurrent = (alleKinderDerVadderOid.ContainsKey(item.ValueListEntryOid)) ? alleKinderDerVadderOid[item.ValueListEntryOid] : null;
|
||||
bool enthealtBereitsAlleKinder = true;
|
||||
|
||||
if (kinderlisteFuerCurrent != null)
|
||||
{
|
||||
foreach (var child in kinderlisteFuerCurrent)
|
||||
{
|
||||
if (!listeMitUeberschneidungen.Contains(child))
|
||||
{
|
||||
enthealtBereitsAlleKinder = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enthealtBereitsAlleKinder)
|
||||
toRemove.Add(item);
|
||||
}
|
||||
|
||||
//icf.RemoveRange(toRemove); // Entfernen klappt nicht
|
||||
|
||||
for (int i = icf.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var current = icf[i];
|
||||
foreach (var c in toRemove) // In toRemove stehen alle drin, die nicht sollen, und nur das gewollte fehlt (noch in listeMitUeberschneidungen)
|
||||
{
|
||||
if (current.ValueListEntryOid == 85)
|
||||
Console.WriteLine("hallo"); // Es gibt im ICF keinen Eintrag damit.. hä?
|
||||
if (c.ValueListEntryOid == 85)
|
||||
Console.WriteLine("hallo");
|
||||
|
||||
if (c.ValueListEntryOid == current.ValueListEntryOid)
|
||||
{
|
||||
icf.Remove(c); // Code kommt hier nicht an
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return icf;
|
||||
}
|
||||
|
||||
public IList<ReportTemplateDC> GetReportTemplates(string url)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user