603 lines
20 KiB
C#
603 lines
20 KiB
C#
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Navigation;
|
|
|
|
using BeWo.Core;
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.View.Detail;
|
|
using BeWo.View.Navigation.Filter;
|
|
using BeWo.View.Navigation.Sorter;
|
|
using BeWo.ViewModel;
|
|
using BeWo.Core.Service;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Translation;
|
|
|
|
using Microsoft.Win32;
|
|
using BeWo.View.Document;
|
|
using DevExpress.Mvvm;
|
|
using System;
|
|
using BeWo.View.Windows;
|
|
using System.Collections;
|
|
using System.Windows.Input;
|
|
using BeWo.Core.Commands;
|
|
using BeWo.ViewModel.View.AI;
|
|
using DevExpress.Xpf.Editors;
|
|
|
|
namespace BeWo.View.Navigation
|
|
{
|
|
/// <summary>
|
|
/// Interaktionslogik für CustomerNavigationView.xaml
|
|
/// </summary>
|
|
public partial class CustomerNavigationView
|
|
{
|
|
//private readonly CheckBox chkShowOnlyMyCustomers;
|
|
//private readonly CheckBox chkShowOnlyTeamCustomers;
|
|
private readonly ComboBox supportConceptFilterComboBox;
|
|
private readonly ComboBoxEdit betreuungsartFilterComboBox;
|
|
|
|
private IEnumerable<IFilterableDC> objectList;
|
|
private IEnumerable<IFilterableDC> recentList;
|
|
|
|
public CustomerNavigationView()
|
|
{
|
|
InitializeComponent();
|
|
|
|
//mainNavigationView.OpenAiWindowCommand = CommandFactory.GetAiViewCommand(OpenAiWindow, UserRightType.AiModuleChatView);
|
|
|
|
mainNavigationView.Sorter = new CustomerSorter();
|
|
mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_AllowArchiving);
|
|
mainNavigationView.ShowArchivedObjectsVisible = true;
|
|
|
|
|
|
supportConceptFilterComboBox = new ComboBox();
|
|
//supportConceptFilterComboBox.HorizontalAlignment = "Left";
|
|
//supportConceptFilterComboBox.FontFamily = "Microsoft Sans Serif";
|
|
|
|
//supportConceptFilterComboBox.Foreground = new SolidColorBrush(Color.FromRgb(210, 210, 210));
|
|
supportConceptFilterComboBox.FontSize = 12;
|
|
supportConceptFilterComboBox.Margin = new Thickness(10, 0, 0, 0);
|
|
supportConceptFilterComboBox.MinWidth = 100;
|
|
//supportConceptFilterComboBox.DisplayMemberPath = "DisplayName";
|
|
//supportConceptFilterComboBox.SelectionChanged = "sortCombo_SelectionChanged";
|
|
supportConceptFilterComboBox.Style = FindResource("SortComboBox") as Style;
|
|
|
|
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View) || BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll))
|
|
{
|
|
supportConceptFilterComboBox.Items.Add(new CustomerFilterItem(CustomerFilterEnum.All));
|
|
}
|
|
|
|
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_ViewMyTeams))
|
|
{
|
|
supportConceptFilterComboBox.Items.Add(new CustomerFilterItem(CustomerFilterEnum.TeamCustomer));
|
|
}
|
|
supportConceptFilterComboBox.Items.Add(new CustomerFilterItem(CustomerFilterEnum.MyCustomer));
|
|
|
|
CustomerFilterItem selectedItem = null;
|
|
|
|
switch (BeWoApp.AppSettings.CustomerFilterSupportConcepts)
|
|
{
|
|
case CustomerFilterEnum.All:
|
|
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View) || BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll))
|
|
{
|
|
selectedItem = new CustomerFilterItem(CustomerFilterEnum.All);
|
|
}
|
|
|
|
break;
|
|
case CustomerFilterEnum.TeamCustomer:
|
|
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View) ||
|
|
BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll) ||
|
|
BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_ViewMyTeams))
|
|
{
|
|
selectedItem = new CustomerFilterItem(CustomerFilterEnum.TeamCustomer);
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
if (selectedItem == null)
|
|
{
|
|
selectedItem = new CustomerFilterItem(CustomerFilterEnum.MyCustomer);
|
|
}
|
|
|
|
supportConceptFilterComboBox.SelectedItem = selectedItem;
|
|
supportConceptFilterComboBox.SelectionChanged += SupportConceptFilterComboBoxOnSelectionChanged;
|
|
|
|
//chkShowOnlyMyCustomers = new CheckBox
|
|
// {
|
|
// FontSize = 12,
|
|
// Margin = new Thickness(10, 0, 0, 0),
|
|
// Content = Translator.Translate("Meine Klienten"),
|
|
// VerticalAlignment = VerticalAlignment.Center
|
|
// };
|
|
//chkShowOnlyTeamCustomers = new CheckBox
|
|
//{
|
|
// FontSize = 12,
|
|
// Margin = new Thickness(10, 0, 0, 0),
|
|
// Content = Translator.Translate("Klienten meines Teams"),
|
|
// VerticalAlignment = VerticalAlignment.Center
|
|
//};
|
|
|
|
//var b = FindResource("MainGroupBoxForegroundBrush") as Brush;
|
|
//if (b != null)
|
|
//{
|
|
// chkShowOnlyMyCustomers.Foreground = b;
|
|
// chkShowOnlyTeamCustomers.Foreground = b;
|
|
//}
|
|
|
|
//if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View) &&
|
|
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll))
|
|
//{
|
|
// chkShowOnlyMyCustomers.IsChecked = true;
|
|
// chkShowOnlyMyCustomers.IsEnabled = false;
|
|
//}
|
|
//else
|
|
//{
|
|
// chkShowOnlyMyCustomers.IsChecked = BeWoApp.AppSettings.ShowOnlyMyClients;
|
|
//}
|
|
|
|
//if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View) &&
|
|
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll))
|
|
//{
|
|
// chkShowOnlyTeamCustomers.IsChecked = true;
|
|
// chkShowOnlyTeamCustomers.IsEnabled = false;
|
|
//}
|
|
//else
|
|
//{
|
|
// chkShowOnlyTeamCustomers.IsChecked = BeWoApp.AppSettings.ShowOnlyTeamClients;
|
|
//}
|
|
|
|
//chkShowOnlyMyCustomers.Click += chkShowOnlyMyCustomers_Click;
|
|
//chkShowOnlyTeamCustomers.Click += chkShowOnlyMyCustomers_Click;
|
|
|
|
//mainNavigationView.AddControlToSortPanel(chkShowOnlyMyCustomers);
|
|
//mainNavigationView.AddControlToSortPanel(chkShowOnlyTeamCustomers);
|
|
var lbl = new TextBlock
|
|
{
|
|
Text = "Filter:",
|
|
FontSize = 12,
|
|
Margin = new Thickness(8, 2, -3, 0)
|
|
};
|
|
|
|
mainNavigationView.sortPanel.Children.Insert(3, lbl);
|
|
mainNavigationView.sortPanel.Children.Insert(4, supportConceptFilterComboBox);
|
|
|
|
betreuungsartFilterComboBox = new ComboBoxEdit();
|
|
betreuungsartFilterComboBox.FontSize = 12;
|
|
betreuungsartFilterComboBox.Margin = new Thickness(10, 0, 0, 0);
|
|
betreuungsartFilterComboBox.Width = 180;
|
|
betreuungsartFilterComboBox.IsTextEditable = false;
|
|
betreuungsartFilterComboBox.NullText = Translator.Translate("Nach Betreuungsart filtern");
|
|
betreuungsartFilterComboBox.ItemsSource = ServiceFacade.DoValueListServiceSync(s => s.GetAllValueListEntrysByType(ValueListEntryType.CustomerCareType));
|
|
betreuungsartFilterComboBox.DisplayMember = "TypeDescription";
|
|
betreuungsartFilterComboBox.StyleSettings = new CheckedComboBoxStyleSettings();
|
|
betreuungsartFilterComboBox.EditValueChanged += BetreuungsartComboBox_EditValueChanged;
|
|
|
|
//< dxe:ComboBoxEdit x:Name = "checkedComboBox"
|
|
// NullText = "Select categories"
|
|
// IsTextEditable = "False"
|
|
// ItemsSource = "{Binding Categories}"
|
|
// EditValue = "{Binding SelectedCategories}"
|
|
// DisplayMember = "CategoryName"
|
|
// ShowCustomItems = "True" >
|
|
// < dxe:ComboBoxEdit.StyleSettings >
|
|
// < dxe:CheckedComboBoxStyleSettings />
|
|
// </ dxe:ComboBoxEdit.StyleSettings >
|
|
// </ dxe:ComboBoxEdit >
|
|
|
|
lbl = new TextBlock
|
|
{
|
|
Text = Translator.Translate("Betreuungsart:"),
|
|
FontSize = 12,
|
|
Margin = new Thickness(8, 2, -3, 0)
|
|
};
|
|
|
|
mainNavigationView.sortPanel.Children.Insert(5, lbl);
|
|
mainNavigationView.sortPanel.Children.Insert(6, betreuungsartFilterComboBox);
|
|
|
|
|
|
|
|
|
|
UpdateCustomFilter();
|
|
}
|
|
|
|
public Dictionary<TableID, long[]> GetVisibleInformationReferences()
|
|
{
|
|
var visible = mainNavigationView.objectListBox.ItemsSource;
|
|
|
|
return GetVisibleInformationReferences(visible);
|
|
}
|
|
|
|
private Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable visible_customers)
|
|
{
|
|
var oids = new List<long>();
|
|
foreach (var c in visible_customers)
|
|
{
|
|
var customer = c as CompactCustomerDC;
|
|
oids.Add(customer.CustomerOid);
|
|
}
|
|
|
|
var dict = new Dictionary<TableID, long[]>() {
|
|
{ TableID.Customer, oids.Distinct().ToArray()}
|
|
};
|
|
|
|
return dict;
|
|
}
|
|
|
|
//private AiConversationChatViewModel getAiConversationChatViewModel()
|
|
//{
|
|
// throw new NotImplementedException();
|
|
//// var context = GetVisibleInformationReferences();
|
|
|
|
//// var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
|
|
|
|
//// return vm;
|
|
//}
|
|
|
|
//private void OpenAiWindow()
|
|
//{
|
|
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
|
|
//}
|
|
|
|
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
|
|
{
|
|
BeWoApp.AppSettings.CustomerFilterSupportConcepts = ((CustomerFilterItem)supportConceptFilterComboBox.SelectedItem)?.CustomerFilter ?? CustomerFilterEnum.MyCustomer;
|
|
|
|
BeWoApp.SaveAppSettings();
|
|
|
|
UpdateCustomFilter();
|
|
}
|
|
|
|
|
|
|
|
private void BetreuungsartComboBox_EditValueChanged(object sender, EditValueChangedEventArgs e)
|
|
{
|
|
UpdateCustomFilter();
|
|
}
|
|
|
|
private CustomFilter CreateNewCustomerFilter()
|
|
{
|
|
var filter = new CustomerNavigationFilter { CustomerFilter = ((CustomerFilterItem)supportConceptFilterComboBox.SelectedItem)?.CustomerFilter ?? CustomerFilterEnum.MyCustomer };
|
|
|
|
return filter;
|
|
}
|
|
|
|
private CustomFilter CreateNewBetreuungsartFilter()
|
|
{
|
|
if (betreuungsartFilterComboBox.SelectedItems == null)
|
|
return null;
|
|
|
|
var list = new List<ValueListEntryDC>();
|
|
foreach (var item in betreuungsartFilterComboBox.SelectedItems)
|
|
{
|
|
list.Add(item as ValueListEntryDC);
|
|
}
|
|
|
|
var filter = new ValueListFilter { SelectedValueListEntries = list, ValueListProperty = "CustomerCareTypes" };
|
|
|
|
return filter;
|
|
}
|
|
|
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
|
{
|
|
ServiceFacade.DoCustomerServiceAsync(s => s.ConvertToNewSubstitutionType(), n => this.Dispatch(delegate
|
|
{
|
|
ReloadData(false);
|
|
}));
|
|
|
|
CommandManager.InvalidateRequerySuggested();
|
|
}
|
|
|
|
private void UpdateCustomFilter()
|
|
{
|
|
mainNavigationView.CustomFilters = new List<CustomFilter> { CreateNewCustomerFilter(), CreateNewBetreuungsartFilter() };
|
|
}
|
|
|
|
private void ChkShowOnlyMyCustomers_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
//if (chkShowOnlyMyCustomers.IsChecked != null)
|
|
// BeWoApp.AppSettings.ShowOnlyMyClients = chkShowOnlyMyCustomers.IsChecked.Value;
|
|
//if (chkShowOnlyTeamCustomers.IsChecked != null)
|
|
// BeWoApp.AppSettings.ShowOnlyTeamClients = chkShowOnlyTeamCustomers.IsChecked.Value;
|
|
BeWoApp.SaveAppSettings();
|
|
|
|
UpdateCustomFilter();
|
|
}
|
|
|
|
private bool mainNavigationView_ArchiveObject(IFilterableDC obj)
|
|
{
|
|
var cdc = obj as CompactCustomerDC;
|
|
if (cdc != null)
|
|
{
|
|
if (MessageBox.Show(Translator.Translate("Wollen Sie den Klient '{0}' wirklich archivieren?", cdc.FirstName + " " + cdc.LastName), "Archivieren", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
|
|
{
|
|
ServiceFacade.DoCustomerServiceAsync(
|
|
s =>
|
|
{
|
|
s.ArchiveCustomer(cdc.CustomerOid, cdc.CustomerVersion);
|
|
return cdc;
|
|
},
|
|
cb => cb.CustomerVersion++);
|
|
|
|
Cache.GetInstance().ClearSupportConceptTree();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
private void mainNavigationView_CreateNewObject()
|
|
{
|
|
VMFactory.CreateCustomerVMAsync(cb => this.Dispatch(() => MainControl.NavigateTo(new CustomerView(cb) { ParentView = this })));
|
|
}
|
|
|
|
private bool mainNavigationView_DeleteObject(IFilterableDC obj)
|
|
{
|
|
var cdc = obj as CompactCustomerDC;
|
|
if (cdc != null)
|
|
{
|
|
if (MessageBox.Show(Translator.Translate("Wollen Sie den Klient '{0}' wirklich löschen?", cdc.FirstName + " " + cdc.LastName), "Löschen", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
|
|
{
|
|
|
|
CustomerInfoDC details = ServiceFacade.DoOperationsServiceSync(s => s.GetCustomerInfosForCustomerOid(cdc.CustomerOid));
|
|
bool delete = true;
|
|
if (details != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(details.CurrentSupportConcept) && details.CurrentSupportConcept.ToLower() != Translator.Translate("Kein aktueller Hilfeplan").ToLower())
|
|
{
|
|
if (MessageBox.Show(Translator.Translate("Für Klient '{0}' wurde bereits ein Hilfeplan angelegt. Der Hilfeplan wird dadurch auch gelöscht!\n Möchten Sie wirklich fortfahren und den Klient löschen?", cdc.FirstName + " " + cdc.LastName), "Löschen", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.No)
|
|
{
|
|
delete = false;
|
|
}
|
|
}
|
|
|
|
}
|
|
if (delete)
|
|
{
|
|
|
|
ServiceFacade.DoCustomerServiceAsync(
|
|
s =>
|
|
{
|
|
s.DeactivateCustomer(cdc.CustomerOid, cdc.CustomerVersion);
|
|
return cdc;
|
|
}, cb => cb.CustomerVersion++);
|
|
|
|
Cache.GetInstance().ClearSupportConceptTree();
|
|
return true;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
private void mainNavigationView_ExcelExport(object sender, EventArgs<IEnumerable<IFilterableDC>> e)
|
|
{
|
|
var path = BeWoApp.GetAndCreateUserAppDataPath() + Translator.Translate("\\Klienten.xls");
|
|
|
|
var sf = new SaveFileDialog { FileName = Path.GetFileName(path), Filter = "Microsoft Excel 97-2003-Arbeitsblatt|*.xls|Alle Dateien|*.*" };
|
|
if (sf.ShowDialog() != true)
|
|
return;
|
|
|
|
ServiceFacade.DoDownloadServiceSync(s => BeWoUtils.WriteExcelFile(s.PrepareExcelFileCustomerExport(mainNavigationView.DownloadLinkEngine.ExcelFileId, e.Data.Cast<CompactCustomerDC>().Select(c => c.CustomerOid).ToList()), sf.FileName));
|
|
}
|
|
|
|
private void mainNavigationView_OpenObject(IFilterableDC obj)
|
|
{
|
|
var cdc = obj as CompactCustomerDC;
|
|
if (cdc != null)
|
|
{
|
|
VMFactory.CreateCustomerVMAsync(cdc.CustomerOid, cb => this.Dispatch(() => MainControl.NavigateTo(new CustomerView(cb) { ParentView = this })));
|
|
}
|
|
}
|
|
|
|
public override void ChildViewClosed()
|
|
{
|
|
recentList = null;
|
|
objectList = null;
|
|
}
|
|
private void MainNavigationView_OnReloadData()
|
|
{
|
|
ReloadData(true);
|
|
}
|
|
|
|
private void ReloadData(bool refresh)
|
|
{
|
|
if (refresh || recentList == null)
|
|
{
|
|
ServiceFacade.DoCustomerServiceAsync(
|
|
s => s.GetAllCustomersCompact(BeWoApp.LoggedOnUser.Employee.EmployeeOid),
|
|
r => this.Dispatch(delegate
|
|
{
|
|
objectList = r;
|
|
|
|
mainNavigationView.ShowSearchResult(objectList);
|
|
}));
|
|
|
|
ServiceFacade.DoCustomerServiceAsync(s => s.GetLastOpenedCustomers(),
|
|
r =>
|
|
this.Dispatch(delegate
|
|
{
|
|
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View) || BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll))
|
|
{
|
|
recentList = r;
|
|
}
|
|
else if (BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_ViewMyCustomers))
|
|
{
|
|
recentList = r.Where(w => BeWoApp.LoggedOnEmployee.RelatedCustomers.Select(s3 => s3.Customer.CustomerOid).Contains(w.CustomerOid));
|
|
}
|
|
else
|
|
{
|
|
recentList = new List<IFilterableDC>();
|
|
}
|
|
|
|
mainNavigationView.ShowHistory(recentList);
|
|
|
|
#if DEBUG
|
|
if (DebugConfig.CurrentConfig is object && DebugConfig.CurrentConfig.DebugConfigMode == DebugConfigMode.FeatureCustomerWohnhilfe)
|
|
{
|
|
mainNavigationView_OpenObject(recentList.FirstOrDefault() ?? objectList.FirstOrDefault());
|
|
}
|
|
#endif
|
|
})
|
|
);
|
|
}
|
|
else
|
|
{
|
|
mainNavigationView.ShowSearchResult(objectList);
|
|
mainNavigationView.ShowHistory(recentList);
|
|
}
|
|
}
|
|
|
|
private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
|
{
|
|
var alleVorlagen = ServiceFacade.DoOperationsServiceSync(s => s.GetDokumentvorlagenForType(TableID.Customer));
|
|
if (alleVorlagen.Count > 0)
|
|
{
|
|
var c = (CompactCustomerDC)((Hyperlink)sender).Tag;
|
|
|
|
DokumentViewHelper.OpenTemplateSelectionDialog(alleVorlagen, TableID.Customer, c.CustomerOid, ((Hyperlink)sender).NavigateUri.ToString(), null, null);
|
|
}
|
|
else
|
|
{
|
|
BeWoUtils.NavigateToReportUri(((Hyperlink)sender).NavigateUri.ToString(), "Druckvorschau");
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void MainNavigationView_OnOpenMailMergeWindow(List<IFilterableDC> allCustomers, IFilterableDC selectedCustomer)
|
|
{
|
|
var mmw = new MailMergeWindow(this, typeof(CustomerDC), objectList.ToList(), selectedCustomer) { Sorter = new CustomerSorter() };
|
|
|
|
mmw.Show();
|
|
}
|
|
|
|
private void Hyperlink_Reaktivieren_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var customer = (CompactCustomerDC)((Hyperlink)sender).Tag;
|
|
|
|
if (MessageBox.Show(Translator.Translate("Wollen Sie den Klient '{0}' wirklich reaktivieren?", customer.FirstName + " " + customer.LastName), "Reaktivieren", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.No)
|
|
{
|
|
return;
|
|
}
|
|
|
|
ServiceFacade.DoCustomerServiceAsync(s =>
|
|
{
|
|
s.ReactivateCustomer(customer.CustomerOid, customer.CustomerVersion);
|
|
return customer;
|
|
}, cb => cb.CustomerVersion++);
|
|
|
|
Cache.GetInstance().ClearSupportConceptTree();
|
|
|
|
customer.ActivationType = ActivationTypeId.Active;
|
|
var context = mainNavigationView.objectListBox.DataContext;
|
|
mainNavigationView.objectListBox.DataContext = null;
|
|
mainNavigationView.objectListBox.DataContext = context;
|
|
}
|
|
|
|
private void Hyperlink_AusArchivHolen_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var customer = (CompactCustomerDC)((Hyperlink)sender).Tag;
|
|
|
|
if (MessageBox.Show(Translator.Translate("Wollen Sie den Klient '{0}' wirklich aus dem Archiv holen?", customer.FirstName + " " + customer.LastName), "Reaktivieren", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.No)
|
|
{
|
|
return;
|
|
}
|
|
|
|
ServiceFacade.DoCustomerServiceAsync(s =>
|
|
{
|
|
s.ReactivateCustomer(customer.CustomerOid, customer.CustomerVersion);
|
|
return customer;
|
|
}, cb => cb.CustomerVersion++);
|
|
|
|
Cache.GetInstance().ClearSupportConceptTree();
|
|
|
|
customer.ActivationType = ActivationTypeId.Active;
|
|
var context = mainNavigationView.objectListBox.DataContext;
|
|
mainNavigationView.objectListBox.DataContext = null;
|
|
mainNavigationView.objectListBox.DataContext = context;
|
|
}
|
|
|
|
private void Hyperlink_Anonymize_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var customer = (CompactCustomerDC)((Hyperlink)sender).Tag;
|
|
|
|
var dialog = new MessageDialog(() =>
|
|
{
|
|
this.Dispatch(() =>
|
|
{
|
|
ServiceFacade.DoOperationsServiceAsync(s =>
|
|
{
|
|
s.AnonymizeCustomer(customer.CustomerOid);
|
|
}, () =>
|
|
{
|
|
ReloadData(true);
|
|
});
|
|
});
|
|
});
|
|
|
|
ServiceFacade.DoOperationsServiceAsync(s => s.GetMessageFromServer(TableID.Customer, customer.CustomerOid, MessageType.Anonymization), xaml =>
|
|
{
|
|
this.Dispatch(() =>
|
|
{
|
|
dialog.SetXaml(xaml);
|
|
dialog.ShowDialog();
|
|
});
|
|
});
|
|
}
|
|
|
|
private void Hyperlink_Delete_For_Good_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var customer = (CompactCustomerDC)((Hyperlink)sender).Tag;
|
|
|
|
var dialog = new MessageDialog(() =>
|
|
{
|
|
this.Dispatch(() =>
|
|
{
|
|
ServiceFacade.DoOperationsServiceAsync(s =>
|
|
{
|
|
s.DeleteCustomerForGood(customer.CustomerOid);
|
|
}, () => { ReloadData(true); });
|
|
});
|
|
});
|
|
|
|
ServiceFacade.DoOperationsServiceAsync(s => s.GetMessageFromServer(TableID.Customer, customer.CustomerOid, MessageType.DeleteForGood), xaml =>
|
|
{
|
|
this.Dispatch(() =>
|
|
{
|
|
dialog.SetXaml(xaml);
|
|
dialog.ShowDialog();
|
|
});
|
|
});
|
|
}
|
|
|
|
private void mainNavigationView_Print(object sender, EventArgs<IEnumerable<IFilterableDC>> e)
|
|
{
|
|
var oids = e.Data.Cast<CompactCustomerDC>().Select(c => c.CustomerOid).ToList();
|
|
|
|
ServiceFacade.DoReportServiceAsync(s => s.CreateCustomerListReport(oids), r =>
|
|
{
|
|
this.Dispatch(() =>
|
|
{
|
|
BeWoUtils.ShowReportWindow(r, Translator.Translate("Klienten"));
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} |