74 lines
2.6 KiB
C#
74 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.Converter
|
|
{
|
|
public class SupportConceptOverviewDCConverter : IMultiValueConverter
|
|
{
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (values.Length == 2 && values[0] is Dictionary<string, List<SupportConceptOverviewDC>> && values[1] is string)
|
|
{
|
|
// bool showOnlyMySupportConcepts = (bool)values[2];
|
|
//bool showOnlySCsExpiringNextThreeMonths = (bool)values[2];
|
|
|
|
// bool showOnlyArchived = (bool)values[4];
|
|
var lFilter = (values[1] as string).Split(" ");
|
|
|
|
var ret = new Dictionary<string, List<SupportConceptOverviewDC>>();
|
|
|
|
var dict = values[0] as Dictionary<string, List<SupportConceptOverviewDC>>;
|
|
|
|
foreach (var keyValuePair in dict)
|
|
{
|
|
string key = keyValuePair.Key;
|
|
|
|
// SupportConceptOverviewDC dc = kvp.Value;
|
|
// var filterText = dc.CustomerFirstName + " " + dc.CustomerLastName;
|
|
|
|
// bool valid = ((!showOnlyArchived && dc.ActivationType == ActivationTypeId.Active) ||
|
|
// (showOnlyArchived && dc.ActivationType == ActivationTypeId.Archived)) &&
|
|
// filterText.ContainsAll(lFilter);
|
|
|
|
// if (valid && showOnlyMySupportConcepts)
|
|
|
|
if (key.ContainsAll(lFilter))
|
|
{
|
|
List<SupportConceptOverviewDC> list = new List<SupportConceptOverviewDC>();
|
|
foreach (var item in keyValuePair.Value)
|
|
{
|
|
bool valid = true;
|
|
|
|
|
|
if (valid)
|
|
{
|
|
list.Add(item);
|
|
}
|
|
}
|
|
|
|
if (list.Count > 0)
|
|
{
|
|
ret.Add(key, list);
|
|
}
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |