diff --git a/.gitignore b/.gitignore index df86776d6..82055c379 100644 --- a/.gitignore +++ b/.gitignore @@ -480,3 +480,6 @@ /ReportImp/BeWoFlex/obj/Debug /ValidationLibrary/obj/Debug/*.cache *.cache +/SharedLauncher/bin +/SharedLauncher/obj +/DLLs \ No newline at end of file diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index 4567ee8ee..9242287c1 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -1555,7 +1555,7 @@ namespace BeWo.Core supConSelConSeletedItem.SupportConceptTreeNodeDC.SupportConcept.Customer = updatedCustomer; } - var newList = control.SearchView.ObjectList; + List newList = control.SearchView.ObjectList; foreach (var concept in newList.Where(concept => concept.Customer.Equals(updatedCustomer))) concept.Customer = updatedCustomer; @@ -1576,7 +1576,7 @@ namespace BeWo.Core if (MainSession.MainPage.HomeButtonPanel == null) return; - //MainSession.MainPage.HomeView.txtHeader.Text = MainSession.LoggedOnUser.Employee.ToString(); + MainSession.MainPage.HomeView.txtHeader.Text = MainSession.LoggedOnUser.Employee.ToString(); } public static void WriteExcelFile(string content, string path) diff --git a/BeWo/MainPage.xaml b/BeWo/MainPage.xaml new file mode 100644 index 000000000..87096200a --- /dev/null +++ b/BeWo/MainPage.xaml @@ -0,0 +1,573 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/MainPage.xaml.cs b/BeWo/MainPage.xaml.cs new file mode 100644 index 000000000..71df7251c --- /dev/null +++ b/BeWo/MainPage.xaml.cs @@ -0,0 +1,1707 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Navigation; +using System.Windows.Threading; + +using BeWo.Core; +using BeWo.Core.Config; +using BeWo.Core.Service; +using BeWo.Scheduler.View; +using BeWo.SchulbegleitenderDienst; +using BeWo.ServiceProxy; +using BeWo.View; +using BeWo.View.Detail; +using BeWo.View.Master; +using BeWo.View.Navigation; +using BeWo.ViewModel; +using BS.Shared; +using BS.Shared.DataContracts; +using BS.Shared.Extensions; +using BS.SharedLauncher; +using BS.SharedLauncher.Information; +using BS.SharedLauncher.Pages; +using DevExpress.Xpf.Editors; +using DevExpress.Xpf.Grid; +using DevExpress.Xpf.Scheduler; +using Hyperlink = System.Windows.Documents.Hyperlink; + +namespace BeWo +{ + public enum UIContext + { + SupportConcept, + Customer, + Person, + Employee, + Organisation, + Team, + User, + UserGroup, + Report, + Scheduler, + Wohnheim, + Vertretungen, + CustomerTeam + } + + public partial class MainPage : UserControl, IMainPage + { + private const string _PINInfoText = "Um Zugriff auf Ihre Daten zu bekommen, benötigen wir eine PIN."; + private readonly Stack _ModalPopupControls = new Stack(); + + private BeWoView _CurrentDetailView; + + private Control _CurrentModalPopup; + + private HomeView _HomeView; + + private bool _TermineInitialized; + + private Dictionary _Views = new Dictionary(); + private WaitLayer2 _WaitLayer; + + public MainPage() + { + InitializeComponent(); + + MainSession.MainPage = this; + + InitCommandBindings(); + KeyDown += MainPage_KeyDown; + NavigateToHomeView(); + + OpenedModalViewWindows = new List(); + + if (!string.IsNullOrWhiteSpace(MainSession.AppSettings.TimeRecordingMenuName)) + { + button_serviceRecord.Content = MainSession.AppSettings.TimeRecordingMenuName; + } + + MainSession.InitAutoUILocking(); + + Session.AddTimer("AufOffeneTerminePruefen", new System.Threading.Timer( + e => AufOffeneTerminePruefen(), null, TimeSpan.Zero, TimeSpan.FromMinutes(1) + )); + +#if !DEBUG + if (this.button_Scheduler.Visibility == Visibility.Visible && !MainSession.AppSettings.IsSchedulerAllowed) + { + this.button_Scheduler.Visibility = Visibility.Collapsed; + } + if (this.button_Wohnheim.Visibility == Visibility.Visible && !MainSession.AppSettings.IsWohnheimAllowed) + { + this.button_Wohnheim.Visibility = Visibility.Collapsed; + } + + if (this.button_ResourceBooking.Visibility == Visibility.Visible && !MainSession.AppSettings.ShowRessources) + { + this.button_ResourceBooking.Visibility = Visibility.Collapsed; + } + if (MainSession.Mandator == null || !MainSession.Mandator.AllowSbd) + { + this.button_SchulbegleitenderDienst.Visibility = Visibility.Collapsed; + } +#endif + } + + public List OpenedModalViewWindows { get; set; } + + internal Dictionary Views + { + get { return _Views; } + } + + public Grid ModalPopupBackGround { get; private set; } + + public HomeView HomeView + { + get { return _HomeView; } + set { _HomeView = value; } + } + + public BeWoView ActiveView + { + get + { + if (DetailFrame.Children.Count > 0) + { + return DetailFrame.Children[0] as BeWoView; + } + + return null; + } + } + + public bool IsMaximized { get; set; } + + private bool _HatNeueTermine; + public bool HatNeueTermine + { + get => _HatNeueTermine; + set + { + _HatNeueTermine = value; + NewAppointmentsOutlinedTextBlock.Visibility = value && MainSession.LoggedOnUser != null && MainSession.LoggedOnUser.HasRight(UserRightType.KalenderAnsehen) ? Visibility.Visible : Visibility.Collapsed; + + if(ActiveView?.GetType() == typeof(SchedulerMasterView)) + { + var schedulerMasterView = (SchedulerMasterView) ActiveView; + + if(schedulerMasterView.grid_root.Children.Count > 0) + { + var child0 = schedulerMasterView.grid_root.Children[0]; + + if(child0?.GetType() == typeof(NewSchedulerView)) + { + var scheduler = (NewSchedulerView) schedulerMasterView.grid_root.Children[0]; + scheduler.UpdateRequestString(); + } + } + + } else if(ActiveView?.GetType() == typeof(HomeView)) + { + var homeDragPanelView = (HomeView) ActiveView; + homeDragPanelView.UpdateRequestsHyperLink(); + } + } + } + + public event EventHandler LogoutClicked; + + public void ResetView(UIContext uiContext) + { + if (_Views.ContainsKey(uiContext)) + { + _Views.Remove(uiContext); + } + } + + private BeWoView GetViewForUIContext(UIContext uiContext) + { + if (!_Views.ContainsKey(uiContext)) + { + BeWoView view = null; + switch (uiContext) + { + case UIContext.Person: + view = new PersonNavigationView(); + break; + case UIContext.Customer: + view = new CustomerNavigationView(); + break; + case UIContext.Organisation: + view = new OrganisationNavigationView(); + break; + case UIContext.SupportConcept: + view = new SupportConceptNavigationView(); + break; + case UIContext.Team: + view = new TeamNavigationView(); + break; + case UIContext.User: + view = new UserNavigationView(); + break; + case UIContext.UserGroup: + view = new UserGroupNavigationView(); + break; + case UIContext.Employee: + view = new EmployeeNavigationView(); + break; + case UIContext.Report: + view = new ReportView(); + break; + case UIContext.Scheduler: + view = new SchedulerMasterView(); + break; + case UIContext.Wohnheim: + view = new WohnheimNavigationView(); + break; + case UIContext.Vertretungen: + view = new VertretungsMainView2(); + break; + case UIContext.CustomerTeam: + view = new CustomerTeamNavigationView(); + break; + } + _Views[uiContext] = view; + } + return _Views[uiContext]; + } + + public event PropertyChangedEventHandler PropertyChanged; + public event EventHandler Logout; + + 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(); + + // lAnimation.From = scale.ScaleX; + // lAnimation.To = pOpacitiy; + lAnimation.From = DetailFrame.Opacity; + lAnimation.To = pOpacitiy; + lAnimation.Duration = TimeSpan.FromMilliseconds(pDuration); + DetailFrame.BeginAnimation(OpacityProperty, lAnimation); + + // scale.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, lAnimation); + // scale.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, lAnimation); + } + + public void AnimateOpacity(double pOpacitiy) + { + AnimateOpacity(pOpacitiy, 500); + } + + public void ChangePopupOpacityMode(bool isPopUpVisible) + { + if (isPopUpVisible) + { + AnimateOpacity(0.5, 200); + } + else + { + AnimateOpacity(1, 100); + } + } + + public void CloseCurrentPopUp() + { + if (ModalPopupBackGround != null) + { + Dispatcher.BeginInvoke( + DispatcherPriority.Normal, + (Action) delegate + { + grid_main.Children.Remove(_CurrentModalPopup); + _CurrentModalPopup = null; + + if(_ModalPopupControls.Count == 0) + { + grid_main.Children.Remove(ModalPopupBackGround); + ModalPopupBackGround = null; + } + else + { + var control = _ModalPopupControls.Pop(); + _CurrentModalPopup = control; + grid_main.Children.Add(control); + Panel.SetZIndex(control, int.MaxValue); + } + }); + } + } + + public void HideCurrentModalViewWindows() + { + if(ModalPopupBackGround != null) + { + Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate + { + ModalPopupBackGround.Visibility = Visibility.Collapsed; + + foreach(var modalPopup in OpenedModalViewWindows) + { + modalPopup.Hide(); + } + }); + } + } + + public void ShowCurrentModalViewWindowsAgain() + { + if(OpenedModalViewWindows.Count > 0 && ModalPopupBackGround != null) + { + ModalPopupBackGround.Visibility = Visibility.Visible; + + foreach(var modalPopup in OpenedModalViewWindows) + { + modalPopup.Show(); + } + } + } + + public void EndWaiting() + { + Dispatcher.BeginInvoke( + DispatcherPriority.Normal, + (Action) delegate + { + if (_WaitLayer != null) + { + grid_main.Children.Remove(_WaitLayer); + _WaitLayer = null; + } + }); + } + + public void NavigateToServiceRecordView(long? supportConceptOid) + { + if (DoSaveCheck()) + { + VMFactory.CreateServiceRecordVMAsync( + MainSession.LoggedOnUser.Employee.EmployeeOid, + vm => this.Dispatch( + delegate + { + vm.DispatcherObject = this; + NavigateTo(new ServiceRecordView2(vm, supportConceptOid)); + })); + } + } + + public void NavigateToAdditionalServiceView(long? supportConceptOid) + { + if (DoSaveCheck()) + { + VMFactory.CreateServiceRecordVMAsync( + MainSession.LoggedOnUser.Employee.EmployeeOid, + vm => Cache.GetInstance().GetAllActiveAndArchivedCustomerCompact( + c => this.Dispatch( + delegate + { + vm.DispatcherObject = this; + + if (vm.NewVM != null) + vm.NewVM.ServiceRecordType = ServiceRecordTypeId.AdditionalService; + + NavigateTo(new AdditionalServiceView(vm, c)); + }))); + } + } + + public void ShowControlAsModalPopup(Control control) + { + ShowControlAsModalPopup(control, HorizontalAlignment.Center, VerticalAlignment.Center); + } + + public void ShowControlAsModalPopup(Control control, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) + { + Dispatcher.BeginInvoke( + DispatcherPriority.Normal, + (Action) delegate + { + if (_CurrentModalPopup != null) + { + grid_main.Children.Remove(_CurrentModalPopup); + _ModalPopupControls.Push(_CurrentModalPopup); + } + else + { + ShowModalBackground(); + } + + _CurrentModalPopup = control; + control.HorizontalAlignment = horizontalAlignment; + control.VerticalAlignment = verticalAlignment; + Grid.SetColumnSpan(control, 3); + Grid.SetRowSpan(control, 3); + grid_main.Children.Add(control); + Panel.SetZIndex(control, int.MaxValue); + }); + } + + public void StartWaiting() + { + Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) StartWaitingImmediately); + } + + public void StartWaitingImmediately() + { + if (_WaitLayer == null) + { + _WaitLayer = new WaitLayer2(); + Grid.SetColumnSpan(_WaitLayer, 3); + Grid.SetRowSpan(_WaitLayer, 3); + grid_main.Children.Add(_WaitLayer); + Panel.SetZIndex(_WaitLayer, int.MaxValue); + _WaitLayer.RefreshUI(); + } + } + + internal void ClearDetailFrame() + { + foreach (var window in Session.GetWindow().OwnedWindows) + { + ((System.Windows.Window)window).Close(); + } + + BeWoView lOld = null; + if (DetailFrame.Children.Count == 1) + { + lOld = DetailFrame.Children[0] as BeWoView; + } + + _CurrentDetailView = null; + + if (lOld != null) + { + if (lOld is HomeView) + { + var hdpv = lOld as HomeView; + hdpv.SaveState(); + MainSession.SaveAppSettings(); + } + + lOld.BlendOutComplete += (s, e) => DetailFrame.Children.Remove(lOld); + lOld.BlendOut(); + } + + DetailFrame.Children.Clear(); + } + + internal void Maximize() + { + var animation = new ThicknessAnimationUsingKeyFrames(); + var t = new Thickness(-5, 0, -5, 0); + animation.KeyFrames.Add(new SplineThicknessKeyFrame(t, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(1, 0, 1, 1))); + + animation.Completed += maximizeAnimation_Completed; + + AnimateToolbarOut(0); + DetailFrame.BeginAnimation(MarginProperty, animation); + + MainSession.AppSettings.WindowState = AppSettings.WindowStateType.Maximised; + MainSession.SaveAppSettings(); + + // toolbarButtonPanel.Visibility = Visibility.Hidden; + // toolbarBord.Visibility = Visibility.Hidden; + // LogoutButtonPanel.Visibility = Visibility.Hidden; + ////###HOMEVIEW HomeButtonPanel.Visibility = Visibility.Hidden; + // toolbarScrollViewer.Visibility = Visibility.Hidden; + } + + internal void Minimize() + { + var animation = new ThicknessAnimationUsingKeyFrames(); + var t = new Thickness(140, 35, 140, 85); + animation.KeyFrames.Add(new SplineThicknessKeyFrame(t, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(0, 1, 1, 1))); + + animation.Completed += minimizeAnimation_Completed; + + AnimateToolbarIn(0); + DetailFrame.BeginAnimation(MarginProperty, animation); + + MainSession.AppSettings.WindowState = AppSettings.WindowStateType.Default; + MainSession.SaveAppSettings(); + + // toolbarButtonPanel.Visibility = Visibility.Visible; + // toolbarBord.Visibility = Visibility.Visible; + // LogoutButtonPanel.Visibility = Visibility.Visible; + ////###HOMEVIEW HomeButtonPanel.Visibility = Visibility.Visible; + // toolbarScrollViewer.Visibility = Visibility.Visible; + } + + internal void NavigateTo(BeWoView pElement) + { + if (MainSession.RenderTier < 2) + NavigateToWithoutFade(pElement); + else + NavigateToWithFade(pElement); + } + + internal void NavigateToWithoutFade(BeWoView pElement) + { + if (pElement == null) + { + NavigateToHomeView(); + } + else + { + if (DetailFrame.Children.Count == 1) + { + var lOld = DetailFrame.Children[0] as BeWoView; + + if (lOld != null) + { + if (lOld is HomeView) + { + var hdpv = lOld as HomeView; + hdpv.SaveState(); + MainSession.SaveAppSettings(); + } + } + DetailFrame.Children.Clear(); + } + + if (pElement != null) + { + DetailFrame.Children.Add(pElement); + } + + _CurrentDetailView = pElement; + + DetailFrame.Children.RemoveRange(2); + } + } + + internal void NavigateToWithFade(BeWoView pElement) + { + if (pElement == null) + { + NavigateToHomeView(); + } + else + { + BeWoView lOld = null; + if (DetailFrame.Children.Count > 0) + { + lOld = DetailFrame.Children[0] as BeWoView; + + if (DetailFrame.Children.Count > 1) + { + DetailFrame.Children.RemoveRange(1); + } + if (lOld != null && lOld.Equals(pElement)) + return; + } + + + if (pElement != null) + { + pElement.Opacity = 0; + DetailFrame.Children.Add(pElement); + pElement.Focus(); + pElement.BlendIn(); + + // Object obj = pElement.Template.FindName("togglebutton_maximise", pElement); + // obj = pElement.FindName("togglebutton_maximise"); + // if (maximizeButton != null) + // { + // maximizeButton.IsChecked = IsMaximized; + // } + } + + _CurrentDetailView = pElement; + + if (lOld != null) + { + if (lOld is HomeView) + { + var hdpv = lOld as HomeView; + hdpv.SaveState(); + MainSession.SaveAppSettings(); + } + + lOld.BlendOutComplete += (s, e) => + { + if (DetailFrame.Children.Count > 1) + DetailFrame.Children.Remove(lOld); + }; + lOld.BlendOut(); + } + + DetailFrame.Children.RemoveRange(2); + } + } + + protected virtual void FirePropertyChanged(string pPropertyName) + { + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs(pPropertyName)); + } + } + + private void AnimateToolbarIn(int delay) + { + var animation = new DoubleAnimationUsingKeyFrames(); + + animation.BeginTime = new TimeSpan(0, 0, 0, 0, delay); + + animation.KeyFrames.Add(new SplineDoubleKeyFrame(-5, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(0, 1, 1, 1))); + animation.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 1000)), new KeySpline(0.35, 0.5, 0.5, 0.9))); + + var group = (TransformGroup) toolbarRoot.RenderTransform; + var trans = (TranslateTransform) group.Children[3]; + + var animationButtons = new DoubleAnimationUsingKeyFrames(); + animationButtons.BeginTime = new TimeSpan(0, 0, 0, 0, delay); + animationButtons.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(0, 1, 1, 1))); + + var groupButtons = (TransformGroup) toolbarContent.RenderTransform; + var transButtons = (TranslateTransform) groupButtons.Children[3]; + + transButtons.BeginAnimation(TranslateTransform.YProperty, animationButtons); + + trans.BeginAnimation(TranslateTransform.YProperty, animation); + } + + private void AnimateToolbarOut(int delay) + { + var animation = new DoubleAnimationUsingKeyFrames(); + + animation.BeginTime = new TimeSpan(0, 0, 0, 0, delay); + + animation.KeyFrames.Add(new SplineDoubleKeyFrame(45, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(1, 0, 1, 1))); + + var group = (TransformGroup) toolbarRoot.RenderTransform; + var trans = (TranslateTransform) group.Children[3]; + + var animationButtons = new DoubleAnimationUsingKeyFrames(); + animationButtons.BeginTime = new TimeSpan(0, 0, 0, 0, delay); + animationButtons.KeyFrames.Add(new SplineDoubleKeyFrame(100, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(1, 0, 1, 1))); + + var groupButtons = (TransformGroup) toolbarContent.RenderTransform; + var transButtons = (TranslateTransform) groupButtons.Children[3]; + + transButtons.BeginAnimation(TranslateTransform.YProperty, animationButtons); + trans.BeginAnimation(TranslateTransform.YProperty, animation); + } + + public bool DoSaveCheck() + { + return _CurrentDetailView == null || _CurrentDetailView.DoSaveCheck(); + } + + private void InitCommandBindings() + { + CommandBindings.Add( + new CommandBinding( + ApplicationCommands.Save, + (s, e) => + { + if (_CurrentModalPopup == null) + { + _CurrentDetailView.SaveData(); + } + else + { + _CurrentDetailView.ModalPopUpSaveInvoked(); + } + }, + (s, e) => + { + if (_CurrentModalPopup == null) + { + e.CanExecute = _CurrentDetailView != null ? _CurrentDetailView.IsDirty : false; + } + else + { + e.CanExecute = _CurrentDetailView != null && (_CurrentModalPopup is BeWoView && ((BeWoView) _CurrentModalPopup).IsDirty); + } + })); + + CommandBindings.Add(new CommandBinding(BeWoCommands.Excel, (s, e) => _CurrentDetailView.ExportToExcel(e.Parameter as string), (s, e) => e.CanExecute = _CurrentDetailView != null ? _CurrentDetailView.CanExcelExport : false)); + + CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, (s, e) => _CurrentDetailView.Delete(), (s, e) => e.CanExecute = _CurrentDetailView != null ? _CurrentDetailView.CanDelete : false)); + + CommandBindings.Add(new CommandBinding(BeWoCommands.Word, (s, e) => _CurrentDetailView.ExportToWord(e.Parameter as string), (s, e) => e.CanExecute = _CurrentDetailView != null ? _CurrentDetailView.CanWordExport : false)); + + CommandBindings.Add( + new CommandBinding( + ApplicationCommands.Close, + (s, e) => + { + if (_CurrentModalPopup == null && DoSaveCheck()) + { + if (_CurrentDetailView.ParentView != null) + _CurrentDetailView.ParentView.ChildViewClosed(); + + NavigateToParentView(_CurrentDetailView.ParentView); + } + else + { + _CurrentDetailView.ModalPopUpCloseInvoked(); + } + }, (s, e) => e.CanExecute = _CurrentDetailView != null)); + } + + private void NavigateToParentView(BeWoView beWoView) + { + if (beWoView is CustomerNavigationView && !_Views.ContainsKey(UIContext.Customer)) + { + _Views.Add(UIContext.Customer, beWoView); + } + else if (beWoView is EmployeeNavigationView && !_Views.ContainsKey(UIContext.Employee)) + { + _Views.Add(UIContext.Employee, beWoView); + } + else if (beWoView is OrganisationNavigationView && !_Views.ContainsKey(UIContext.Organisation)) + { + _Views.Add(UIContext.Organisation, beWoView); + } + else if (beWoView is PersonNavigationView && !_Views.ContainsKey(UIContext.Person)) + { + _Views.Add(UIContext.Person, beWoView); + } + else if (beWoView is SupportConceptNavigationView && !_Views.ContainsKey(UIContext.SupportConcept)) + { + _Views.Add(UIContext.SupportConcept, beWoView); + } + else if (beWoView is TeamNavigationView && !_Views.ContainsKey(UIContext.Team)) + { + _Views.Add(UIContext.Team, beWoView); + } + else if (beWoView is UserNavigationView && !_Views.ContainsKey(UIContext.User)) + { + _Views.Add(UIContext.User, beWoView); + } + else if (beWoView is UserGroupNavigationView && !_Views.ContainsKey(UIContext.UserGroup)) + { + _Views.Add(UIContext.UserGroup, beWoView); + } + else if (beWoView is WohnheimNavigationView && !_Views.ContainsKey(UIContext.Wohnheim)) + { + _Views.Add(UIContext.Wohnheim, beWoView); + } + NavigateTo(beWoView); + } + + private void MainPage_KeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Back) + { + e.Handled = true; + } + } + + private void NavigateToHomeView() + { + if (_HomeView == null) + { + _HomeView = new HomeView(); + } + else + { + //_HomeView.ReorderPanels(); + } + + NavigateTo(_HomeView); + } + + private void OnLoadedStoryboard_Completed(object sender, EventArgs e) + { + if (MainSession.AppSettings.WindowState == AppSettings.WindowStateType.Maximised) + { + Maximize(); + IsMaximized = true; + FirePropertyChanged("IsMaximized"); + } + } + + internal void ShowModalBackground() + { + ModalPopupBackGround = new Grid + { + IsHitTestVisible = true, + Background = Brushes.White, + Opacity = .5 + }; + + Grid.SetColumnSpan(ModalPopupBackGround, 3); + Grid.SetRowSpan(ModalPopupBackGround, 3); + + grid_main.Children.Add(ModalPopupBackGround); + + Panel.SetZIndex(ModalPopupBackGround, int.MaxValue); + } + + private void logoutanimation_Completed(object sender, EventArgs e) + { + //var navigationService = NavigationService.GetNavigationService(this); + //if (navigationService != null) + //{ + // navigationService.Navigate(new LoginPage()); + ConnectionInformation.Username = string.Empty; + ConnectionInformation.Password = string.Empty; + + // ConnectionInformation.Tenant = ""; + MainSession.LoggedOnUser = null; + //} + if (LogoutClicked != null) + LogoutClicked(null, new EventArgs()); + } + + private void btn_home_Click(object sender, RoutedEventArgs e) + { + if (!(_CurrentDetailView is HomeView) && DoSaveCheck()) + { + NavigateToHomeView(); + } + } + + private void button_AccountingTransacation_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(new FinanceView()); + } + } + + private void button_Administration_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(new AdministrationView()); + } + } + + // private void ExcelExport_RequestNavigate(object sender, RequestNavigateEventArgs e) + // { + // BeWoCommands.Excel.Execute(LinkEngine.ExcelFileId, ExcelExport); + // LinkEngine.GenerateNewExcelLink(); + // } + + // private void WordExport_RequestNavigate(object sender, RequestNavigateEventArgs e) + // { + // BeWoCommands.Word.Execute(LinkEngine.WordFileId, WordExport); + // LinkEngine.GenerateNewWordLink(); + // } + + private void button_Customer_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Customer)); + } + } + + private void button_Wohnheim_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Wohnheim)); + } + } + + private void button_Employee_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Employee)); + } + } + + private void button_Home(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + // NavigateTo(new HomeView()); + NavigateTo(new HomeView()); + } + } + + private void button_Logout(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + Cache.GetInstance().ClearAll(); + _Views = new Dictionary(); + + var animation = new DoubleAnimationUsingKeyFrames(); + + animation.KeyFrames.Add(new SplineDoubleKeyFrame(100, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(1, 0, 1, 1))); + + var group = (TransformGroup) toolbarRoot.RenderTransform; + var trans = (TranslateTransform) group.Children[3]; + + trans.BeginAnimation(TranslateTransform.YProperty, animation); + + animation = new DoubleAnimationUsingKeyFrames(); + animation.Completed += logoutanimation_Completed; + + animation.KeyFrames.Add(new SplineDoubleKeyFrame(-200, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 500)), new KeySpline(1, 0, 1, 1))); + + group = (TransformGroup) image.RenderTransform; + trans = (TranslateTransform) group.Children[3]; + + trans.BeginAnimation(TranslateTransform.XProperty, animation); + ClearDetailFrame(); + } + + //Hier das mit Chat Refreshen + if (MainSession.MainPage != null && MainSession.MainPage.HomeView.ServiceChatView != null) + { + if (MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl != null && + MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer != null) + { + MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer.Stop(); + MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer = null; + MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl.ShouldInterruptContactsThread = true; + } + + if (MainSession.MainPage.HomeView.ServiceChatView.ServiceChat.EmojiView != null) + { + MainSession.MainPage.HomeView.ServiceChatView.ServiceChat.EmojiView.Close(); + MainSession.MainPage.HomeView.ServiceChatView.ServiceChat.EmojiView = null; + } + + if (MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl != null) + { + MainSession.MainPage.HomeView.ServiceChatView.ChatMainControl.DeleteTempFiles(); + } + MainSession.MainPage.HomeView.ServiceChatView.Close(); + MainSession.MainPage.HomeView.ServiceChatView = null; + + } + MainSession.Cleanup(); + Logout(this, null); + //Ende + + } + + private void button_Organisation_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Organisation)); + } + } + + private void button_Person_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Person)); + } + } + + private void button_Reports_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Report)); + } + } + + private void button_ResourceBooking_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + ServiceFacade.DoResourceServiceAsync( + s1 => s1.GetAllResources(), + r1 => ServiceFacade.DoEmployeeServiceAsync( + s2 => s2.GetAllActiveEmployeesCompact(), + r2 => + { + if (r1.Count > 0 && r2.Count > 0) + { + try + { + Dictionary> lCategoriesToResources = r1.Select(res => res.ResourceCategory).Distinct().OrderBy(cat => cat.TypeDescription).Select(cat => new {Key = cat, Value = r1.Where(res => res.ResourceCategory.Equals(cat)).OrderBy(res => res.Name).ToList()}).ToDictionary(a => a.Key, a => a.Value); + + this.Dispatch(delegate { NavigateTo(new BookingView(lCategoriesToResources, r2, MainSession.LoggedOnUser.Employee)); }); + } + catch (Exception) + { + MessageBox.Show("Bitte legen Sie zunächst unter Verwaltung Resourcen und Resourcenkategorien an."); + } + } + })); + } + } + + private void button_Scheduler_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Scheduler)); + } + } + + private void button_SupportConcept_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.SupportConcept)); + } + } + + private void button_Team_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Team)); + } + } + + private void button_CustomerTeam_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.CustomerTeam)); + } + } + + private void button_UserGroup_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.UserGroup)); + } + } + + private void button_User_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.User)); + } + } + + //private void button_assessmentSheetEntry_Click(object sender, RoutedEventArgs e) + //{ + // if (this.DoSaveCheck()) + // { + // this.NavigateTo(new AssessmentSheetEntryView()); + // } + //} + + + private void button_resources_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + VMFactory.CreateResourceListVMAsync(cb => this.Dispatch(delegate { NavigateTo(new RessourceView(cb)); })); + } + } + + private void button_serviceRecord_Click(object sender, RoutedEventArgs e) + { + NavigateToServiceRecordView(null); + } + + private void button_additionalService_Click(object sender, RoutedEventArgs e) + { + NavigateToAdditionalServiceView(null); + } + + private void maximizeAnimation_Completed(object sender, EventArgs e) + { + IsMaximized = true; + } + + private void minimizeAnimation_Completed(object sender, EventArgs e) + { + IsMaximized = false; + } + + private void toolbarRoot_MouseEnter(object sender, MouseEventArgs e) + { + if (IsMaximized) + { + AnimateToolbarIn(500); + } + } + + private void toolbarRoot_MouseLeave(object sender, MouseEventArgs e) + { + if (IsMaximized) + { + AnimateToolbarOut(200); + } + } + + private void toolbarScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + e.Handled = true; + } + + private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e) + { + // Hier Token anfordern; Hier nicht notwendig -> Link auf www.beyondsoft.de + Process.Start(new ProcessStartInfo((sender as Hyperlink).NavigateUri.ToString())); + } + + private void button_Support_Click(object sender, RoutedEventArgs e) + { + var mailButton = new Button + { + Content = "*", + FontFamily = new FontFamily("Wingdings"), + FontSize = 16, + Width = 25, + Margin = new Thickness(5), + HorizontalContentAlignment = HorizontalAlignment.Center, + VerticalContentAlignment = VerticalAlignment.Center + }; + + + var phoneButton = new Button + { + Content = ")", + FontFamily = new FontFamily("Wingdings"), + FontSize = 16, + Width = 25, + Margin = new Thickness(5), + HorizontalContentAlignment = HorizontalAlignment.Center, + VerticalContentAlignment = VerticalAlignment.Center + }; + + + var cancelButton = new Button {Content = "Schließen"}; + cancelButton.Margin = new Thickness(5); + + var mailLabel = new Label + { + Content = "Support-Mail schreiben", + FontWeight = FontWeights.Bold, + Margin = new Thickness(5), + HorizontalContentAlignment = HorizontalAlignment.Center, + VerticalContentAlignment = VerticalAlignment.Center + }; + + //var mailButtonLabel = new Button + //{ + // Content = "Support-Mail schreiben", + // FontWeight = FontWeights.Bold, + // Margin = new Thickness(5), + // HorizontalContentAlignment = HorizontalAlignment.Center, + // VerticalContentAlignment = VerticalAlignment.Center, + // Style = null, + // Background = Brushes.Transparent + //}; + //mailButtonLabel.Content = mailLabel; + + var textBlockMail = new TextBlock + { + Foreground = Brushes.Black, + Margin = new Thickness(45, 5, 5, 5), + Text = "Wenn Sie auf das Brief-Symbol klicken öffnet sich ein Fenster,\nin dem Sie eine E-Mail an den BeWoPlaner-Support formulieren können" + }; + var phoneLabel = new Label + { + Content = "PIN für Support-Anruf erhalten", + FontWeight = FontWeights.Bold, + Margin = new Thickness(5), + HorizontalContentAlignment = HorizontalAlignment.Center, + VerticalContentAlignment = VerticalAlignment.Center + }; + + var textBlockPhone = new TextBlock + { + Foreground = Brushes.Black, + Margin = new Thickness(45, 5, 5, 5), + Text = "Wenn Sie auf das PIN-Symbol klicken, wird Ihnen eine zufällige Support-PIN angezeigt.\n\n" + + "Benötigen wir zur Lösung einer Support-Anfrage den Zugriff auf Ihre Datenbank,\n" + + "werden Sie vom Support-Mitarbeiter gebeten, ihm eine solche Support-PIN zu übermitteln.\n" + + "Diese PIN ist nur einmalig nutzbar/gültig. Sie wird nicht automatisch an den Support übermittelt.\n" + + "Dies stellt sicher, dass ein Support-Mitarbeiter nicht ohne Ihre Einwilligung auf Ihre Datenbank zugreifen kann.\n" + + "Jeder Support-Zugriff auf Ihre Datenbank wird zudem mit Hilfe der PIN protokolliert." + }; + + /* + * + www.beyondsoft.de + + */ + var supportToolLink = new TextBlock + { + Foreground = Brushes.Black, + Margin = new Thickness(45, 5, 5, 5), + FontSize = 12 + + }; + + String linkText = "Teamviewer herunterladen"; + String url = "https://get.teamviewer.com/dj5y4zy"; + + if (!String.IsNullOrWhiteSpace(MainSession.Mandator.SupportToolUrl)) + { + url = MainSession.Mandator.SupportToolUrl; + if (MainSession.Mandator.SupportToolUrl.Contains("<") && MainSession.Mandator.SupportToolUrl.Contains(">") && MainSession.Mandator.SupportToolUrl.IndexOf("<") > 0) + { + linkText = MainSession.Mandator.SupportToolUrl.Substring(0, MainSession.Mandator.SupportToolUrl.IndexOf("<")); + url = MainSession.Mandator.SupportToolUrl.Substring(MainSession.Mandator.SupportToolUrl.IndexOf("<")); + url = url.Replace("<", "").Replace(">", ""); + } + + } + + Hyperlink link = new Hyperlink(); + link.NavigateUri = new Uri(url); + link.TargetName = "newWindow"; + link.Inlines.Add(linkText); + supportToolLink.Inlines.Add(link); + link.RequestNavigate += (s, e2) => + { + System.Diagnostics.Process.Start( + new System.Diagnostics.ProcessStartInfo((s as Hyperlink).NavigateUri.ToString())); + }; + + BeWoWindow bewoWindow = BeWoWpfUtils.CreateBeWoPopupWindow(300, 1000, true); + + cancelButton.Click += delegate { bewoWindow.Close(); }; + + + mailButton.Click += delegate + { + bewoWindow.Close(); + CreateSupportMailWindow(); + }; + + phoneButton.Click += delegate + { + bewoWindow.Close(); + CreateSupportRequestWindow(); + }; + + + //var mailHelpButton = new Button + //{ + // Content = "?", + // Width = 25, + // Margin = new Thickness(5), + // HorizontalContentAlignment = HorizontalAlignment.Center, + // VerticalContentAlignment = VerticalAlignment.Center, + // ToolTip = "Wenn Sie auf das Brief-Symbol klicken öffnet sich ein Fenster,\nin dem Sie eine E-Mail an den BeWoPlaner-Support formulieren können" + //}; + + //var phoneHelpButton = new Button + //{ + // Content = "?", + // Width = 25, + // Margin = new Thickness(5), + // HorizontalContentAlignment = HorizontalAlignment.Center, + // VerticalContentAlignment = VerticalAlignment.Center, + // ToolTip = "Wenn Sie auf das PIN-Symbol klicken, wird Ihnen eine zufällige Support-PIN angezeigt.\n\n" + + // "Benötigen wir zur Lösung einer Support-Anfrage den Zugriff auf Ihre Datenbank,\n" + + // "werden Sie vom Support-Mitarbeiter gebeten, ihm eine solche Support-PIN zu übermitteln.\n" + + // "Diese PIN ist nur einmalig nutzbar/gültig. Sie wird nicht automatisch an den Support übermittelt.\n" + + // "Dies stellt sicher, dass ein Support-Mitarbeiter nicht ohne Ihre Einwilligung auf Ihre Datenbank zugreifen kann.\n"+ + // "Jeder Support-Zugriff auf Ihre Datenbank wird zudem mit Hilfe der PIN protokolliert." + //}; + + var centeredStackPanel = new StackPanel {Orientation = Orientation.Vertical, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center}; + var mailStackPanel = new StackPanel {Orientation = Orientation.Horizontal}; + var phoneStackPanel = new StackPanel {Orientation = Orientation.Horizontal}; + + + mailStackPanel.Children.Add(mailButton); + mailStackPanel.Children.Add(mailLabel); + + + phoneStackPanel.Children.Add(phoneButton); + phoneStackPanel.Children.Add(phoneLabel); + + + centeredStackPanel.Children.Add(mailStackPanel); + centeredStackPanel.Children.Add(textBlockMail); + centeredStackPanel.Children.Add(phoneStackPanel); + centeredStackPanel.Children.Add(textBlockPhone); + centeredStackPanel.Children.Add(supportToolLink); + centeredStackPanel.Children.Add(cancelButton); + + + var grid = new Grid + { + Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush") + }; + + grid.Children.Add(centeredStackPanel); + + bewoWindow.GroupBoxContent = grid; + bewoWindow.rootGroupBox.Header = "Support"; + bewoWindow.Owner = Session.GetWindow(); + bewoWindow.Show(); + } + + private void CreateSupportMailWindow() + { + BeWoWindow bewoWindow = BeWoWpfUtils.CreateBeWoPopupWindow(600, 800); + bewoWindow.SizeChanged += delegate + { + bewoWindow.Left = ActualWidth/2 - bewoWindow.Width/2; + bewoWindow.Top = ActualHeight/2 - bewoWindow.Height/2; + }; + + //var grid = new Grid + //{ + // Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush") + //}; + + //var infoGrid = new Grid + //{ + // Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush") + //}; + + //var beschreibungLabel = new Label {Content = "Hier können Sie eine E-Mail an den BeWoPlaner-Support formulieren.", Margin = new Thickness(3)}; + //var betreffLabel = new Label {Content = "Betreff:", Margin = new Thickness(3)}; + //var betreffTextBox = new TextBox {Margin = new Thickness(3, 3, 3, 0)}; + //var nachrichtsTextBox = new TextBox + //{ + // Margin = new Thickness(3), + // AcceptsReturn = true, + // VerticalScrollBarVisibility = ScrollBarVisibility.Auto, + // HorizontalScrollBarVisibility = ScrollBarVisibility.Auto + //}; + //var pinCheckBox = new CheckBox + //{ + // Margin = new Thickness(3), + // Content = "PIN anfügen", + // ToolTip = "Nur mit dieser PIN erhält ein Servicemitarbeiter Zugang zu Ihren Daten" + //}; + //var abbrechenButton = new Button {Margin = new Thickness(3), Content = "Abbrechen"}; + //var schliessenButton = new Button {Margin = new Thickness(3), Content = "Schließen"}; + //var sendenButton = new Button + //{ + // Margin = new Thickness(3), + // Content = "Senden", + // HorizontalAlignment = HorizontalAlignment.Left + //}; + //var zurueckButton = new Button + //{ + // Margin = new Thickness(3), + // Content = "Zurück" + //}; + //var weiterButton = new Button + //{ + // Margin = new Thickness(3), + // Content = "Weiter", + // HorizontalAlignment = HorizontalAlignment.Left + //}; + //weiterButton.Click += delegate { bewoWindow.GroupBoxContent = infoGrid; }; + + //zurueckButton.Click += delegate + //{ + // bewoWindow.GroupBoxContent = grid; + // bewoWindow.Left = ActualWidth/2 - bewoWindow.Width/2; + // bewoWindow.Top = ActualHeight/2 - bewoWindow.Height/2; + //}; + + //grid.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto}); + //grid.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto}); + //grid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)}); + //grid.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto}); + + //grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + //grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + //grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}); + //grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + //grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + + //Grid.SetRow(beschreibungLabel, 0); + //Grid.SetRow(betreffLabel, 1); + //Grid.SetRow(betreffTextBox, 1); + //Grid.SetRow(nachrichtsTextBox, 2); + //Grid.SetRow(abbrechenButton, 3); + //Grid.SetRow(weiterButton, 3); + + //Grid.SetColumn(betreffLabel, 0); + //Grid.SetColumn(betreffTextBox, 1); + //Grid.SetColumn(nachrichtsTextBox, 0); + //Grid.SetColumn(abbrechenButton, 3); + //Grid.SetColumn(weiterButton, 0); + + //Grid.SetColumnSpan(beschreibungLabel, 4); + //Grid.SetColumnSpan(betreffTextBox, 3); + //Grid.SetColumnSpan(nachrichtsTextBox, 4); + //Grid.SetColumnSpan(weiterButton, 2); + + //grid.Children.Add(beschreibungLabel); + //grid.Children.Add(betreffLabel); + //grid.Children.Add(betreffTextBox); + //grid.Children.Add(nachrichtsTextBox); + //grid.Children.Add(abbrechenButton); + //grid.Children.Add(weiterButton); + + //abbrechenButton.Click += delegate { bewoWindow.Close(); }; + //schliessenButton.Click += delegate { bewoWindow.Close(); }; + + //sendenButton.Click += delegate + //{ + // if (betreffTextBox.Text.IsNullOrEmpty()) + // { + // MessageBox.Show("Bitte geben Sie einen Betreff an.", "Senden nicht möglich", + // MessageBoxButton.OK, MessageBoxImage.Warning); + // return; + // } + + // if (nachrichtsTextBox.Text.IsNullOrEmpty()) + // { + // MessageBox.Show("Bitte tragen Sie eine Nachricht ein.", "Senden nicht möglich", + // MessageBoxButton.OK, MessageBoxImage.Warning); + // return; + // } + + + // string nachricht = nachrichtsTextBox.Text; + // if (pinCheckBox.IsChecked.HasValue && pinCheckBox.IsChecked.Value) + // { + // nachricht += string.Format("\r\rPIN: {0}", GeneratePIN()); + // } + // EMailVersenden(betreffTextBox.Text, nachricht); + //}; + + //var infoTextBlock = new TextBlock + //{ + // Text = _PINInfoText, + // Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0)), + // Margin = new Thickness(3), + // TextWrapping = TextWrapping.Wrap, + // TextAlignment = TextAlignment.Center, + // VerticalAlignment = VerticalAlignment.Center + //}; + + //var naviStackPanel = new StackPanel {Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right}; + //naviStackPanel.Children.Add(zurueckButton); + //naviStackPanel.Children.Add(schliessenButton); + + //infoGrid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}); + //infoGrid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + //infoGrid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + + //infoGrid.ColumnDefinitions.Add(new ColumnDefinition()); + //infoGrid.ColumnDefinitions.Add(new ColumnDefinition()); + + //Grid.SetRow(infoTextBlock, 0); + //Grid.SetRow(pinCheckBox, 1); + //Grid.SetRow(naviStackPanel, 2); + //Grid.SetRow(sendenButton, 2); + + //Grid.SetColumn(naviStackPanel, 1); + + //Grid.SetColumnSpan(infoTextBlock, 2); + + //infoGrid.Children.Add(infoTextBlock); + //infoGrid.Children.Add(pinCheckBox); + //infoGrid.Children.Add(sendenButton); + //infoGrid.Children.Add(naviStackPanel); + SupportEMailControl ctrl = new SupportEMailControl(); + ctrl.SenderName = String.Format("{0} {1}", MainSession.LoggedOnEmployee.FirstName, MainSession.LoggedOnEmployee.LastName); + if (MainSession.LoggedOnEmployee.ContactInformations != null) + { + foreach (var contact in MainSession.LoggedOnEmployee.ContactInformations) + { + if (contact.ContactType == ContactType.business_Mail) + { + ctrl.SenderEMail = contact.ContactValue; + } + } + + } + + ctrl.CancelButtonClicked += delegate + { + bewoWindow.Close(); + }; + + ctrl.OkButtonClicked += delegate + { + string nachricht = ctrl.Message; + nachricht = String.Format("Supportanfrage von {0} <{1}>:\n\n{2}", ctrl.SenderName, ctrl.SenderEMail, nachricht); + if (ctrl.CheckBoxSupportPin.IsChecked.HasValue && ctrl.CheckBoxSupportPin.IsChecked.Value) + { + nachricht += string.Format("\n\nPIN: {0}", GeneratePIN()); + } + + EMailVersenden(ctrl.SenderName, ctrl.SenderEMail, ctrl.Subject, nachricht, bewoWindow); + }; + + bewoWindow.GroupBoxContent = ctrl; + bewoWindow.rootGroupBox.Header = "E-Mail versenden"; + bewoWindow.Owner = Session.GetWindow(); + bewoWindow.Show(); + } + + private void EMailVersenden(string senderName, string senderEMail, string betreff, string nachricht, BeWoWindow window) + { + var result = ServiceFacade.DoMailServiceSync(m => m.SendEMailWithSender(senderName, senderEMail, betreff, nachricht)); + + if (result) + { + window.Close(); + MessageBox.Show("Die E-Mail wurde erfolgreich versendet.", "E-Mail senden", MessageBoxButton.OK, + MessageBoxImage.Information); + } + else + { + MessageBox.Show("Die E-Mail konnte leider nicht gesendet werden", "E-Mail senden", MessageBoxButton.OK, + MessageBoxImage.Error); + } + + } + + private void CreateSupportRequestWindow() + { + BeWoWindow bewoWindow = BeWoWpfUtils.CreateBeWoPopupWindow(withDynamicSize: true); + + #region PIN Erzeugen + + var grid = new Grid + { + Width = 300d, + Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush") + }; + + var label1 = new Label {Content = "Ihre PIN lautet:", HorizontalAlignment = HorizontalAlignment.Center}; + var boldLabel = new Label + { + Content = "", + FontWeight = FontWeights.Bold, + HorizontalAlignment = HorizontalAlignment.Center + }; + var label3 = new Label + { + Content = "Bitte geben Sie diese PIN beim Support-Anruf an", + HorizontalAlignment = HorizontalAlignment.Center + }; + + var cancelButton = new Button {Content = "Schließen"}; + cancelButton.Click += delegate { bewoWindow.Close(); }; + + var centeredStackPanel = new StackPanel + { + Orientation = Orientation.Vertical, + VerticalAlignment = VerticalAlignment.Center, + HorizontalAlignment = HorizontalAlignment.Center + }; + centeredStackPanel.Children.Add(label1); + centeredStackPanel.Children.Add(boldLabel); + centeredStackPanel.Children.Add(label3); + centeredStackPanel.Children.Add(cancelButton); + + grid.Children.Add(centeredStackPanel); + + #endregion + + #region InfoText + + var infoTextBlock = new TextBlock + { + Text = _PINInfoText, + Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0)), + Margin = new Thickness(3), + TextWrapping = TextWrapping.Wrap, + TextAlignment = TextAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }; + + var infoGrid = new Grid + { + Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush") + }; + var pinErzeugenButton = new Button {Content = "PIN erzeugen", Margin = new Thickness(3)}; + + infoGrid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}); + infoGrid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); + + Grid.SetRow(infoTextBlock, 0); + Grid.SetRow(pinErzeugenButton, 1); + + infoGrid.Children.Add(infoTextBlock); + infoGrid.Children.Add(pinErzeugenButton); + + pinErzeugenButton.Click += delegate + { + bewoWindow.GroupBoxContent = grid; + boldLabel.Content = GeneratePIN(); + }; + + #endregion + + bewoWindow.GroupBoxContent = infoGrid; + bewoWindow.rootGroupBox.Header = "Support"; + bewoWindow.Owner = Session.GetWindow(); + bewoWindow.Show(); + } + + private static string GeneratePIN(int maxSize = 5) + { + var data = new byte[1]; + var crypto = new RNGCryptoServiceProvider(); + var result = new StringBuilder(maxSize); + + char[] chars = "ABCDEFGHJKLMNPQRSTUVWXYZ123456789".ToCharArray(); + crypto.GetBytes(data); + data = new byte[maxSize]; + crypto.GetBytes(data); + + foreach (byte b in data) + result.Append(chars[b%(chars.Length)]); + + var pin = new SupportPinDC + { + Pin = result.ToString(), + IsUsed = false, + CreationDate = DateTime.Now + }; + pin.ExpirationDate = pin.CreationDate.Value.AddDays(3); + + ServiceFacade.DoUserServiceAsync(p => + { + long res = -1; + + while (res == -1L) + { + pin = new SupportPinDC + { + Pin = result.ToString(), + IsUsed = false, + CreationDate = DateTime.Now + }; + pin.ExpirationDate = pin.CreationDate.Value.AddDays(3); + + res = p.InsertNewSupportPin(pin); + } + }, false); + + return result.ToString(); + } + + private void button_Template_Click(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(new WordDocumentTemplateView(TableID.Mandator, 1)); + } + } + + private void UIElement_OnMouseEnter(object sender, MouseEventArgs e) + { + AufOffeneTerminePruefen(); + } + + public void InitOffeneTermine() + { + if (!_TermineInitialized && MainSession.LoggedOnEmployee != null) + { + AufOffeneTerminePruefen(); + _TermineInitialized = true; + } + } + + public void AufOffeneTerminePruefen() + { + if (MainSession.LoggedOnEmployee != null && MainSession.LoggedOnEmployee.EmployeeOid != null && MainSession.AppSettings.IsSchedulerAllowed) + ServiceFacade.DoResourceServiceAsync(rs => rs.GetAllOpenAppointmentsForEmployee(MainSession.LoggedOnEmployee.EmployeeOid.Value), r => this.Dispatch(delegate + { + HatNeueTermine = r.Count > 0; + }), false); + } + + private void ToolbarContent_OnLoaded(object sender, RoutedEventArgs e) + { + InitOffeneTermine(); + } + + private void Button_Vertretungen_OnClick(object sender, RoutedEventArgs e) + { + if (DoSaveCheck()) + { + NavigateTo(GetViewForUIContext(UIContext.Vertretungen)); + } + } + + public void DoMoreSaveStuff() + { + throw new NotImplementedException("#54356476245725465"); + } + + public void UpdateServerAddresses(string url) + { + throw new NotImplementedException("#8734745253415"); + } + } +} \ No newline at end of file diff --git a/BeWo/MainSession.cs b/BeWo/MainSession.cs new file mode 100644 index 000000000..82cad3f68 --- /dev/null +++ b/BeWo/MainSession.cs @@ -0,0 +1,894 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Threading; + +using BeWo.Core; +using BeWo.Core.Config; +using BeWo.ServiceProxy; +using BeWo.View; +using BeWo.View.Navigation; +using BeWo.View.Navigation.Filter; + +using BS.Shared; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; +using BS.Shared.Extensions; +using BS.Shared.Core; + +using ChatController.HauptKlassen; +using DevExpress.Xpf.Core; +using DevExpress.Xpf.Grid; +using BS.SharedLauncher; +using BS.SharedLauncher.Information; + +namespace BeWo +{ + public static class MainSession + { + public static string ShortVersion = "3"; + public static string Version = "Version 3.0 TEST"; + public static int RenderTier = 0; + + private static AppSettings _AppSettings; + private static CompactEmployeeDC _CompactLoggedOnEmployee; + private static EmployeeDC _LoggedOnEmployee; + private static UserDC _LoggedOnUser; + private static MandatorDC _Mandator; + private static List _OpenDevExpressEditForms = new List(); + private static DocumentWatcher _DocumentWatcher; + + private static FrameworkElement _lockedContent; + + private static int _LockUITime = 30; + + + static MainSession() + { + MainSessionSingleton.Instance.LoggedOnUsersRights = LoggedOnUsersRights; + } + + public static Dictionary ICD10Diagnosis { get; set; } + public static EmployeeDC LoggedOnEmployee + { + get { return _LoggedOnEmployee; } + + set { _LoggedOnEmployee = value; } + } + + public static long? LoggedOnEmployeeOid => _LoggedOnEmployee?.EmployeeOid; + public static CompactEmployeeDC CompactLoggedOnEmployee + { + get => _CompactLoggedOnEmployee; + + set => _CompactLoggedOnEmployee = value; + } + public static ObservableCollection LoggedOnUsersRights + { + get + { + if (LoggedOnUser != null) + return LoggedOnUser.GetGrantedRights().ToObservableCollection(); + return null; + } + } + public static DocumentWatcher DocumentWatcher + { + get + { + if (_DocumentWatcher == null) + { + _DocumentWatcher = new DocumentWatcher(); + } + + return _DocumentWatcher; + } + } + public static AppSettings AppSettings + { + get + { + if (_AppSettings == null) + { + RestoreAppSettings(); + } + + return _AppSettings; + } + } + public static UserDC LoggedOnUser + { + get => _LoggedOnUser; + + set + { + _LoggedOnUser = value; + if (_LoggedOnUser != null) + { + var settings = _LoggedOnUser.Settings; + + //Session.BeginInvokeNormal(() => + ServiceFacade.DoEmployeeServiceAsync(s => s.LoadEmployee(value.Employee.EmployeeOid), + r => + { + _LoggedOnEmployee = r; + + ServiceFacade.DoEmployeeServiceAsync(s => s.LoadCompactEmployee(value.Employee.EmployeeOid), r2 => { _CompactLoggedOnEmployee = r2; }); + + Session.BeginInvokeNormal(() => MainPage.InitOffeneTermine()); + }); + } + + Session.FirePropertyChanged("LoggedOnUsersRights"); + } + } + public static MandatorDC Mandator + { + get => _Mandator; + + set + { + _Mandator = value; + + bool showDatevFields = false; + bool isServiceRecordNoticeMandatory = true; + bool isPasswordSecurityActiv = false; + bool showServiceRecordsDistanceFields = false; + bool showHilfeplanBezeichnung = false; + bool showArbeitszeiten = false; + bool showCustomerDistanceFields = false; + bool showAdditionalService = false; + bool showRoundedDurationInEmployeeAnalysis = true; + bool showTeamNews = false; + bool showMarker = false; + bool showAnnualReport = false; + int maxDaysEditServiceRecordsAllowed = 0; + int hilfeplanAuslaufAuswahl = 3; + int anzTageZeiterfassErfolgt = 0; + int zeiterfassungsSchwellwert = 80; + bool printerSettingsUseLandscape = false; + bool printerSettingsUseMargins = false; + bool printerSettingsUsePaperKind = false; + var hideServiceRecordInsertedByAndInsertedOn = false; + bool isEndDateVisible = false; + bool isOnlyYearMonthVisible = false; + bool isZeiterfassDateNormal = true; + bool isZeiterfassungInStdMin = false; + int lastSelectedStundenkontoIntervall = 3; + bool showSignatures = false; + bool showRtfTextfield = false; + bool showPivotGrid = false; + bool showUrlaubsplanung = false; + bool dontShowSpitzabrechnung = false; + bool showDienstplanung = false; + + + AppSettings.ShowAdvisedAttendedFlag = false; + String timeRecordingMenuName = ""; + + if (_Mandator != null) + { + string val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowMedication"); + AppSettings.IsMedicationAllowed = val != null && val.Equals("1"); + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowScheduler"); + AppSettings.IsSchedulerAllowed = val != null && val.Equals("1"); + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowWohnheime"); + AppSettings.IsWohnheimAllowed = val != null && val.Equals("1"); + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowChat"); + AppSettings.IsChatAllowed = val != null && val.Equals("1"); + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "IsServiceRecordNoticeMandatory"); + if (val != null && val.Equals("0")) + { + isServiceRecordNoticeMandatory = false; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "IsPasswordSecurityActiv"); + if (val != null && val.Equals("1")) + { + isPasswordSecurityActiv = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "IsEndDateVisible"); + if (val != null && val.Equals("1")) + { + isEndDateVisible = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "IsOnlyYearMonthVisible"); + if (val != null && val.Equals("1")) + { + isOnlyYearMonthVisible = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "IsZeiterfassungInStdMin"); + if (val != null && val.Equals("1")) + { + isZeiterfassungInStdMin = true; + } + if (!isZeiterfassungInStdMin) + { + AppSettings.LetzteZeiterfassungsDauer = ZeiterfassungsDauer.Minuten; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "IsZeiterfassDateNormal"); + if (val != null && val.Equals("0")) + { + isZeiterfassDateNormal = false; + } + + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "MaxDaysEditServiceRecordsAllowed"); + int result; + if (Int32.TryParse(val, out result)) + { + maxDaysEditServiceRecordsAllowed = result; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "HilfeplanAuslaufAuswahl"); + int resultplan; + if (Int32.TryParse(val, out resultplan)) + { + hilfeplanAuslaufAuswahl = resultplan; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "LastSelectedStundenkontoIntervall"); + int resultinterval; + if (Int32.TryParse(val, out resultinterval)) + { + lastSelectedStundenkontoIntervall = resultinterval; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "AnzTageZeiterfassErfolgt"); + int resultzeitplan; + if (Int32.TryParse(val, out resultzeitplan)) + { + anzTageZeiterfassErfolgt = resultzeitplan; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ZeiterfassungsSchwellwert"); + int resultschwell; + if (Int32.TryParse(val, out resultschwell)) + { + zeiterfassungsSchwellwert = resultschwell; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowDistanceFields"); + if (val != null && val.Equals("1")) + { + showServiceRecordsDistanceFields = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowHilfeplanBezeichnung"); + if (val != null && val.Equals("1")) + { + showHilfeplanBezeichnung = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowArbeitszeiten"); + if (val != null && val.Equals("1")) + { + showArbeitszeiten = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowRessources"); + AppSettings.ShowRessources = val != null && val.Equals("1"); + + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowTeamNews"); + if (val != null && val.Equals("1")) + { + showTeamNews = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowPivotGrid"); + if (val != null && val.Equals("1")) + { + showPivotGrid = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowUrlaubsplanung"); + if (val != null && val.Equals("1")) + { + showUrlaubsplanung = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "dontShowSpitzabrechnung"); + if (val != null && val.Equals("1")) + { + dontShowSpitzabrechnung = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowDienstplanung"); + if (val != null && val.Equals("1")) + { + showDienstplanung = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowMarker"); + if (val != null && val.Equals("1")) + { + showMarker = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowAnnualReport"); + if (val != null && val.Equals("1")) + { + showAnnualReport = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowCustomerDistanceFields"); + if (val != null && val.Equals("1")) + { + showCustomerDistanceFields = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowAdditionalService"); + if (val != null && val.Equals("1")) + { + showAdditionalService = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowRoundedDurationInEmployeeAnalysis"); + if (val != null && val.Equals("0")) + { + showRoundedDurationInEmployeeAnalysis = false; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowDatevFields"); + if (val != null && val.Equals("1")) + { + showDatevFields = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "PrinterSettingsUseLandscape"); + if (val != null && val.Equals("1")) + { + printerSettingsUseLandscape = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "PrinterSettingsUseMargins"); + if (val != null && val.Equals("1")) + { + printerSettingsUseMargins = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "PrinterSettingsUsePaperKind"); + if (val != null && val.Equals("1")) + { + printerSettingsUsePaperKind = true; + } + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "HideServiceRecordInsertedByAndInsertedOn"); + if (val != null && val.Equals("1")) + { + hideServiceRecordInsertedByAndInsertedOn = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowSignature"); + if (val != null && val.Equals("1")) + { + showSignatures = true; + } + + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, "ShowRtfTextfield"); + if (val != null && val.Equals("1")) + { + showRtfTextfield = true; + } + + + switch (_Mandator.BeWoClientType) + { + case 1: + //Die Kette + showDatevFields = true; + AppSettings.ShowAdvisedAttendedFlag = true; + break; + case 2: + //Datev + showDatevFields = true; + break; + case 3: + ////Köln Ring + showDatevFields = true; + timeRecordingMenuName = "Dokumentation"; + break; + case 4: + //Betreuwo + break; + + case 5: + //Kontakt und Krisenhilfe + AppSettings.ShowLargeCustomerNotice = true; + break; + case 6: + // Nur Jahresbericht + break; + case 7: + //IBP + showDatevFields = true; + break; + case 8: + //LH Würzburg + break; + case 9: + //Caritas Frankfurt+Aids Hilfe Gießen + Alle mit Korridor (Kostenträger Hessen) + break; + case 10: + //Integra + showDatevFields = true; + break; + case 11: + //Hannover + showDatevFields = true; + break; + } + } + + AppSettings.ShowDatevFields = showDatevFields; + AppSettings.IsServiceRecordNoticeMandatory = isServiceRecordNoticeMandatory; + AppSettings.IsPasswordSecurityActiv = isPasswordSecurityActiv; + AppSettings.IsEndDateVisible = isEndDateVisible; + AppSettings.IsOnlyYearMonthVisible = isOnlyYearMonthVisible; + AppSettings.IsZeiterfassDateNormal = isZeiterfassDateNormal; + AppSettings.IsZeiterfassungInStdMin = isZeiterfassungInStdMin; + AppSettings.MaxDaysEditServiceRecordsAllowed = maxDaysEditServiceRecordsAllowed; + AppSettings.HilfeplanAuslaufAuswahl = hilfeplanAuslaufAuswahl; + AppSettings.LastSelectedStundenkontoIntervall = lastSelectedStundenkontoIntervall; + AppSettings.AnzTageZeiterfassErfolgt = anzTageZeiterfassErfolgt; + AppSettings.ZeiterfassungsSchwellwert = zeiterfassungsSchwellwert; + AppSettings.TimeRecordingMenuName = timeRecordingMenuName; + AppSettings.ShowDistanceFields = showServiceRecordsDistanceFields; + AppSettings.ShowHilfeplanBezeichnung = showHilfeplanBezeichnung; + AppSettings.ShowArbeitszeiten = showArbeitszeiten; + AppSettings.ShowSignatures = showSignatures; + AppSettings.ShowRtfTextfield = showRtfTextfield; + AppSettings.ShowCustomerDistanceFields = showCustomerDistanceFields; + AppSettings.ShowAdditionalService = showAdditionalService; + AppSettings.ShowRoundedDurationInEmployeeAnalysis = showRoundedDurationInEmployeeAnalysis; + AppSettings.HideServiceRecordInsertedByAndInsertedOn = hideServiceRecordInsertedByAndInsertedOn; + AppSettings.ShowTeamNews = showTeamNews; + AppSettings.ShowMarker = showMarker; + AppSettings.ShowAnnualReport = showAnnualReport; + AppSettings.PrinterSettingsUseLandscape = printerSettingsUseLandscape; + AppSettings.PrinterSettingsUseMargins = printerSettingsUseMargins; + AppSettings.PrinterSettingsUsePaperKind = printerSettingsUsePaperKind; + AppSettings.ShowPivotGrid = showPivotGrid; + AppSettings.ShowUrlaubsplanung = showUrlaubsplanung; + AppSettings.DontShowSpitzabrechnung = dontShowSpitzabrechnung; + AppSettings.ShowDienstplanung = showDienstplanung; + + BS.Shared.Settings.ApplicationSettings.SupportConceptExpirationLimitInMonths = AppSettings.HilfeplanAuslaufAuswahl; + } + } + public static int LockUITime + { + get + { + var lockTime = _Mandator.Settings.SplitToKeyValuePairList(";", "=").FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value; + + if (_LoggedOnUser != null && lockTime != null) + { + return Convert.ToInt32(lockTime); + } + + return _LockUITime; + } + + set + { + _LockUITime = value; + + if (_LoggedOnUser == null) + { + return; + } + + AutoLockUI.LockUITime = value; + AutoLockUI.StopTimer(); + AutoLockUI.StartAutoLockUIOption(); + } + } + public static MainPage MainPage { get; set; } + + + public static string GetAndCreateUserAppDataPath() + { + try + { + string localAppData = Environment.GetFolderPath( + Environment.SpecialFolder.LocalApplicationData); + string companyFilePath + = Path.Combine(localAppData, "beyondSoft"); + + if (!Directory.Exists(companyFilePath)) + Directory.CreateDirectory(companyFilePath); + + string bewoFilePath + = Path.Combine(companyFilePath, "BeWoPlaner"); + + if (!Directory.Exists(bewoFilePath)) + Directory.CreateDirectory(bewoFilePath); + + return bewoFilePath; + } + catch (Exception ex) + { + MessageBox.Show( + "Fehler beim Anlegen des Anwendungsordners. Sie besitzen nicht die erforderlichen Rechte, bitte wenden Sie sich an Ihren Systemadministrator.\n" + + ex.Message, "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + } + internal static bool HasLoggedOnUserRight(UserRightType[] pRight) + { + if (LoggedOnUser != null) + { + return pRight == null || (pRight.Length == 1 && pRight[0] == UserRightType.None) || LoggedOnUser.GetGrantedRights().Exists( + right => + { + var rightAsString = pRight.ToString(); + var vals = rightAsString.Split(","); + + foreach (var urt in pRight) + { + if (urt == right) + { + return true; + } + } + + return false; + }); + } + + return false; + } + internal static void SaveAppSettings() + { + if (_AppSettings != null && _LoggedOnUser != null && _AppSettings.IsDirty) + { + _AppSettings.IsDirty = false; + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "WindowStateType", ((int)_AppSettings.WindowState).ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "LastSelectedServiceRecordTimeInterval", ((int)_AppSettings.LastSelectedServiceRecordTimeInterval).ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "CustomerFilterInZeiterfassung", ((int)_AppSettings.CustomerFilterInZeiterfassung).ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "CustomerFilterSupportConcepts", ((int)_AppSettings.CustomerFilterSupportConcepts).ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "CustomerFilterCustomers", ((int)_AppSettings.CustomerFilterCustomers).ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "ShowExpiredSupportConcepts", _AppSettings.ShowExpiredSupportConcepts ? "1" : "0", _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "ShowServiceRecordGridControl", _AppSettings.ShowServiceRecordGridControl ? "1" : "0", _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "StartupPanelMaximized", _AppSettings.StartupPanelMaximized, _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "HideServiceRecordInsertedByAndInsertedOn", _AppSettings.HideServiceRecordInsertedByAndInsertedOn ? "1" : "0", _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "DocumentationFontSize", _AppSettings.DocumentationFontSize.ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "ZeigeNurMeineTermine", _AppSettings.ZeigeNurMeineTermine ? "1" : "0", _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "LastSelectedServiceRecordTimeIntervalDays", _AppSettings.LastSelectedServiceRecordTimeIntervalDays.ToString(), _LoggedOnUser.Settings); + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "LetzteZeiterfassungsDauer", ((int)_AppSettings.LetzteZeiterfassungsDauer).ToString(), _LoggedOnUser.Settings); + + string val = string.Empty; + if (_AppSettings.StartupPanelOrder != null) + { + foreach (string item in _AppSettings.StartupPanelOrder) + { + if (val.Length > 0) + { + val += "|"; + } + + val += item; + } + } + + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, "StartupPanelOrder", val, _LoggedOnUser.Settings); + + ServiceFacade.DoUserServiceAsync(s => s.UpdateUserSettings(_LoggedOnUser.UserOid.Value, _LoggedOnUser.Settings), ReloadSettings, false); + } + } + public static void FirePropertyChanged(string pPropertyName) + { + Session.FirePropertyChanged(pPropertyName); + } + public static void InitAutoUILocking() + { + EventManager.RegisterClassHandler(typeof(Window), UIElement.PreviewMouseDownEvent, new MouseButtonEventHandler(OnPreviewMouseDown)); + EventManager.RegisterClassHandler(typeof(Window), UIElement.PreviewKeyDownEvent, new KeyEventHandler(OnPreviewKeyDown)); + + var settingsKeyValuePairList = _Mandator.Settings.SplitToKeyValuePairList(";", "=").ToList(); + + var x = settingsKeyValuePairList.FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value ?? "NULL"; + + var y = _LockUITime; + + AutoLockUI.LockUITime = Convert.ToInt32(settingsKeyValuePairList.FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value ?? LockUITime.ToString()); + + + AutoLockUI.DoAutoLockUIEvent += AutoLockUIDoAutoLockUIEvent; + AutoLockUI.StartAutoLockUIOption(); + } + private static void ReloadSettings(List settings) + { + if (_LoggedOnUser != null) + _LoggedOnUser.Settings = settings; + } + private static void RestoreAppSettings() + { + if (_LoggedOnUser != null) + { + _AppSettings = new AppSettings(); + var settings = _LoggedOnUser.Settings; + + var val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "WindowStateType", settings); + if (int.TryParse(val, out var result)) + { + _AppSettings.WindowState = (AppSettings.WindowStateType)result; + } + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "LastSelectedServiceRecordTimeInterval", settings); + if (int.TryParse(val, out result)) + { + _AppSettings.LastSelectedServiceRecordTimeInterval = (ServiceRecordTimeInterval)result; + } + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "CustomerFilterInZeiterfassung", settings); + if (int.TryParse(val, out result)) + { + _AppSettings.CustomerFilterInZeiterfassung = (CustomerFilterEnum)result; + } + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "CustomerFilterSupportConcepts", settings); + if (int.TryParse(val, out result)) + { + _AppSettings.CustomerFilterSupportConcepts = (CustomerFilterEnum)result; + } + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "CustomerFilterCustomers", settings); + if (int.TryParse(val, out result)) + { + _AppSettings.CustomerFilterCustomers = (CustomerFilterEnum)result; + } + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "ShowServiceRecordGridControl", settings); + _AppSettings.ShowServiceRecordGridControl = val == "1"; + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "ShowExpiredSupportConcepts", settings); + _AppSettings.ShowExpiredSupportConcepts = val != "0"; + + + + _AppSettings.StartupPanelMaximized = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "StartupPanelMaximized", settings); + + _AppSettings.DocumentationFontSize = Convert.ToDouble(UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "DocumentationFontSize", settings)); + + //val = GetSettingValue(SettingsType.ApplicationSettings, "ZeigeNurMeineTermine"); + //_AppSettings.ZeigeNurMeineTermine = val != "0"; + + _AppSettings.ZeigeNurMeineTermine = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "ZeigeNurMeineTermine", settings) == "1"; + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "LastSelectedServiceRecordTimeIntervalDays", settings); + if (val != null) + { + _AppSettings.LastSelectedServiceRecordTimeIntervalDays = Convert.ToInt32(UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "LastSelectedServiceRecordTimeIntervalDays", settings)); + } + + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "LetzteZeiterfassungsDauer", settings); + if (val != null) + { + var x = Convert.ToInt32(UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "LetzteZeiterfassungsDauer", settings)); + _AppSettings.LetzteZeiterfassungsDauer = x == 0 ? ZeiterfassungsDauer.Minuten : ZeiterfassungsDauer.Stunden; + } + + val = UserSettingsUtils.GetSettingValue(SettingsType.ApplicationSettings, "StartupPanelOrder", settings); + if (val != null) + { + _AppSettings.StartupPanelOrder = new List(); + var panels = val.Split('|'); + + foreach (var item in panels) + { + _AppSettings.StartupPanelOrder.Add(item); + } + } + + _AppSettings.IsDirty = false; + } + } + private static void BtnOpenServiceRecordView_Click(object sender, RoutedEventArgs e) + { + var btn = sender as Button; + if (btn == null) return; + + var dc = btn.Tag as CompactSupportConceptDC; + + if (dc == null) return; + + if (MainPage != null) + MainPage.NavigateToServiceRecordView(dc.SupportConceptOid); + } + private static void Togglebutton_maximise_Checked(object sender, RoutedEventArgs e) + { + if (MainPage != null) + MainPage.Maximize(); + } + private static void Togglebutton_maximise_Unchecked(object sender, RoutedEventArgs e) + { + if (MainPage != null) + MainPage.Minimize(); + } + private static void TogglebuttonChat_maximise_Unchecked(object sender, RoutedEventArgs e) + { + if (MainPage.HomeView.ServiceChatView != null) + MainPage.HomeView.ServiceChatView.Normal(); + } + private static void TogglebuttonChat_maximise_Checked(object sender, RoutedEventArgs e) + { + if (MainPage.HomeView.ServiceChatView != null) + MainPage.HomeView.ServiceChatView.Maximize(); + } + private static void TogglebuttonChat_Minimize_Checked(object sender, RoutedEventArgs e) + { + if (MainPage.HomeView.ServiceChatView != null) + MainPage.HomeView.ServiceChatView.Minimize(); + } + private static void FrameLeftMouseDown(object sender, MouseButtonEventArgs e) + { + var border = (Border)sender; + var borderParent = (Grid)border.Parent; + DependencyObject template = borderParent.TemplatedParent; + var parent = new Window(); + + var x = (FrameworkElement)template; + if (x != null) + { + var y = new FrameworkElement(); + while (y != null) + { + y = (FrameworkElement)x.Parent; + if (y != null) + x = y; + } + + if (x is Window) + { + parent = (Window)x; + parent.DragMove(); + } + } + } + private static void AutoLockUIDoAutoLockUIEvent() + { + if (ConnectionInformation.Username.Equals("BSAdmin")) + { + AutoLockUI.StartAutoLockUIOption(); + return; + } + + if (MainPage.Content is LockedPage) + { + AutoLockUI.StartAutoLockUIOption(); + return; + } + + _lockedContent = MainPage.Content as FrameworkElement; + + var openWindowCollection = Application.Current.Windows; + foreach (var blubb in openWindowCollection) + { + var abc = (Window)blubb; + + if (!abc.Title.Equals("BeWoPlaner") && blubb.GetType() == typeof(WindowContentHolder)) + { + abc.Close(); + } + } + + MainPage.HideCurrentModalViewWindows(); + + var lockedPage = new LockedPage(); + lockedPage.ButtonLogin.Click += UnlockBeWoPlaner; + + Application.Current.MainWindow.Content = lockedPage; + + Application.Current.Dispatcher.Invoke(new Action(() => Application.Current.MainWindow?.Activate())); + + AutoLockUI.StartAutoLockUIOption(); + } + + private static void UnlockBeWoPlaner(object sender, RoutedEventArgs e) + { + var lbtn = (Button)sender; + + var lbtnParent = (Grid)lbtn.Parent; + var mainWindowUIElements = new UIElement[lbtnParent.Children.Count]; + lbtnParent.Children.CopyTo(mainWindowUIElements, 0); + + var elementList = mainWindowUIElements.ToList(); + var username = ((TextBox)elementList.Where(el => el is TextBox && ((TextBox)el).Name.Equals("TextBoxUsername")).ToList()[0]).Text; + var password = ((PasswordBox)elementList.Where(el => el is PasswordBox && ((PasswordBox)el).Name.Equals("PasswordBoxPassword")).ToList()[0]).Password; + + if (string.IsNullOrEmpty(username) || !username.Equals(_LoggedOnUser.LoginName, StringComparison.OrdinalIgnoreCase)) + { + MessageBox.Show("Das Programm kann nur vom Benutzer '" + _LoggedOnUser.LoginName + "' entsperrt werden.", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); + return; + } + + username = $"{username}//Version=Sperrung aufgehoben"; + + ServiceFacade.DoUserServiceAsync(u => u.IsUserValid(username, password, ""), r => + { + if (!r.Equals(ServiceProxy.UserValidationResult.UserValid)) + { + MessageBox.Show("Anmeldeinformationen nicht bekannt. Bitte überprüfen Sie den Benutzernamen und das Passwort!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); + return; + } + + AutoLockUI.HasJustBeenUnlocked = true; + + Application.Current.Dispatcher.Invoke(delegate + { + Application.Current.MainWindow.Content = _lockedContent; + + MainPage.ShowCurrentModalViewWindowsAgain(); + }); + }, true); + } + + private static void OnPreviewMouseDown(object sender, MouseButtonEventArgs e) + { + AutoLockUI.ResetLockUITimer(); + } + + private static void OnPreviewKeyDown(object sender, KeyEventArgs e) + { + AutoLockUI.ResetLockUITimer(); + } + + private static void Hyperlink_Hilfeplan_Reaktivieren_Click(object sender, RoutedEventArgs e) + { + var scNavView = (SupportConceptNavigationView)MainPage.ActiveView; + + if (scNavView != null) + { + var supportConcept = (CompactSupportConceptDC)((Hyperlink)sender).Tag; + scNavView.MainNavigationView_OnReactivateObject(supportConcept); + } + } + + public static void GetChatServerUrlAsync(Action callback) + { + if (string.IsNullOrWhiteSpace(ConnectionInformation.ServerName)) + { + var tenant = ConnectionInformation.Tenant; + +#if DEBUG + tenant = "5473568546"; +#endif + + var login = new Login(tenant, serverUrl => + { + if (!string.IsNullOrWhiteSpace(serverUrl)) + { + callback(serverUrl); + } + }); + } + else + { + callback?.Invoke(ConnectionInformation.ChatServerAddress); + } + } + public static void Cleanup() + { + _lockedContent = null; + _AppSettings = null; + _CompactLoggedOnEmployee = null; + _LoggedOnEmployee = null; + _LoggedOnUser = null; + _Mandator = null; + } + } +} \ No newline at end of file diff --git a/BeWo/MainSessionSingleton.cs b/BeWo/MainSessionSingleton.cs new file mode 100644 index 000000000..d031ceef1 --- /dev/null +++ b/BeWo/MainSessionSingleton.cs @@ -0,0 +1,37 @@ +using BS.Shared; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo +{ + public class MainSessionSingleton + { + private static MainSessionSingleton instance = null; + private static readonly object padlock = new object(); + + public ObservableCollection LoggedOnUsersRights { get; set; } + + MainSessionSingleton() + { + } + + public static MainSessionSingleton Instance + { + get + { + lock (padlock) + { + if (instance == null) + { + instance = new MainSessionSingleton(); + } + return instance; + } + } + } + } +} diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 2e6de6856..4a026249f 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -2493,7 +2493,7 @@ namespace BeWo.Scheduler.View return null; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException("#4534523454"); } } public class AppointmentToolTipConverter : IValueConverter diff --git a/BeWo/ServiceProxy/ServiceConfig.cs b/BeWo/ServiceProxy/ServiceConfig.cs new file mode 100644 index 000000000..c54309c00 --- /dev/null +++ b/BeWo/ServiceProxy/ServiceConfig.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceModel; +using System.ServiceModel.Description; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.ServiceProxy +{ + public static class ServiceConfig + { + public static BasicHttpBinding BeWoBasicHttpBinding = new BasicHttpBinding() + { + Name = "BeWoBasicEndpoint", + CloseTimeout = new TimeSpan(0, 5, 0), + OpenTimeout = new TimeSpan(0, 5, 0), + ReceiveTimeout = new TimeSpan(0, 10, 0), + SendTimeout = new TimeSpan(0, 5, 0), + AllowCookies = false, + BypassProxyOnLocal = false, + HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, + MaxBufferPoolSize = 524288, + MaxBufferSize = int.MaxValue, + MaxReceivedMessageSize = int.MaxValue, + TextEncoding = Encoding.UTF8, + TransferMode = TransferMode.Buffered, + UseDefaultWebProxy = true, + MessageEncoding = WSMessageEncoding.Text, + ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas + { + MaxDepth = 32, + MaxStringContentLength = int.MaxValue, + MaxArrayLength = int.MaxValue, + MaxBytesPerRead = 4096, + MaxNameTableCharCount = 16384 + }, + Security = new BasicHttpSecurity + { + Mode = BasicHttpSecurityMode.None + } + }; + public static BasicHttpBinding BeWoStreamingBinding = new BasicHttpBinding() + { + Name = "BeWoStreamingEndpoint", + ReceiveTimeout = new TimeSpan(10, 0, 0), + SendTimeout = new TimeSpan(10, 0, 0), + MaxBufferSize = 65536, + MaxReceivedMessageSize = 67108864, + TextEncoding = Encoding.UTF8, + TransferMode = TransferMode.StreamedRequest, + UseDefaultWebProxy = true, + MessageEncoding = WSMessageEncoding.Text, + ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas + { + MaxDepth = 32, + MaxStringContentLength = 8192, + MaxArrayLength = 16384, + MaxBytesPerRead = 4096, + MaxNameTableCharCount = 16384 + }, + Security = new BasicHttpSecurity + { + Mode = BasicHttpSecurityMode.None + } + }; + public static BasicHttpBinding QueryServiceBinding = new BasicHttpBinding() + { + Name = "BeWoBasicEndpoint", + CloseTimeout = new TimeSpan(0, 5, 0), + OpenTimeout = new TimeSpan(0, 5, 0), + ReceiveTimeout = new TimeSpan(0, 10, 0), + SendTimeout = new TimeSpan(0, 5, 0), + AllowCookies = false, + BypassProxyOnLocal = false, + HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, + MaxBufferPoolSize = 524288, + MaxBufferSize = int.MaxValue, + MaxReceivedMessageSize = int.MaxValue, + TextEncoding = Encoding.UTF8, + TransferMode = TransferMode.Buffered, + UseDefaultWebProxy = true, + MessageEncoding = WSMessageEncoding.Text, + ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas + { + MaxDepth = 32, + MaxStringContentLength = 8192, + MaxArrayLength = 16384, + MaxBytesPerRead = 4096, + MaxNameTableCharCount = 16384 + }, + Security = new BasicHttpSecurity + { + Mode = BasicHttpSecurityMode.None + } + }; + + public static Dictionary HttpBindingConfiguration = new Dictionary + { + { typeof(IQueryService), QueryServiceBinding}, + { typeof(IStreamingService), BeWoStreamingBinding}, + { typeof(IEmployeeService), BeWoBasicHttpBinding }, + { typeof(ICustomerService), BeWoBasicHttpBinding }, + { typeof(IUserService), BeWoBasicHttpBinding }, + { typeof(IValueListService), BeWoBasicHttpBinding }, + { typeof(IDownloadService), BeWoBasicHttpBinding }, + { typeof(IResourceService), BeWoBasicHttpBinding }, + { typeof(IOperationsService), BeWoBasicHttpBinding }, + { typeof(IAnalysisService), BeWoBasicHttpBinding }, + { typeof(IMailService), BeWoBasicHttpBinding }, + { typeof(IAccountingService), BeWoBasicHttpBinding}, + { typeof(IReportService), BeWoBasicHttpBinding} + }; + + public static Dictionary ServiceClient = new Dictionary + { + { typeof(IQueryService), QueryServiceBinding}, + { typeof(IStreamingService), BeWoStreamingBinding}, + { typeof(IEmployeeService), BeWoBasicHttpBinding }, + { typeof(ICustomerService), BeWoBasicHttpBinding }, + { typeof(IUserService), BeWoBasicHttpBinding }, + { typeof(IValueListService), BeWoBasicHttpBinding }, + { typeof(IDownloadService), BeWoBasicHttpBinding }, + { typeof(IResourceService), BeWoBasicHttpBinding }, + { typeof(IOperationsService), BeWoBasicHttpBinding }, + { typeof(IAnalysisService), BeWoBasicHttpBinding }, + { typeof(IMailService), BeWoBasicHttpBinding }, + { typeof(IAccountingService), BeWoBasicHttpBinding}, + { typeof(IReportService), BeWoBasicHttpBinding} + }; + + public static TClient GetClient() + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + TClient client = null; + + try + { + client = new TClient(); + } + catch (Exception e) + { + + } + + var binding = HttpBindingConfiguration[typeof(TInterface)]; + var endpoint = ServiceFacade.EndpointAddresses[typeof(TInterface)]; + + + + client = //new UserServiceClient(binding, endpoint) as TClient; + (TClient)Activator.CreateInstance(typeof(TClient), new object[] {binding, endpoint}); + + if (typeof(IQueryService).IsAssignableFrom(typeof(TClient))) + { + + } + else if (typeof(IUserService).IsAssignableFrom(typeof(TClient))) + { + + } + + + return client; + } + } +} diff --git a/BeWo/ServiceProxy/ServiceFacade.cs b/BeWo/ServiceProxy/ServiceFacade.cs index 0dca0db9a..6a6d4d580 100644 --- a/BeWo/ServiceProxy/ServiceFacade.cs +++ b/BeWo/ServiceProxy/ServiceFacade.cs @@ -598,7 +598,7 @@ namespace BeWo.ServiceProxy } else { - throw new NotImplementedException(); + throw new NotImplementedException("#4342345669875"); } } diff --git a/BeWo/StartRoutine.cs b/BeWo/StartRoutine.cs index 157d67ded..55601077d 100644 --- a/BeWo/StartRoutine.cs +++ b/BeWo/StartRoutine.cs @@ -1,4 +1,8 @@ -using BeWo.ServiceProxy; +using BeWo.MultiLanguage; +using BeWo.ServiceProxy; +using BeWo.View.Controls; +using BeWo.View.Search; +using BS.Shared.Translation; using BS.SharedLauncher.Information; using BS.SharedLauncher.Interfaces; using BS.SharedLauncher.Windows; @@ -28,6 +32,16 @@ namespace BeWo var dict = new MainDictionary(); app.Resources.MergedDictionaries.Add(dict); + + Translator t = new Translator(new ServiceTranslator()); + + //var test = Session.FindResource("SupportConceptListBrush"); + + //throw new NotImplementedException("#342342342309"); + + //new SupportConceptSearchView(); + + new SingleSupportConceptSelectionControl(); } } } diff --git a/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml b/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml index 780235ed6..47000af13 100644 --- a/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml +++ b/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml @@ -125,7 +125,7 @@ - + diff --git a/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml.cs b/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml.cs index 595eddb8c..11fe769a0 100644 --- a/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml.cs +++ b/BeWo/View/Controls/MultiSupportConceptSelectionControl.xaml.cs @@ -25,6 +25,8 @@ namespace BeWo.View.Controls { this.InitializeComponent(); + SearchView.SearchMode = Search.SearchMode.ActiveCostbearer2SupportConcepts; + this.UpdateListBox(); GroupSearchView.EditGroupButtonClicked += GroupSearchView_EditGroupButtonClicked; } diff --git a/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml b/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml index cfad06f2e..d2653cd24 100644 --- a/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml +++ b/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml @@ -51,7 +51,7 @@ - + \ No newline at end of file diff --git a/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml.cs b/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml.cs index 8cc468380..ea54864ca 100644 --- a/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml.cs +++ b/BeWo/View/Controls/SingleSupportConceptSelectionControl.xaml.cs @@ -21,8 +21,16 @@ namespace BeWo.View.Controls public SingleSupportConceptSelectionControl() { - InitializeComponent(); - SearchView.ControlInitialized += SearchView_ControlInitialized; + try + { + InitializeComponent(); + SearchView.SearchMode = Search.SearchMode.ActiveCostbearer2SupportConcepts; + SearchView.ControlInitialized += SearchView_ControlInitialized; + } + catch(Exception e) + { + + } } void SearchView_ControlInitialized(object sender, EventArgs e) @@ -39,6 +47,9 @@ namespace BeWo.View.Controls public List SupportConceptList { + //get => null; + //set { } + get { return SearchView.SupportConcepts; } set { SearchView.SupportConcepts = value; } } @@ -74,6 +85,9 @@ namespace BeWo.View.Controls { SearchView.SearchText = value; } + + //get => null; + //set { } } private void SupportConceptSearchView_ItemSelected(object sender, EventArgs e) @@ -122,7 +136,7 @@ namespace BeWo.View.Controls internal void SetSelectedSupportConceptOid(long pOid) { - var items = SearchView.SupportConcepts; + List items = SearchView.SupportConcepts; if (items != null) { diff --git a/BeWo/View/Navigation/CustomerNavigationView.xaml b/BeWo/View/Navigation/CustomerNavigationView.xaml index 168eee564..4480364eb 100644 --- a/BeWo/View/Navigation/CustomerNavigationView.xaml +++ b/BeWo/View/Navigation/CustomerNavigationView.xaml @@ -174,9 +174,9 @@ CreateDemands="CreateAll, CustomerView_Create" ShowDetailsPanel="True" DetailPanelItemTemplate="{StaticResource CustomerDetailInfoTemplate}" - ContentGroupStyle="{DynamicResource CustomerNavigationStyle}" - MainListItemStyle="{DynamicResource CustomerDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource CustomerNavigationStyle}" + MainListItemStyle="{StaticResource CustomerDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/CustomerTeamNavigationView.xaml b/BeWo/View/Navigation/CustomerTeamNavigationView.xaml index 6e1435d15..5eb5d1727 100644 --- a/BeWo/View/Navigation/CustomerTeamNavigationView.xaml +++ b/BeWo/View/Navigation/CustomerTeamNavigationView.xaml @@ -15,9 +15,9 @@ DeleteDemands="DeleteAll, CustomerTeam_Delete" CreateDemands="CreateAll, CustomerTeam_Create" ExcelExport="mainNavigationView_ExcelExport" - ContentGroupStyle="{DynamicResource CustomerTeamNavigationStyle}" - MainListItemStyle="{DynamicResource SearchDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource CustomerTeamNavigationStyle}" + MainListItemStyle="{StaticResource SearchDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/EmployeeNavigationView.xaml b/BeWo/View/Navigation/EmployeeNavigationView.xaml index 9c3260dad..0c665d259 100644 --- a/BeWo/View/Navigation/EmployeeNavigationView.xaml +++ b/BeWo/View/Navigation/EmployeeNavigationView.xaml @@ -16,9 +16,9 @@ DeleteDemands="DeleteAll, EmployeeView_Delete" CreateDemands="CreateAll, EmployeeView_Create" ArchiveObject="MainNavigationView_ArchiveObject" - ContentGroupStyle="{DynamicResource EmployeeNavigationStyle}" - MainListItemStyle="{DynamicResource EmployeeDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource EmployeeNavigationStyle}" + MainListItemStyle="{StaticResource EmployeeDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/OrganisationNavigationView.xaml b/BeWo/View/Navigation/OrganisationNavigationView.xaml index 0ceee576b..381e5e3ff 100644 --- a/BeWo/View/Navigation/OrganisationNavigationView.xaml +++ b/BeWo/View/Navigation/OrganisationNavigationView.xaml @@ -11,9 +11,9 @@ ExcelExport="mainNavigationView_ExcelExport" DeleteDemands="DeleteAll, OrganisationView_Delete" CreateDemands="CreateAll, OrganisationView_Create" - ContentGroupStyle="{DynamicResource OrganisationNavigationStyle}" - MainListItemStyle="{DynamicResource OrganisationDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource OrganisationNavigationStyle}" + MainListItemStyle="{StaticResource OrganisationDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/PersonNavigationView.xaml b/BeWo/View/Navigation/PersonNavigationView.xaml index 328897269..63753affd 100644 --- a/BeWo/View/Navigation/PersonNavigationView.xaml +++ b/BeWo/View/Navigation/PersonNavigationView.xaml @@ -11,9 +11,9 @@ DeleteDemands="DeleteAll, PersonView_Delete" CreateDemands="CreateAll, PersonView_Create" ExcelExport="mainNavigationView_ExcelExport" - ContentGroupStyle="{DynamicResource PersonNavigationStyle}" - MainListItemStyle="{DynamicResource PersonDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource PersonNavigationStyle}" + MainListItemStyle="{StaticResource PersonDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/TeamNavigationView.xaml b/BeWo/View/Navigation/TeamNavigationView.xaml index 499e118d1..0c36f66bc 100644 --- a/BeWo/View/Navigation/TeamNavigationView.xaml +++ b/BeWo/View/Navigation/TeamNavigationView.xaml @@ -13,9 +13,9 @@ DeleteDemands="DeleteAll, TeamView_Delete" CreateDemands="CreateAll, TeamView_Create" ExcelExport="mainNavigationView_ExcelExport" - ContentGroupStyle="{DynamicResource TeamNavigationStyle}" - MainListItemStyle="{DynamicResource SearchDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource TeamNavigationStyle}" + MainListItemStyle="{StaticResource SearchDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/UserGroupNavigationView.xaml b/BeWo/View/Navigation/UserGroupNavigationView.xaml index cabded3b1..72dca98b1 100644 --- a/BeWo/View/Navigation/UserGroupNavigationView.xaml +++ b/BeWo/View/Navigation/UserGroupNavigationView.xaml @@ -1,6 +1,17 @@  - + \ No newline at end of file diff --git a/BeWo/View/Navigation/UserNavigationView.xaml b/BeWo/View/Navigation/UserNavigationView.xaml index 861bf2e1f..735df48eb 100644 --- a/BeWo/View/Navigation/UserNavigationView.xaml +++ b/BeWo/View/Navigation/UserNavigationView.xaml @@ -9,9 +9,9 @@ DeleteDemands="DeleteAll, UserView_Delete" CreateDemands="CreateAll, UserView_Create" ExcelExport="mainNavigationView_ExcelExport" - ContentGroupStyle="{DynamicResource UserNavigationStyle}" - MainListItemStyle="{DynamicResource SearchDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource UserNavigationStyle}" + MainListItemStyle="{StaticResource SearchDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="MainNavigationView_OnReloadData"/> diff --git a/BeWo/View/Navigation/WohnheimNavigationView.xaml b/BeWo/View/Navigation/WohnheimNavigationView.xaml index 443de94f8..0d72be205 100644 --- a/BeWo/View/Navigation/WohnheimNavigationView.xaml +++ b/BeWo/View/Navigation/WohnheimNavigationView.xaml @@ -10,9 +10,9 @@ DeleteDemands="DeleteAll,WohnheimView_Delete" CreateDemands="CreateAll,WohnheimView_Create" ArchiveObject="wohnheimNavigationView_ArchiveObject" - ContentGroupStyle="{DynamicResource WohnheimNavigationStyle}" - MainListItemStyle="{DynamicResource WohnheimDetailStyle}" - HistoryListItemStyle="{DynamicResource SearchSimpleStyle}" + ContentGroupStyle="{StaticResource WohnheimNavigationStyle}" + MainListItemStyle="{StaticResource WohnheimDetailStyle}" + HistoryListItemStyle="{StaticResource SearchSimpleStyle}" OnReloadData="WohnheimNavigationView_OnReloadData"/> diff --git a/BeWoLauncher/Components/PasswortAenderungsView.xaml b/BeWoLauncher/Components/PasswortAenderungsView.xaml new file mode 100644 index 000000000..aead48f68 --- /dev/null +++ b/BeWoLauncher/Components/PasswortAenderungsView.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + +