5168 lines
202 KiB
C#
5168 lines
202 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
//using System.Drawing;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Animation;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Threading;
|
|
|
|
using BeWo.Controls;
|
|
using BeWo.Core;
|
|
using BeWo.Core.Service;
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.Validation;
|
|
using BeWo.View.Controls;
|
|
using BeWo.View.Search;
|
|
using BeWo.ViewModel;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.ClientPartials;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
using BS.Shared.Translation;
|
|
|
|
using DevExpress.Xpf.Bars;
|
|
using DevExpress.Xpf.Core;
|
|
using DevExpress.Xpf.Docking;
|
|
using DevExpress.Xpf.Docking.Platform;
|
|
using DevExpress.Xpf.Editors;
|
|
using DevExpress.Xpf.RichEdit;
|
|
using Microsoft.Win32;
|
|
using DevExpress.Xpf.Grid;
|
|
using Brushes = System.Windows.Media.Brushes;
|
|
using Color = System.Windows.Media.Color;
|
|
using ColorConverter = System.Windows.Media.ColorConverter;
|
|
using FontFamily = System.Windows.Media.FontFamily;
|
|
using Point = System.Windows.Point;
|
|
using Size = System.Windows.Size;
|
|
using SupportConceptService = BeWo.Core.Service.SupportConceptService;
|
|
using VerticalAlignment = System.Windows.VerticalAlignment;
|
|
using DependencyObject = System.Windows.DependencyObject;
|
|
using BeWo.View.Windows;
|
|
using BeWo.Core.Commands;
|
|
using BeWo.ViewModel.View.AI;
|
|
using System.Text;
|
|
|
|
namespace BeWo.View.Detail.Zeiterfassung
|
|
{
|
|
#pragma warning disable CS0618
|
|
public partial class ServiceRecordView2
|
|
{
|
|
public static Visibility InsertedOnAndByVisibility
|
|
{
|
|
get
|
|
{
|
|
return BeWoApp.AppSettings.HideServiceRecordInsertedByAndInsertedOn
|
|
? Visibility.Collapsed
|
|
: Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
private TextBox _GrosseDokuTextBox;
|
|
|
|
public List<CompactWohnheimDC> AlleWohnheime { get; private set; }
|
|
|
|
private GroupOfPeopleView _GroupOfPeopleModalPopUp;
|
|
|
|
private readonly Dictionary<DayOfWeek, CheckBox> _DayBoxes = new Dictionary<DayOfWeek, CheckBox>();
|
|
|
|
private CompactEmployeeDC _SelectedEmployee;
|
|
|
|
private long? _StartSupportConceptOid;
|
|
|
|
private ServiceRecordListVM _ViewModel;
|
|
|
|
private readonly AssessmentSheetEntryView _AssessmentSheet;
|
|
|
|
private ServiceRecordVM _LastSelectedVM;
|
|
|
|
private readonly Dictionary<CompactCustomerDC, List<AssessmentSheetCategoryDC>> _CustomerContainsAssessmentCategories = new Dictionary<CompactCustomerDC, List<AssessmentSheetCategoryDC>>();
|
|
|
|
private bool _IgnoreGroupMultiCheck;
|
|
|
|
private int _LastPosition;
|
|
|
|
public static double DocumentationTextBoxFontSize => BeWoApp.AppSettings.DocumentationFontSize;
|
|
|
|
public ServiceRecordView2(ServiceRecordListVM pViewModel, long? startSupportConceptOid)
|
|
{
|
|
InitializeComponent();
|
|
InitDateCombos();
|
|
|
|
multiSupportConceptControl.AutoGetAllAfterLoaded = false;
|
|
multiSupportConceptControl.EditGroupButtonClicked += MultiSupportConceptControl_EditGroupButtonClicked;
|
|
popup_content.Visibility = Visibility.Hidden;
|
|
|
|
InsertedByColumn.Visible = !BeWoApp.AppSettings.HideServiceRecordInsertedByAndInsertedOn;
|
|
InsertedOnColumn.Visible = !BeWoApp.AppSettings.HideServiceRecordInsertedByAndInsertedOn;
|
|
|
|
_StartSupportConceptOid = startSupportConceptOid;
|
|
|
|
ViewModel = pViewModel;
|
|
|
|
//serviceRecordListContent.
|
|
// CheckMinStdSwitch.SelectedIndex = 0;
|
|
|
|
//if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.LastNDays)
|
|
//{
|
|
// NDayTextbox.Visibility = Visibility.Visible;
|
|
// TimeIntervalComboBox.Visibility = Visibility.Collapsed;
|
|
|
|
// NLadenBtn.Visibility = Visibility.Visible;
|
|
//}
|
|
if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.XTage)
|
|
{
|
|
NDays.Visibility = Visibility.Visible;
|
|
}
|
|
else if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.ZeitraumWaehlen)
|
|
{
|
|
NDays_Von_Bis.Visibility = Visibility.Visible;
|
|
ZeitraumComboStackPanel.HorizontalAlignment = HorizontalAlignment.Right;
|
|
TimeIntervalComboBox.Width = 110;
|
|
}
|
|
else if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.Monatsauswahl)
|
|
{
|
|
MonatsauswahlGrid.Visibility = Visibility.Visible;
|
|
}
|
|
|
|
|
|
ViewModel.StatisticInfosLoaded += ViewModelOnStatisticInfosLoaded;
|
|
|
|
DownloadLinkEngine = new DownloadLinkEngine();
|
|
linkExcelExport.NavigateUri = DownloadLinkEngine.GenerateNewExcelLink();
|
|
|
|
if (!String.IsNullOrWhiteSpace(BeWoApp.AppSettings.TimeRecordingMenuName))
|
|
{
|
|
chkWithClient.Content = BeWoApp.AppSettings.TimeRecordingMenuName +
|
|
Translator.Translate(" für ausgewählten Klienten");
|
|
txtTimeRecording.Text = BeWoApp.AppSettings.TimeRecordingMenuName;
|
|
}
|
|
else
|
|
{
|
|
chkWithClient.Content = Translator.Translate("Zeiterfassung für ausgewählten Klienten");
|
|
txtTimeRecording.Text = Translator.Translate("Zeiterfassung");
|
|
}
|
|
|
|
numerictb_distance.Visibility = BeWoApp.AppSettings.ShowDistanceFields ? Visibility.Visible : Visibility.Collapsed;
|
|
lblDistance.Visibility = BeWoApp.AppSettings.ShowDistanceFields ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
DistanceGridColumn.Visible = BeWoApp.AppSettings.ShowDistanceFields;
|
|
|
|
numerictb_betrag.Visibility = BeWoApp.AppSettings.ShowBetrag ? Visibility.Visible : Visibility.Collapsed;
|
|
lblBetrag.Visibility = BeWoApp.AppSettings.ShowBetrag ? Visibility.Visible : Visibility.Collapsed;
|
|
BetragGridColumn.Visible = BeWoApp.AppSettings.ShowBetrag;
|
|
ButtonZeiterfassungErstellen.Visibility = BeWoApp.AppSettings.ShowKlientenBetreuungszeiten ? Visibility.Visible : Visibility.Collapsed;
|
|
#if DEBUG
|
|
ButtonZeiterfassungErstellen.Visibility = Visibility.Visible;
|
|
#endif
|
|
//this.numerictb_duration.TextChanged += (s, e) =>
|
|
// {
|
|
// if (string.IsNullOrEmpty(this.numerictb_duration.Text))
|
|
// {
|
|
// this.numerictb_duration.Value = 0;
|
|
// }
|
|
// };
|
|
|
|
combobox_services.SelectionChanged += (s, e) =>
|
|
{
|
|
if (combobox_services.SelectedIndex == -1)
|
|
{
|
|
combobox_services.SelectedIndex = 0;
|
|
}
|
|
};
|
|
|
|
//combobox_services_wohnheimbuchung.SelectionChanged += (s, e) =>
|
|
//{
|
|
// if (combobox_services_wohnheimbuchung.SelectedIndex == - 1)
|
|
// {
|
|
// combobox_services_wohnheimbuchung.SelectedIndex = 0;
|
|
// }
|
|
//};
|
|
|
|
InitDayCheckBoxes();
|
|
|
|
Loaded += ServiceRecordView2_Loaded;
|
|
|
|
supportConceptSelectionControl.ControlInitialized += SupportConceptSelectionControl_ControlInitialized;
|
|
|
|
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.AssessmentSheet_View))
|
|
{
|
|
_AssessmentSheet = new AssessmentSheetEntryView();
|
|
punktebogenRootGrid.Children.Clear();
|
|
punktebogenRootGrid.Children.Add(_AssessmentSheet);
|
|
_AssessmentSheet.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
punktebogenRootGrid.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
if (BeWoApp.AppSettings.ShowServiceRecordGridControl)
|
|
{
|
|
ChkDetailView.IsChecked = true;
|
|
//srListBox.Visibility = Visibility.Hidden;
|
|
//srGridControl.Visibility = Visibility.Visible;
|
|
}
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees))
|
|
{
|
|
employeeSearchView.SearchMode = SearchMode.OnlyTeamMember;
|
|
}
|
|
|
|
if (BeWoApp.AppSettings.ShowMarker)
|
|
{
|
|
chkContentFilter.Content = "Nur Marker anzeigen";
|
|
chkContentFilter.Visibility = Visibility.Visible;
|
|
|
|
chkServiceRecordTypeContent.Content = "Marker";
|
|
chkServiceRecordTypeContent.Visibility = Visibility.Visible;
|
|
|
|
}
|
|
else
|
|
{
|
|
if (BeWoApp.Mandator.BeWoClientType == 3)
|
|
{
|
|
//Köln Ring
|
|
chkContentFilter.Visibility = Visibility.Visible;
|
|
chkServiceRecordTypeContent.Visibility = Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
chkContentFilter.Visibility = Visibility.Collapsed;
|
|
chkServiceRecordTypeContent.Visibility = Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking))
|
|
{
|
|
chkGroupBooking.Visibility = Visibility.Collapsed;
|
|
}
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreatingMultiBooking))
|
|
{
|
|
chkMultiBooking.Visibility = Visibility.Collapsed;
|
|
}
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineAlleAnsehen) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineNurEigeneAnsehen))
|
|
{
|
|
TextbausteineButton1.Visibility = Visibility.Collapsed;
|
|
TextbausteineButtonRtf1.Visibility = Visibility.Collapsed;
|
|
|
|
TextbausteineButton2.Visibility = Visibility.Collapsed;
|
|
TextbausteineButtonRtf2.Visibility = Visibility.Collapsed;
|
|
|
|
TextbausteineButton3.Visibility = Visibility.Collapsed;
|
|
TextbausteineButtonRtf3.Visibility = Visibility.Collapsed;
|
|
|
|
TextbausteineButton4.Visibility = Visibility.Collapsed;
|
|
TextbausteineButtonRtf4.Visibility = Visibility.Collapsed;
|
|
|
|
TextbausteineButton5.Visibility = Visibility.Collapsed;
|
|
TextbausteineButtonRtf5.Visibility = Visibility.Collapsed;
|
|
|
|
//TextModuleTreeViewControl1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton1.Visibility = Visibility.Collapsed;
|
|
//TextModuleTreeViewControlRtf1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF1.Visibility = Visibility.Collapsed;
|
|
|
|
//TextModuleTreeViewControl2.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton2.Visibility = Visibility.Collapsed;
|
|
//TextModuleTreeViewControlRtf1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF2.Visibility = Visibility.Collapsed;
|
|
|
|
//TextModuleTreeViewControl3.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton3.Visibility = Visibility.Collapsed;
|
|
//TextModuleTreeViewControlRtf1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF3.Visibility = Visibility.Collapsed;
|
|
|
|
//TextModuleTreeViewControl4.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton4.Visibility = Visibility.Collapsed;
|
|
//TextModuleTreeViewControlRtf1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF4.Visibility = Visibility.Collapsed;
|
|
|
|
//TextModuleTreeViewControl5.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton5.Visibility = Visibility.Collapsed;
|
|
//TextModuleTreeViewControlRtf1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF5.Visibility = Visibility.Collapsed;
|
|
}
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineAlleBearbeiten) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineNurEigeneBearbeiten))
|
|
{
|
|
TextbausteineBearbeitenButton1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton2.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton3.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton4.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButton5.Visibility = Visibility.Collapsed;
|
|
|
|
TextbausteineBearbeitenButtonRTF1.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF2.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF3.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF4.Visibility = Visibility.Collapsed;
|
|
TextbausteineBearbeitenButtonRTF5.Visibility = Visibility.Collapsed;
|
|
}
|
|
// gridServiceRecordsSelection.DataSource = pViewModel.VMList;
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecordAllowRebooking))
|
|
{
|
|
Eintragumbuchunsbutton.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
//ServiceFacade.DoCustomerServiceAsync(s => s.GetAllActiveWohnheimeCompact(), wohnheime => this.Dispatch(() =>
|
|
//{
|
|
// chkWohnheimBooking.Visibility = wohnheime.Any() ? Visibility.Visible : Visibility.Collapsed;
|
|
//}));
|
|
|
|
SetStatisticsVisibility();
|
|
|
|
if (BeWoApp.AppSettings.ShowRtfTextfield)
|
|
{
|
|
ConfigureRTFDocTypes();
|
|
SetRTFFontSizeFromApp();
|
|
}
|
|
else
|
|
{
|
|
ConfigureDocTypes();
|
|
}
|
|
|
|
ConfigureEndDate();
|
|
|
|
UnterschriftenHeader.Visible = BeWoApp.AppSettings.ShowSignatures;
|
|
|
|
//richEdit.HorizontalRulerVisibility = Visibility.Collapsed;
|
|
//richEdit.VerticalRulerVisibility = Visibility.Collapsed;
|
|
|
|
//richEdit.ActiveViewType = RichEditViewType.Simple;
|
|
|
|
srGridControl.FilterChanged += SrGridControl_FilterChanged;
|
|
srGridControl.ItemsSourceChanged += SrGridControl_ItemsSourceChanged;
|
|
|
|
btn_ai_conv.DataContext = pViewModel.AiChatButtonConversationViewModel;
|
|
btn_ai_conv.ViewModel.GetAiConversationChatViewModel = () => getAiConversationChatViewModel();
|
|
|
|
btn_ai_docu.DataContext = pViewModel.AiChatButtonDocumentationViewModel;
|
|
}
|
|
|
|
public ICommand OpenAiWindowCommand { get; set; }
|
|
public ICommand OpenAiChatPromptWindowCommand { get; set; }
|
|
|
|
private void SrGridControl_ItemsSourceChanged(object sender, DevExpress.Xpf.Grid.ItemsSourceChangedEventArgs e)
|
|
{
|
|
ErstelleRecordInformationString();
|
|
|
|
}
|
|
|
|
private void SrGridControl_FilterChanged(object sender, RoutedEventArgs e)
|
|
{
|
|
ErstelleRecordInformationString();
|
|
}
|
|
|
|
private void ErstelleRecordInformationString()
|
|
{
|
|
if (ViewModel != null)
|
|
{
|
|
var visibleRecords = new List<ServiceRecordVM>();
|
|
|
|
var items = srGridControl.ItemsSource as IList<ServiceRecordVM>;
|
|
|
|
if (items != null)
|
|
{
|
|
for (int i = 0; i < items.Count; i++)
|
|
{
|
|
if (srGridControl.IsRowVisible(i))
|
|
{
|
|
var vm = srGridControl.GetRow(i) as ServiceRecordVM;
|
|
if (vm != null)
|
|
{
|
|
visibleRecords.Add(vm);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//srTableView.vis
|
|
//int dataRowCount = srGridControl.View.Coun;
|
|
//// Traverse data rows and change the Price field values.
|
|
//for (int i = 0; i < dataRowCount; i++)
|
|
//{
|
|
// object cellValue = View.GetRowCellValue(i, col);
|
|
// double newValue = Convert.ToDouble(cellValue) * 0.9;
|
|
// View.SetRowCellValue(i, col, newValue);
|
|
//}
|
|
|
|
ViewModel.ErstelleRecordInformationString(visibleRecords);
|
|
|
|
ViewModel.UpdateViewYearFilter(visibleRecords);
|
|
}
|
|
}
|
|
|
|
private void InitDateCombos()
|
|
{
|
|
this.combobox_month.ItemsSource = DateTimeFormatInfo.CurrentInfo.MonthNames.Where(s => !string.IsNullOrEmpty(s));
|
|
|
|
var years = new List<int>();
|
|
years.Add(DateTime.Now.Year + 1);
|
|
for (int i = 0; i <= 10; i++)
|
|
{
|
|
years.Add(DateTime.Now.Year - i);
|
|
}
|
|
|
|
this.combobox_year.ItemsSource = years;
|
|
|
|
}
|
|
private static void SetRTFFontSizeFromApp()
|
|
{
|
|
//var size = BeWoApp.AppSettings.DocumentationFontSize;
|
|
//if (size > 0)
|
|
//{
|
|
// richEditControl1.FontSize = size;
|
|
// richEditControl2.FontSize = size;
|
|
// richEditControl3.FontSize = size;
|
|
// richEditControl4.FontSize = size;
|
|
// richEditControl5.FontSize = size;
|
|
//}
|
|
}
|
|
|
|
private void ConfigureEndDate()
|
|
{
|
|
var settings = BeWoApp.AppSettings;
|
|
|
|
if (settings.IsEndDateVisible)
|
|
{
|
|
GridMitEnddatum.Visibility = Visibility.Visible;
|
|
GridOhneEnddatum.Visibility = Visibility.Collapsed;
|
|
|
|
|
|
if (!settings.EinheitZeiterfassung.Equals("0"))
|
|
{
|
|
if (settings.EinheitZeiterfassung.Equals("1"))
|
|
{
|
|
MinSTDMitEnd.Visibility = Visibility.Collapsed;
|
|
MinStdDauerLabel.Content = "Dauer (h)";
|
|
MinStdDauerlbl.Content = "Dauer (h)";
|
|
MinStdDauerlbl.SetValue(Grid.ColumnProperty, 1);
|
|
MinStdDauerlbl.SetValue(Grid.ColumnSpanProperty, 2);
|
|
MinStdDauerlbl.HorizontalAlignment = HorizontalAlignment.Right;
|
|
numeric_duration.SetValue(Grid.ColumnProperty, 3);
|
|
}
|
|
else
|
|
{
|
|
MinSTDMitEnd.Visibility = Visibility.Visible;
|
|
MinStdDauerLabel.Content = "Dauer";
|
|
MinStdDauerlbl.Content = "Dauer";
|
|
MinStdDauerlbl.SetValue(Grid.ColumnProperty, 0);
|
|
numeric_duration.SetValue(Grid.ColumnProperty, 1);
|
|
}
|
|
|
|
|
|
|
|
if (MinSTDMitEnd.Text == ZeiterfassungsDauer.Stunden.ToString())
|
|
{
|
|
numeric_duration.IsFloatValue = true;
|
|
numeric_duration.Mask = "########0.00";
|
|
}
|
|
else
|
|
{
|
|
numeric_duration.IsFloatValue = false;
|
|
numeric_duration.Mask = "########0";
|
|
}
|
|
}
|
|
|
|
EndDatumHeader.Visible = true;
|
|
|
|
numerictb_distance.SetValue(WidthProperty, (double) 47);
|
|
numerictb_distance.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Right);
|
|
|
|
}
|
|
else
|
|
{
|
|
GridMitEnddatum.Visibility = Visibility.Collapsed;
|
|
//GridMitJahrMonat.Visibility = Visibility.Collapsed;
|
|
GridOhneEnddatum.Visibility = Visibility.Visible;
|
|
|
|
//Collapse Zeit art und ändere namen von Dauer aufs originale zurück.
|
|
RoundedDHeader.Header = "Minuten";
|
|
DutationInSTDHeader.Visible = false;
|
|
|
|
if (settings.LetzteZeiterfassungsDauer == ZeiterfassungsDauer.Stunden)
|
|
{
|
|
RoundedDHeader.Header = "Stunden";
|
|
}
|
|
if (!settings.EinheitZeiterfassung.Equals("0"))
|
|
{
|
|
|
|
if (settings.EinheitZeiterfassung.Equals("1"))
|
|
{
|
|
MinSTDOhneEnd.Visibility = Visibility.Collapsed;
|
|
MinStdDauerLabel.Content = "Dauer (h)";
|
|
MinStdDauerlbl.Content = "Dauer (h)";
|
|
MinStdDauerLabel.SetValue(Grid.ColumnProperty, 2);
|
|
SpinEditDurationOhneEnddatum.SetValue(Grid.ColumnProperty, 3);
|
|
MinStdDauerLabel.HorizontalAlignment = HorizontalAlignment.Right;
|
|
}
|
|
else
|
|
{
|
|
MinSTDOhneEnd.Visibility = Visibility.Visible;
|
|
MinStdDauerLabel.Content = "Dauer";
|
|
MinStdDauerlbl.Content = "Dauer";
|
|
MinStdDauerLabel.SetValue(Grid.ColumnProperty, 0);
|
|
SpinEditDurationOhneEnddatum.SetValue(Grid.ColumnProperty, 1);
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MinSTDOhneEnd.Text == ZeiterfassungsDauer.Stunden.ToString())
|
|
{
|
|
SpinEditDurationOhneEnddatum.IsFloatValue = true;
|
|
SpinEditDurationOhneEnddatum.Mask = "########0.00";
|
|
}
|
|
else
|
|
{
|
|
SpinEditDurationOhneEnddatum.IsFloatValue = false;
|
|
SpinEditDurationOhneEnddatum.Mask = "########0";
|
|
}
|
|
}
|
|
|
|
EndDatumHeader.Visible = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void ConfigureRTFDocTypes()
|
|
{
|
|
//hier der Aufruf für die RTF GEdönse
|
|
TabitemRtf1Note.IsSelected = true;
|
|
|
|
TabItem1_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem2_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem3_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem4_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem5_Notice.Visibility = Visibility.Collapsed;
|
|
|
|
TabitemRtf1Note.Visibility = Visibility.Visible;
|
|
TabitemRtf2Note.Visibility = Visibility.Visible;
|
|
TabitemRtf3Note.Visibility = Visibility.Visible;
|
|
TabitemRtf4Note.Visibility = Visibility.Visible;
|
|
TabitemRtf5Note.Visibility = Visibility.Visible;
|
|
|
|
int i = _ViewModel.AllDocTypes.Count;
|
|
DokumentationLabel.Visibility = Visibility.Collapsed;
|
|
|
|
//var sp = new SpellChecker();
|
|
|
|
//sp.SpellCheckMode = SpellCheckMode.AsYouType;
|
|
//this.richEditControl1.SpellChecker = sp;
|
|
if (i == 0)
|
|
{
|
|
TabitemRtf1Note.Header = "Dokumentation";
|
|
head_Doku1.Header = "Dokumentation";
|
|
DokumentationLabel.Content = "";
|
|
|
|
TabitemRtf2Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf3Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf4Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf5Note.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku2.Visible = false;
|
|
head_Doku3.Visible = false;
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
//DokumentationLabel.Content = "Dokumentation";
|
|
TabitemRtf1Note.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
|
|
TabitemRtf2Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf3Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf4Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf5Note.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku2.Visible = false;
|
|
head_Doku3.Visible = false;
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 2)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
TabitemRtf1Note.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabitemRtf2Note.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
|
|
TabitemRtf3Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf4Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf5Note.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku3.Visible = false;
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 3)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
TabitemRtf1Note.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabitemRtf2Note.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
TabitemRtf2Note.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku3.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
|
|
TabitemRtf4Note.Visibility = Visibility.Collapsed;
|
|
TabitemRtf5Note.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 4)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
|
|
TabitemRtf1Note.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabitemRtf2Note.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
TabitemRtf3Note.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
TabitemRtf4Note.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku3.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
head_Doku4.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
|
|
TabitemRtf5Note.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 5)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
|
|
TabitemRtf1Note.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabitemRtf2Note.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
TabitemRtf3Note.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
TabitemRtf4Note.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
TabitemRtf5Note.Header = _ViewModel.AllDocTypes[4].ToString();
|
|
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku3.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
head_Doku4.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
head_Doku5.Header = _ViewModel.AllDocTypes[4].ToString();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void ConfigureDocTypes()
|
|
{
|
|
TabItem1_Notice.IsSelected = true;
|
|
//Tabs und Tabelle
|
|
int i = _ViewModel.AllDocTypes.Count;
|
|
DokumentationLabel.Visibility = Visibility.Collapsed;
|
|
if (i == 0)
|
|
{
|
|
TabItem1_Notice.Header = "Dokumentation";
|
|
head_Doku1.Header = "Dokumentation";
|
|
DokumentationLabel.Content = "";
|
|
|
|
TabItem2_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem3_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem4_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem5_Notice.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku2.Visible = false;
|
|
head_Doku3.Visible = false;
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
//DokumentationLabel.Content = "Dokumentation";
|
|
TabItem1_Notice.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
|
|
TabItem2_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem3_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem4_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem5_Notice.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku2.Visible = false;
|
|
head_Doku3.Visible = false;
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 2)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
TabItem1_Notice.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabItem2_Notice.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
|
|
TabItem3_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem4_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem5_Notice.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku3.Visible = false;
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 3)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
TabItem1_Notice.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabItem2_Notice.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
TabItem3_Notice.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku3.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
|
|
TabItem4_Notice.Visibility = Visibility.Collapsed;
|
|
TabItem5_Notice.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku4.Visible = false;
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 4)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
|
|
TabItem1_Notice.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabItem2_Notice.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
TabItem3_Notice.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
TabItem4_Notice.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku3.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
head_Doku4.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
|
|
TabItem5_Notice.Visibility = Visibility.Collapsed;
|
|
|
|
head_Doku5.Visible = false;
|
|
}
|
|
else if (i == 5)
|
|
{
|
|
DokumentationLabel.Content = "Dokumentation";
|
|
|
|
TabItem1_Notice.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
TabItem2_Notice.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
TabItem3_Notice.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
TabItem4_Notice.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
TabItem5_Notice.Header = _ViewModel.AllDocTypes[4].ToString();
|
|
|
|
head_Doku1.Header = _ViewModel.AllDocTypes[0].ToString();
|
|
head_Doku2.Header = _ViewModel.AllDocTypes[1].ToString();
|
|
head_Doku3.Header = _ViewModel.AllDocTypes[2].ToString();
|
|
head_Doku4.Header = _ViewModel.AllDocTypes[3].ToString();
|
|
head_Doku5.Header = _ViewModel.AllDocTypes[4].ToString();
|
|
}
|
|
}
|
|
|
|
private void ViewModelOnStatisticInfosLoaded(object sender, EventArgs eventArgs)
|
|
{
|
|
var info = sender as ServiceRecordStatisticsInfoDC;
|
|
if (info != null)
|
|
{
|
|
StatisticInfoGrid.Children.Clear();
|
|
StatisticInfoGrid.ColumnDefinitions.Clear();
|
|
StatisticInfoGrid.RowDefinitions.Clear();
|
|
|
|
if (info.Header != null)
|
|
{
|
|
StatisticInfoGrid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1, GridUnitType.Auto)
|
|
});
|
|
|
|
|
|
foreach (var header in info.Header)
|
|
{
|
|
StatisticInfoGrid.RowDefinitions.Add(new RowDefinition());
|
|
}
|
|
int rowIndex = 0;
|
|
foreach (var header in info.Header)
|
|
{
|
|
var txt = new TextBlock();
|
|
txt.SetValue(Grid.ColumnProperty, 0);
|
|
txt.SetValue(Grid.RowProperty, rowIndex);
|
|
txt.Foreground =
|
|
new SolidColorBrush(
|
|
(Color) ColorConverter.ConvertFromString(info.ForegroundColor[rowIndex]));
|
|
txt.Height = 14;
|
|
txt.Text = header;
|
|
|
|
StatisticInfoGrid.Children.Add(txt);
|
|
|
|
rowIndex++;
|
|
}
|
|
|
|
if (info.PeriodStatisticInfos != null)
|
|
{
|
|
foreach (var periodInfo in info.PeriodStatisticInfos)
|
|
{
|
|
StatisticInfoGrid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1, GridUnitType.Auto)
|
|
});
|
|
StatisticInfoGrid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1, GridUnitType.Auto)
|
|
});
|
|
}
|
|
|
|
int colIndex = 1;
|
|
foreach (var periodInfo in info.PeriodStatisticInfos)
|
|
{
|
|
rowIndex = 0;
|
|
foreach (var lv in periodInfo.LeftValues)
|
|
{
|
|
if (!String.IsNullOrEmpty(lv))
|
|
{
|
|
var txt = new TextBlock();
|
|
txt.SetValue(Grid.ColumnProperty, colIndex);
|
|
txt.SetValue(Grid.RowProperty, rowIndex);
|
|
txt.Foreground = new SolidColorBrush(
|
|
(Color) ColorConverter.ConvertFromString(periodInfo.LeftValueColors[rowIndex]));
|
|
txt.Height = 12;
|
|
txt.FontWeight = FontWeights.Bold;
|
|
txt.Text = lv;
|
|
txt.HorizontalAlignment = HorizontalAlignment.Right;
|
|
txt.Margin = new Thickness(10, 0, 0, 0);
|
|
txt.Padding = new Thickness(1, 0, 1, 0);
|
|
if (String.IsNullOrEmpty(periodInfo.RightValues[rowIndex]))
|
|
{
|
|
txt.SetValue(Grid.ColumnSpanProperty, 2);
|
|
}
|
|
|
|
StatisticInfoGrid.Children.Add(txt);
|
|
|
|
|
|
//<TextBlock x:Name="txtStatisticInfoHeader" Grid.Column="0" Grid.Row="0"
|
|
// Text="{Binding Path=Header}" Grid.ColumnSpan="4"
|
|
// FontWeight="Bold" FontSize="12" Foreground="{DynamicResource BigInfoTextBrush}" Height="14"/>
|
|
}
|
|
if (!String.IsNullOrEmpty(periodInfo.RightValues[rowIndex]))
|
|
{
|
|
var txt = new TextBlock();
|
|
txt.SetValue(Grid.ColumnProperty, colIndex + 1);
|
|
txt.SetValue(Grid.RowProperty, rowIndex);
|
|
txt.Foreground =
|
|
new SolidColorBrush(
|
|
(Color) ColorConverter.ConvertFromString(
|
|
periodInfo.RightValueColors[rowIndex]));
|
|
txt.Height = 12;
|
|
txt.FontWeight = FontWeights.Bold;
|
|
txt.Text = periodInfo.RightValues[rowIndex];
|
|
txt.HorizontalAlignment = HorizontalAlignment.Right;
|
|
txt.Margin = new Thickness(10, 0, 0, 0);
|
|
txt.Padding = new Thickness(1, 0, 1, 0);
|
|
StatisticInfoGrid.Children.Add(txt);
|
|
|
|
|
|
//<TextBlock x:Name="txtStatisticInfoHeader" Grid.Column="0" Grid.Row="0"
|
|
// Text="{Binding Path=Header}" Grid.ColumnSpan="4"
|
|
// FontWeight="Bold" FontSize="12" Foreground="{DynamicResource BigInfoTextBrush}" Height="14"/>
|
|
}
|
|
|
|
|
|
rowIndex++;
|
|
}
|
|
|
|
colIndex += 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void SetStatisticsVisibility()
|
|
{
|
|
String tenant = BeWoApp.Tenant;
|
|
|
|
#if DEBUG
|
|
//tenant = "3057313346";
|
|
#endif
|
|
|
|
if (tenant == "3057313346" || tenant == "2918696314")
|
|
{
|
|
lblStatisticInfo1.Text = "Geleistet/bewilligt Gesamt";
|
|
lblStatisticInfo2.Text = "Geleistet/bewilligt pro Woche";
|
|
lblStatisticInfo3.Text = "Geleistet/bewilligt pro Monat";
|
|
lblStatisticInfo4.Text = "Übertrag Monat";
|
|
lblStatisticInfo4.Visibility = Visibility.Visible;
|
|
lblStatisticInfo5.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
lblStatisticInfo4.Visibility = Visibility.Collapsed;
|
|
lblStatisticInfo5.Visibility = Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
private void SupportConceptSelectionControl_ControlInitialized(object sender, EventArgs e)
|
|
{
|
|
InitCustomerSelectedItem();
|
|
multiSupportConceptControl.SupportConceptList = supportConceptSelectionControl.SupportConceptList;
|
|
}
|
|
|
|
public override bool CanDelete
|
|
{
|
|
get { return false; }
|
|
}
|
|
|
|
public DownloadLinkEngine DownloadLinkEngine { get; set; }
|
|
|
|
public override bool IsDirty
|
|
{
|
|
get { return ViewModel != null && ViewModel.AddedCount != 0; }
|
|
}
|
|
|
|
public override string Title
|
|
{
|
|
get { return Translator.Translate("Zeiterfassung"); }
|
|
}
|
|
|
|
public bool WithoutClient
|
|
{
|
|
get { return ViewModel != null && ViewModel.WithoutClient; }
|
|
|
|
set
|
|
{
|
|
if (ViewModel != null)
|
|
ViewModel.WithoutClient = value;
|
|
}
|
|
}
|
|
|
|
internal override DependencyObject ValidationOnSaveRootElement
|
|
{
|
|
get { return srListBox; }
|
|
}
|
|
|
|
internal ServiceRecordListVM ViewModel
|
|
{
|
|
get { return _ViewModel; }
|
|
|
|
set
|
|
{
|
|
_SelectedEmployee = BeWoApp.LoggedOnUser.Employee;
|
|
popupedit_employee.Text = _SelectedEmployee.ToString();
|
|
|
|
multiEmployeeControl.SelectedEmployees.Add(_SelectedEmployee);
|
|
|
|
DataContext = value;
|
|
|
|
SetEmployeeComboVisibility();
|
|
|
|
supportConceptSelectionControl.SelectedItem = new FlatSupportConceptTreeNodeDC();
|
|
_ViewModel = value;
|
|
|
|
_ViewModel.ServiceRecordListChanged += ViewModel_ServiceRecordListChanged;
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecordView_Create) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.CreateAll))
|
|
{
|
|
newObjectInfoGrid.IsEnabled = false;
|
|
button_add.IsEnabled = false;
|
|
}
|
|
|
|
Unloaded += ServiceRecordView2_Unloaded;
|
|
}
|
|
}
|
|
|
|
public void AnimateOpacity(double pOpacitiy, double pDuration)
|
|
{
|
|
// System.Windows.Media.TransformGroup group = this.DetailFrame.RenderTransform as System.Windows.Media.TransformGroup;
|
|
// System.Windows.Media.ScaleTransform scale = group.Children[0] as System.Windows.Media.ScaleTransform;
|
|
var lAnimation = new DoubleAnimation
|
|
{
|
|
From = detailContentGrid.Opacity,
|
|
To = pOpacitiy,
|
|
Duration = TimeSpan.FromMilliseconds(pDuration)
|
|
};
|
|
|
|
// lAnimation.From = scale.ScaleX;
|
|
// lAnimation.To = pOpacitiy;
|
|
detailContentGrid.BeginAnimation(OpacityProperty, lAnimation);
|
|
|
|
// scale.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, lAnimation);
|
|
// scale.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, lAnimation);
|
|
}
|
|
|
|
public override void Delete()
|
|
{
|
|
Delete(GetSelectedServiceRecordFromListBox());
|
|
}
|
|
|
|
public void Delete(ServiceRecordVM vm)
|
|
{
|
|
if (vm == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var result = BeWoUtils.ValidateServiceRecordDeletion(vm);
|
|
|
|
if (result)
|
|
{
|
|
|
|
if (vm.GroupOid != null)
|
|
{
|
|
var deletedVMs = new List<ServiceRecordVM>();
|
|
|
|
foreach (var item in ViewModel.VMList)
|
|
{
|
|
if (item.GroupOid != null && item.GroupOid.Value == vm.GroupOid.Value)
|
|
{
|
|
deletedVMs.Add(item);
|
|
}
|
|
}
|
|
|
|
foreach (var deletedVM in deletedVMs)
|
|
{
|
|
ViewModel.VMList.Remove(deletedVM);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool test = ViewModel.VMList.Remove(vm);
|
|
}
|
|
|
|
|
|
var lDC = vm.CommitToDataContract();
|
|
|
|
ServiceFacade.DoOperationsServiceAsync(
|
|
s => s.DeleteServiceRecord(lDC.ServiceRecordOid.Value, lDC.ServiceRecordVersion.Value),
|
|
RefreshGrid);
|
|
|
|
}
|
|
// gridServiceRecordsSelection.UpdateLayout();
|
|
// gridServiceRecordsSelection.DataSource = ViewModel.VMList;
|
|
}
|
|
|
|
public ServiceRecordVM GetSelectedServiceRecordFromListBox()
|
|
{
|
|
return (ServiceRecordVM) srListBox.SelectedItem;
|
|
}
|
|
|
|
public void SetSelectedServiceRecordVM(ServiceRecordVM vm, bool isOnDelete)
|
|
{
|
|
if (vm != null)
|
|
{
|
|
ServiceRecordVM existingVm = null;
|
|
|
|
if (!isOnDelete)
|
|
{
|
|
foreach (var serviceRecordVm in ViewModel.VMList)
|
|
{
|
|
if (serviceRecordVm.Id == vm.Id)
|
|
{
|
|
existingVm = serviceRecordVm;
|
|
}
|
|
}
|
|
}
|
|
else if (ChkDetailView.IsChecked.HasValue && ChkDetailView.IsChecked.Value)
|
|
{
|
|
|
|
if (ViewModel.VMList.Count > 0 && _LastPosition > 0)
|
|
{
|
|
var a = ViewModel.VMList[_LastPosition - 1];
|
|
|
|
existingVm = a;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
srListBox.SelectedItem = existingVm;
|
|
srGridControl.CurrentItem = existingVm;
|
|
//srTableView.cur = existingVm;
|
|
}
|
|
}
|
|
|
|
protected override void Save()
|
|
{
|
|
var lToDos = new List<Action<IOperationsService>>();
|
|
|
|
if (ViewModel.AddedCount > 0)
|
|
{
|
|
lToDos.Add(
|
|
s =>
|
|
{
|
|
var newItems = ViewModel.CommitAdded();
|
|
try
|
|
{
|
|
var oids = s.InsertNewServiceRecords(newItems);
|
|
var idx = 0;
|
|
|
|
foreach (var vm in ViewModel.VMList)
|
|
{
|
|
if (!vm.IsNew)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
|
|
vm.IsNew = false;
|
|
vm.DataContract.ServiceRecordVersion = 1;
|
|
vm.DataContract.ServiceRecordOid = oids[idx++];
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
var newVMs = ViewModel.VMList.Where(vm => vm.IsNew).ToList();
|
|
|
|
foreach (var serviceRecordVm in newVMs)
|
|
{
|
|
ViewModel.VMList.Remove(serviceRecordVm);
|
|
}
|
|
|
|
this.Dispatch(() => ViewModel.RefreshServiceRecordsForSelectedTreeNode(true));
|
|
|
|
throw e;
|
|
}
|
|
});
|
|
}
|
|
ServiceFacade.DoMultipleOperationsServicesSync(lToDos);
|
|
ReloadViewModel();
|
|
}
|
|
|
|
internal override bool DoSaveCheck()
|
|
{
|
|
BeWoApp.SaveAppSettings();
|
|
|
|
if (!String.IsNullOrEmpty(ViewModel.PrototypeVM.Notice))
|
|
{
|
|
var lResult = ShowSaveQuestion();
|
|
if (lResult == MessageBoxResult.Cancel)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (lResult == MessageBoxResult.Yes)
|
|
{
|
|
return SaveServiceRecord();
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private void ClosePopupView()
|
|
{
|
|
SetPopupViewVisible(false);
|
|
popup_content.Child = null;
|
|
}
|
|
|
|
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ViewModel.VMList.Remove((ServiceRecordVM) ((Button) sender).Tag);
|
|
Save();
|
|
}
|
|
|
|
private void Edit(ServiceRecordVM vm)
|
|
{
|
|
if (vm == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
BeWoView serviceRecordEditView;
|
|
|
|
if (vm.GroupOid != null)
|
|
{
|
|
serviceRecordEditView = new ServiceRecordGroupEditView();
|
|
}
|
|
else
|
|
{
|
|
serviceRecordEditView = new ServiceRecordEditView();
|
|
}
|
|
|
|
ViewModel.AiChatButtonDocumentationEditViewModel.ClearHistory();
|
|
|
|
popup_content.Child = serviceRecordEditView;
|
|
|
|
double height = MainControl.ActualHeight * 0.8;
|
|
double width = 810;
|
|
|
|
if (BeWoApp.AppSettings.ShowRtfTextfield)
|
|
{
|
|
height = MainControl.ActualHeight -120;
|
|
width = 1000;
|
|
}
|
|
if (MainControl.ActualWidth < width)
|
|
{
|
|
width = MainControl.ActualWidth;
|
|
}
|
|
if (height < 600)
|
|
{
|
|
height = 600;
|
|
}
|
|
|
|
popup_content.Width = width;
|
|
popup_content.Height = height;
|
|
|
|
if (serviceRecordEditView.CommandBindings.Count == 0)
|
|
{
|
|
serviceRecordEditView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
var result = ServiceRecordDialogResult.ClosedWithoutSaving;
|
|
|
|
if(vm.EditAllowed)
|
|
{
|
|
if (serviceRecordEditView is ServiceRecordEditView view)
|
|
{
|
|
result = view.CloseAndDoSaveCheck();
|
|
}
|
|
else
|
|
{
|
|
result = ((ServiceRecordGroupEditView) serviceRecordEditView).CloseAndDoSaveCheck();
|
|
}
|
|
}
|
|
|
|
if(result == ServiceRecordDialogResult.ClosedWithSaving)
|
|
{
|
|
ClosePopupView();
|
|
ViewModel.RefreshServiceRecordsForSelectedTreeNode(false);
|
|
SetSelectedServiceRecordVM(vm, false);
|
|
}
|
|
else if(result == ServiceRecordDialogResult.ClosedWithoutSaving)
|
|
{
|
|
ClosePopupView();
|
|
}
|
|
}));
|
|
serviceRecordEditView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Save,
|
|
(s, e) =>
|
|
{
|
|
if (vm.EditAllowed)
|
|
{
|
|
bool save;
|
|
if (serviceRecordEditView is ServiceRecordEditView)
|
|
{
|
|
save = ((ServiceRecordEditView) serviceRecordEditView).IsValid() &&
|
|
((ServiceRecordEditView) serviceRecordEditView).IsCustomerChangeAllowed();
|
|
}
|
|
else
|
|
{
|
|
save = ((ServiceRecordGroupEditView) serviceRecordEditView).IsValid() &&
|
|
((ServiceRecordGroupEditView) serviceRecordEditView)
|
|
.IsCustomerChangeAllowed();
|
|
}
|
|
|
|
if (!save)
|
|
{
|
|
return;
|
|
}
|
|
|
|
serviceRecordEditView.SaveData();
|
|
}
|
|
|
|
ClosePopupView();
|
|
|
|
if (!(serviceRecordEditView is ServiceRecordEditView))
|
|
{
|
|
return;
|
|
}
|
|
|
|
ViewModel.BuildServiceRecordsForSelectedTreeNode(true, false, RefreshFinished);
|
|
_LastSelectedVM = vm;
|
|
}));
|
|
}
|
|
|
|
if (serviceRecordEditView is ServiceRecordEditView)
|
|
{
|
|
((ServiceRecordEditView) serviceRecordEditView).InitView(ViewModel, vm, WithoutClient);
|
|
serviceRecordEditView.ParentView = this;
|
|
SetPopupViewVisible(true);
|
|
}
|
|
else
|
|
{
|
|
ServiceFacade.DoOperationsServiceAsync(
|
|
s => s.GetServiceRecordGroup(vm.GroupOid.Value),
|
|
r => this.Dispatch(
|
|
delegate
|
|
{
|
|
((ServiceRecordGroupEditView) serviceRecordEditView).InitView(ViewModel, vm, r);
|
|
|
|
serviceRecordEditView.ParentView = this;
|
|
popup_content.Width += 190;
|
|
SetPopupViewVisible(true);
|
|
}));
|
|
}
|
|
}
|
|
|
|
private void RefreshFinished()
|
|
{
|
|
SetSelectedServiceRecordVM(_LastSelectedVM, false);
|
|
}
|
|
|
|
private void ShowHistory(ServiceRecordVM vm)
|
|
{
|
|
if (vm is null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var height = rootGrid.ActualHeight * .8;//600d;
|
|
var width = rootGrid.ActualWidth * .8;//1200;
|
|
|
|
var serviceRecordHistoryView = new ServiceRecordHistoryView();
|
|
|
|
popup_content.Child = serviceRecordHistoryView;
|
|
|
|
if(rootGrid.ActualHeight < height)
|
|
{
|
|
height = rootGrid.ActualHeight;
|
|
}
|
|
|
|
if(rootGrid.ActualWidth < width)
|
|
{
|
|
width = rootGrid.ActualWidth;
|
|
}
|
|
|
|
popup_content.Height = height;
|
|
popup_content.Width = width;
|
|
|
|
if (serviceRecordHistoryView.CommandBindings.Count == 0)
|
|
{
|
|
serviceRecordHistoryView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) => ClosePopupView()));
|
|
|
|
}
|
|
|
|
ServiceFacade.DoOperationsServiceAsync(
|
|
s => s.GetServiceRecordHistory(vm.DataContract.ServiceRecordOid.Value),
|
|
r => this.Dispatch(
|
|
delegate
|
|
{
|
|
serviceRecordHistoryView.InitView(r);
|
|
|
|
serviceRecordHistoryView.ParentView = this;
|
|
SetPopupViewVisible(true);
|
|
|
|
serviceRecordHistoryView.OptimizeDataGridColumns();
|
|
}));
|
|
}
|
|
|
|
private void EmployeeSearchView_CustomerSelected(object sender, EventArgs<CompactEmployeeDC> e)
|
|
{
|
|
_SelectedEmployee = e.Data;
|
|
popupedit_employee.Text = _SelectedEmployee.ToString();
|
|
popup_employee.IsOpen = false;
|
|
|
|
ViewModel.SelectedEmployee = _SelectedEmployee;
|
|
|
|
if (WithoutClient)
|
|
{
|
|
SelectedItemChanged(null);
|
|
}
|
|
}
|
|
|
|
private static ChildItem FindVisualChild<ChildItem>(DependencyObject obj) where ChildItem : DependencyObject
|
|
{
|
|
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
|
|
{
|
|
var child = VisualTreeHelper.GetChild(obj, i);
|
|
if (child != null && child is ChildItem)
|
|
{
|
|
return (ChildItem) child;
|
|
}
|
|
|
|
var childOfChild = FindVisualChild<ChildItem>(child);
|
|
|
|
if (childOfChild != null)
|
|
{
|
|
return childOfChild;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
private void InitCustomerSelectedItem()
|
|
{
|
|
if (_StartSupportConceptOid != null)
|
|
{
|
|
supportConceptSelectionControl.SetSelectedSupportConceptOid(_StartSupportConceptOid.Value);
|
|
_StartSupportConceptOid = null;
|
|
}
|
|
}
|
|
|
|
private void InitDayCheckBoxes()
|
|
{
|
|
foreach (var iDay in Utils.GetDayOfWeeks(DayOfWeek.Monday))
|
|
{
|
|
var lCb = new CheckBox
|
|
{
|
|
Content = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedDayName(iDay),
|
|
Margin = new Thickness(3),
|
|
IsHitTestVisible = DateTime.Now.DayOfWeek != iDay
|
|
};
|
|
|
|
_DayBoxes[iDay] = lCb;
|
|
wrapPanel_days.Visibility = Visibility.Collapsed;
|
|
wrapPanel_days.Children.Add(lCb);
|
|
|
|
lCb.Checked += (s, e) => ViewModel.RecordingDays.Add(_DayBoxes.Single(entry => entry.Value == s).Key);
|
|
lCb.Unchecked += (s, e) =>
|
|
ViewModel.RecordingDays.Remove(_DayBoxes.Single(entry => entry.Value == s).Key);
|
|
|
|
lCb.IsChecked = DateTime.Now.DayOfWeek == iDay;
|
|
}
|
|
|
|
DependencyPropertyDescriptor.FromProperty(DateEdit.EditValueProperty, typeof(DateEdit)).AddValueChanged(
|
|
datepicker_newDate1,
|
|
(s, e) => _DayBoxes.DoForEach(
|
|
iCheck =>
|
|
{
|
|
iCheck.Value.IsChecked = datepicker_newDate1.EditValue != null &&
|
|
iCheck.Key == datepicker_newDate1.DateTime.DayOfWeek;
|
|
iCheck.Value.IsHitTestVisible = !iCheck.Value.IsChecked.Value;
|
|
iCheck.Value.IsEnabled = iCheck.Value.IsHitTestVisible;
|
|
}));
|
|
|
|
|
|
}
|
|
|
|
private static bool IsPartOf(object p, Type type)
|
|
{
|
|
if (p != null)
|
|
{
|
|
var fe = p as FrameworkElement;
|
|
if (fe != null)
|
|
{
|
|
return fe.GetType() == type || IsPartOf(fe.TemplatedParent, type);
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
private void RefreshGrid()
|
|
{
|
|
Dispatcher.BeginInvoke(
|
|
DispatcherPriority.Normal,
|
|
(Action) delegate
|
|
{
|
|
ServiceRecordVM selected = null;
|
|
if (ChkDetailView.IsChecked.HasValue && ChkDetailView.IsChecked.Value)
|
|
{
|
|
selected = GetSelectedServiceRecordFromGrid();
|
|
}
|
|
else
|
|
{
|
|
selected = GetSelectedServiceRecordFromListBox();
|
|
}
|
|
|
|
ViewModel.RefreshServiceRecordsForSelectedTreeNode(false);
|
|
SetSelectedServiceRecordVM(selected, true);
|
|
|
|
});
|
|
}
|
|
|
|
private void ReloadViewModel()
|
|
{
|
|
ViewModel.PrototypeVM.Notice = string.Empty;
|
|
ViewModel.PrototypeVM.Notice2 = string.Empty;
|
|
ViewModel.PrototypeVM.Notice3 = string.Empty;
|
|
ViewModel.PrototypeVM.Notice4 = string.Empty;
|
|
ViewModel.PrototypeVM.Notice5 = string.Empty;
|
|
|
|
ViewModel.PrototypeVM.RTFNotice = string.Empty;
|
|
ViewModel.PrototypeVM.RTFNotice2 = string.Empty;
|
|
ViewModel.PrototypeVM.RTFNotice3 = string.Empty;
|
|
ViewModel.PrototypeVM.RTFNotice4 = string.Empty;
|
|
ViewModel.PrototypeVM.RTFNotice5 = string.Empty;
|
|
|
|
richEditControl1.Text = string.Empty;
|
|
richEditControl1.RtfText = string.Empty;
|
|
|
|
richEditControl2.Text = string.Empty;
|
|
richEditControl2.RtfText = string.Empty;
|
|
|
|
richEditControl3.Text = string.Empty;
|
|
richEditControl3.RtfText = string.Empty;
|
|
|
|
richEditControl4.Text = string.Empty;
|
|
richEditControl4.RtfText = string.Empty;
|
|
|
|
richEditControl5.Text = string.Empty;
|
|
richEditControl5.RtfText = string.Empty;
|
|
|
|
SetDefaultCategory();
|
|
|
|
if (ViewModel.PrototypeVM.GoalTree != null && ViewModel.PrototypeVM.GoalTree.Count > 0)
|
|
{
|
|
ResetAllGoals(ViewModel.PrototypeVM.GoalTree);
|
|
|
|
}
|
|
|
|
ViewModel.PrototypeVM.DistanceInMeter = null;
|
|
|
|
if (BeWoApp.AppSettings.SetStartTimeToEndTimeAfterSave)
|
|
{
|
|
if (!String.IsNullOrEmpty(ViewModel.PrototypeVM.EndTimeString))
|
|
{
|
|
var oldDuration = ViewModel.PrototypeVM.Duration;
|
|
ViewModel.PrototypeVM.StartTimeString = ViewModel.PrototypeVM.EndTimeString;
|
|
ViewModel.PrototypeVM.Duration = oldDuration;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void SetDefaultCategory()
|
|
{
|
|
if (ViewModel.PrototypeVM.SortedCategories != null)
|
|
{
|
|
foreach (var cat in ViewModel.PrototypeVM.SortedCategories.Where(cat => cat.IsDefault))
|
|
{
|
|
ViewModel.PrototypeVM.Category = cat;
|
|
}
|
|
}
|
|
|
|
if (ViewModel.PrototypeVM.PossibleServiceDescriptions != null)
|
|
{
|
|
foreach (var sd in ViewModel.PrototypeVM.PossibleServiceDescriptions.Where(sd => sd.IsDefault))
|
|
{
|
|
ViewModel.PrototypeVM.ServiceDescription = sd;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool SaveGroupBooking()
|
|
{
|
|
var lValid = true;
|
|
|
|
if(multiSupportConceptControl.SelectedSupportConcepts.Count == 0)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate(
|
|
"Bitte wählen Sie mindestens einen Klienten aus, für den Sie eine Gruppenbuchung anlegen möchten."),
|
|
"Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
lValid = false;
|
|
}
|
|
|
|
if(lValid)
|
|
{
|
|
if(multiEmployeeControl.SelectedEmployees.Count == 0)
|
|
{
|
|
MessageBox.Show(Translator.Translate("Bitte wählen Sie mindestens einen Mitarbeiter aus, für den Sie eine Gruppenbuchung anlegen möchten."), "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
lValid = false;
|
|
}
|
|
}
|
|
|
|
var employeeOids = multiEmployeeControl.SelectedEmployees.Select(compactEmployeeDc => compactEmployeeDc.EmployeeOid).ToList();
|
|
|
|
var cb2scOids = (from scDc in multiSupportConceptControl.SelectedSupportConcepts where scDc.CostBearerRelOids != null && scDc.CostBearerRelOids.Count > 0 select scDc.CostBearerRelOids[0]).ToList();
|
|
|
|
int index = 1;
|
|
foreach(var node in from dc in multiSupportConceptControl.SelectedSupportConcepts where lValid select SupportConceptService.CreateFlatSupportConceptItem(dc, null))
|
|
{
|
|
lValid = BeWoUtils.ValidateServiceRecordVM(ViewModel.PrototypeVM, null, node, WithoutClient, ViewModel.SelectedEmployee, employeeOids, cb2scOids, index++);
|
|
}
|
|
|
|
if(lValid)
|
|
{
|
|
var list = ViewModel.CreateFromPrototype();
|
|
|
|
if(list.Count > 0)
|
|
{
|
|
var prototypeVM = list[0];
|
|
|
|
var personCount = multiSupportConceptControl.SelectedSupportConcepts.Count;
|
|
var employeeCount = multiEmployeeControl.SelectedEmployees.Count;
|
|
|
|
prototypeVM.GroupEmployeeCount = employeeCount;
|
|
prototypeVM.GroupPersonCount = personCount;
|
|
|
|
// Runden
|
|
var roundDuration = false;
|
|
var minuteInterval = 0;
|
|
string calcId = null;
|
|
var lastMinuteInterval = -1;
|
|
|
|
if(prototypeVM.ServiceDescription.Category.IsBillable)
|
|
{
|
|
roundDuration = true;
|
|
foreach(var org in from dc in multiSupportConceptControl.SelectedSupportConcepts where dc.CostBearerList.Count > 0 select dc.CostBearerList[0].Organisation)
|
|
{
|
|
if(org != null)
|
|
{
|
|
minuteInterval = org.ActualMinuteIntervall;
|
|
|
|
if(lastMinuteInterval == -1)
|
|
{
|
|
lastMinuteInterval = minuteInterval;
|
|
calcId = org.CostBearerID;
|
|
}
|
|
else if(lastMinuteInterval != minuteInterval)
|
|
{
|
|
roundDuration = false;
|
|
}
|
|
}
|
|
else if(minuteInterval >= 0)
|
|
{
|
|
roundDuration = false;
|
|
}
|
|
else
|
|
{
|
|
minuteInterval = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
var duration = prototypeVM.RoundedDuration;
|
|
var totalDuration = duration;
|
|
|
|
var gd = ServiceRecordListVM.CalculateGroupDuration(personCount, employeeCount, totalDuration, cb2scOids);
|
|
|
|
if(gd != null)
|
|
{
|
|
prototypeVM.GroupRoundedDuration = gd.TotalDuration;
|
|
prototypeVM.RoundedDuration = gd.SingleDuration;
|
|
}
|
|
else
|
|
{
|
|
//if (personCount > 2 && (BeWoApp.Tenant == "9893557471") || (BeWoApp.Tenant == "2918696314")) //Caritas Frankfurt
|
|
//{
|
|
// prototypeVM.GroupRoundedDuration = totalDuration;
|
|
// prototypeVM.RoundedDuration = ((totalDuration * employeeCount) / personCount) + 10;
|
|
//}
|
|
//else if (personCount > 1 && BeWoApp.Tenant == "5653806613") //Feid&Kollegen
|
|
//{
|
|
// prototypeVM.GroupRoundedDuration = totalDuration;
|
|
// prototypeVM.RoundedDuration = ((totalDuration * employeeCount) / personCount);
|
|
|
|
//}
|
|
//else
|
|
//{
|
|
if(minuteInterval > 0 && roundDuration)
|
|
{
|
|
var calc = Calculations.GetInstance(calcId);
|
|
totalDuration = calc.GetRoundedDuration(minuteInterval, duration);
|
|
}
|
|
|
|
prototypeVM.RoundedDuration = Math.Round(totalDuration / personCount, 0, MidpointRounding.AwayFromZero);
|
|
prototypeVM.GroupRoundedDuration = totalDuration;
|
|
|
|
//if (BeWoApp.Tenant == "0216265667") //Lebenshilfe Hannover
|
|
//{
|
|
// prototypeVM.RoundedDuration += 10;
|
|
//}
|
|
|
|
//}
|
|
}
|
|
|
|
var newVMList = new List<ServiceRecordVM>();
|
|
|
|
foreach(var dc in multiSupportConceptControl.SelectedSupportConcepts)
|
|
{
|
|
var addToList = true;
|
|
foreach(var emp in multiEmployeeControl.SelectedEmployees)
|
|
{
|
|
var newVM = prototypeVM.Clone();
|
|
|
|
newVM.Employee = emp;
|
|
newVM.ChoosenNode = SupportConceptService.CreateFlatSupportConceptItem(dc, null);
|
|
newVM.SetInsertedOn(DateTime.Now);
|
|
newVMList.Add(newVM);
|
|
|
|
if (!addToList)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
ViewModel.VMList.Add(newVM);
|
|
addToList = false;
|
|
}
|
|
}
|
|
|
|
var lToDos = new List<Action<IOperationsService>>();
|
|
|
|
if(newVMList.Count > 0)
|
|
{
|
|
var dcList = newVMList.Select(item => item.CommitToDataContract()).ToList();
|
|
|
|
if(newVMList.Count == 1)
|
|
{
|
|
lToDos.Add(
|
|
s =>
|
|
{
|
|
var oids = s.InsertNewServiceRecords(dcList);
|
|
var idx = 0;
|
|
|
|
foreach(var vm in newVMList)
|
|
{
|
|
vm.IsNew = false;
|
|
vm.DataContract.ServiceRecordVersion = 1;
|
|
vm.DataContract.ServiceRecordOid = oids[idx++];
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
var groupDC = new ServiceRecordGroupDC
|
|
{
|
|
CustomerCount = personCount,
|
|
EmployeeCount = employeeCount,
|
|
StartDate = prototypeVM.StartDate,
|
|
EndDate = prototypeVM.EndDate,
|
|
Notice = prototypeVM.Notice
|
|
};
|
|
|
|
if (prototypeVM.GroupRoundedDuration != null)
|
|
groupDC.RoundedDuration = prototypeVM.GroupRoundedDuration.Value;
|
|
|
|
groupDC.ServiceRecordList = dcList;
|
|
|
|
lToDos.Add(
|
|
s =>
|
|
{
|
|
var newGroupDC = s.InsertNewServiceRecordGroup(groupDC);
|
|
|
|
var idx = 0;
|
|
foreach(var vm in newVMList)
|
|
{
|
|
var newDC = newGroupDC.ServiceRecordList[idx++];
|
|
vm.IsNew = false;
|
|
vm.DataContract.ServiceRecordVersion = newDC.ServiceRecordVersion;
|
|
vm.DataContract.ServiceRecordOid = newDC.ServiceRecordOid;
|
|
vm.DataContract.GroupOid = newGroupDC.ServiceRecordGroupOid;
|
|
vm.GroupOid = newGroupDC.ServiceRecordGroupOid;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
ServiceFacade.DoMultipleOperationsServicesAsync(lToDos, UpdateViewModel);
|
|
|
|
MessageBox.Show("Die Gruppenbuchung wurde erfolgreich gespeichert.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
}
|
|
}
|
|
|
|
return lValid;
|
|
}
|
|
|
|
private bool SaveMultiBooking()
|
|
{
|
|
var lValid = true;
|
|
|
|
if (multiSupportConceptControl.SelectedSupportConcepts.Count == 0)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate(
|
|
"Bitte wählen Sie mindestens einen Hilfeplan aus, für den Sie eine Mehrfachbuchung anlegen möchten."),
|
|
"Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
lValid = false;
|
|
}
|
|
|
|
if (lValid)
|
|
{
|
|
if (multiEmployeeControl.SelectedEmployees.Count == 0)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate(
|
|
"Bitte wählen Sie mindestens einen Mitarbeiter aus, für den Sie eine Mehrfachbuchung anlegen möchten."),
|
|
"Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
lValid = false;
|
|
}
|
|
}
|
|
|
|
List<long> employeeOids = new List<long>();
|
|
foreach (var compactEmployeeDc in multiEmployeeControl.SelectedEmployees)
|
|
{
|
|
employeeOids.Add(compactEmployeeDc.EmployeeOid);
|
|
}
|
|
|
|
List<long> cb2scOids = new List<long>();
|
|
foreach (var scDc in multiSupportConceptControl.SelectedSupportConcepts)
|
|
{
|
|
if (scDc.CostBearerRelOids != null && scDc.CostBearerRelOids.Count > 0)
|
|
{
|
|
cb2scOids.Add(scDc.CostBearerRelOids[0]);
|
|
}
|
|
}
|
|
|
|
int index = 1;
|
|
foreach(var selectedSupportConcept in multiSupportConceptControl.SelectedSupportConcepts)
|
|
{
|
|
if(lValid)
|
|
{
|
|
FlatSupportConceptTreeNodeDC node = SupportConceptService.CreateFlatSupportConceptItem(selectedSupportConcept, null);
|
|
lValid = BeWoUtils.ValidateServiceRecordVM(ViewModel.PrototypeVM, null, node, true, ViewModel.SelectedEmployee, employeeOids, cb2scOids, index++);
|
|
}
|
|
}
|
|
//lValid = ValidateServiceRecordVMClientX(ViewModel.PrototypeVM, node, true);
|
|
|
|
|
|
if (lValid)
|
|
{
|
|
List<ServiceRecordVM> list = ViewModel.CreateFromPrototype();
|
|
|
|
if (list.Count > 0)
|
|
{
|
|
ServiceRecordVM prototypeVM = list[0];
|
|
|
|
ServiceRecordVM newVM = null;
|
|
List<ServiceRecordVM> newVMList = new List<ServiceRecordVM>();
|
|
|
|
var vmDuration = prototypeVM.RoundedDuration;
|
|
foreach (CompactSupportConceptDC dc in this.multiSupportConceptControl.SelectedSupportConcepts)
|
|
{
|
|
decimal duration = vmDuration;
|
|
|
|
if (dc.CostBearerList.Count > 0)
|
|
{
|
|
var org = dc.CostBearerList[0].Organisation;
|
|
if (org != null)
|
|
{
|
|
Calculations calc = Calculations.GetInstance(org.CostBearerID);
|
|
|
|
prototypeVM.RoundedDuration = calc.GetRoundedDuration(org, duration);
|
|
}
|
|
}
|
|
|
|
|
|
bool addToList = true;
|
|
foreach (CompactEmployeeDC emp in this.multiEmployeeControl.SelectedEmployees)
|
|
{
|
|
newVM = prototypeVM.Clone();
|
|
|
|
newVM.Employee = emp;
|
|
newVM.ChoosenNode = SupportConceptService.CreateFlatSupportConceptItem(dc, null);
|
|
newVM.SetInsertedOn(DateTime.Now);
|
|
newVMList.Add(newVM);
|
|
|
|
if (addToList)
|
|
{
|
|
// ###AddServiceRecord
|
|
this.ViewModel.VMList.Add(newVM);
|
|
addToList = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
var lToDos = new List<Action<IOperationsService>>();
|
|
|
|
if (newVMList.Count > 0)
|
|
{
|
|
var dcList = newVMList.Select(item => item.CommitToDataContract()).ToList();
|
|
|
|
lToDos.Add(
|
|
s =>
|
|
{
|
|
List<long> oids = s.InsertNewServiceRecords(dcList);
|
|
int idx = 0;
|
|
foreach (ServiceRecordVM vm in newVMList)
|
|
{
|
|
vm.IsNew = false;
|
|
vm.DataContract.ServiceRecordVersion = 1;
|
|
vm.DataContract.ServiceRecordOid = oids[idx++];
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
ServiceFacade.DoMultipleOperationsServicesAsync(lToDos, UpdateViewModel);
|
|
|
|
MessageBox.Show("Die Dokumentationen wurde erfolgreich gespeichert.", "Speichern",
|
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
|
}
|
|
}
|
|
|
|
return lValid;
|
|
}
|
|
|
|
private bool SaveSingleBooking()
|
|
{
|
|
var lValid = true;
|
|
|
|
FlatSupportConceptTreeNodeDC selectedNode = null;
|
|
if (ViewModel.CustomerNodes.Count > 0)
|
|
selectedNode = ViewModel.CustomerNodes[0];
|
|
|
|
if (!WithoutClient && (selectedNode == null || selectedNode.SupportConceptTreeNodeDC == null))
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate(
|
|
"Bitte wählen Sie zuerst einen Hilfeplan, für den Sie Leistungen dokumentieren möchten."),
|
|
"Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
lValid = false;
|
|
}
|
|
|
|
if (lValid)
|
|
{
|
|
lValid = BeWoUtils.ValidateServiceRecordVM(ViewModel.PrototypeVM, ViewModel.StatisticsDC, selectedNode,
|
|
WithoutClient, ViewModel.SelectedEmployee, null, null, 1);
|
|
|
|
if (lValid)
|
|
{
|
|
var save = false;
|
|
foreach (var iVM in ViewModel.CreateFromPrototype())
|
|
{
|
|
iVM.Employee = _SelectedEmployee;
|
|
|
|
ViewModel.VMList.Add(iVM);
|
|
save = true;
|
|
}
|
|
|
|
if (save)
|
|
{
|
|
Save();
|
|
ViewModel.RefreshServiceRecordsForSelectedTreeNode(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
return lValid;
|
|
}
|
|
|
|
private void SelectedItemChanged(FlatSupportConceptTreeNodeDC selectedNode)
|
|
{
|
|
if (ViewModel == null)
|
|
return;
|
|
|
|
UpdateAssessmentSheet(selectedNode);
|
|
|
|
ViewModel.ChangeTreeItemSelection(selectedNode);
|
|
srListBox.SelectedIndex = -1;
|
|
|
|
var sv = FindVisualChild<ScrollViewer>(srListBox);
|
|
if (sv != null)
|
|
sv.ScrollToTop();
|
|
|
|
UpdateServiceRecordListReportUrl(selectedNode);
|
|
|
|
SetDefaultCategory();
|
|
}
|
|
|
|
private void ServiceRecordView2_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
if(!AutoLockUI.HasJustBeenUnlocked)
|
|
{
|
|
ReloadViewModel();
|
|
}
|
|
else
|
|
{
|
|
AutoLockUI.HasJustBeenUnlocked = false;
|
|
}
|
|
|
|
if (ActualHeight > 0)
|
|
{
|
|
ComboBoxTreeViewControl.ParentWindowHeight = ActualHeight;
|
|
}
|
|
|
|
supportConceptSelectionControl.Focus();
|
|
}
|
|
|
|
private static void ServiceRecordView2_Unloaded(object sender, RoutedEventArgs e)
|
|
{
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
|
|
private void SetEmployeeComboVisibility()
|
|
{
|
|
if ((!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember))
|
|
|| chkGroupBooking.IsChecked.Value || chkMultiBooking.IsChecked.Value)
|
|
{
|
|
lblEmployee.Visibility = Visibility.Collapsed;
|
|
popupedit_employee.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
lblEmployee.Visibility = Visibility.Visible;
|
|
popupedit_employee.Visibility = Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
private void SetPopupViewVisible(bool visible)
|
|
{
|
|
popup_content.Visibility = visible ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
if (visible)
|
|
{
|
|
AnimateOpacity(0.5, 200);
|
|
}
|
|
else
|
|
{
|
|
AnimateOpacity(1, 100);
|
|
}
|
|
}
|
|
|
|
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
|
|
{
|
|
var vm = ((TextBox) sender).Tag as ServiceRecordVM;
|
|
if (vm != null)
|
|
srListBox.SelectedItem = vm;
|
|
}
|
|
|
|
private void UpdateServiceRecordListReportUrl(FlatSupportConceptTreeNodeDC selectedNode)
|
|
{
|
|
long scOid = 0;
|
|
long cOid = 0;
|
|
long cb2scOid = 0;
|
|
var eOid = BeWoApp.LoggedOnUser.Employee.EmployeeOid;
|
|
|
|
if (selectedNode != null && selectedNode.SupportConceptTreeNodeDC != null)
|
|
{
|
|
if (selectedNode.SupportConceptTreeNodeDC.SupportConcept != null)
|
|
{
|
|
scOid = selectedNode.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
|
|
}
|
|
|
|
if (selectedNode.SupportConceptTreeNodeDC.Customer != null)
|
|
{
|
|
cOid = selectedNode.SupportConceptTreeNodeDC.Customer.CustomerOid;
|
|
}
|
|
|
|
if (selectedNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC != null)
|
|
{
|
|
cb2scOid = selectedNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC
|
|
.CostBearer2SupportConceptOid.Value;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (_SelectedEmployee != null)
|
|
{
|
|
eOid = _SelectedEmployee.EmployeeOid;
|
|
}
|
|
}
|
|
|
|
var url = BeWoApp.SiteOfOrigin + "/ReportView.aspx" + "?eOid=" + eOid + "&scOid=" + scOid + "&cOid=" +
|
|
cOid + "&cb2scOid=" + cb2scOid + "&type=" + Utils.EnumName(ReportTypes.ServiceRecordList);
|
|
url = BeWoWpfUtils.GetHTMLEncodedURL(url);
|
|
|
|
linkPdfExport.NavigateUri = new Uri(url);
|
|
}
|
|
|
|
private void UpdateViewModel()
|
|
{
|
|
this.Dispatch(
|
|
delegate
|
|
{
|
|
ReloadViewModel();
|
|
ViewModel.RefreshServiceRecordsForSelectedTreeNode(false);
|
|
});
|
|
}
|
|
|
|
private void ViewModel_ServiceRecordListChanged(object sender, EventArgs e)
|
|
{
|
|
var list = _ViewModel.ServiceRecordsForSelectedCustomer.OrderByDescending(srVM => srVM.StartDate).ToList();
|
|
|
|
bool containsMinutenFormat = false;
|
|
bool containsStundenFormat = false;
|
|
|
|
foreach (var a in list)
|
|
{
|
|
if (a.ServiceRecordType == ServiceRecordTypeId.AdditionalService)
|
|
{
|
|
a.EditAllowed = false;
|
|
a.DeleteAllowed = false;
|
|
a.Notice = string.Empty;
|
|
}
|
|
if (a.DauerEinheit == ZeiterfassungsDauer.Stunden)
|
|
{
|
|
containsStundenFormat = true;
|
|
}
|
|
else
|
|
{
|
|
containsMinutenFormat = true;
|
|
}
|
|
}
|
|
|
|
RoundedDHeader.Header = "Minuten";
|
|
DutationInSTDHeader.Visible = false;
|
|
if (BeWoApp.AppSettings.LetzteZeiterfassungsDauer == ZeiterfassungsDauer.Stunden)
|
|
{
|
|
RoundedDHeader.Header = "Stunden";
|
|
}
|
|
|
|
if (containsStundenFormat && containsMinutenFormat)
|
|
{
|
|
RoundedDHeader.Header = "Dauer";
|
|
DutationInSTDHeader.Visible = true;
|
|
DutationInSTDHeader.VisibleIndex = RoundedDHeader.VisibleIndex + 1;
|
|
|
|
}
|
|
else if (containsMinutenFormat)
|
|
{
|
|
RoundedDHeader.Header = "Minuten";
|
|
}
|
|
else if (containsStundenFormat)
|
|
{
|
|
RoundedDHeader.Header = "Stunden";
|
|
}
|
|
|
|
srListBox.ItemsSource = list;
|
|
ViewModel.CurrentVisibleVMs = list;
|
|
//###Bars
|
|
var selected = srGridControl.CurrentItem;
|
|
|
|
srGridControl.ItemsSource = list;
|
|
srGridControl.CurrentItem = selected;
|
|
//ColorLinesWithMarker(list);
|
|
|
|
|
|
//this.serviceRecordScheduler.ServiceRecordList = list;
|
|
|
|
if (_AssessmentSheet != null)
|
|
_AssessmentSheet.ServiceRecords = list;
|
|
|
|
// ViewModel.UpdateViewYearFilter(GetVisibleRecordVMs());
|
|
}
|
|
|
|
//private void ColorLinesWithMarker(List<ServiceRecordVM> list)
|
|
//{
|
|
// var converter = new BrushConverter();
|
|
|
|
// var colorString = ServiceFacade.DoOperationsServiceSync(s => s.GetColorForServiceRecordView2());
|
|
// var color = (Brush)converter.ConvertFromString(colorString);
|
|
|
|
// for (int i = 0; i < list.Count; i++)
|
|
// {
|
|
|
|
// if(list[i].ServiceRecordType.ToString().Equals("Content"))
|
|
// {
|
|
// var rowHandle = srGridControl.gethandle
|
|
// var rowstate = srGridControl.GetRowState(i, true);
|
|
// rowstate.SetValue(RowBackgroundHelper.IsEnabledProperty, true);
|
|
// rowstate.SetValue(RowBackgroundHelper.BackgroundProperty, color);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
private void BtnDelete_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var vm = ((Button) sender).Tag as ServiceRecordVM;
|
|
if (vm != null)
|
|
{
|
|
srListBox.SelectedItem = vm;
|
|
}
|
|
|
|
Delete();
|
|
}
|
|
|
|
private void BtnEdit_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var vm = ((Button) sender).Tag as ServiceRecordVM;
|
|
|
|
if (vm != null)
|
|
{
|
|
srListBox.SelectedItem = vm;
|
|
}
|
|
|
|
StartEdit(GetSelectedServiceRecordFromListBox());
|
|
}
|
|
|
|
private void ServiceRecordListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (IsPartOf(e.OriginalSource, typeof(ScrollBar)))
|
|
{
|
|
return;
|
|
}
|
|
|
|
StartEdit(GetSelectedServiceRecordFromListBox());
|
|
}
|
|
|
|
private void StartEdit(ServiceRecordVM selectedRecord)
|
|
{
|
|
if (selectedRecord != null)
|
|
{
|
|
var serviceRecordOid = Convert.ToInt64(selectedRecord.Id);
|
|
|
|
var record = ServiceFacade.DoOperationsServiceSync(s => s.GetServiceRecordById(serviceRecordOid));
|
|
|
|
if (record == null)
|
|
{
|
|
MessageBox.Show("Der ausgewählte Eintrag wurde in der Zwischenzeit gelöscht.",
|
|
"Editieren nicht möglich", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
ViewModel.RefreshServiceRecordsForSelectedTreeNode(false);
|
|
return;
|
|
}
|
|
|
|
var allgoalsCopy = GoalService.CopyGoals(selectedRecord.AllGoals, false);
|
|
|
|
var sr = new ServiceRecordVM(record, ViewModel.PrototypeVM.Category2Services,
|
|
selectedRecord.AllGoalCategories, allgoalsCopy);
|
|
|
|
ViewModel.EditVM = sr;
|
|
|
|
Edit(sr);
|
|
}
|
|
}
|
|
|
|
private void BtnShowHistory_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var vm = ((Button) sender).Tag as ServiceRecordVM;
|
|
if (vm != null)
|
|
{
|
|
srListBox.SelectedItem = vm;
|
|
}
|
|
|
|
ShowHistory(GetSelectedServiceRecordFromListBox());
|
|
}
|
|
|
|
private void Button_add_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
SaveServiceRecord();
|
|
}
|
|
|
|
private bool SaveServiceRecord()
|
|
{
|
|
//var lValid = ValidationTrigger.Validate(root, new Collection<string> { "BedarfsmedikationsGrid" });
|
|
|
|
if (BeWoApp.AppSettings.ShowRtfTextfield)
|
|
{
|
|
SetRTFDaten();
|
|
}
|
|
|
|
var lValid = ValidationTrigger.Validate(root);
|
|
|
|
if (lValid)
|
|
{
|
|
if (chkGroupBooking.IsChecked != null && chkGroupBooking.IsChecked.Value)
|
|
{
|
|
lValid = SaveGroupBooking();
|
|
}
|
|
else if (chkMultiBooking.IsChecked != null && chkMultiBooking.IsChecked.Value)
|
|
{
|
|
lValid = SaveMultiBooking();
|
|
}
|
|
else
|
|
{
|
|
lValid = SaveSingleBooking();
|
|
|
|
ComboBoxTreeViewControl.ResetControl();
|
|
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
|
|
}
|
|
|
|
ViewModel.AiChatButtonDocumentationViewModel.ClearHistory();
|
|
}
|
|
|
|
return lValid;
|
|
}
|
|
|
|
private void SetRTFDaten()
|
|
{
|
|
|
|
ViewModel.PrototypeVM.Notice = richEditControl1.Text;
|
|
ViewModel.PrototypeVM.RTFNotice = richEditControl1.RtfText;
|
|
|
|
ViewModel.PrototypeVM.Notice2 = richEditControl2.Text;
|
|
ViewModel.PrototypeVM.RTFNotice2 = richEditControl2.RtfText;
|
|
|
|
ViewModel.PrototypeVM.Notice3 = richEditControl3.Text;
|
|
ViewModel.PrototypeVM.RTFNotice3 = richEditControl3.RtfText;
|
|
|
|
ViewModel.PrototypeVM.Notice4 = richEditControl4.Text;
|
|
ViewModel.PrototypeVM.RTFNotice4 = richEditControl4.RtfText;
|
|
|
|
ViewModel.PrototypeVM.Notice5 = richEditControl5.Text;
|
|
ViewModel.PrototypeVM.RTFNotice5 = richEditControl5.RtfText;
|
|
|
|
}
|
|
|
|
private void SetRebookingButtonVisibility()
|
|
{
|
|
if (Eintragumbuchunsbutton == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var erg = chkWithClient != null && chkWithClient.IsChecked != null && chkWithClient.IsChecked.Value &&
|
|
chkGroupBooking != null && chkGroupBooking.IsChecked != null &&
|
|
!chkGroupBooking.IsChecked.Value &&
|
|
chkMultiBooking != null && chkMultiBooking.IsChecked != null && !chkMultiBooking.IsChecked.Value;
|
|
|
|
Eintragumbuchunsbutton.Visibility = erg ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
|
|
private void ChkGroupBooking_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (_IgnoreGroupMultiCheck)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (ViewModel != null)
|
|
{
|
|
ViewModel.IsGroupBooking = true;
|
|
}
|
|
|
|
supportConceptSelectionControl.Visibility = Visibility.Collapsed;
|
|
ButtonZeiterfassungErstellen.Visibility = Visibility.Collapsed;
|
|
multiSupportConceptControl.Visibility = Visibility.Visible;
|
|
multiEmployeeControl.Visibility = Visibility.Visible;
|
|
//panelGoalLabel.Visibility = Visibility.Collapsed;
|
|
//panelGoalTree.Visibility = Visibility.Collapsed;
|
|
|
|
SetEmployeeComboVisibility();
|
|
|
|
SetRebookingButtonVisibility();
|
|
|
|
if (chkWithClient != null)
|
|
{
|
|
chkWithClient.IsEnabled = false;
|
|
}
|
|
|
|
if (chkMultiBooking != null)
|
|
{
|
|
_IgnoreGroupMultiCheck = true;
|
|
chkMultiBooking.IsChecked = false;
|
|
_IgnoreGroupMultiCheck = false;
|
|
}
|
|
|
|
SelectedItemChanged(
|
|
SupportConceptService.CreateFlatSupportConceptItem(multiSupportConceptControl.SelectedItem, null));
|
|
}
|
|
|
|
private void ChkGroupBooking_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (_IgnoreGroupMultiCheck)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (ViewModel != null)
|
|
{
|
|
ViewModel.IsGroupBooking = false;
|
|
}
|
|
|
|
supportConceptSelectionControl.Visibility = Visibility.Visible;
|
|
ButtonZeiterfassungErstellen.Visibility = BeWoApp.AppSettings.ShowKlientenBetreuungszeiten ? Visibility.Visible : Visibility.Collapsed;
|
|
multiSupportConceptControl.Visibility = Visibility.Collapsed;
|
|
multiEmployeeControl.Visibility = Visibility.Collapsed;
|
|
//panelGoalLabel.Visibility = Visibility.Visible;
|
|
//panelGoalTree.Visibility = Visibility.Visible;
|
|
|
|
SetEmployeeComboVisibility();
|
|
SetRebookingButtonVisibility();
|
|
|
|
if (chkWithClient != null)
|
|
{
|
|
chkWithClient.IsEnabled = true;
|
|
}
|
|
|
|
SelectedItemChanged(supportConceptSelectionControl.SelectedItem);
|
|
}
|
|
|
|
private void ChkMultiBooking_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (_IgnoreGroupMultiCheck)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (ViewModel != null)
|
|
{
|
|
ViewModel.IsMultiBooking = true;
|
|
}
|
|
|
|
supportConceptSelectionControl.Visibility = Visibility.Collapsed;
|
|
ButtonZeiterfassungErstellen.Visibility = Visibility.Collapsed;
|
|
multiSupportConceptControl.Visibility = Visibility.Visible;
|
|
multiEmployeeControl.Visibility = Visibility.Visible;
|
|
//panelGoalLabel.Visibility = Visibility.Collapsed;
|
|
//panelGoalTree.Visibility = Visibility.Collapsed;
|
|
|
|
SetEmployeeComboVisibility();
|
|
SetRebookingButtonVisibility();
|
|
|
|
if (chkWithClient != null)
|
|
{
|
|
chkWithClient.IsEnabled = false;
|
|
}
|
|
|
|
if (chkGroupBooking != null)
|
|
{
|
|
_IgnoreGroupMultiCheck = true;
|
|
chkGroupBooking.IsChecked = false;
|
|
_IgnoreGroupMultiCheck = false;
|
|
}
|
|
|
|
SelectedItemChanged(
|
|
SupportConceptService.CreateFlatSupportConceptItem(multiSupportConceptControl.SelectedItem, null));
|
|
}
|
|
|
|
private void ChkMultiBooking_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (_IgnoreGroupMultiCheck)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (ViewModel != null)
|
|
{
|
|
ViewModel.IsMultiBooking = false;
|
|
}
|
|
|
|
supportConceptSelectionControl.Visibility = Visibility.Visible;
|
|
ButtonZeiterfassungErstellen.Visibility = BeWoApp.AppSettings.ShowKlientenBetreuungszeiten ? Visibility.Visible : Visibility.Collapsed;
|
|
multiSupportConceptControl.Visibility = Visibility.Collapsed;
|
|
multiEmployeeControl.Visibility = Visibility.Collapsed;
|
|
//panelGoalLabel.Visibility = Visibility.Visible;
|
|
//panelGoalTree.Visibility = Visibility.Visible;
|
|
|
|
SetEmployeeComboVisibility();
|
|
SetRebookingButtonVisibility();
|
|
|
|
if (chkWithClient != null)
|
|
{
|
|
chkWithClient.IsEnabled = true;
|
|
}
|
|
|
|
SelectedItemChanged(supportConceptSelectionControl.SelectedItem);
|
|
}
|
|
|
|
private void ChkWithClient_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (customerSelectAndInfoGrid != null)
|
|
{
|
|
customerSelectAndInfoGrid.Visibility = Visibility.Visible;
|
|
}
|
|
|
|
WithoutClient = false;
|
|
|
|
if (supportConceptSelectionControl != null)
|
|
{
|
|
var selectedNode = supportConceptSelectionControl.SelectedItem;
|
|
SelectedItemChanged(selectedNode);
|
|
}
|
|
|
|
if (chkGroupBooking != null)
|
|
{
|
|
chkGroupBooking.IsEnabled = true;
|
|
}
|
|
|
|
if (chkMultiBooking != null)
|
|
{
|
|
chkMultiBooking.IsEnabled = true;
|
|
}
|
|
if (ButtonZeiterfassungErstellen != null)
|
|
{
|
|
ButtonZeiterfassungErstellen.Visibility = BeWoApp.AppSettings.ShowKlientenBetreuungszeiten ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
SetRebookingButtonVisibility();
|
|
}
|
|
|
|
private void ChkWithClient_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (ButtonZeiterfassungErstellen != null)
|
|
{
|
|
ButtonZeiterfassungErstellen.Visibility = Visibility.Collapsed;
|
|
}
|
|
if (customerSelectAndInfoGrid != null)
|
|
{
|
|
customerSelectAndInfoGrid.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
WithoutClient = true;
|
|
|
|
SelectedItemChanged(null);
|
|
|
|
if (chkGroupBooking != null)
|
|
{
|
|
chkGroupBooking.IsEnabled = false;
|
|
}
|
|
|
|
if (chkMultiBooking != null)
|
|
{
|
|
chkMultiBooking.IsEnabled = false;
|
|
}
|
|
|
|
SetRebookingButtonVisibility();
|
|
}
|
|
|
|
//CB EINKOMMENTIEREN
|
|
//private void ChkWohnheimBookingChecked(object sender, RoutedEventArgs e)
|
|
//{
|
|
// chkWithClient.IsEnabled = false;
|
|
// chkMultiBooking.IsEnabled = false;
|
|
// chkGroupBooking.IsEnabled = false;
|
|
|
|
// WithoutClient = true;
|
|
// SelectedItemChanged(null);
|
|
|
|
// customerDetailGrid.Visibility = Visibility.Collapsed;
|
|
// zeitraumGrid.Visibility = Visibility.Collapsed;
|
|
// customerSelectAndInfoGrid.Visibility = Visibility.Collapsed;
|
|
// wohnheimbuchungsGrid.Visibility = Visibility.Visible;
|
|
// btnSaveWohnheimbuchung.Visibility = Visibility.Visible;
|
|
|
|
// UpdateWohnheimBuchungGrid();
|
|
// PreselectSupportConceptsFromWohnheim(ViewModel.SelectedWohnheimbuchung.Wohnheim);
|
|
//}
|
|
|
|
//private void UpdateWohnheimBuchungGrid()
|
|
//{
|
|
// LoadExistingWohnheimbuchung(foundExistingBuchung => this.Dispatch(() =>
|
|
// {
|
|
// BeWoWpfUtils.RefreshDXGrid(SupportConcept2WohnheimbuchungGridControl);
|
|
// BeWoWpfUtils.RefreshDXGrid(Employee2WohnheimbuchungGridControl);
|
|
|
|
// if (!foundExistingBuchung)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// var firstDate = ViewModel.SelectedWohnheimbuchung.Buchungsdatum.Value;
|
|
|
|
// foreach (var item in ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.VMList.Where(w => w.StartDate != null && w.EndDate != null))
|
|
// {
|
|
// item.StartDate = firstDate.MergeDatesByDate(item.StartDate.Value);
|
|
// item.EndDate = firstDate.MergeDatesByDate(item.EndDate.Value);
|
|
// }
|
|
|
|
// foreach (var item in ViewModel.SelectedWohnheimbuchung.EmployeeList.VMList.Where(w => w.StartDate != null && w.EndDate != null))
|
|
// {
|
|
// item.StartDate = firstDate.MergeDatesByDate(item.StartDate.Value);
|
|
// item.EndDate = firstDate.MergeDatesByDate(item.EndDate.Value);
|
|
// }
|
|
// }));
|
|
//}
|
|
|
|
//private void ChkWohnheimBookingUnchecked(object sender, RoutedEventArgs e)
|
|
//{
|
|
// chkWithClient.IsEnabled = true;
|
|
// chkMultiBooking.IsEnabled = true;
|
|
// chkGroupBooking.IsEnabled = true;
|
|
|
|
// WithoutClient = false;
|
|
|
|
// if (supportConceptSelectionControl != null)
|
|
// {
|
|
// var selectedNode = supportConceptSelectionControl.SelectedItem;
|
|
// SelectedItemChanged(selectedNode);
|
|
// }
|
|
|
|
// customerDetailGrid.Visibility = Visibility.Visible;
|
|
// zeitraumGrid.Visibility = Visibility.Visible;
|
|
// customerSelectAndInfoGrid.Visibility = Visibility.Visible;
|
|
// wohnheimbuchungsGrid.Visibility = Visibility.Collapsed;
|
|
// btnSaveWohnheimbuchung.Visibility = Visibility.Collapsed;
|
|
//}
|
|
|
|
private void SupportConceptSelectionControl_ItemSelected(object sender, EventArgs<FlatSupportConceptTreeNodeDC> e)
|
|
{
|
|
if (chkGroupBooking.IsChecked.Value || chkMultiBooking.IsChecked.Value)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var selectedNode = e.Data;
|
|
SelectedItemChanged(selectedNode);
|
|
|
|
ComboBoxTreeViewControl.ResetControl();
|
|
|
|
ResetAllGoals(ViewModel.PrototypeVM.GoalTree);
|
|
|
|
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
|
|
}
|
|
|
|
private void ResetAllGoals(List<SupportConceptGoalDC> goals)
|
|
{
|
|
if (goals != null)
|
|
{
|
|
foreach (var item in goals)
|
|
{
|
|
item.CheckRecursive = false;
|
|
item.IsChecked = false;
|
|
item.SetRatingType(null);
|
|
|
|
ResetAllGoals(item.Children);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void LinkExcelExportRequestNavigate(object sender, RequestNavigateEventArgs e)
|
|
{
|
|
var list = srListBox.ItemsSource as List<ServiceRecordVM>;
|
|
|
|
var lHeaderCaptions = new List<string>();
|
|
var lContent = new List<List<string>>();
|
|
lHeaderCaptions.Add("OID");
|
|
|
|
if (BeWoApp.AppSettings.IsEndDateVisible)
|
|
{
|
|
lHeaderCaptions.Add("Startdatum");
|
|
lHeaderCaptions.Add("Enddatum");
|
|
}
|
|
else
|
|
{
|
|
lHeaderCaptions.Add("Datum");
|
|
}
|
|
|
|
lHeaderCaptions.Add("Von");
|
|
lHeaderCaptions.Add("Bis");
|
|
lHeaderCaptions.Add(Translator.Translate("FLM"));
|
|
lHeaderCaptions.Add(Translator.Translate("FLM gerundet"));
|
|
if (BeWoApp.AppSettings.ShowDistanceFields)
|
|
{
|
|
lHeaderCaptions.Add(Translator.Translate("Gefahrene km"));
|
|
}
|
|
if (BeWoApp.AppSettings.ShowBetrag)
|
|
{
|
|
lHeaderCaptions.Add(Translator.Translate("Betrag"));
|
|
}
|
|
lHeaderCaptions.Add(Translator.Translate("MitarbeiterSingular"));
|
|
lHeaderCaptions.Add(Translator.Translate("Klient"));
|
|
lHeaderCaptions.Add(Translator.Translate("Hilfeplan"));
|
|
lHeaderCaptions.Add(Translator.Translate("Kostenträger"));
|
|
lHeaderCaptions.Add("Kategorie");
|
|
lHeaderCaptions.Add("Leistung");
|
|
if (ViewModel.AllDocTypes != null && ViewModel.AllDocTypes.Count > 0)
|
|
{
|
|
foreach (var dt in ViewModel.AllDocTypes)
|
|
{
|
|
lHeaderCaptions.Add(dt.TypeDescription);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lHeaderCaptions.Add("Dokumentation");
|
|
}
|
|
|
|
lHeaderCaptions.Add("Ziele");
|
|
lHeaderCaptions.Add("Maßnahmen");
|
|
|
|
if (!BeWoApp.AppSettings.HideServiceRecordInsertedByAndInsertedOn)
|
|
{
|
|
lHeaderCaptions.Add("Angelegt von");
|
|
lHeaderCaptions.Add("Angelegt am");
|
|
}
|
|
if (!BeWoApp.AppSettings.ShowSignatures)
|
|
{
|
|
lHeaderCaptions.Add("Unterschrieben");
|
|
}
|
|
if (list != null)
|
|
{
|
|
foreach (var vm in list)
|
|
{
|
|
var row = new List<string>();
|
|
|
|
row.Add(vm.DataContract.ServiceRecordOid.ToString());
|
|
|
|
if (BeWoApp.AppSettings.IsEndDateVisible)
|
|
{
|
|
row.Add(String.Format("{0:dd.MM.yyyy}", vm.StartDate));
|
|
row.Add(String.Format("{0:dd.MM.yyyy}", vm.EndDate));
|
|
}
|
|
else
|
|
{
|
|
row.Add(String.Format("{0:dd.MM.yyyy}", vm.StartDate));
|
|
}
|
|
|
|
row.Add(vm.StartDate.Second == 0 ? String.Format("{0:HH:mm}", vm.StartDate) : "");
|
|
row.Add(vm.EndDate.Second == 0 ? String.Format("{0:HH:mm}", vm.EndDate) : "");
|
|
|
|
row.Add(vm.AssistanceDuration.ToString());
|
|
row.Add(vm.RoundedDuration.ToString());
|
|
if (BeWoApp.AppSettings.ShowDistanceFields)
|
|
{
|
|
row.Add(String.Format("{0:0.##}", vm.DistanceInMeter));
|
|
}
|
|
if (BeWoApp.AppSettings.ShowBetrag)
|
|
{
|
|
row.Add(String.Format("{0:c}", vm.Betrag));
|
|
}
|
|
row.Add(vm.Employee != null ? vm.Employee.ToString() : string.Empty);
|
|
row.Add(vm.Customer != null ? vm.Customer.ToString() : string.Empty);
|
|
row.Add(vm.SupportConcept != null ? vm.SupportConcept.ToString() : string.Empty);
|
|
row.Add(vm.CostBearer != null ? vm.CostBearer.ToString() : string.Empty);
|
|
row.Add(vm.Category != null ? vm.Category.ToString() : string.Empty);
|
|
row.Add(vm.ServiceDescription != null ? vm.ServiceDescription.ToString() : string.Empty);
|
|
|
|
row.Add(vm.Notice);
|
|
if (ViewModel.AllDocTypes != null)
|
|
{
|
|
if (ViewModel.AllDocTypes.Count >= 2)
|
|
{
|
|
row.Add(vm.Notice2);
|
|
}
|
|
if (ViewModel.AllDocTypes.Count >= 3)
|
|
{
|
|
row.Add(vm.Notice3);
|
|
}
|
|
if (ViewModel.AllDocTypes.Count >= 4)
|
|
{
|
|
row.Add(vm.Notice4);
|
|
}
|
|
if (ViewModel.AllDocTypes.Count >= 5)
|
|
{
|
|
row.Add(vm.Notice5);
|
|
}
|
|
}
|
|
|
|
row.Add(vm.OnlyGoalString);
|
|
row.Add(vm.MassnahmenString);
|
|
|
|
if (!BeWoApp.AppSettings.HideServiceRecordInsertedByAndInsertedOn)
|
|
{
|
|
row.Add(vm.InsUser);
|
|
row.Add(vm.InsertedOn);
|
|
}
|
|
if (!BeWoApp.AppSettings.ShowSignatures)
|
|
{
|
|
row.Add(vm.SignatureOid.HasValue ? "Ja" : "Nein");
|
|
}
|
|
|
|
//lContent.AddRange(list.Select(vm => new List<string>
|
|
// {
|
|
// String.Format("{0:dd.MM.yyyy}", vm.StartTime != null ? vm.Date : null),
|
|
// String.Format("{0:HH:mm}", vm.StartTime != null && vm.StartTime.Value.Second == 0 ? vm.StartTime : null),
|
|
// String.Format("{0:HH:mm}", vm.EndTime != null && vm.EndTime.Value.Second == 0 ? vm.EndTime : null),
|
|
// vm.AssistanceDuration.ToString(),
|
|
// vm.RoundedDuration.ToString(),
|
|
// vm.Employee != null ? vm.Employee.ToString() : string.Empty,
|
|
// vm.Customer != null ? vm.Customer.ToString() : string.Empty,
|
|
// vm.SupportConcept != null ? vm.SupportConcept.ToString() : string.Empty,
|
|
// vm.CostBearer != null ? vm.CostBearer.ToString() : string.Empty,
|
|
// vm.Category != null ? vm.Category.ToString() : string.Empty,
|
|
// vm.ServiceDescription != null ? vm.ServiceDescription.ToString() : string.Empty,
|
|
// vm.Notice,vm.Notice2,vm.Notice3,vm.Notice4,vm.Notice5,
|
|
// vm.GoalString
|
|
// }));
|
|
lContent.Add(row);
|
|
}
|
|
|
|
}
|
|
|
|
var path = BeWoApp.GetAndCreateUserAppDataPath() + "\\Dokumentation.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.PrepareExcelFile(DownloadLinkEngine.ExcelFileId, lHeaderCaptions, lContent),
|
|
sf.FileName));
|
|
}
|
|
|
|
private void MultiSupportConceptControl_ItemSelected(object sender, EventArgs<CompactSupportConceptDC> e)
|
|
{
|
|
FlatSupportConceptTreeNodeDC flatNode = SupportConceptService.CreateFlatSupportConceptItem(e.Data, null);
|
|
|
|
SelectedItemChanged(flatNode);
|
|
}
|
|
|
|
private void PopupeditEmployeePopUpClick(object sender, RoutedEventArgs e)
|
|
{
|
|
popup_employee.IsOpen = true;
|
|
}
|
|
|
|
private void UpdateAssessmentSheet(FlatSupportConceptTreeNodeDC selectedNode)
|
|
{
|
|
if (_AssessmentSheet == null)
|
|
return;
|
|
|
|
if (selectedNode != null && selectedNode.SupportConceptTreeNodeDC != null)
|
|
{
|
|
var customer = selectedNode.SupportConceptTreeNodeDC.Customer;
|
|
if (customer != null)
|
|
{
|
|
if (!_CustomerContainsAssessmentCategories.ContainsKey(customer))
|
|
{
|
|
ServiceFacade.DoCustomerServiceAsync(
|
|
s1 => s1.LoadCustomerAssessmentSheetCategoryList(customer.Oid.Value),
|
|
|
|
cb => this.Dispatch(
|
|
delegate
|
|
{
|
|
_CustomerContainsAssessmentCategories.Add(customer, cb);
|
|
|
|
UpdateAssessmentSheet(selectedNode.SupportConceptTreeNodeDC.Customer, cb);
|
|
}), false);
|
|
}
|
|
else
|
|
{
|
|
var cats = _CustomerContainsAssessmentCategories[customer];
|
|
UpdateAssessmentSheet(selectedNode.SupportConceptTreeNodeDC.Customer, cats);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
HideAssessmentSheet();
|
|
}
|
|
}
|
|
|
|
private DockLayoutManager dockLayoutManager;
|
|
private LayoutPanel layoutPanel1;
|
|
private LayoutPanel layoutPanel2;
|
|
private LayoutPanel layoutPanel3;
|
|
private Grid panel1;
|
|
private Grid panel2;
|
|
private Grid panel3;
|
|
|
|
private void CreateLayoutManager()
|
|
{
|
|
dockLayoutManager = new DockLayoutManager();
|
|
dockLayoutManager.SetValue(Grid.RowProperty, 2);
|
|
dockLayoutManager.SetValue(Grid.ColumnSpanProperty, 2);
|
|
dockLayoutManager.Margin = new Thickness(0, 5, 0, 0);
|
|
dockLayoutManager.SetValue(ThemeManager.ThemeNameProperty, "LightGray");
|
|
dockLayoutManager.Background = Brushes.Transparent;
|
|
dockLayoutManager.Visibility = Visibility.Hidden;
|
|
dockLayoutManager.ShowingDockHints += DockLayoutManager_ShowingDockHints;
|
|
|
|
var group = new LayoutGroup();
|
|
dockLayoutManager.LayoutRoot = group;
|
|
|
|
layoutPanel1 = new LayoutPanel
|
|
{
|
|
Caption = "Neue Leistung hinzufügen",
|
|
ItemWidth = GridLength.Auto,
|
|
ShowCloseButton = false,
|
|
ShowPinButton = false,
|
|
AllowDrag = false,
|
|
AllowMove = false,
|
|
CaptionHorizontalAlignment = HorizontalAlignment.Stretch,
|
|
CaptionTemplate = (DataTemplate) FindResource("LayoutPanelCaptionTemplate")
|
|
};
|
|
|
|
var border = new Border
|
|
{
|
|
Background = new SolidColorBrush(Color.FromRgb(195, 203, 206)),
|
|
BorderThickness = new Thickness(0),
|
|
BorderBrush = Brushes.Gray
|
|
};
|
|
|
|
panel1 = new Grid {Margin = new Thickness(4)};
|
|
border.Child = panel1;
|
|
|
|
layoutPanel1.Content = border;
|
|
|
|
group.Items.Add(layoutPanel1);
|
|
|
|
layoutPanel2 = new LayoutPanel
|
|
{
|
|
Caption = "Leistungen",
|
|
ItemWidth = new GridLength(1, GridUnitType.Star),
|
|
ShowCloseButton = false,
|
|
ShowPinButton = false,
|
|
AllowDrag = false,
|
|
AllowMove = false,
|
|
CaptionTemplate = (DataTemplate) FindResource("LayoutPanelCaptionTemplate"),
|
|
CaptionHorizontalAlignment = HorizontalAlignment.Stretch
|
|
};
|
|
|
|
border = new Border
|
|
{
|
|
Background = new SolidColorBrush(Color.FromRgb(195, 203, 206)),
|
|
BorderThickness = new Thickness(0),
|
|
BorderBrush = Brushes.Gray
|
|
};
|
|
|
|
panel2 = new Grid {Margin = new Thickness(0)};
|
|
border.Child = panel2;
|
|
|
|
layoutPanel2.Content = border;
|
|
|
|
group.Items.Add(layoutPanel2);
|
|
|
|
layoutPanel3 = new LayoutPanel
|
|
{
|
|
Caption = "Punktebogen",
|
|
ItemWidth = new GridLength(400, GridUnitType.Pixel),
|
|
ShowCloseButton = false,
|
|
ShowPinButton = false,
|
|
AllowDrag = false,
|
|
AllowMove = false,
|
|
CaptionTemplate = (DataTemplate) FindResource("LayoutPanelCaptionTemplate"),
|
|
CaptionHorizontalAlignment = HorizontalAlignment.Stretch
|
|
};
|
|
|
|
border = new Border
|
|
{
|
|
Background = new SolidColorBrush(Color.FromRgb(195, 203, 206)),
|
|
BorderThickness = new Thickness(0),
|
|
BorderBrush = Brushes.Gray
|
|
};
|
|
|
|
panel3 = new Grid {Margin = new Thickness(0, 4, 0, 0)};
|
|
border.Child = panel3;
|
|
|
|
layoutPanel3.Content = border;
|
|
|
|
group.Items.Add(layoutPanel3);
|
|
|
|
root.Children.Add(dockLayoutManager);
|
|
|
|
InitDockPanel();
|
|
|
|
_AssessmentSheet.LayoutManager = dockLayoutManager;
|
|
}
|
|
|
|
private static void DockLayoutManager_ShowingDockHints(object sender, DevExpress.Xpf.Docking.Base.ShowingDockHintsEventArgs e)
|
|
{
|
|
e.DisableAll();
|
|
e.HideAll();
|
|
e.Handled = true;
|
|
}
|
|
|
|
private void HideAssessmentSheet()
|
|
{
|
|
_AssessmentSheet.SetCustomer(null, null);
|
|
_AssessmentSheet.Visibility = Visibility.Collapsed;
|
|
|
|
customerDetailGrid.Visibility = Visibility.Visible;
|
|
|
|
if (dockLayoutManager != null)
|
|
dockLayoutManager.Visibility = Visibility.Collapsed;
|
|
|
|
if (customerDetailGrid.Children.Count != 0)
|
|
return;
|
|
|
|
if (panel1 != null)
|
|
{
|
|
panel1.Children.Clear();
|
|
panel2.Children.Clear();
|
|
panel3.Children.Clear();
|
|
}
|
|
|
|
groupBoxNeueLeistung.Content = gridNeueLeistung;
|
|
customerDetailGrid.Children.Add(groupBoxNeueLeistung);
|
|
customerDetailGrid.Children.Add(serviceRecordListContent);
|
|
customerDetailGrid.Children.Add(txtServiceListCount);
|
|
customerDetailGrid.Children.Add(stackPanelInfoText);
|
|
customerDetailGrid.Children.Add(punktebogenRootGrid);
|
|
}
|
|
|
|
private void ShowAssessmentSheet(CompactCustomerDC customer, List<AssessmentSheetCategoryDC> cats)
|
|
{
|
|
if (dockLayoutManager == null)
|
|
CreateLayoutManager();
|
|
|
|
_AssessmentSheet.SetCustomer(customer, cats);
|
|
|
|
if (_AssessmentSheet.Visibility == Visibility.Visible)
|
|
return;
|
|
|
|
_AssessmentSheet.Visibility = Visibility.Visible;
|
|
|
|
customerDetailGrid.Visibility = Visibility.Collapsed;
|
|
dockLayoutManager.Visibility = Visibility.Visible;
|
|
|
|
if (customerDetailGrid.Children.Count > 0)
|
|
customerDetailGrid.Children.Clear();
|
|
|
|
groupBoxNeueLeistung.Content = null;
|
|
panel1.Children.Add(gridNeueLeistung);
|
|
panel2.Children.Add(serviceRecordListContent);
|
|
panel2.Children.Add(txtServiceListCount);
|
|
panel2.Children.Add(stackPanelInfoText);
|
|
panel3.Children.Add(punktebogenRootGrid);
|
|
}
|
|
|
|
private void UpdateAssessmentSheet(CompactCustomerDC customer, List<AssessmentSheetCategoryDC> cats)
|
|
{
|
|
if (cats.Count == 0)
|
|
{
|
|
HideAssessmentSheet();
|
|
}
|
|
else
|
|
{
|
|
ShowAssessmentSheet(customer, cats);
|
|
}
|
|
}
|
|
|
|
private BaseLayoutItem lastPanel;
|
|
private LayoutGroup lastParentGroup;
|
|
private LayoutPanel emptyPanel;
|
|
private int lastIndexWithinParent;
|
|
private int lastIndexWithinRoot;
|
|
|
|
private void InitDockPanel()
|
|
{
|
|
if (_AssessmentSheet == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (var item in dockLayoutManager.LayoutRoot.GetItems())
|
|
{
|
|
var layoutGroup = item as LayoutGroup;
|
|
if (layoutGroup != null)
|
|
{
|
|
foreach (LayoutPanel layoutPanel in (layoutGroup).Items)
|
|
{
|
|
AddMaximizeRestoreButtons(layoutPanel);
|
|
}
|
|
}
|
|
else if (item is LayoutPanel)
|
|
{
|
|
AddMaximizeRestoreButtons(item as LayoutPanel);
|
|
}
|
|
}
|
|
|
|
foreach (var layoutPanel in dockLayoutManager.FloatGroups.SelectMany(floatGroup =>
|
|
floatGroup.Items.Cast<LayoutPanel>()))
|
|
{
|
|
AddMaximizeRestoreButtons(layoutPanel);
|
|
}
|
|
}
|
|
|
|
private Rect CalcMaximizedBounds(Rect restoreBounds)
|
|
{
|
|
var bounds = WindowHelper.GetMaximizeBounds(dockLayoutManager, restoreBounds);
|
|
bounds.Inflate(new Size(5, 5));
|
|
return bounds;
|
|
}
|
|
|
|
private void ButtonClickHandler(object sender, RoutedEventArgs e)
|
|
{
|
|
var btn = sender as Button;
|
|
var item = DockLayoutManager.GetLayoutItem(sender as DependencyObject);
|
|
|
|
if (btn.Content.ToString() == "Maximieren")
|
|
{
|
|
item.CaptionTemplate = (DataTemplate) FindResource("LayoutPanelCaptionTemplateMinimize");
|
|
|
|
//btn.Content = "Wiederherstellen";
|
|
//btn.ToolTip = btn.Content;
|
|
//btn.Style = (Style) FindResource("DockPanelRestoreButtonStyle");
|
|
|
|
MaximizeButtonClickHandler(item);
|
|
|
|
if (Equals(item, layoutPanel1))
|
|
{
|
|
popupedit_employee.Focus();
|
|
}
|
|
else if (Equals(item, layoutPanel2))
|
|
{
|
|
srListBox.Focus();
|
|
}
|
|
else if (Equals(item, layoutPanel3))
|
|
{
|
|
_AssessmentSheet.Focus();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
item.CaptionTemplate = (DataTemplate) FindResource("LayoutPanelCaptionTemplate");
|
|
|
|
//btn.Content = "Maximieren";
|
|
//btn.ToolTip = btn.Content;
|
|
//btn.Style = (Style)this.FindResource("DockPanelMaximizeButtonStyle");
|
|
RestoreButtonClickHandler(item);
|
|
}
|
|
}
|
|
|
|
private void MaximizeButtonClickHandler(BaseLayoutItem item)
|
|
{
|
|
//BaseLayoutItem item = DockLayoutManager.GetLayoutItem(sender as DependencyObject);
|
|
if (item == null || item.GetRoot() == null) return;
|
|
|
|
lastParentGroup = item.Parent;
|
|
lastPanel = item;
|
|
|
|
if (item.GetRoot() is FloatGroup)
|
|
{
|
|
MaximizeFloatButtonClickHandler(item);
|
|
}
|
|
else
|
|
{
|
|
MaximizeDockButtonClickHandler(item);
|
|
}
|
|
|
|
if (!(item.ControlBoxContent is StackPanel)) return;
|
|
var controlBox = item.ControlBoxContent as StackPanel;
|
|
foreach (var child in controlBox.Children)
|
|
{
|
|
if (child is Button && ((Button) child).Content.ToString() == "Maximieren")
|
|
{
|
|
((Button) child).Visibility = Visibility.Collapsed;
|
|
}
|
|
else if (child is Button && ((Button) child).Content.ToString() == "Wiederherstellen")
|
|
{
|
|
((Button) child).Visibility = Visibility.Visible;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void RestoreButtonClickHandler(BaseLayoutItem item)
|
|
{
|
|
//BaseLayoutItem item = DockLayoutManager.GetLayoutItem(sender as DependencyObject);
|
|
if (item == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (lastParentGroup is FloatGroup)
|
|
{
|
|
RestoreFloatButtonClickHandler(item);
|
|
}
|
|
else
|
|
{
|
|
RestoreDockButtonClickHandler(item);
|
|
}
|
|
|
|
if (!(item.ControlBoxContent is StackPanel))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var controlBox = item.ControlBoxContent as StackPanel;
|
|
|
|
foreach (var child in controlBox.Children)
|
|
{
|
|
if (child is Button && ((Button) child).Content.ToString() == "Maximieren")
|
|
{
|
|
((Button) child).Visibility = Visibility.Visible;
|
|
}
|
|
else if (child is Button && ((Button) child).Content.ToString() == "Wiederherstellen")
|
|
{
|
|
((Button) child).Visibility = Visibility.Collapsed;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void MaximizeFloatButtonClickHandler(BaseLayoutItem item)
|
|
{
|
|
//BaseLayoutItem item = DockLayoutManager.GetLayoutItem(sender);
|
|
if (item == null || !(item.GetRoot() is FloatGroup))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var parent = item.GetRoot() as FloatGroup;
|
|
var restoreBounds = new Rect(parent.FloatLocation, parent.FloatSize);
|
|
var bounds = CalcMaximizedBounds(restoreBounds);
|
|
|
|
DocumentPanel.SetRestoreBounds(parent, restoreBounds);
|
|
|
|
parent.FloatLocation = new Point(bounds.X, bounds.Y);
|
|
parent.FloatSize = new Size(bounds.Width, bounds.Height);
|
|
}
|
|
|
|
private static void RestoreFloatButtonClickHandler(BaseLayoutItem item)
|
|
{
|
|
//BaseLayoutItem item = DockLayoutManager.GetLayoutItem(sender);
|
|
if (item == null || !(item.GetRoot() is FloatGroup))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var parent = item.GetRoot() as FloatGroup;
|
|
var bounds = DocumentPanel.GetRestoreBounds(parent);
|
|
|
|
parent.FloatLocation = new Point(bounds.X, bounds.Y);
|
|
parent.FloatSize = new Size(bounds.Width, bounds.Height);
|
|
}
|
|
|
|
private void MaximizeDockButtonClickHandler(BaseLayoutItem item)
|
|
{
|
|
//BaseLayoutItem item = DockLayoutManager.GetLayoutItem(sender);
|
|
if (item == null || item.GetRoot() == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (lastParentGroup is TabbedGroup)
|
|
{
|
|
lastIndexWithinParent = lastParentGroup.Items.IndexOf(item);
|
|
emptyPanel = new LayoutPanel();
|
|
|
|
dockLayoutManager.DockController.Insert(lastParentGroup, emptyPanel, lastParentGroup.Items.Count);
|
|
}
|
|
else
|
|
{
|
|
lastIndexWithinRoot = dockLayoutManager.LayoutRoot.Items.IndexOf(lastParentGroup);
|
|
|
|
if (lastIndexWithinRoot == -1)
|
|
{
|
|
lastIndexWithinRoot = dockLayoutManager.LayoutRoot.Items.IndexOf(lastPanel);
|
|
}
|
|
}
|
|
|
|
var parent = dockLayoutManager.DockController.Float(item);
|
|
//parent.Items[0].Focus();
|
|
//parent.ItemsAppearance.Active.Background = Brushes.Transparent;
|
|
//LayoutPanel lp = item as LayoutPanel;
|
|
//if (lp != null)
|
|
// lp.Background = Brushes.Transparent;
|
|
|
|
var width = dockLayoutManager.ActualWidth + 5;
|
|
var height = dockLayoutManager.ActualHeight + 5;
|
|
var pos = new Point(-5, -5);
|
|
|
|
var restoreBounds = new Rect(pos, new Point(width, height));
|
|
var bounds = CalcMaximizedBounds(restoreBounds);
|
|
|
|
DocumentPanel.SetRestoreBounds(parent, restoreBounds);
|
|
|
|
parent.FloatLocation = new Point(restoreBounds.X, restoreBounds.Y);
|
|
parent.FloatSize = new Size(restoreBounds.Width, restoreBounds.Height);
|
|
|
|
}
|
|
|
|
private void RestoreDockButtonClickHandler(BaseLayoutItem item)
|
|
{
|
|
//BaseLayoutItem item = DockLayoutManager.GetLayoutItem(sender);
|
|
if (item == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (lastParentGroup is TabbedGroup)
|
|
{
|
|
dockLayoutManager.DockController.Insert(lastParentGroup, item, lastIndexWithinParent);
|
|
dockLayoutManager.DockController.RemovePanel(emptyPanel);
|
|
dockLayoutManager.DockController.Activate(item);
|
|
|
|
emptyPanel = null;
|
|
lastIndexWithinParent = -1;
|
|
|
|
return;
|
|
}
|
|
|
|
//this.lastParentGroup.Items.Add(item);
|
|
dockLayoutManager.DockController.Insert(dockLayoutManager.LayoutRoot, lastPanel, lastIndexWithinRoot);
|
|
lastIndexWithinRoot = -1;
|
|
}
|
|
|
|
private static void AddMaximizeRestoreButtons(LayoutPanel layoutPanel)
|
|
{
|
|
//StackPanel stackPanel = new StackPanel { Orientation = Orientation.Horizontal };
|
|
|
|
//Button maximizeButton = new Button();
|
|
//maximizeButton.Content = "Maximieren";
|
|
//maximizeButton.ToolTip = "Maximieren";
|
|
//maximizeButton.Click += this.MaximizeButtonClickHandler;
|
|
//maximizeButton.Style = (Style)this.FindResource("DockPanelMaximizeButtonStyle");
|
|
|
|
//Button restoreButton = new Button();
|
|
//restoreButton.Content = "Wiederherstellen";
|
|
//restoreButton.ToolTip = "Wiederherstellen";
|
|
//restoreButton.Click += this.RestoreButtonClickHandler;
|
|
//restoreButton.MouseDown += new MouseButtonEventHandler(restoreButton_MouseDown);
|
|
//restoreButton.Style = (Style)this.FindResource("DockPanelRestoreButtonStyle");
|
|
//restoreButton.Visibility = Visibility.Collapsed;
|
|
|
|
//stackPanel.Children.Add(maximizeButton);
|
|
//stackPanel.Children.Add(restoreButton);
|
|
|
|
//layoutPanel.ControlBoxContent = stackPanel;
|
|
}
|
|
|
|
private void ChkRowView_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (srListBox == null)
|
|
return;
|
|
|
|
srListBox.Visibility = Visibility.Visible;
|
|
//###Bars
|
|
srGridControl.Visibility = Visibility.Hidden;
|
|
|
|
BeWoApp.AppSettings.ShowServiceRecordGridControl = false;
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
|
|
private void ChkDetailView_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (srListBox == null)
|
|
return;
|
|
|
|
srListBox.Visibility = Visibility.Hidden;
|
|
|
|
//###Bars
|
|
srGridControl.Visibility = Visibility.Visible;
|
|
object ds = srGridControl.ItemsSource;
|
|
object selected = srTableView.FocusedRow;
|
|
srGridControl.ItemsSource = null;
|
|
srGridControl.ItemsSource = ds;
|
|
srTableView.FocusedRow = selected;
|
|
|
|
BeWoApp.AppSettings.ShowServiceRecordGridControl = true;
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
|
|
private void SrTableView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
{
|
|
//###Bars
|
|
var hitInfo = srTableView.CalcHitInfo(e.OriginalSource as DependencyObject);
|
|
if (!hitInfo.InRow)
|
|
return;
|
|
|
|
ServiceRecordVM vm = GetSelectedServiceRecordFromGrid();
|
|
if (vm != null)
|
|
StartEdit(vm);
|
|
|
|
|
|
_LastPosition = ViewModel.VMList.IndexOf(vm);
|
|
}
|
|
|
|
private ServiceRecordVM GetSelectedServiceRecordFromGrid()
|
|
{
|
|
//###Bars
|
|
var selected = srTableView.SelectedRows;
|
|
if (selected != null && selected.Count > 0)
|
|
return selected[0] as ServiceRecordVM;
|
|
return null;
|
|
}
|
|
|
|
private void DxEditButton_OnItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
ServiceRecordVM vm = GetSelectedServiceRecordFromGrid();
|
|
|
|
if (vm != null)
|
|
{
|
|
if (vm.EditAllowed)
|
|
StartEdit(vm);
|
|
}
|
|
}
|
|
|
|
private void DxDeleteButton_OnItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
ServiceRecordVM vm = GetSelectedServiceRecordFromGrid();
|
|
|
|
_LastPosition = ViewModel.VMList.IndexOf(vm);
|
|
|
|
if (vm != null && vm.DeleteAllowed)
|
|
Delete(vm);
|
|
}
|
|
|
|
private void DxHistoryButton_OnItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
ServiceRecordVM vm = GetSelectedServiceRecordFromGrid();
|
|
if (vm != null && ServiceRecordVM.IsHistoryAllowed)
|
|
ShowHistory(vm);
|
|
}
|
|
|
|
public override void ModalPopUpCloseInvoked()
|
|
{
|
|
MainControl.CloseCurrentPopUp();
|
|
}
|
|
|
|
public override void ModalPopUpSaveInvoked()
|
|
{
|
|
if (_GroupOfPeopleModalPopUp != null)
|
|
_GroupOfPeopleModalPopUp.SaveData();
|
|
}
|
|
|
|
private void MultiSupportConceptControl_EditGroupButtonClicked(object sender, EventArgs e)
|
|
{
|
|
OpenGroupEditView();
|
|
}
|
|
|
|
private void OpenGroupEditView()
|
|
{
|
|
VMFactory.CreateGroupOfPeopleListVMAsync(
|
|
cb => this.Dispatch(
|
|
delegate
|
|
{
|
|
if (cb.VMList.Count > 0)
|
|
cb.EditVM = cb.VMList[0];
|
|
|
|
_GroupOfPeopleModalPopUp =
|
|
new GroupOfPeopleView(cb) {MinWidth = 900, MaxWidth = 900, Height = 600};
|
|
_GroupOfPeopleModalPopUp.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
if (_GroupOfPeopleModalPopUp.DoSaveCheck())
|
|
BeWoApp.MainControl.CloseCurrentPopUp();
|
|
}));
|
|
_GroupOfPeopleModalPopUp.GroupOfPeopleSavedOrUpdated +=
|
|
GroupOfPeopleModalPopUp_GroupOfPeopleSavedOrUpdated;
|
|
BeWoApp.MainControl.ShowControlAsModalPopup(_GroupOfPeopleModalPopUp);
|
|
_GroupOfPeopleModalPopUp.Focus();
|
|
}));
|
|
}
|
|
|
|
private static void GroupOfPeopleModalPopUp_GroupOfPeopleSavedOrUpdated(object sender, EventArgs<GroupOfPeopleListVM> e)
|
|
{
|
|
//ServiceFacade.DoCustomerServiceAsync(
|
|
// s => s.LoadPersonCompact(e.Data.DataContract.PersonOid.Value),
|
|
// p => this.Dispatch(
|
|
// delegate
|
|
// {
|
|
BeWoApp.MainControl.CloseCurrentPopUp();
|
|
// }));
|
|
}
|
|
|
|
private void LinkPdfExport_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
|
{
|
|
if ((chkGroupBooking.IsChecked == null ||
|
|
chkGroupBooking.IsChecked != null && chkGroupBooking.IsChecked.Value) ||
|
|
(chkMultiBooking.IsChecked == null ||
|
|
chkMultiBooking.IsChecked != null && chkMultiBooking.IsChecked.Value))
|
|
{
|
|
return;
|
|
}
|
|
|
|
long scOid = 0;
|
|
long cOid = 0;
|
|
long cb2scOid = 0;
|
|
var eOid = BeWoApp.LoggedOnUser.Employee.EmployeeOid;
|
|
|
|
var selectedNode = ViewModel.SelectedCustomerNode;
|
|
|
|
if (selectedNode != null && selectedNode.SupportConceptTreeNodeDC != null)
|
|
{
|
|
if (selectedNode.SupportConceptTreeNodeDC.SupportConcept != null)
|
|
scOid = selectedNode.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
|
|
|
|
if (selectedNode.SupportConceptTreeNodeDC.Customer != null)
|
|
cOid = selectedNode.SupportConceptTreeNodeDC.Customer.CustomerOid;
|
|
|
|
if (selectedNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC != null)
|
|
cb2scOid = selectedNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC
|
|
.CostBearer2SupportConceptOid.Value;
|
|
}
|
|
else
|
|
{
|
|
if (_SelectedEmployee != null)
|
|
{
|
|
eOid = _SelectedEmployee.EmployeeOid;
|
|
}
|
|
}
|
|
|
|
var sr = ViewModel.ServiceRecordsForSelectedCustomer;
|
|
|
|
var earliestStartDate = sr.Any() ? sr.OrderBy(o => o.StartDate).First().StartDate : DateTime.Now;
|
|
var latestEndDate = sr.Any()
|
|
? sr.OrderByDescending(o => o.EndDate).First().EndDate
|
|
: DateTime.Now.AddSeconds(1);
|
|
|
|
if (latestEndDate.Hour == 0 && latestEndDate.Minute == 0 && latestEndDate.Second == 1)
|
|
{
|
|
latestEndDate = latestEndDate.AddHours(23);
|
|
latestEndDate = latestEndDate.AddMinutes(59);
|
|
}
|
|
|
|
ServiceFacade.DoReportServiceAsync(
|
|
s => s.CreateServiceRecordListReport(eOid, cOid, scOid, cb2scOid, false,
|
|
new DateTimeSpan
|
|
{
|
|
StartDate = earliestStartDate,
|
|
StartHours = earliestStartDate.Hour,
|
|
StartMinutes = earliestStartDate.Minute,
|
|
EndDate = latestEndDate,
|
|
EndHours = latestEndDate.Hour,
|
|
EndMinutes = latestEndDate.Minute
|
|
}), cb => this.Dispatch(() => BeWoUtils.ShowReportWindow(cb, "Dokumentation")));
|
|
}
|
|
|
|
private void PopupInfo_OnOpened(object sender, EventArgs e)
|
|
{
|
|
ServiceRecordVM vm = GetSelectedServiceRecordFromGrid();
|
|
|
|
if (vm != null)
|
|
{
|
|
dxEditButton.IsEnabled = vm.EditAllowed;
|
|
dxDeleteButton.IsEnabled = vm.DeleteAllowed;
|
|
dxHistoryButton.IsVisible = ServiceRecordVM.IsHistoryAllowed;
|
|
}
|
|
}
|
|
|
|
private void Popupedit_employee_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit) sender, e) || !BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_View))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var employeeCompact = ViewModel.SelectedEmployee ?? BeWoApp.LoggedOnUser.Employee;
|
|
|
|
VMFactory.CreateEmployeeVMAsync(
|
|
employeeCompact.EmployeeOid,
|
|
employeeVM => this.Dispatch(
|
|
() => BeWoUtils.OpenModalViewWindow<EmployeeVM, EmployeeDC, ServiceRecordView2>(
|
|
employeeVM,
|
|
this,
|
|
() => this.Dispatch(
|
|
() =>
|
|
{
|
|
BeWoUtils.UpdateAllViews(employeeCompact);
|
|
}))));
|
|
}
|
|
|
|
private void ReloadButton_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
ViewModel.BuildServiceRecordsForSelectedTreeNode(true, false);
|
|
}
|
|
|
|
public static void AddTextModuleToTextBox(string textToAdd, TextBox documentationTextBox, TextBox grosseDokuTextBox)
|
|
{
|
|
if (!string.IsNullOrEmpty(textToAdd))
|
|
{
|
|
var caretIndex = documentationTextBox.CaretIndex;
|
|
|
|
if (string.IsNullOrEmpty(documentationTextBox.Text))
|
|
{
|
|
documentationTextBox.Text = textToAdd;
|
|
documentationTextBox.CaretIndex = documentationTextBox.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
if (documentationTextBox.CaretIndex == 0)
|
|
{
|
|
documentationTextBox.Text = textToAdd + documentationTextBox.Text;
|
|
}
|
|
else if (documentationTextBox.CaretIndex == documentationTextBox.Text.Length)
|
|
{
|
|
documentationTextBox.Text = documentationTextBox.Text + textToAdd;
|
|
}
|
|
else
|
|
{
|
|
var anzahlLeerzeichen = documentationTextBox.CaretIndex - documentationTextBox.Text.Length;
|
|
|
|
var leerzeichen = string.Empty;
|
|
for (var i = 0; i < anzahlLeerzeichen; i++)
|
|
{
|
|
leerzeichen += " ";
|
|
}
|
|
|
|
var start = documentationTextBox.Text.Substring(0,
|
|
documentationTextBox.CaretIndex - anzahlLeerzeichen);
|
|
var ende = documentationTextBox.Text.Substring(
|
|
documentationTextBox.CaretIndex - anzahlLeerzeichen);
|
|
|
|
documentationTextBox.Text = start + leerzeichen + textToAdd + ende;
|
|
}
|
|
|
|
documentationTextBox.CaretIndex = caretIndex + textToAdd.Length;
|
|
}
|
|
|
|
if (grosseDokuTextBox == null)
|
|
{
|
|
documentationTextBox.Focus();
|
|
}
|
|
else
|
|
{
|
|
grosseDokuTextBox.Text = documentationTextBox.Text;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void AddTextModuleToRichEditControl(string textToAdd, RichEditControl richEditControl)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(textToAdd))
|
|
{
|
|
var oldPos = richEditControl.Document.CaretPosition.ToInt();
|
|
|
|
var pos = richEditControl.Document.CaretPosition;
|
|
var doc = pos.BeginUpdateDocument();
|
|
doc.InsertText(pos, textToAdd);
|
|
|
|
richEditControl.Document.CaretPosition = richEditControl.Document.CreatePosition(oldPos + textToAdd.Length);
|
|
|
|
pos.EndUpdateDocument(doc);
|
|
|
|
richEditControl.Focus();
|
|
}
|
|
}
|
|
|
|
private void Combobox_category_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
var serviceCategoryComboBox = (ComboBox) sender;
|
|
var category = (ServiceCategoryDC) serviceCategoryComboBox?.SelectedItem;
|
|
|
|
if (category?.ServiceCategoryOid != null)
|
|
{
|
|
textbausteineSearchView.ServiceCategoryOid = category.ServiceCategoryOid.Value;
|
|
|
|
// TextModuleTreeViewControl1.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControl2.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControl3.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControl4.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
// TextModuleTreeViewControl5.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
|
|
//TextModuleTreeViewControlRTF1.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControlRTF2.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControlRTF3.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControlRTF4.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
//TextModuleTreeViewControlRTF5.ServiceCategoryOid = category.ServiceCategoryOid;
|
|
}
|
|
}
|
|
|
|
private void EditTextbausteineClick(object sender, RoutedEventArgs e)
|
|
{
|
|
VMFactory.CreateTextModuleListVMAsync(
|
|
textModuleListVM => this.Dispatch(delegate
|
|
{
|
|
var tbv = new TextbausteinView(textModuleListVM) { Background = FindResource("ApplicationBackground") as LinearGradientBrush };
|
|
|
|
var rootGrid2 = (Grid) tbv.root.Content;
|
|
|
|
var stackPanel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right };
|
|
|
|
var speichernBtn = new Button
|
|
{
|
|
Content = "Speichern",
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
Margin = new Thickness(3),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
var schliessenBtn = new Button
|
|
{
|
|
Content = "Schließen",
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
Margin = new Thickness(3),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
stackPanel.Children.Add(speichernBtn);
|
|
stackPanel.Children.Add(schliessenBtn);
|
|
Grid.SetRow(stackPanel, 6);
|
|
Grid.SetColumn(stackPanel, 0);
|
|
Grid.SetColumnSpan(stackPanel, 4);
|
|
|
|
rootGrid2.Children.Add(stackPanel);
|
|
tbv.root.Header = string.Empty;
|
|
var window = new BeWoWindow(tbv) { Width = 914, Height = 600, rootGroupBox = { Header = "Textbausteine" } };
|
|
|
|
speichernBtn.Click += (o, args) =>
|
|
{
|
|
tbv.Focus();
|
|
if(textModuleListVM.IsDirty || textModuleListVM.VMList.Any(vm => vm.IsDirty))
|
|
{
|
|
tbv.Save(() => { textbausteineSearchView.ServiceCategoryOid = textbausteineSearchView.ServiceCategoryOid; });
|
|
}
|
|
};
|
|
|
|
schliessenBtn.Click += (o, args) =>
|
|
{
|
|
tbv.Focus();
|
|
tbv.DoSaveCheck();
|
|
|
|
window.Close();
|
|
};
|
|
|
|
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
window.Show();
|
|
}));
|
|
}
|
|
|
|
//private void EditTextbausteineClick(object sender, RoutedEventArgs e)
|
|
//{
|
|
// VMFactory.CreateTextModuleListVMAsync(
|
|
// textModules => this.Dispatch(delegate
|
|
// {
|
|
// var tbv = new TextModuleView(textModules)
|
|
// {
|
|
// Background = FindResource("ApplicationBackground") as LinearGradientBrush
|
|
// };
|
|
|
|
// var window = new BeWoWindow(tbv)
|
|
// {
|
|
// rootGroupBox = {Header = "Textbausteine"},
|
|
// Width = 850,
|
|
// MinWidth = 850
|
|
// };
|
|
|
|
// tbv.CancelButton.Click += (o, args) =>
|
|
// {
|
|
// tbv.Focus();
|
|
// tbv.DoSaveCheck();
|
|
|
|
// window.Close();
|
|
// };
|
|
|
|
// window.Show();
|
|
// }), false, true);
|
|
//}
|
|
private void ButtonZeiterfassungErstellen_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var si = supportConceptSelectionControl.SelectedItem;
|
|
if (si.SupportConceptTreeNodeDC == null || si.SupportConceptTreeNodeDC.Customer == null)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate("Bitte wählen Sie einen Hilfeplan aus."),
|
|
Translator.Translate("Kein Hilfeplan gewählt"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
return;
|
|
}
|
|
var az = ServiceFacade.DoOperationsServiceSync(s => s.LoadArbeitszeitenForObject(TableID.Customer, si.SupportConceptTreeNodeDC.Customer.Oid.Value));
|
|
if (az.Count == 0)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate("Bei der ausgewählten Klient:in wurden keine Betreuungszeiten hinterlegt."),
|
|
Translator.Translate("BeWoPlaner"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
return;
|
|
}
|
|
var view =
|
|
new ServiceRecordCreationView(si.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC, az)
|
|
{
|
|
Background = FindResource("ApplicationBackground") as LinearGradientBrush
|
|
};
|
|
|
|
var rootGrid2 = (Grid)view.root.Content;
|
|
var stackPanel = new StackPanel
|
|
{
|
|
Orientation = Orientation.Horizontal,
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
VerticalAlignment = VerticalAlignment.Bottom
|
|
};
|
|
|
|
var speichernBtn = new Button
|
|
{
|
|
Content = "Erstellen und schließen",
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
Margin = new Thickness(3),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
var abbrechenBtn = new Button
|
|
{
|
|
Content = "Abbrechen",
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
Margin = new Thickness(3),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
stackPanel.Children.Add(speichernBtn);
|
|
stackPanel.Children.Add(abbrechenBtn);
|
|
Grid.SetRow(stackPanel, 3);
|
|
Grid.SetColumnSpan(stackPanel, 2);
|
|
|
|
rootGrid2.Children.Add(stackPanel);
|
|
|
|
var window = new BeWoWindow(view)
|
|
{
|
|
Width = 600,
|
|
Height = 400,
|
|
rootGroupBox = { Header = Translator.Translate("Zeiterfassung erstellen") },
|
|
MinHeight = 170
|
|
};
|
|
|
|
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
window.Owner = Application.Current.MainWindow;
|
|
|
|
speichernBtn.Click += (o, args) =>
|
|
{
|
|
|
|
|
|
view.Focus();
|
|
|
|
view.Save(result => this.Dispatch(() =>
|
|
{
|
|
|
|
ViewModel.BuildServiceRecordsForSelectedTreeNode(true, false);
|
|
if (!String.IsNullOrEmpty(result))
|
|
{
|
|
var image = MessageBoxImage.Information;
|
|
if (result.Contains("Fehler"))
|
|
{
|
|
image = MessageBoxImage.Exclamation;
|
|
}
|
|
MessageBox.Show(result, Translator.Translate(Translator.Translate("Zeiterfassung erstellen")), MessageBoxButton.OK, image);
|
|
}
|
|
|
|
}
|
|
));
|
|
|
|
window.Close();
|
|
};
|
|
|
|
abbrechenBtn.Click += (o, args) =>
|
|
{
|
|
view.Focus();
|
|
|
|
window.Close();
|
|
};
|
|
|
|
window.ShowDialog();
|
|
}
|
|
|
|
private void EintraegeUmbuchenBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var si = supportConceptSelectionControl.SelectedItem;
|
|
if (si.SupportConceptTreeNodeDC == null)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate("Bitte wählen Sie einen Hilfeplan zum Umbuchen von Einträgen aus."),
|
|
Translator.Translate("Kein Hilfeplan gewählt"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
return;
|
|
}
|
|
|
|
var umbuchungsView =
|
|
new ServiceRecordRebookingView(si.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC)
|
|
{
|
|
Background = FindResource("ApplicationBackground") as LinearGradientBrush
|
|
};
|
|
if (si.SupportConceptTreeNodeDC.Customer != null)
|
|
{
|
|
umbuchungsView.SetSearchText(si.SupportConceptTreeNodeDC.Customer.LastNameFirstName);
|
|
}
|
|
var rootGrid2 = (Grid) umbuchungsView.root.Content;
|
|
var stackPanel = new StackPanel
|
|
{
|
|
Orientation = Orientation.Horizontal,
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
VerticalAlignment = VerticalAlignment.Bottom
|
|
};
|
|
|
|
var speichernBtn = new Button
|
|
{
|
|
Content = "Umbuchen und schließen",
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
Margin = new Thickness(3),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
var abbrechenBtn = new Button
|
|
{
|
|
Content = "Abbrechen",
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
Margin = new Thickness(3),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
stackPanel.Children.Add(speichernBtn);
|
|
stackPanel.Children.Add(abbrechenBtn);
|
|
Grid.SetRow(stackPanel, 1);
|
|
Grid.SetColumnSpan(stackPanel, 2);
|
|
|
|
rootGrid2.Children.Add(stackPanel);
|
|
|
|
var window = new BeWoWindow(umbuchungsView)
|
|
{
|
|
Width = 450,
|
|
Height = 200,
|
|
rootGroupBox = {Header = "Umbuchung"},
|
|
MinHeight = 170,
|
|
ResizeMode = ResizeMode.NoResize
|
|
};
|
|
|
|
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
window.Owner = Application.Current.MainWindow;
|
|
|
|
speichernBtn.Click += (o, args) =>
|
|
{
|
|
if (umbuchungsView.Zielhilfeplan == null)
|
|
{
|
|
MessageBox.Show(
|
|
Translator.Translate(
|
|
"Bitte wählen Sie einen Hilfeplan auf den die Einträge umgebucht werden sollen aus."),
|
|
Translator.Translate("Kein Hilfeplan gewählt"), MessageBoxButton.OK,
|
|
MessageBoxImage.Exclamation);
|
|
return;
|
|
}
|
|
|
|
umbuchungsView.Focus();
|
|
|
|
umbuchungsView.Save(records => this.Dispatch(() =>
|
|
{
|
|
String text = "";
|
|
|
|
|
|
if (records.Count <= 0)
|
|
{
|
|
MessageBox.Show(Translator.Translate("Es wurden keine Einträge zum umbuchen gefunden."), Translator.Translate("Umbuchen"), MessageBoxButton.OK, MessageBoxImage.Information);
|
|
}
|
|
else
|
|
{
|
|
if (records.Count == 1)
|
|
{
|
|
text = Translator.Translate("Sind Sie sicher, dass Sie einen Eintrag umbuchen möchten?");
|
|
}
|
|
else
|
|
{
|
|
int realCount = 0;
|
|
|
|
//Prüfen, ob es Gruppen gibt, die von mehreren MAs betreut werden. Denn diese werden mehrfach gezählt, was zu Verwirrung geführt hat.
|
|
Dictionary<long, bool> groupDict = new Dictionary<long, bool>();
|
|
foreach (var item in records)
|
|
{
|
|
if (!item.GroupOid.HasValue || !groupDict.ContainsKey(item.GroupOid.Value))
|
|
{
|
|
realCount++;
|
|
|
|
if (item.GroupOid.HasValue && !groupDict.ContainsKey(item.GroupOid.Value))
|
|
{
|
|
groupDict.Add(item.GroupOid.Value, true);
|
|
}
|
|
}
|
|
|
|
}
|
|
text = Translator.Translate("Sind Sie sicher, dass Sie {0} Einträge umbuchen möchten?", realCount);
|
|
}
|
|
if (MessageBox.Show(text, Translator.Translate("Umbuchen"), MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
|
|
{
|
|
ServiceFacade.DoOperationsServiceAsync(s => s.UpdateServiceRecords(records), () => this.Dispatch(() => ViewModel.BuildServiceRecordsForSelectedTreeNode(true, false)));
|
|
}
|
|
}
|
|
}
|
|
));
|
|
|
|
window.Close();
|
|
};
|
|
|
|
abbrechenBtn.Click += (o, args) =>
|
|
{
|
|
umbuchungsView.Focus();
|
|
|
|
window.Close();
|
|
};
|
|
|
|
window.ShowDialog();
|
|
}
|
|
|
|
private void IncreaseFontSizeBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (BeWoApp.AppSettings.ShowRtfTextfield)
|
|
{
|
|
//richEditControl1.FontSize++;
|
|
//richEditControl2.FontSize++;
|
|
//richEditControl3.FontSize++;
|
|
//richEditControl4.FontSize++;
|
|
//richEditControl5.FontSize++;
|
|
|
|
//BeWoApp.AppSettings.DocumentationFontSize = richEditControl1.FontSize;
|
|
}
|
|
else
|
|
{
|
|
dokumentationsTextBox.FontSize++;
|
|
dokumentationsTextBox2.FontSize++;
|
|
dokumentationsTextBox3.FontSize++;
|
|
dokumentationsTextBox4.FontSize++;
|
|
dokumentationsTextBox5.FontSize++;
|
|
|
|
BeWoApp.AppSettings.DocumentationFontSize = dokumentationsTextBox.FontSize;
|
|
}
|
|
}
|
|
|
|
private void DecreaseFontSizeBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (BeWoApp.AppSettings.ShowRtfTextfield)
|
|
{
|
|
//if (richEditControl1.FontSize <= 1 || richEditControl2.FontSize <= 1 || richEditControl3.FontSize <= 1 ||
|
|
// richEditControl4.FontSize <= 1 || richEditControl5.FontSize <= 1)
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
//richEditControl1.FontSize--;
|
|
//richEditControl2.FontSize--;
|
|
//richEditControl3.FontSize--;
|
|
//richEditControl4.FontSize--;
|
|
//richEditControl5.FontSize--;
|
|
|
|
//BeWoApp.AppSettings.DocumentationFontSize = richEditControl1.FontSize;
|
|
}
|
|
else
|
|
{
|
|
if (dokumentationsTextBox.FontSize <= 1 || dokumentationsTextBox2.FontSize <= 1 ||
|
|
dokumentationsTextBox3.FontSize <= 1 ||
|
|
dokumentationsTextBox4.FontSize <= 1 || dokumentationsTextBox5.FontSize <= 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
dokumentationsTextBox.FontSize--;
|
|
dokumentationsTextBox2.FontSize--;
|
|
dokumentationsTextBox3.FontSize--;
|
|
dokumentationsTextBox4.FontSize--;
|
|
dokumentationsTextBox5.FontSize--;
|
|
|
|
BeWoApp.AppSettings.DocumentationFontSize = dokumentationsTextBox.FontSize;
|
|
}
|
|
}
|
|
|
|
//private void ZeitraumauswahlwechselBtn_Click(object sender, RoutedEventArgs e)
|
|
//{
|
|
// var nAlt = NDayTextbox.Visibility;
|
|
// NDayTextbox.Visibility = TimeIntervalComboBox.Visibility;
|
|
// TimeIntervalComboBox.Visibility = nAlt;
|
|
// NLadenBtn.Visibility = NDayTextbox.Visibility;
|
|
|
|
// if (TimeIntervalComboBox.Visibility == Visibility.Visible)
|
|
// {
|
|
// var s = (KeyValuePair<object, String>)(TimeIntervalComboBox.SelectedItem ?? ((Dictionary<object, String>) TimeIntervalComboBox.ItemsSource).First());
|
|
// ViewModel.ServiceRecordTimeInterval = (ServiceRecordTimeInterval) s.Key;
|
|
// }
|
|
// else
|
|
// {
|
|
// ViewModel.ServiceRecordTimeInterval = ServiceRecordTimeInterval.LastNDays;
|
|
// }
|
|
//}
|
|
|
|
private void NLadenBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ViewModel.BuildServiceRecordsForSelectedTreeNode(true, false);
|
|
}
|
|
|
|
private void btnAddEmployee2Wohnheimbuchung_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
popupEmployees.IsOpen = true;
|
|
}
|
|
|
|
private void EmployeeSearchView_ItemSelected(object sender, EventArgs<CompactEmployeeDC> e)
|
|
{
|
|
popupEmployees.IsOpen = false;
|
|
var selectedEmployee = e.Data;
|
|
|
|
//CB EINKOMMENTIEREN
|
|
//ViewModel.SelectedWohnheimbuchung.EmployeeList.NewVM.Employee = selectedEmployee;
|
|
//ViewModel.SelectedWohnheimbuchung.EmployeeList.AddNewVMToList();
|
|
|
|
//BeWoWpfUtils.RefreshDXGrid(Employee2WohnheimbuchungGridControl);
|
|
}
|
|
|
|
//CB EINKOMMENTIEREN
|
|
//private void SupportConceptForWohnheimbuchungSearchView_ItemSelected(object sender, EventArgs<CompactSupportConceptDC> e)
|
|
//{
|
|
// popupSupportConcepts.IsOpen = false;
|
|
// var selectedSupportConcept = e.Data;
|
|
|
|
// ServiceFacade.DoCustomerServiceAsync(s => s.LoadSupportConcept(selectedSupportConcept.SupportConceptOid), sc => this.Dispatch(delegate
|
|
// {
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.NewVM.Costbearer2SupportConcept = sc.CostBearerRelations.FirstOrDefault(f => f.CostBearer2SupportConceptOid.Equals(selectedSupportConcept.CostBearerRelOids.First()));
|
|
|
|
// var startDate = DateTime.Now.Date;
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.NewVM.StartDate = startDate;
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.NewVM.EndDate = startDate.AddHours(23).AddMinutes(59);
|
|
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.AddNewVMToList();
|
|
|
|
// BeWoWpfUtils.RefreshDXGrid(SupportConcept2WohnheimbuchungGridControl);
|
|
// }));
|
|
//}
|
|
|
|
//private void btnAddSupportConcept2Wohnheimbuchung_Click(object sender, RoutedEventArgs e)
|
|
//{
|
|
// popupSupportConcepts.IsOpen = true;
|
|
//}
|
|
|
|
//CB EINKOMMENTIEREN
|
|
//private void BtnSaveWohnheimbuchung_OnClick(object sender, RoutedEventArgs e)
|
|
//{
|
|
// if (!ViewModel.SelectedWohnheimbuchung.IsDirty)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// var lValid = ValidationTrigger.Validate(wohnheimbuchungsGrid);
|
|
|
|
|
|
|
|
// var hasInvalidSupportConceptRelTimeSpans = ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.VMList.Any(a => a.StartDate > a.EndDate);
|
|
// var hasInvalidEmployeeRelTimeSpans = ViewModel.SelectedWohnheimbuchung.EmployeeList.VMList.Any(a => a.StartDate > a.EndDate);
|
|
|
|
// if (hasInvalidEmployeeRelTimeSpans || hasInvalidSupportConceptRelTimeSpans)
|
|
// {
|
|
// MessageBox.Show("Die Endzeit darf nicht vor der Startzeit liegen.", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
// return;
|
|
// }
|
|
|
|
// if (lValid)
|
|
// {
|
|
// var wohnheimbuchungDC = ViewModel.SelectedWohnheimbuchung.CommitToDataContract();
|
|
|
|
// if (ViewModel.SelectedWohnheimbuchung.IsNew)
|
|
// {
|
|
// ServiceFacade.DoCustomerServiceAsync(s => s.InsertWohnheimbuchung(wohnheimbuchungDC), wb => this.Dispatch(() => CreateServiceRecordsFromWohnheimbuchung(wb, x => ReloadWohnheimbuchungen(wb))));
|
|
// }
|
|
// else if (ViewModel.SelectedWohnheimbuchung.EmployeeList.VMList.IsEmpty() && ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.VMList.IsEmpty() && !ViewModel.SelectedWohnheimbuchung.IsNew)
|
|
// {
|
|
// ServiceFacade.DoCustomerServiceAsync(s => s.FindWohnheimbuchungsServiceRecords(ViewModel.SelectedWohnheimbuchung.DataContract.WohnheimbuchungOid.Value), bestehendeEintraege =>
|
|
// {
|
|
// ServiceFacade.DoOperationsServiceSync(s2 => s2.DeleteServiceRecords(bestehendeEintraege.ToDictionary(sr2 => sr2.ServiceRecordOid.Value, sr2 => sr2.ServiceRecordVersion.Value)));
|
|
// ServiceFacade.DoCustomerServiceSync(s3 => s3.DeleteWohnheimbuchung(ViewModel.SelectedWohnheimbuchung.DataContract.WohnheimbuchungOid.Value, ViewModel.SelectedWohnheimbuchung.DataContract.WohnheimbuchungVersion.Value));
|
|
// ViewModel.RefreshServiceRecordsForSelectedTreeNode();
|
|
// ViewModel.SelectedWohnheimbuchung = new WohnheimbuchungsVM(new WohnheimbuchungDC(), ViewModel.PrototypeVM.Category2Services) {Buchungsdatum = ViewModel.SelectedWohnheimbuchung.Buchungsdatum, Wohnheim = ViewModel.SelectedWohnheimbuchung.Wohnheim};
|
|
// });
|
|
// }
|
|
// else
|
|
// {
|
|
// ServiceFacade.DoCustomerServiceAsync(s => s.UpdateWohnheimbuchung(wohnheimbuchungDC), wb => this.Dispatch(() => CreateServiceRecordsFromWohnheimbuchung(wb, x => ReloadWohnheimbuchungen(wb))));
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// var message = ViewModel.SelectedWohnheimbuchung.ServiceDescription == null ? "Bitte geben Sie eine Kategorie und eine Leistung an." : "Bitte geben Sie eine gültige Uhrzeit ein.";
|
|
|
|
// MessageBox.Show(message, "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
// }
|
|
//}
|
|
|
|
//private void CreateServiceRecordsFromWohnheimbuchung(long pWohnheimbuchungsOid, Action<long> callBack)
|
|
//{
|
|
// //ServiceFacade.DoCustomerServiceAsync(s => s.CreateServiceRecordsFromWohnheimbuchung(pWohnheimbuchungsOid, ViewModel.SelectedWohnheimbuchung.ServiceDescription.ServiceDescriptionOid.Value),
|
|
// ServiceFacade.DoCustomerServiceAsync(s => s.CreateServiceRecordsFromWohnheimbuchung(pWohnheimbuchungsOid, 0),
|
|
// r => this.Dispatch(() =>
|
|
// {
|
|
// callBack(pWohnheimbuchungsOid);
|
|
// ViewModel.RefreshServiceRecordsForSelectedTreeNode();
|
|
// }));
|
|
//}
|
|
|
|
//CB EINKOMMENTIEREN
|
|
//public void ReloadWohnheimbuchungen(long? pOid)
|
|
//{
|
|
// VMFactory.CreateWohnheimbuchungsVMAsync(pOid, wb => this.Dispatch(delegate
|
|
// {
|
|
// LoadExistingWohnheimbuchung(foundExistingBuchung => this.Dispatch(() => { }));
|
|
// }));
|
|
//}
|
|
|
|
//private void WohnheimbuchungsDateEdit_OnEditValueChanged(object sender, EditValueChangedEventArgs e)
|
|
//{
|
|
// if (chkWohnheimBooking.IsChecked.HasValue && chkWohnheimBooking.IsChecked.Value)
|
|
// {
|
|
// UpdateWohnheimBuchungGrid();
|
|
// }
|
|
//}
|
|
|
|
//private void LoadExistingWohnheimbuchung(Action<bool> callback)
|
|
//{
|
|
// var wohnheim = (CompactWohnheimDC) wohnheimbuchungsWohnheimComboBox.SelectedItem;
|
|
// var buchungsdatum = (DateTime?) wohnheimbuchungsDateEdit.EditValue;
|
|
|
|
// if (wohnheim == null || buchungsdatum == null)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// ViewModel.LoadExistingWohnheimbuchung(wohnheim, buchungsdatum.Value, callback);
|
|
//}
|
|
|
|
//private void WohnheimbuchungsWohnheimComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
//{
|
|
// var comboBox = (ComboBox) sender;
|
|
// var selectedWohnheim = (CompactWohnheimDC) (comboBox.SelectedItem ?? comboBox.SelectionBoxItem);
|
|
|
|
// btnAddSupportConcept.IsEnabled = true;
|
|
// btnAddEmployee2Wohnheimbuchung.IsEnabled = true;
|
|
|
|
// if (chkWohnheimBooking.IsChecked.HasValue && chkWohnheimBooking.IsChecked.Value)
|
|
// {
|
|
// PreselectSupportConceptsFromWohnheim(selectedWohnheim);
|
|
// LoadExistingWohnheimbuchung(foundExistingBuchung => this.Dispatch(() => { }));
|
|
// }
|
|
//}
|
|
|
|
//private void PreselectSupportConceptsFromWohnheim(CompactWohnheimDC wohnheim)
|
|
//{
|
|
// if (supportConceptForWohnheimbuchungSearchView.SupportConcepts != null && wohnheim != null)
|
|
// {
|
|
// supportConceptForWohnheimbuchungSearchView.HiddenSupportConcepts =
|
|
// supportConceptForWohnheimbuchungSearchView.SupportConcepts.Where(
|
|
// w => !wohnheim.CustomerOids.Contains(w.Customer.CustomerOid)).ToList();
|
|
// }
|
|
//}
|
|
|
|
//CB EINKOMMENTIEREN
|
|
//private void Button_deleteSupportConcept2WohnheimbuchungClick(object sender, RoutedEventArgs e)
|
|
//{
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.VMList.Remove(SupportConcept2WohnheimbuchungGridControl.GetCurrentValue<WohnheimbuchungCostbearerSupportConceptRelationVM>());
|
|
// BeWoWpfUtils.RefreshDXGrid(SupportConcept2WohnheimbuchungGridControl);
|
|
//}
|
|
|
|
//private void Button_Employee2WohnheimbuchungClick(object sender, RoutedEventArgs e)
|
|
//{
|
|
// ViewModel.SelectedWohnheimbuchung.EmployeeList.VMList.Remove(Employee2WohnheimbuchungGridControl.GetCurrentValue<WohnheimbuchungEmployeeRelationVM>());
|
|
// BeWoWpfUtils.RefreshDXGrid(Employee2WohnheimbuchungGridControl);
|
|
//}
|
|
|
|
private void Speicher_Schliessen_Button_OnMouseEnter(object sender, MouseEventArgs e)
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//var buchung = ViewModel.SelectedWohnheimbuchung;
|
|
|
|
//if (ViewModel.SelectedWohnheimbuchung.Buchungsdatum != null &&
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheim != null &&
|
|
// ViewModel.SelectedWohnheimbuchung.EmployeeList.VMList.Any() &&
|
|
// ViewModel.SelectedWohnheimbuchung.Wohnheimbuchung2Costbearer2SupportConceptList.VMList.Any())
|
|
//{
|
|
// btnSaveWohnheimbuchung.IsEnabled = true;
|
|
//}
|
|
//else
|
|
//{
|
|
// btnSaveWohnheimbuchung.IsEnabled = false;
|
|
//}
|
|
|
|
//if (!buchung.IsNew && !buchung.EmployeeList.VMList.Any() && !buchung.Wohnheimbuchung2Costbearer2SupportConceptList.VMList.Any())
|
|
//{
|
|
// btnSaveWohnheimbuchung.IsEnabled = true;
|
|
//}
|
|
}
|
|
|
|
private void VollbildDokuButton_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var stackPanel = new StackPanel
|
|
{
|
|
Orientation = Orientation.Horizontal,
|
|
HorizontalAlignment = HorizontalAlignment.Left
|
|
};
|
|
|
|
var schriftVergroessern = new Button
|
|
{
|
|
Margin = new Thickness(3),
|
|
HorizontalAlignment = HorizontalAlignment.Left,
|
|
Content = "A+"
|
|
};
|
|
var schriftVerkleinern = new Button
|
|
{
|
|
Margin = new Thickness(3),
|
|
HorizontalAlignment = HorizontalAlignment.Left,
|
|
Content = "A-"
|
|
};
|
|
var textbausteineOptionen = new Button
|
|
{
|
|
Margin = new Thickness(3),
|
|
HorizontalAlignment = HorizontalAlignment.Left,
|
|
Content = "@",
|
|
FontFamily = new FontFamily("Webdings")
|
|
};
|
|
//var textbausteine = new TextModuleTreeViewControl
|
|
//{
|
|
// Margin = new Thickness(3),
|
|
// HorizontalAlignment = HorizontalAlignment.Left
|
|
//};
|
|
var textbausteine = new Button { Margin = new Thickness(3), HorizontalAlignment = HorizontalAlignment.Left, Content = "Textbausteine" };
|
|
|
|
textbausteineOptionen.Click += EditTextbausteineClick;
|
|
textbausteine.Click += ButtonBase_OnClick;
|
|
//textbausteine.TextModuleSelected += TextModuleTreeViewControl_OnTextModuleSelected;
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineAlleAnsehen) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineNurEigeneAnsehen))
|
|
{
|
|
textbausteine.Visibility = Visibility.Collapsed;
|
|
textbausteineOptionen.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineAlleBearbeiten) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineNurEigeneBearbeiten))
|
|
{
|
|
textbausteineOptionen.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
stackPanel.Children.Add(schriftVergroessern);
|
|
stackPanel.Children.Add(schriftVerkleinern);
|
|
stackPanel.Children.Add(textbausteineOptionen);
|
|
stackPanel.Children.Add(textbausteine);
|
|
|
|
String header = Translator.Translate("Dokumentation");
|
|
|
|
if (TabItem1_Notice.IsSelected)
|
|
{
|
|
_GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox);
|
|
header = TabItem1_Notice.Header.ToString();
|
|
}
|
|
else if (TabItem2_Notice.IsSelected)
|
|
{
|
|
_GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox2);
|
|
header = TabItem2_Notice.Header.ToString();
|
|
}
|
|
else if (TabItem3_Notice.IsSelected)
|
|
{
|
|
_GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox3);
|
|
header = TabItem3_Notice.Header.ToString();
|
|
}
|
|
else if (TabItem4_Notice.IsSelected)
|
|
{
|
|
_GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox4);
|
|
header = TabItem4_Notice.Header.ToString();
|
|
}
|
|
else if (TabItem5_Notice.IsSelected)
|
|
{
|
|
_GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox5);
|
|
header = TabItem5_Notice.Header.ToString();
|
|
}
|
|
|
|
schriftVergroessern.Click += delegate(object o, RoutedEventArgs args)
|
|
{
|
|
IncreaseFontSizeBtn_Click(o, args);
|
|
_GrosseDokuTextBox.FontSize = dokumentationsTextBox.FontSize;
|
|
};
|
|
|
|
schriftVerkleinern.Click += delegate(object o, RoutedEventArgs args)
|
|
{
|
|
DecreaseFontSizeBtn_Click(o, args);
|
|
_GrosseDokuTextBox.FontSize = dokumentationsTextBox.FontSize;
|
|
};
|
|
|
|
Grid.SetRow(stackPanel, 0);
|
|
Grid.SetRow(_GrosseDokuTextBox, 1);
|
|
|
|
_GrosseDokuTextBox.SpellCheck.IsEnabled = true;
|
|
|
|
var rootGrid2 = new Grid();
|
|
rootGrid2.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
|
|
rootGrid2.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)});
|
|
rootGrid2.Children.Add(stackPanel);
|
|
rootGrid2.Children.Add(_GrosseDokuTextBox);
|
|
|
|
var neunzigProzentHoehe = MainControl.ActualHeight * .9;
|
|
var neunzigProzentBreite = MainControl.ActualWidth * .9;
|
|
|
|
var beWoWindow = new BeWoWindow(rootGrid2, "MainContentGroupBoxWithMinimizeBtnStyle")
|
|
{
|
|
Width = neunzigProzentBreite,
|
|
Height = neunzigProzentHoehe,
|
|
rootGroupBox = {Header = header},
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen
|
|
};
|
|
|
|
beWoWindow.Closed += delegate
|
|
{
|
|
_GrosseDokuTextBox = null;
|
|
};
|
|
|
|
beWoWindow.ShowDialog();
|
|
}
|
|
|
|
public static TextBox InitMaximizedDocumentationTextBox(TextBox smallDocumentationTextBox)
|
|
{
|
|
var grosseDokuTextBox = new TextBox
|
|
{
|
|
AcceptsReturn = true,
|
|
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
|
|
TextWrapping = TextWrapping.Wrap,
|
|
Language = smallDocumentationTextBox.Language,
|
|
HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden,
|
|
AutoWordSelection = true,
|
|
FontSize = smallDocumentationTextBox.FontSize,
|
|
Text = smallDocumentationTextBox.Text
|
|
};
|
|
|
|
grosseDokuTextBox.TextChanged += delegate { smallDocumentationTextBox.Text = grosseDokuTextBox.Text; };
|
|
|
|
return grosseDokuTextBox;
|
|
}
|
|
|
|
private ServiceRecordRTFWindowView _rtfWindowView;
|
|
|
|
private void RTFVollbildDokuButton_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var stringtheorie = "";
|
|
var rtfStringTheorie = "";
|
|
|
|
String header = Translator.Translate("Dokumentation");
|
|
if (TabitemRtf1Note.IsSelected)
|
|
{
|
|
stringtheorie = richEditControl1.Text;
|
|
rtfStringTheorie = richEditControl1.RtfText;
|
|
header = TabitemRtf1Note.Header.ToString();
|
|
}
|
|
else if (TabitemRtf2Note.IsSelected)
|
|
{
|
|
stringtheorie = richEditControl2.Text;
|
|
rtfStringTheorie = richEditControl2.RtfText;
|
|
header = TabitemRtf2Note.Header.ToString();
|
|
}
|
|
else if (TabitemRtf3Note.IsSelected)
|
|
{
|
|
stringtheorie = richEditControl3.Text;
|
|
rtfStringTheorie = richEditControl3.RtfText;
|
|
header = TabitemRtf3Note.Header.ToString();
|
|
}
|
|
else if (TabitemRtf4Note.IsSelected)
|
|
{
|
|
stringtheorie = richEditControl4.Text;
|
|
rtfStringTheorie = richEditControl4.RtfText;
|
|
header = TabitemRtf4Note.Header.ToString();
|
|
}
|
|
else if (TabitemRtf5Note.IsSelected)
|
|
{
|
|
stringtheorie = richEditControl5.Text;
|
|
rtfStringTheorie = richEditControl5.RtfText;
|
|
header = TabitemRtf5Note.Header.ToString();
|
|
}
|
|
|
|
var neunzigProzentHoehe = MainControl.ActualHeight * .8;
|
|
var neunzigProzentBreite = MainControl.ActualWidth * .6;
|
|
|
|
if (_rtfWindowView != null)
|
|
{
|
|
neunzigProzentBreite = _rtfWindowView.Width;
|
|
neunzigProzentHoehe = _rtfWindowView.Height;
|
|
_rtfWindowView.RaiseCustomEvent -= NewWindow_RaiseRTFEvent;
|
|
_rtfWindowView.Close();
|
|
}
|
|
|
|
_rtfWindowView = new ServiceRecordRTFWindowView(header, stringtheorie, rtfStringTheorie);
|
|
_rtfWindowView.RaiseCustomEvent += NewWindow_RaiseRTFEvent;
|
|
_rtfWindowView.Width = neunzigProzentBreite;
|
|
_rtfWindowView.Height = neunzigProzentHoehe;
|
|
_rtfWindowView.ShowDialog();
|
|
}
|
|
|
|
private void NewWindow_RaiseRTFEvent(object sender, CustomRTFWindowArgs e)
|
|
{
|
|
if (TabitemRtf1Note.IsSelected)
|
|
{
|
|
richEditControl1.Text = e.Text;
|
|
richEditControl1.RtfText = e.RtfText;
|
|
}
|
|
else if (TabitemRtf2Note.IsSelected)
|
|
{
|
|
richEditControl2.Text = e.Text;
|
|
richEditControl2.RtfText = e.RtfText;
|
|
}
|
|
else if (TabitemRtf3Note.IsSelected)
|
|
{
|
|
richEditControl3.Text = e.Text;
|
|
richEditControl3.RtfText = e.RtfText;
|
|
}
|
|
else if (TabitemRtf4Note.IsSelected)
|
|
{
|
|
richEditControl4.Text = e.Text;
|
|
richEditControl4.RtfText = e.RtfText;
|
|
}
|
|
else if (TabitemRtf5Note.IsSelected)
|
|
{
|
|
richEditControl5.Text = e.Text;
|
|
richEditControl5.RtfText = e.RtfText;
|
|
}
|
|
|
|
_rtfWindowView.Close();
|
|
}
|
|
|
|
private void ChkBedarfsmedikationChecked(object sender, RoutedEventArgs e)
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//chkWithClient.IsEnabled = false;
|
|
//chkMultiBooking.IsEnabled = false;
|
|
//chkGroupBooking.IsEnabled = false;
|
|
//chkWohnheimBooking.IsEnabled = false;
|
|
|
|
//WithoutClient = true;
|
|
//SelectedItemChanged(null);
|
|
|
|
//customerDetailGrid.Visibility = Visibility.Collapsed;
|
|
//zeitraumGrid.Visibility = Visibility.Collapsed;
|
|
//customerSelectAndInfoGrid.Visibility = Visibility.Collapsed;
|
|
//wohnheimbuchungsGrid.Visibility = Visibility.Collapsed;
|
|
//btnSaveWohnheimbuchung.Visibility = Visibility.Collapsed;
|
|
//BedarfsmedikationsGrid.Visibility = Visibility.Visible;
|
|
|
|
//if (DarrFormCBE.SelectedIndex == -1 && ServiceRecordListVM.AllDosageForms.Count > 0)
|
|
//{
|
|
// DarrFormCBE.SelectedIndex = 0;
|
|
//}
|
|
}
|
|
|
|
private void ChkBedarfsmedikationUnchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//chkWithClient.IsEnabled = true;
|
|
//chkMultiBooking.IsEnabled = true;
|
|
//chkGroupBooking.IsEnabled = true;
|
|
//chkWohnheimBooking.IsEnabled = true;
|
|
|
|
//WithoutClient = false;
|
|
|
|
//if (supportConceptSelectionControl != null)
|
|
//{
|
|
// var selectedNode = supportConceptSelectionControl.SelectedItem;
|
|
// SelectedItemChanged(selectedNode);
|
|
//}
|
|
|
|
//customerDetailGrid.Visibility = Visibility.Visible;
|
|
//zeitraumGrid.Visibility = Visibility.Visible;
|
|
//customerSelectAndInfoGrid.Visibility = Visibility.Visible;
|
|
//wohnheimbuchungsGrid.Visibility = Visibility.Collapsed;
|
|
//btnSaveWohnheimbuchung.Visibility = Visibility.Collapsed;
|
|
//BedarfsmedikationsGrid.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
private void CustomerSelectionControl_ItemSelected(object sender, EventArgs<CompactCustomerDC> e)
|
|
{
|
|
VMFactory.CreateMedRecordVMAsync(e.Data.CustomerOid, medRecords => this.Dispatch(() =>
|
|
{
|
|
ViewModel.BedarfsMedViewModel = medRecords;
|
|
ViewModel.BedarfsMedViewModel.NewVM.Customer = e.Data;
|
|
|
|
ViewModel.BedarfsMedViewModel.NewVM.SetInitialDosageForm(ServiceRecordListVM.AllDosageForms.FirstOrDefault());
|
|
}));
|
|
}
|
|
|
|
private void PopupeditEmployeeBedarfsMedPopUpClick(object sender, RoutedEventArgs e)
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//popupMedRecordEmployees.IsOpen = true;
|
|
}
|
|
|
|
private void Popupedit_employee_bedarfsmed_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit) sender, e) ||
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_View) ||
|
|
ViewModel.BedarfsMedViewModel == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var employeeCompact = ViewModel.BedarfsMedViewModel.NewVM.Employee;
|
|
|
|
VMFactory.CreateEmployeeVMAsync(employeeCompact.EmployeeOid,
|
|
cb => this.Dispatch(
|
|
() => BeWoUtils.OpenModalViewWindow<EmployeeVM, EmployeeDC, ServiceRecordView2>(cb, this, () =>
|
|
this.Dispatch(
|
|
() => BeWoUtils.UpdateAllViews(employeeCompact)))));
|
|
}
|
|
|
|
private void ButtonSaveMedRecord_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var newMedRecordIsValid = Validate(NewMedRecordGrid);
|
|
|
|
if (ViewModel.BedarfsMedViewModel.NewVM.Employee == null)
|
|
{
|
|
MessageBox.Show(Translator.Translate("Bitte wählen Sie einen Mitarbeiter aus."), "Fehler beim Anlegen",
|
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
|
return;
|
|
}
|
|
|
|
if (newMedRecordIsValid)
|
|
{
|
|
var currentDosageForm = ViewModel.BedarfsMedViewModel.NewVM.DosageForm;
|
|
|
|
var currentCustomer = ViewModel.BedarfsMedViewModel.NewVM.Customer;
|
|
var currentEmployee = ViewModel.BedarfsMedViewModel.NewVM.Employee;
|
|
|
|
ViewModel.BedarfsMedViewModel.AddNewVMToList();
|
|
ViewModel.BedarfsMedViewModel.NewVM.SetInitialDosageForm(currentDosageForm);
|
|
|
|
ServiceFacade.DoCustomerServiceAsync(
|
|
s => s.InsertMedRecords(ViewModel.BedarfsMedViewModel.CommitAdded()),
|
|
x => this.Dispatch(() => ReloadMedRecordViewModel(currentCustomer, currentEmployee)));
|
|
}
|
|
}
|
|
|
|
private void ReloadMedRecordViewModel(CompactCustomerDC pCustomer, CompactEmployeeDC pEmployee)
|
|
{
|
|
VMFactory.CreateMedRecordVMAsync(pCustomer.CustomerOid, medRecords => this.Dispatch(() =>
|
|
{
|
|
ViewModel.BedarfsMedViewModel = medRecords;
|
|
ViewModel.BedarfsMedViewModel.NewVM.Customer = pCustomer;
|
|
ViewModel.BedarfsMedViewModel.NewVM.Employee = pEmployee;
|
|
|
|
ViewModel.BedarfsMedViewModel.NewVM.SetInitialDosageForm(ServiceRecordListVM.AllDosageForms
|
|
.FirstOrDefault());
|
|
}));
|
|
}
|
|
|
|
private void MedRecordEmployeeSearchView_OnItemSelected(object sender, EventArgs<CompactEmployeeDC> e)
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//popupMedRecordEmployees.IsOpen = false;
|
|
//popupedit_employee_bedarfsmed.Text = e.Data.ToString();
|
|
|
|
//ViewModel.BedarfsMedViewModel.NewVM.Employee = e.Data;
|
|
}
|
|
|
|
private void MedRecord_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
{
|
|
ShowMedRecordEditView();
|
|
}
|
|
|
|
private void ShowMedRecordEditView()
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.MedRecordsAendern) && !BeWoApp.LoggedOnUser.HasRight(UserRightType.EditAll))
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
var currentMedRecord = (MedRecordVM) MedRecordGridControl.CurrentItem;
|
|
var currentEmployee = currentMedRecord.Employee;
|
|
var currentCustomer = currentMedRecord.Customer;
|
|
var medRecord2Edit = new MedRecordVM(currentMedRecord.CommitToDataContract());
|
|
|
|
var medRecordEditView = new MedRecordEditView(medRecord2Edit);
|
|
|
|
popup_content.Child = medRecordEditView;
|
|
|
|
double height = 270;
|
|
double width = 800;
|
|
|
|
popup_content.Child = medRecordEditView;
|
|
|
|
if (rootGrid.ActualWidth < width)
|
|
{
|
|
width = rootGrid.ActualWidth;
|
|
}
|
|
|
|
if (rootGrid.ActualHeight < height)
|
|
{
|
|
height = rootGrid.ActualHeight;
|
|
}
|
|
|
|
popup_content.Width = width;
|
|
popup_content.Height = height;
|
|
|
|
if (medRecordEditView.CommandBindings.Count == 0)
|
|
{
|
|
medRecordEditView.CommandBindings.Add(new CommandBinding(
|
|
ApplicationCommands.Close, (s, e2) =>
|
|
{
|
|
if (!medRecordEditView.DoSaveCheck())
|
|
{
|
|
return;
|
|
}
|
|
|
|
ClosePopupView();
|
|
}));
|
|
|
|
medRecordEditView.CommandBindings.Add(new CommandBinding(
|
|
ApplicationCommands.Save, (s, e2) =>
|
|
{
|
|
var isValid = medRecordEditView.IsValid();
|
|
|
|
if (!isValid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!medRecordEditView.ViewModel.Customer.Equals(currentCustomer))
|
|
{
|
|
var messageBoxResult = MessageBox.Show(
|
|
Translator.Translate("Möchten Sie diesen Eintrag wirklich auf Klient {0} umbuchen?",
|
|
medRecordEditView.ViewModel.Customer.FullName), "Speichern", MessageBoxButton.YesNo,
|
|
MessageBoxImage.Question);
|
|
|
|
if (messageBoxResult.Equals(MessageBoxResult.No))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
medRecordEditView.SaveData();
|
|
ClosePopupView();
|
|
|
|
ReloadMedRecordViewModel(currentCustomer, currentEmployee);
|
|
}));
|
|
}
|
|
|
|
medRecordEditView.ParentView = this;
|
|
SetPopupViewVisible(true);
|
|
}
|
|
|
|
private void Button_deleteMedRecordClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var messageBoxResult = MessageBox.Show("Sind Sie sicher, dass Sie diese Bedarfsmedikation löschen möchten?",
|
|
"Eintrag löschen", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
if (messageBoxResult.Equals(MessageBoxResult.No))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var medRecord2Delete = (MedRecordVM) MedRecordGridControl.CurrentItem;
|
|
|
|
ViewModel.BedarfsMedViewModel.VMList.Remove(medRecord2Delete);
|
|
|
|
var mrDC = medRecord2Delete.CommitToDataContract();
|
|
|
|
ServiceFacade.DoCustomerServiceSync(s =>
|
|
s.DeleteMedRecord(mrDC.MedRecordOid.Value, mrDC.MedRecordVersion.Value));
|
|
|
|
ReloadMedRecordViewModel(ViewModel.BedarfsMedViewModel.NewVM.Customer,
|
|
ViewModel.BedarfsMedViewModel.NewVM.Employee);
|
|
}
|
|
|
|
private void PopupInfoMedRecord_OnOpened(object sender, EventArgs e)
|
|
{
|
|
//CB EINKOMMENTIEREN
|
|
//dxDeleteButtonMedRecord.IsEnabled = BeWoApp.LoggedOnUser.HasRight(UserRightType.MedRecordsLoeschen) || BeWoApp.LoggedOnUser.HasRight(UserRightType.DeleteAll);
|
|
//dxEditButtonMedRecord.IsEnabled = BeWoApp.LoggedOnUser.HasRight(UserRightType.MedRecordsAendern) || BeWoApp.LoggedOnUser.HasRight(UserRightType.EditAll);
|
|
}
|
|
|
|
private void DxEditButtonMedRecord_OnItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
ShowMedRecordEditView();
|
|
}
|
|
|
|
private void DxDeleteButtonMedRecord_OnItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
var messageBoxResult = MessageBox.Show("Sind Sie sicher, dass Sie diese Bedarfsmedikation löschen möchten?",
|
|
"Eintrag löschen", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
if (messageBoxResult.Equals(MessageBoxResult.No))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var medRecord2Delete = (MedRecordVM) MedRecordGridControl.CurrentItem;
|
|
|
|
ViewModel.BedarfsMedViewModel.VMList.Remove(medRecord2Delete);
|
|
|
|
var mrDC = medRecord2Delete.CommitToDataContract();
|
|
|
|
ServiceFacade.DoCustomerServiceSync(s =>
|
|
s.DeleteMedRecord(mrDC.MedRecordOid.Value, mrDC.MedRecordVersion.Value));
|
|
|
|
ReloadMedRecordViewModel(ViewModel.BedarfsMedViewModel.NewVM.Customer,
|
|
ViewModel.BedarfsMedViewModel.NewVM.Employee);
|
|
}
|
|
|
|
private void TimeIntervalComboBox_OnSelectedIndexChanged(object sender, RoutedEventArgs e)
|
|
{
|
|
if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.XTage)
|
|
{
|
|
NDays.Visibility = Visibility.Visible;
|
|
NDays_Von_Bis.Visibility = Visibility.Collapsed;
|
|
MonatsauswahlGrid.Visibility = Visibility.Collapsed;
|
|
|
|
ZeitraumComboStackPanel.HorizontalAlignment = HorizontalAlignment.Left;
|
|
TimeIntervalComboBox.Width = 120;
|
|
}
|
|
else if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.ZeitraumWaehlen)
|
|
{
|
|
NDays_Von_Bis.Visibility = Visibility.Visible;
|
|
ZeitraumComboStackPanel.HorizontalAlignment = HorizontalAlignment.Right;
|
|
TimeIntervalComboBox.Width = 110;
|
|
|
|
NDays.Visibility = Visibility.Collapsed;
|
|
MonatsauswahlGrid.Visibility = Visibility.Collapsed;
|
|
}
|
|
else if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.Monatsauswahl)
|
|
{
|
|
MonatsauswahlGrid.Visibility = Visibility.Visible;
|
|
|
|
NDays.Visibility = Visibility.Collapsed;
|
|
NDays_Von_Bis.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
NDays.Visibility = Visibility.Collapsed;
|
|
NDays_Von_Bis.Visibility = Visibility.Collapsed;
|
|
MonatsauswahlGrid.Visibility = Visibility.Collapsed;
|
|
|
|
ZeitraumComboStackPanel.HorizontalAlignment = HorizontalAlignment.Left;
|
|
TimeIntervalComboBox.Width = 120;
|
|
}
|
|
}
|
|
|
|
private void MinSTDOhneEnd_OnSelectedIndexChanged(object sender, RoutedEventArgs e)
|
|
{
|
|
//if (MinSTDMitEnd.Visibility == Visibility.Visible)
|
|
//{
|
|
if (MinSTDOhneEnd.Text == ZeiterfassungsDauer.Minuten.ToString())
|
|
{
|
|
SpinEditDurationOhneEnddatum.IsFloatValue = false;
|
|
SpinEditDurationOhneEnddatum.Mask = "########0";
|
|
|
|
BeWoApp.AppSettings.LetzteZeiterfassungsDauer = ZeiterfassungsDauer.Minuten;
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
else
|
|
{
|
|
SpinEditDurationOhneEnddatum.IsFloatValue = true;
|
|
SpinEditDurationOhneEnddatum.Mask = "########0.00";
|
|
|
|
BeWoApp.AppSettings.LetzteZeiterfassungsDauer = ZeiterfassungsDauer.Stunden;
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
//}
|
|
}
|
|
|
|
private void MinSTDMitEnd_OnSelectedIndexChanged(object sender, RoutedEventArgs e)
|
|
{
|
|
if (MinSTDMitEnd.Text == ZeiterfassungsDauer.Minuten.ToString())
|
|
{
|
|
numeric_duration.IsFloatValue = false;
|
|
numeric_duration.Mask = "########0";
|
|
|
|
BeWoApp.AppSettings.LetzteZeiterfassungsDauer = ZeiterfassungsDauer.Minuten;
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
else
|
|
{
|
|
numeric_duration.IsFloatValue = true;
|
|
numeric_duration.Mask = "########0.00";
|
|
|
|
BeWoApp.AppSettings.LetzteZeiterfassungsDauer = ZeiterfassungsDauer.Stunden;
|
|
BeWoApp.SaveAppSettings();
|
|
}
|
|
}
|
|
|
|
private void TextModuleTreeViewControl_OnTextModuleSelected(object sender, EventArgs<TextModuleVM> e)
|
|
{
|
|
if (TabItem1_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox, _GrosseDokuTextBox);
|
|
}
|
|
else if (TabItem2_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox2, _GrosseDokuTextBox);
|
|
}
|
|
else if (TabItem3_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox3, _GrosseDokuTextBox);
|
|
}
|
|
else if (TabItem4_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox4, _GrosseDokuTextBox);
|
|
}
|
|
else if (TabItem5_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox5, _GrosseDokuTextBox);
|
|
}
|
|
else if (TabitemRtf1Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl1);
|
|
}
|
|
else if (TabitemRtf2Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl2);
|
|
}
|
|
else if (TabitemRtf3Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl3);
|
|
}
|
|
else if (TabitemRtf4Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl4);
|
|
}
|
|
else if (TabitemRtf5Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl5);
|
|
}
|
|
}
|
|
|
|
private void ServiceRecordView2_OnKeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if ((e.Key == Key.S) && (Keyboard.IsKeyDown(Key.LeftCtrl)))
|
|
{
|
|
SaveServiceRecord();
|
|
}
|
|
}
|
|
|
|
private void RichEditControl1_OnContentChanged(object sender, EventArgs e)
|
|
{
|
|
ViewModel.PrototypeVM.Notice = richEditControl1.Text;
|
|
ViewModel.PrototypeVM.RTFNotice = richEditControl1.RtfText;
|
|
}
|
|
|
|
private void RichEditControl2_OnContentChanged(object sender, EventArgs e)
|
|
{
|
|
ViewModel.PrototypeVM.Notice2 = richEditControl2.Text;
|
|
ViewModel.PrototypeVM.RTFNotice2 = richEditControl2.RtfText;
|
|
}
|
|
|
|
private void RichEditControl3_OnContentChanged(object sender, EventArgs e)
|
|
{
|
|
ViewModel.PrototypeVM.Notice3 = richEditControl3.Text;
|
|
ViewModel.PrototypeVM.RTFNotice3 = richEditControl3.RtfText;
|
|
}
|
|
|
|
private void RichEditControl4_OnContentChanged(object sender, EventArgs e)
|
|
{
|
|
ViewModel.PrototypeVM.Notice4 = richEditControl4.Text;
|
|
ViewModel.PrototypeVM.RTFNotice4 = richEditControl4.RtfText;
|
|
}
|
|
|
|
private void RichEditControl5_OnContentChanged(object sender, EventArgs e)
|
|
{
|
|
ViewModel.PrototypeVM.Notice5 = richEditControl5.Text;
|
|
ViewModel.PrototypeVM.RTFNotice5 = richEditControl5.RtfText;
|
|
}
|
|
|
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
long? cb2scOid = null;
|
|
|
|
if (ViewModel?.SelectedCustomerNode?.SupportConceptTreeNodeDC?.SupportConceptCostBearerRelDC != null)
|
|
{
|
|
cb2scOid = ViewModel.SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid.Value;
|
|
}
|
|
ServiceFacade.DoOperationsServiceAsync(s => s.GetTextModulesForSelectedSupportConcept(false, BeWoApp.LoggedOnEmployeeOid.Value, BeWoApp.HasLoggedOnUserRight(new [] { UserRightType.TextbausteineAlleAnsehen, UserRightType.ViewAll }), false, cb2scOid), textModules => this.Dispatch(delegate
|
|
{
|
|
popup_textbausteine.IsOpen = true;
|
|
|
|
if(textbausteineSearchView.ServiceCategoryOid > 0)
|
|
{
|
|
var selectedTextmodules = textModules.Where(w => !w.IsParent && (w.ServiceCategory == null || (w.ServiceCategory.ServiceCategoryOid == textbausteineSearchView.ServiceCategoryOid))).ToList();
|
|
|
|
textModules = Utils.GetParentTextModules(selectedTextmodules);
|
|
textModules.AddRangeIfElementsNotIn(selectedTextmodules);
|
|
}
|
|
|
|
|
|
textbausteineSearchView.InitSearchView(textModules);
|
|
}));
|
|
}
|
|
|
|
private void TextModulesSearchView_OnItemSelected(object sender, EventArgs<TextModuleDC> e)
|
|
{
|
|
if(TabItem1_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox, _GrosseDokuTextBox);
|
|
}
|
|
else if(TabItem2_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox2, _GrosseDokuTextBox);
|
|
}
|
|
else if(TabItem3_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox3, _GrosseDokuTextBox);
|
|
}
|
|
else if(TabItem4_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox4, _GrosseDokuTextBox);
|
|
}
|
|
else if(TabItem5_Notice.IsSelected)
|
|
{
|
|
AddTextModuleToTextBox(e.Data.Text, dokumentationsTextBox5, _GrosseDokuTextBox);
|
|
}
|
|
else if(TabitemRtf1Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl1);
|
|
}
|
|
else if(TabitemRtf2Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl2);
|
|
}
|
|
else if(TabitemRtf3Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl3);
|
|
}
|
|
else if(TabitemRtf4Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl4);
|
|
}
|
|
else if(TabitemRtf5Note.IsSelected)
|
|
{
|
|
AddTextModuleToRichEditControl(e.Data.Text, richEditControl5);
|
|
}
|
|
|
|
popup_textbausteine.IsOpen = false;
|
|
}
|
|
|
|
private void ButtonBewertung_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var goals = GetSelectedGoals();
|
|
|
|
if (goals.Count == 0)
|
|
{
|
|
MessageBox.Show(Translator.Translate("Es wurden keine Ziele ausgewählt."), "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
return;
|
|
}
|
|
|
|
var control = new GoalRatingControl();
|
|
control.Goals = goals;
|
|
var beWoWindow = new BeWoWindow
|
|
{
|
|
rootGroupBox = { Header = "Bewertung ändern" },
|
|
Height = 150,
|
|
Width = 800,
|
|
WindowStartupLocation = WindowStartupLocation.Manual,
|
|
GroupBoxContent = control,
|
|
Owner = BeWoApp.CurrentBeWo.MainWindow
|
|
};
|
|
|
|
var x = ButtonBewertung.PointToScreen(new Point(0, 0));
|
|
var source = PresentationSource.FromVisual(ButtonBewertung);
|
|
var top = x.Y / source.CompositionTarget.TransformToDevice.M22;
|
|
var left = x.X / source.CompositionTarget.TransformToDevice.M11;
|
|
|
|
top += ButtonBewertung.Height;
|
|
|
|
beWoWindow.Left = left;
|
|
beWoWindow.Top = top;
|
|
|
|
control.ActionButtonClicked += delegate
|
|
{
|
|
beWoWindow.Close();
|
|
};
|
|
|
|
control.CancelButtonClicked += delegate
|
|
{
|
|
beWoWindow.Close();
|
|
};
|
|
|
|
|
|
beWoWindow.ShowDialog();
|
|
}
|
|
|
|
private List<SupportConceptGoalDC> GetSelectedGoals()
|
|
{
|
|
var list = new List<SupportConceptGoalDC>();
|
|
|
|
AddCheckedGoals(list, ViewModel.PrototypeVM.GoalTree);
|
|
|
|
|
|
|
|
return list;
|
|
}
|
|
|
|
private void AddCheckedGoals(List<SupportConceptGoalDC> checkedList, List<SupportConceptGoalDC> allGoals)
|
|
{
|
|
if (allGoals != null)
|
|
{
|
|
foreach (var goal in allGoals)
|
|
{
|
|
if (goal.IsChecked && (goal.Children == null || goal.Children.Count == 0))
|
|
{
|
|
checkedList.Add(goal);
|
|
}
|
|
AddCheckedGoals(checkedList, goal.Children);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void TimeTextBox_OnLostFocus(object sender, RoutedEventArgs e)
|
|
{
|
|
var te = sender as TextEdit;
|
|
|
|
if (te != null)
|
|
{
|
|
te.EditValue = te.DisplayText.Replace("_", "0").Replace(" ", "");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void SrTableView_OnCustomRowAppearance(object sender, CustomRowAppearanceEventArgs e)
|
|
{
|
|
if (e.Property != null && e.Property.Name == "Background")
|
|
{
|
|
var sr = srGridControl.GetRow(e.RowHandle) as ServiceRecordVM;
|
|
if (sr != null && !String.IsNullOrEmpty(sr.BackgroundColor))
|
|
{
|
|
e.Result = new SolidColorBrush((Color)ColorConverter.ConvertFromString(sr.BackgroundColor));
|
|
e.Handled = true;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//var data = srGridControl.rowhan
|
|
}
|
|
|
|
private void PrintStatistics(object sender, MouseButtonEventArgs e)
|
|
{
|
|
var textBlock = (TextBlock)sender;
|
|
|
|
var node = ViewModel.SelectedCustomerNode;
|
|
long c2sOid = 0;
|
|
|
|
if (node != null && node.SupportConceptTreeNodeDC != null && node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC != null)
|
|
{
|
|
c2sOid = node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid.Value;
|
|
}
|
|
var url = BeWoApp.SiteOfOrigin + "/ReportView.aspx?c2sOid=" + c2sOid + "&type=" + Utils.EnumName(ReportTypes.HilfeplanStatistik);
|
|
|
|
BeWoUtils.NavigateToReportUri(url, "Druckvorschau");
|
|
}
|
|
|
|
private void multiSupportConceptControl_ListChanged(object sender, EventArgs<IList<CompactSupportConceptDC>> e)
|
|
{
|
|
ViewModel.UpdateGroupServiceAccountings(e.Data);
|
|
ComboBoxTreeViewControl.ResetControl();
|
|
|
|
ResetAllGoals(ViewModel.PrototypeVM.GoalTree);
|
|
|
|
|
|
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
|
|
}
|
|
|
|
private AiConversationChatViewModel getAiConversationChatViewModel()
|
|
{
|
|
var records = GetVisibleRecordVMs();
|
|
var context = ViewModel.GetVisibleInformationReferences(records);
|
|
var oid = supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
|
|
var canSendNewMessage = ViewModel.AiConversationButtonState == Controls.AI.AiConversationButtonState.Normal;
|
|
|
|
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.ServiceRecord, context, oid, canSendNewMessage);
|
|
|
|
return vm;
|
|
}
|
|
|
|
private void OpenAiWindow()
|
|
{
|
|
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
|
|
}
|
|
|
|
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
|
|
{
|
|
var list = new List<ServiceRecordVM>();
|
|
|
|
var items = srListBox.ItemsSource as IList<ServiceRecordVM>;
|
|
|
|
if (items != null)
|
|
{
|
|
for (int i = 0; i < items.Count; i++)
|
|
{
|
|
var vm = srListBox.Items[i] as ServiceRecordVM;
|
|
//if (srListBox.IsRowVisible(i))
|
|
//{
|
|
// var vm = datagrid_invoices.GetRow(i) as InvoiceBaseVM;
|
|
if (vm != null)
|
|
{
|
|
list.Add(vm);
|
|
}
|
|
//}
|
|
}
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
private void ItemAccepted(object sender, AbstractBaseVM e)
|
|
{
|
|
ViewModel.ItemAccepted(sender, e);
|
|
}
|
|
|
|
private void btn_AiPromptbaustein2_ItemAccepted(object sender, AbstractBaseVM e)
|
|
{
|
|
ViewModel.ItemAccepted(sender, e);
|
|
}
|
|
}
|
|
|
|
//public class RowBackgroundHelper
|
|
//{
|
|
// public static Brush GetBackground(DependencyObject obj)
|
|
// {
|
|
// return (Brush)obj.GetValue(BackgroundProperty);
|
|
// }
|
|
// public static void SetBackground(DependencyObject obj, Brush value)
|
|
// {
|
|
// obj.SetValue(BackgroundProperty, value);
|
|
// }
|
|
// public static readonly DependencyProperty BackgroundProperty =
|
|
// DependencyProperty.RegisterAttached("Background", typeof(Brush), typeof(RowBackgroundHelper), null);
|
|
|
|
|
|
|
|
// public static bool GetIsEnabled(DependencyObject obj)
|
|
// {
|
|
// return (bool)obj.GetValue(IsEnabledProperty);
|
|
// }
|
|
|
|
// public static void SetIsEnabled(DependencyObject obj, bool value)
|
|
// {
|
|
// obj.SetValue(IsEnabledProperty, value);
|
|
// }
|
|
|
|
// public static readonly DependencyProperty IsEnabledProperty =
|
|
// DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(RowBackgroundHelper), new PropertyMetadata(false));
|
|
|
|
//}
|
|
#pragma warning restore CS0618
|
|
} |