diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml b/BeWo/Scheduler/View/NewSchedulerView.xaml
index d76e79c85..b4156372a 100644
--- a/BeWo/Scheduler/View/NewSchedulerView.xaml
+++ b/BeWo/Scheduler/View/NewSchedulerView.xaml
@@ -970,21 +970,22 @@
+ AllowAppointmentDrag="AllowAppointmentAenderung"
+ AllowAppointmentEdit="AllowAppointmentAenderung"
+ AllowAppointmentResize="AllowAppointmentAenderung"
+ AllowAppointmentCreate="AllowAppointmentCreateEvent"
+ AllowAppointmentDragBetweenResources="AllowAppointmentAenderung"
+ AllowAppointmentDelete="AllowAppointmentAenderung"
+ ActiveViewType="WorkWeek">
diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs
index ca72ad4f0..5c9c64b2f 100644
--- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs
+++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs
@@ -26,6 +26,7 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Translation;
+
using DevExpress.Xpf.Bars;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Scheduler;
@@ -35,35 +36,35 @@ using DevExpress.XtraScheduler;
using Appointment = DevExpress.XtraScheduler.Appointment;
using ColorConverter = System.Windows.Media.ColorConverter;
using DateTime = System.DateTime;
+using InplaceEditorEventArgs = DevExpress.Xpf.Scheduler.InplaceEditorEventArgs;
using SchedulerControl = DevExpress.Xpf.Scheduler.SchedulerControl;
-
namespace BeWo.Scheduler.View
{
public partial class NewSchedulerView : INotifyPropertyChanged
{
- private bool _isEmployeeBrushVisible;
+ private bool _IsEmployeeBrushVisible;
public bool IsEmployeeBrushVisible
{
- get => _isEmployeeBrushVisible;
+ get => _IsEmployeeBrushVisible;
set
{
- _isEmployeeBrushVisible = value;
+ _IsEmployeeBrushVisible = value;
OnPropertyChanged(nameof(IsEmployeeBrushVisible));
}
}
- private bool _isAbsenceTimeVisible;
+ private bool _IsAbsenceTimeVisible;
public bool IsAbsenceTimeVisible
{
- get => _isAbsenceTimeVisible;
+ get => _IsAbsenceTimeVisible;
set
{
- _isAbsenceTimeVisible = value;
+ _IsAbsenceTimeVisible = value;
OnPropertyChanged(nameof(IsAbsenceTimeVisible));
}
}
@@ -72,7 +73,7 @@ namespace BeWo.Scheduler.View
public event PropertyChangedEventHandler PropertyChanged;
- private SchedulerPrintingSettings _printingSettings = new SchedulerPrintingSettings();
+ private SchedulerPrintingSettings _PrintingSettings = new SchedulerPrintingSettings();
public NewSchedulerViewModel ViewModel { get; set; }
@@ -97,115 +98,115 @@ namespace BeWo.Scheduler.View
}
}
- private List _allEmployees;
+ private List _AllEmployees;
public List AllEmployees
{
- get => _allEmployees ?? (_allEmployees = new List());
+ get => _AllEmployees ?? (_AllEmployees = new List());
set
{
- if(!ListEquals(_allEmployees, value))
+ if(!ListEquals(_AllEmployees, value))
{
- _allEmployees = value;
+ _AllEmployees = value;
OnPropertyChanged(nameof(AllEmployees));
}
}
}
- private List _gefilterteMitarbeiter;
+ private List _GefilterteMitarbeiter;
public List GefilterteMitarbeiter
{
- get => _gefilterteMitarbeiter ?? (_gefilterteMitarbeiter = new List(AllEmployees));
+ get => _GefilterteMitarbeiter ?? (_GefilterteMitarbeiter = new List(AllEmployees));
set
{
- if(!ListEquals(_gefilterteMitarbeiter, value))
+ if(!ListEquals(_GefilterteMitarbeiter, value))
{
- _gefilterteMitarbeiter = value;
- _gefilterteMitarbeiter.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
+ _GefilterteMitarbeiter = value;
+ _GefilterteMitarbeiter.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
OnPropertyChanged(nameof(GefilterteMitarbeiter));
}
}
}
- private List _gefilterteKlienten;
+ private List _GefilterteKlienten;
public List GefilterteKlienten
{
- get => _gefilterteKlienten ?? (_gefilterteKlienten = new List(AllCustomers));
+ get => _GefilterteKlienten ?? (_GefilterteKlienten = new List(AllCustomers));
set
{
- if(!ListEquals(_gefilterteKlienten, value))
+ if(!ListEquals(_GefilterteKlienten, value))
{
- _gefilterteKlienten = value;
- _gefilterteKlienten.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
+ _GefilterteKlienten = value;
+ _GefilterteKlienten.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
OnPropertyChanged(nameof(GefilterteKlienten));
}
}
}
- private List _allCustomers;
+ private List _AllCustomers;
public List AllCustomers
{
- get => _allCustomers ?? (_allCustomers = new List());
+ get => _AllCustomers ?? (_AllCustomers = new List());
set
{
- if(!ListEquals(_allCustomers, value))
+ if(!ListEquals(_AllCustomers, value))
{
- _allCustomers = value;
+ _AllCustomers = value;
OnPropertyChanged(nameof(AllCustomers));
}
}
}
- private List _allResources;
+ private List _AllResources;
public List AllResources
{
- get => _allResources ?? (_allResources = new List());
+ get => _AllResources ?? (_AllResources = new List());
set
{
- if(!ListEquals(_allResources, value))
+ if(!ListEquals(_AllResources, value))
{
- _allResources = value;
+ _AllResources = value;
OnPropertyChanged(nameof(AllResources));
}
}
}
- private List _customerList;
+ private List _CustomerList;
public List CustomerList
{
- get => _customerList ?? (_customerList = new List());
+ get => _CustomerList ?? (_CustomerList = new List());
set
{
- if(!ListEquals(_customerList, value))
+ if(!ListEquals(_CustomerList, value))
{
- _customerList = value;
- _customerList.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
+ _CustomerList = value;
+ _CustomerList.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
OnPropertyChanged(nameof(CustomerList));
}
}
}
- private int _timelineDayCount;
- private SchedulerViewType _currentViewType;
+ private int _TimelineDayCount;
+ private SchedulerViewType _CurrentViewType;
- private Dictionary> _category2ResourcesDictionary;
+ private Dictionary> _Category2ResourcesDictionary;
public Dictionary> Category2ResourcesDictionary
{
- get => _category2ResourcesDictionary ?? (_category2ResourcesDictionary = new Dictionary>());
+ get => _Category2ResourcesDictionary ?? (_Category2ResourcesDictionary = new Dictionary>());
set
{
if(!CheckCats2ResourcesForEqualitiy(value))
{
- _category2ResourcesDictionary = value;
+ _Category2ResourcesDictionary = value;
AllResources = new List();
value.DoForEach(d => AllResources.AddRange(d.Value));
@@ -217,12 +218,12 @@ namespace BeWo.Scheduler.View
private bool CheckCats2ResourcesForEqualitiy(Dictionary> dic2)
{
- if(_category2ResourcesDictionary == null && dic2 != null || dic2 == null && _category2ResourcesDictionary != null)
+ if(_Category2ResourcesDictionary == null && dic2 != null || dic2 == null && _Category2ResourcesDictionary != null)
{
return false;
}
- return _category2ResourcesDictionary == null && dic2 == null || _category2ResourcesDictionary != null && dic2 != null && _category2ResourcesDictionary.Count == dic2.Count && _category2ResourcesDictionary.Except(dic2).Any();
+ return _Category2ResourcesDictionary == null && dic2 == null || _Category2ResourcesDictionary != null && dic2 != null && _Category2ResourcesDictionary.Count == dic2.Count && _Category2ResourcesDictionary.Except(dic2).Any();
}
private static bool ListEquals(IReadOnlyCollection list1, List list2)
@@ -240,19 +241,19 @@ namespace BeWo.Scheduler.View
return list1.Count == list2.Count && list1.All(list2.Contains);
}
- private List _selectedEmployees = new List();
- private List _selectedCustomers = new List();
- private List _selectedResources = new List();
+ private List _SelectedEmployees = new List();
+ private List _SelectedCustomers = new List();
+ private List _SelectedResources = new List();
public List SelectedEmployees
{
- get => _selectedEmployees;
+ get => _SelectedEmployees;
set
{
- if(!ListEquals(_selectedEmployees, value))
+ if(!ListEquals(_SelectedEmployees, value))
{
- _selectedEmployees = value;
- _selectedEmployees.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
+ _SelectedEmployees = value;
+ _SelectedEmployees.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
if (value.Equals(AllEmployees))
{
@@ -269,13 +270,13 @@ namespace BeWo.Scheduler.View
public List SelectedCustomers
{
- get => _selectedCustomers;
+ get => _SelectedCustomers;
set
{
- if(!ListEquals(_selectedCustomers, value))
+ if(!ListEquals(_SelectedCustomers, value))
{
- _selectedCustomers = value;
- _selectedCustomers.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName,
+ _SelectedCustomers = value;
+ _SelectedCustomers.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName,
y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
if(NurMeineKlientenCB.IsChecked.HasValue && NurMeineKlientenCB.IsChecked.Value &&
@@ -292,12 +293,12 @@ namespace BeWo.Scheduler.View
public List SelectedResources
{
- get => _selectedResources;
+ get => _SelectedResources;
set
{
- if(!ListEquals(_selectedResources, value))
+ if(!ListEquals(_SelectedResources, value))
{
- _selectedResources = value;
+ _SelectedResources = value;
if(value.Equals(AllResources))
{
AlleRessourcenCB.IsChecked = true;
@@ -336,22 +337,22 @@ namespace BeWo.Scheduler.View
public static bool IgnoreChangeEvents;
- private List _employeesTeams = new List();
+ private List _EmployeesTeams = new List();
- private string _requests;
+ private string _Requests;
public string Requests
{
- get => _requests ?? (_requests = "keine Benachrichtigungen");
+ get => _Requests ?? (_Requests = "keine Benachrichtigungen");
set
{
- _requests = value;
+ _Requests = value;
OnPropertyChanged(nameof(Requests));
}
}
public static TimeSpan FetchPadding = TimeSpan.FromDays(14);
- private TimeInterval _lastFetchedInterval = new TimeInterval();
+ private TimeInterval _LastFetchedInterval = new TimeInterval();
public long CustomerOidToPreselect { get; set; }
@@ -448,7 +449,7 @@ namespace BeWo.Scheduler.View
Category2ResourcesDictionary = dict;
}));
- ServiceFacade.DoEmployeeServiceSync(es => _employeesTeams = es.GetTeamOidsByEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
+ ServiceFacade.DoEmployeeServiceSync(es => _EmployeesTeams = es.GetTeamOidsByEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
InitializeComponent();
InitViewModel();
@@ -458,7 +459,7 @@ namespace BeWo.Scheduler.View
DataContext = this;
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
EditorLocalizer.Active = new GermanEditorLocalizer();
@@ -491,7 +492,7 @@ namespace BeWo.Scheduler.View
// synchronizer.Synchronize();
//}
- private bool _istErsterAufruf = true;
+ private bool _IstErsterAufruf = true;
#region InitViewModel
private void InitViewModel()
@@ -511,14 +512,14 @@ namespace BeWo.Scheduler.View
UpdateDataSource(e.Data);
- if (_istErsterAufruf)
+ if (_IstErsterAufruf)
{
if (MainControl.HatNeueTermine)
{
FensterOeffnen();
}
- _istErsterAufruf = false;
+ _IstErsterAufruf = false;
}
WriteToDebugLog("Done");
@@ -529,7 +530,7 @@ namespace BeWo.Scheduler.View
{
WriteToDebugLog("Beginning");
Scheduler.Start = DateTime.Now;
- _timelineDayCount = 0;
+ _TimelineDayCount = 0;
Scheduler.DayView.NavigationButtonVisibility = NavigationButtonVisibility.Always;
Scheduler.DayView.AppointmentDisplayOptions.ShowRecurrence = true;
Scheduler.DayView.AppointmentDisplayOptions.ShowReminder = true;
@@ -630,7 +631,7 @@ namespace BeWo.Scheduler.View
Scheduler.Start = settings.StartDate;
var starttimeInterval = settings.StartDate.Date;
starttimeInterval = starttimeInterval.AddHours(Scheduler.WorkWeekView.WorkTime.Start.Hours);
- settings.ViewType = ViewTypeConvert.ToAppointmentViewType(_currentViewType);
+ settings.ViewType = ViewTypeConvert.ToAppointmentViewType(_CurrentViewType);
switch (settings.ViewType)
{
@@ -767,7 +768,6 @@ namespace BeWo.Scheduler.View
private void ListItemCheckedEvent(object sender, RoutedEventArgs e)
{
- WriteToDebugLog("");
UpdateVM(true);
}
@@ -814,7 +814,7 @@ namespace BeWo.Scheduler.View
private void ButtonDayView_Click(object sender, RoutedEventArgs e)
{
Scheduler.ActiveViewType = SchedulerViewType.Day;
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
UpdateOptionPanel();
DayViewOptions.Visibility = Visibility.Visible;
@@ -824,7 +824,7 @@ namespace BeWo.Scheduler.View
private void ButtonMonthView_Click(object sender, RoutedEventArgs e)
{
Scheduler.ActiveViewType = SchedulerViewType.Month;
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
var interval = Scheduler.ActiveView.GetVisibleIntervals();
Scheduler.ActiveView.SetVisibleIntervals(new TimeIntervalCollection {new TimeInterval(interval.Start, new TimeSpan(35, 0, 0, 0))});
@@ -834,21 +834,21 @@ namespace BeWo.Scheduler.View
private void ButtonWorkWeekView_Click(object sender, RoutedEventArgs e)
{
Scheduler.ActiveViewType = SchedulerViewType.WorkWeek;
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
UpdateOptionPanel();
}
private void ButtonWeekView_Click(object sender, RoutedEventArgs e)
{
Scheduler.ActiveViewType = SchedulerViewType.Week;
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
UpdateOptionPanel();
}
private void ButtonTimelineView_Click(object sender, RoutedEventArgs e)
{
Scheduler.ActiveViewType = SchedulerViewType.Timeline;
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
UpdateOptionPanel();
DayViewOptions.Visibility = Visibility.Collapsed;
@@ -860,7 +860,7 @@ namespace BeWo.Scheduler.View
if (e.NewValue != null && int.TryParse(e.NewValue.ToString(), out var count) && count > 0)
{
Scheduler.DayView.DayCount = count;
- _timelineDayCount = count;
+ _TimelineDayCount = count;
}
}
@@ -874,28 +874,28 @@ namespace BeWo.Scheduler.View
if (count > 0)
{
Scheduler.TimelineView.IntervalCount = count;
- _timelineDayCount = count;
+ _TimelineDayCount = count;
}
}
#endregion
- private bool _enabled;
+ private bool _Enabled;
public bool Enabled
{
- get => _enabled;
+ get => _Enabled;
set
{
- _enabled = value;
+ _Enabled = value;
OnPropertyChanged("Enabled");
}
}
private void UpdateRequestString()
{
- ServiceFacade.DoResourceServiceSync(r => Liste = r.GetAllOpenAppointmentsForEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
+ ServiceFacade.DoResourceServiceSync(r => _Liste = r.GetAllOpenAppointmentsForEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
var count = 0;
var oidList = new List();
- foreach (var termin in Liste)
+ foreach (var termin in _Liste)
{
if (termin.Originator.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value)
{
@@ -928,19 +928,18 @@ namespace BeWo.Scheduler.View
Requests = $"{(count == 0 ? "keine" : count.ToString())} Benachrichtigung{(count == 1 ? "" : "en")}";
}
- private List Liste = new List();
+ private List _Liste = new List();
private void NewSchedulerStorage_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
{
- WriteToDebugLog("Beginning");
-
if (IgnoreChangeEvents)
{
- WriteToDebugLog("Aborting");
return;
}
- var appList = e.Objects.Cast().ToList();
+ WriteToDebugLog("Appointment chaning...");
+
+ var appList = e.Objects.Cast().ToList();
if (appList.Any(f => f.CustomFields["IsPrivate"] != null && (bool)f.CustomFields["IsPrivate"]))
{
@@ -950,13 +949,13 @@ namespace BeWo.Scheduler.View
ViewModel.ActiveAppointmentViewModel.SaveAppointments(Scheduler, appList);
UpdateVM(true);
-
- WriteToDebugLog("Done");
}
private void NewSchedulerStorage_AppointmentDeleting(object sender, PersistentObjectCancelEventArgs e)
{
- if (e.Object is Appointment app && app.Type != AppointmentType.ChangedOccurrence)
+ WriteToDebugLog("Appointment deleting");
+
+ if (e.Object is Appointment app && app.Type != AppointmentType.ChangedOccurrence)
{
const string msg = "Möchten Sie den gewählten Termin wirklich löschen?";
@@ -983,7 +982,9 @@ namespace BeWo.Scheduler.View
private void NewSchedulerStorage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
{
- var appList = e.Objects.Cast().ToList();
+ WriteToDebugLog("Appointments inserted");
+
+ var appList = e.Objects.Cast().ToList();
if(appList.Any(f => f.CustomFields["IsPrivate"] != null && (bool) f.CustomFields["IsPrivate"]))
{
@@ -997,9 +998,9 @@ namespace BeWo.Scheduler.View
private void Scheduler_EditAppointmentFormShowing(object sender, EditAppointmentFormEventArgs e)
{
- var control = (SchedulerControl) sender;
+ var control = (SchedulerControl) sender;
- if (_isNew)
+ if (_IsNew)
{
var n = SelectedEmployees.Select(item => new Employee2SchedulerAppointmentDC {Employee = item, ParticipationAnswer = ParticipationAnswer.Offen}).ToList();
e.Appointment.CustomFields["EmployeeList"] = n;
@@ -1010,15 +1011,22 @@ namespace BeWo.Scheduler.View
var form = ViewModel.GetEditAppointmentForm(control, e.Appointment);
if (form == null)
{
- return;
+ WriteToDebugLog("Appointment edit form is null!");
+
+ if(_IsNew)
+ {
+ _IsNew = false;
+ }
+
+ return;
}
e.Form = form;
e.AllowResize = false;
- if (_isNew)
+ if (_IsNew)
{
- _isNew = false;
+ _IsNew = false;
}
}
@@ -1059,16 +1067,18 @@ namespace BeWo.Scheduler.View
}
- private bool _isNew;
+ private bool _IsNew;
private void Scheduler_InitNewAppointment(object sender, AppointmentEventArgs e)
{
- _isNew = true;
+ WriteToDebugLog("Initiating new appointment");
+
+ _IsNew = true;
ViewModel.InitNewAppointment(e.Appointment);
}
private void Scheduler_AppointmentViewInfoCustomizing(object sender, DevExpress.Xpf.Scheduler.AppointmentViewInfoCustomizingEventArgs e)
{
- var cf = e.ViewInfo.Appointment.CustomFields;
+ var cf = e.ViewInfo.Appointment.CustomFields;
if(cf[SchedulerAppointmentListVM.CustomField_CustomerList] == null &&
cf[SchedulerAppointmentListVM.CustomField_EmployeeList] == null &&
@@ -1135,28 +1145,30 @@ namespace BeWo.Scheduler.View
private void AllowAppointmentCreateEvent(object sender, AppointmentOperationEventArgs e)
{
- var darfAnlegen = BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderKliententermineAnlegen) || BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnlegen);
+ WriteToDebugLog("Allowing appointment create event");
+
+ var darfAnlegen = BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderKliententermineAnlegen) || BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnlegen);
e.Allow = darfAnlegen;
}
private void UpdateOptionPanel()
{
- switch (ViewTypeConvert.ToAppointmentViewType(_currentViewType))
+ switch (ViewTypeConvert.ToAppointmentViewType(_CurrentViewType))
{
case AppointmentViewType.Day:
TimelineViewOptions.Visibility = Visibility.Collapsed;
DayViewOptions.Visibility = Visibility.Visible;
SpinEditDayViewDayCount.Value = Scheduler.DayView.DayCount;
- _timelineDayCount = 0;
+ _TimelineDayCount = 0;
break;
case AppointmentViewType.Timeline:
TimelineViewOptions.Visibility = Visibility.Visible;
DayViewOptions.Visibility = Visibility.Collapsed;
- SpinEditTimelineViewDayCount.Value = _timelineDayCount == 0 ? Scheduler.TimelineView.IntervalCount : _timelineDayCount;
+ SpinEditTimelineViewDayCount.Value = _TimelineDayCount == 0 ? Scheduler.TimelineView.IntervalCount : _TimelineDayCount;
break;
default:
- _timelineDayCount = 0;
+ _TimelineDayCount = 0;
TimelineViewOptions.Visibility = Visibility.Collapsed;
DayViewOptions.Visibility = Visibility.Collapsed;
break;
@@ -1225,7 +1237,7 @@ namespace BeWo.Scheduler.View
private void FensterOeffnen()
{
- var neueListe = new SchedulerAppointmentListVM(Liste, AllCustomers, AllEmployees, Category2ResourcesDictionary);
+ var neueListe = new SchedulerAppointmentListVM(_Liste, AllCustomers, AllEmployees, Category2ResourcesDictionary);
var vm = neueListe;
@@ -1486,27 +1498,28 @@ namespace BeWo.Scheduler.View
private void SchedulerStorage_OnFetchAppointments(object sender, FetchAppointmentsEventArgs e)
{
- WriteToDebugLog("Beginning");
-
UpdateVM();
-
- WriteToDebugLog("Done");
}
- private bool updatingViewModel = false;
-
+ private bool _UpdatingViewModel;
private void UpdateVM(bool shouldForceUpdate = false)
{
- if (updatingViewModel)
+ WriteToDebugLog(new StackTrace().GetFrame(1).GetMethod().Name);
+
+ if (_UpdatingViewModel)
+ {
+ WriteToDebugLog("Already updating. Aborting second try.");
return;
- updatingViewModel = true;
+ }
+
+ _UpdatingViewModel = true;
WriteToDebugLog("Beginning");
if (ViewModel == null)
{
WriteToDebugLog("Aborting");
- updatingViewModel = false;
+ _UpdatingViewModel = false;
return;
}
@@ -1518,22 +1531,22 @@ namespace BeWo.Scheduler.View
var selectedEmployeeOids = SelectedEmployees.Select(s => s.EmployeeOid).ToList();
var selectedCustomerOids = SelectedCustomers.Select(s => s.CustomerOid).ToList();
- var selectedResourceOids = SelectedResources.Select(s => s.ResourceOid.Value).ToList();
- var employeesOnly = MitarbeiterEbenenCheckBox.IsChecked.Value;
- var customersOnly = KlientenEbenenCheckBox.IsChecked.Value;
- var resourcesOnly = RessourcenEbenenCheckBox.IsChecked.Value;
- var onlyPrivateAppointments = ShowPrivateAppointmentsCheckBox.IsChecked.Value;
+ var selectedResourceOids = SelectedResources.Where(w => w.ResourceOid.HasValue).Select(s => s.ResourceOid.Value).ToList();
+ var employeesOnly = MitarbeiterEbenenCheckBox.IsChecked != null && MitarbeiterEbenenCheckBox.IsChecked.Value;
+ var customersOnly = KlientenEbenenCheckBox.IsChecked != null && KlientenEbenenCheckBox.IsChecked.Value;
+ var resourcesOnly = RessourcenEbenenCheckBox.IsChecked != null && RessourcenEbenenCheckBox.IsChecked.Value;
+ var onlyPrivateAppointments = ShowPrivateAppointmentsCheckBox.IsChecked != null && ShowPrivateAppointmentsCheckBox.IsChecked.Value;
var showOnlyMyAppointments = ZeigeNurMeineTermine;
- var showAbsenceTimes = AbwesenheitenEinAusCheckBox.IsChecked.Value;
+ var showAbsenceTimes = AbwesenheitenEinAusCheckBox.IsChecked != null && AbwesenheitenEinAusCheckBox.IsChecked.Value;
- if(!shouldForceUpdate && newFetchingInterval.Equals(_lastFetchedInterval))
+ if(!shouldForceUpdate && newFetchingInterval.Equals(_LastFetchedInterval))
{
- updatingViewModel = false;
+ _UpdatingViewModel = false;
WriteToDebugLog("Aborting. Redundant call.");
return;
}
- _lastFetchedInterval = newFetchingInterval;
+ _LastFetchedInterval = newFetchingInterval;
UpdateAppointmentViewModel(start, end, selectedEmployeeOids, selectedCustomerOids, selectedResourceOids, employeesOnly, customersOnly, resourcesOnly, onlyPrivateAppointments, showOnlyMyAppointments, showAbsenceTimes);
}
@@ -1565,30 +1578,12 @@ namespace BeWo.Scheduler.View
ServiceFacade.DoResourceServiceAsync(s3 => s3.GetAllActiveAbsenceTimesInInterval(start, end, BeWoApp.LoggedOnEmployee.EmployeeOid.Value, BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)),
absenceTimes =>
{
-
- //var prefilteredAppointments = appointments.Where(w => (w.EmployeeList.Count == 0 && w.Originator.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) ||
- // w.EmployeeList.Count > 0 && w.EmployeeList.Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) ||
- // BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) && (!w.EmployeeList.TrueForAll(e2a => e2a.ParticipationAnswer == ParticipationAnswer.Absage) || (w.EmployeeList == null || w.EmployeeList.Count == 0))).ToList();
-
-
- //var vm = new SchedulerAppointmentListVM(prefilteredAppointments, customers, allEmployees, cats2Res);
- //if(pShouldShowAbsenceTimes)
- //{
- // vm.Appointments.AddRange(ConvertAbsenceTimesToAppointments(absenceTimes, end));
- //}
-
- //ActiveAppointmentViewModel = vm;
-
- //SchedulerSettings = GetActiveSettings();
- //SchedulerSettings.StartDate = pIntervalEnd;
-
this.Dispatch(() =>
{
var prefilteredAppointments = appointments.Where(w => (w.EmployeeList.Count == 0 && w.Originator.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) ||
w.EmployeeList.Count > 0 && w.EmployeeList.Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) ||
BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) && (!w.EmployeeList.TrueForAll(e2a => e2a.ParticipationAnswer == ParticipationAnswer.Absage) || (w.EmployeeList == null || w.EmployeeList.Count == 0))).ToList();
-
var vm = new SchedulerAppointmentListVM(prefilteredAppointments, customers, allEmployees, cats2Res);
if (pShouldShowAbsenceTimes)
{
@@ -1615,7 +1610,7 @@ namespace BeWo.Scheduler.View
var testtesttest = ViewModel.ActiveAppointmentViewModel;
- updatingViewModel = false;
+ _UpdatingViewModel = false;
WriteToDebugLog("Done");
});
@@ -1882,21 +1877,19 @@ namespace BeWo.Scheduler.View
private void DateNavigator_OnSelectedDatesChanged(object sender, EventArgs e)
{
- WriteToDebugLog("Beginning");
+ WriteToDebugLog("Selected dates changed");
- _currentViewType = Scheduler.ActiveViewType;
+ _CurrentViewType = Scheduler.ActiveViewType;
var navigator = (DevExpress.Xpf.Editors.DateNavigator.DateNavigator) sender;
var selectedDates = navigator.SelectedDates;
- var isSelectedDateFetched = _lastFetchedInterval.ContainsEveryDateFromList(selectedDates);
- if(!isSelectedDateFetched && !(_lastFetchedInterval.Start.Equals(new DateTime(1,1,1,0,0,0)) && _lastFetchedInterval.End.Equals(new DateTime(1, 1, 1, 0, 30, 0))))
+ var isSelectedDateFetched = _LastFetchedInterval.ContainsEveryDateFromList(selectedDates);
+ if(!isSelectedDateFetched && !(_LastFetchedInterval.Start.Equals(new DateTime(1,1,1,0,0,0)) && _LastFetchedInterval.End.Equals(new DateTime(1, 1, 1, 0, 30, 0))))
{
UpdateVM();
}
-
- WriteToDebugLog("Done");
}
private void MitarbeiterVerfuegbarkeitPruefenButtonItem_OnItemClick(object sender, ItemClickEventArgs e)
@@ -1971,16 +1964,35 @@ namespace BeWo.Scheduler.View
UpdateVM(true);
}
- private static void WriteToDebugLog(string message)
+ private static void WriteToDebugLog(string message, bool isWithoutTimestamp = false)
{
- var callerName = new StackTrace().GetFrame(1).GetMethod().Name;
+#if DEBUG
+ var callerName2 = new StackTrace().GetFrame(2).GetMethod().Name;
+ var callerName = new StackTrace().GetFrame(1).GetMethod().Name;
+
+ using(var file = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\scheduler_log.txt", true))
+ {
+ var messageToWrite = isWithoutTimestamp ? message : $"{DateTime.Now:yyyy-MM-dd HH:mm:ss:ffff} {callerName2}->{callerName}: {message}";
+
+ file.WriteLine(messageToWrite);
+ }
- //using(var file = new StreamWriter(@"C:\Users\Lyndon\Desktop\scheduler_log.txt", true))
- //{
- // file.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss:ffff} {callerName}: {message}");
- //}
Debug.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss:ffff} {callerName}: {message}");
+#endif
+ }
+
+ private void Scheduler_OnInplaceEditorShowing(object sender, InplaceEditorEventArgs e)
+ {
+ if(_IsNew)
+ {
+ var n = SelectedEmployees.Select(item => new Employee2SchedulerAppointmentDC { Employee = item, ParticipationAnswer = ParticipationAnswer.Offen }).ToList();
+ e.Appointment.CustomFields["EmployeeList"] = n;
+ e.Appointment.CustomFields["CustomerList"] = new List(SelectedCustomers);
+ e.Appointment.CustomFields["ResourceList"] = new List(SelectedResources);
+
+ _IsNew = false;
+ }
}
}
diff --git a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml
index 2ec9def54..8cf44a482 100644
--- a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml
+++ b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml
@@ -368,7 +368,7 @@
-
+
diff --git a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs
index b2e4b1f91..7673dd8cc 100644
--- a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs
+++ b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs
@@ -12,7 +12,6 @@ using BeWo.Annotations;
using BeWo.Core;
using BeWo.Scheduler.ViewModel;
using BeWo.ServiceProxy;
-using BeWo.View;
using BeWo.View.Search;
using BS.Shared;
@@ -31,18 +30,18 @@ namespace BeWo.Scheduler.View
{
public bool IsInCustomerViewMode { get; set; }
- private List categories;
+ private List _Categories;
public List Categories
{
- get { return categories; }
- set { categories = value; OnPropertyChanged(nameof(Categories)); }
+ get => _Categories;
+ set { _Categories = value; OnPropertyChanged(nameof(Categories)); }
}
- private List resourceList;
+ private List _ResourceList;
public List ResourceList
{
- get { return resourceList; }
- set { resourceList = value; OnPropertyChanged(nameof(ResourceList)); }
+ get => _ResourceList;
+ set { _ResourceList = value; OnPropertyChanged(nameof(ResourceList)); }
}
public SchedulerAppointmentListVM ViewModel { get; set; }
@@ -52,48 +51,45 @@ namespace BeWo.Scheduler.View
LocalizeVisualChild(sender as DependencyObject);
}
- public NewSchedulerAppointmentFormController NewSchedulerAppointmentFormController { get { return Controller as NewSchedulerAppointmentFormController; } }
+ public NewSchedulerAppointmentFormController NewSchedulerAppointmentFormController => Controller as NewSchedulerAppointmentFormController;
- private ObservableCollection selectedResources;
+ private ObservableCollection _SelectedResources;
public ObservableCollection SelectedResources
{
- get { return selectedResources ?? (selectedResources = new ObservableCollection(NewSchedulerAppointmentFormController.ResourceList ?? new List())); }
- set
+ get => _SelectedResources ?? (_SelectedResources = new ObservableCollection(NewSchedulerAppointmentFormController.ResourceList ?? new List()));
+ set
{
- selectedResources = value;
+ _SelectedResources = value;
SelectedResources.CollectionChanged += SelectedResourcesCollectionChanged;
NewSchedulerAppointmentFormController.ResourceList = value.ToList();
OnPropertyChanged(nameof(SelectedResources));
}
}
- private ObservableCollection selectedEmployees;
+ private ObservableCollection _SelectedEmployees;
public ObservableCollection SelectedEmployees
{
- get { return selectedEmployees ?? (selectedEmployees = new ObservableCollection(NewSchedulerAppointmentFormController.EmployeeList ?? new List())); }
- set
+ get => _SelectedEmployees ?? (_SelectedEmployees = new ObservableCollection(NewSchedulerAppointmentFormController.EmployeeList ?? new List()));
+ set
{
- if (selectedEmployees.Equals(value)) return;
+ if (_SelectedEmployees.Equals(value)) return;
- selectedEmployees = value;
+ _SelectedEmployees = value;
SelectedEmployees.CollectionChanged += SelectedEmployeesCollectionChanged;
NewSchedulerAppointmentFormController.EmployeeList = value.ToList();
OnPropertyChanged(nameof(SelectedEmployees));
}
}
- private ObservableCollection selectedCustomers;
+ private ObservableCollection _SelectedCustomers;
public ObservableCollection SelectedCustomers
{
- get
+ get => _SelectedCustomers ?? (_SelectedCustomers = new ObservableCollection(NewSchedulerAppointmentFormController.CustomerList ?? new List()));
+ set
{
- return selectedCustomers ?? (selectedCustomers = new ObservableCollection(NewSchedulerAppointmentFormController.CustomerList ?? new List()));
- }
- set
- {
- if (selectedCustomers.Equals(value)) return;
+ if (_SelectedCustomers.Equals(value)) return;
- selectedCustomers = value;
+ _SelectedCustomers = value;
SelectedCustomers.CollectionChanged += SelectedCustomersCollectionChanged;
NewSchedulerAppointmentFormController.CustomerList = value.ToList();
OnPropertyChanged(nameof(SelectedCustomers));
@@ -187,7 +183,7 @@ namespace BeWo.Scheduler.View
return;
}
- OKButton.Visibility = Visibility.Hidden;
+ OkButton.Visibility = Visibility.Hidden;
DeleteButton.Visibility = Visibility.Hidden;
}
@@ -231,7 +227,7 @@ namespace BeWo.Scheduler.View
protected void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
- if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
+ handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void EmployeePopupClick(object sender, RoutedEventArgs e)
@@ -241,7 +237,7 @@ namespace BeWo.Scheduler.View
private void CustomerPopUpEditClick(object sender, RoutedEventArgs e)
{
- ResourcesTreeSearchView.AusgewaehlteRessourcen = selectedResources.ToList();
+ ResourcesTreeSearchView.AusgewaehlteRessourcen = _SelectedResources.ToList();
PopupCustomer.IsOpen = true;
}
@@ -367,25 +363,14 @@ namespace BeWo.Scheduler.View
var endDate = EndDate.DateTime;
var endTime = DateTime.Parse(EndTime.Text);
- DateTime start = new DateTime(startDate.Year, startDate.Month, startDate.Day, startTime.Hour, startTime.Minute, startTime.Second);
- DateTime end = new DateTime(endDate.Year, endDate.Month, endDate.Day, endTime.Hour, endTime.Minute, endTime.Second);
+ var start = new DateTime(startDate.Year, startDate.Month, startDate.Day, startTime.Hour, startTime.Minute, startTime.Second);
+ var end = new DateTime(endDate.Year, endDate.Month, endDate.Day, endTime.Hour, endTime.Minute, endTime.Second);
- List customerlist = new List();
- List employeelist = new List();
+ var employeelist = (from Employee2SchedulerAppointmentDC xy in employ select xy.Employee).ToList();
- foreach (var employee in employ)
- {
- var xy = (Employee2SchedulerAppointmentDC)employee;
- employeelist.Add(xy.Employee);
- }
+ var customerlist = y.Cast().ToList();
- foreach (var klient in y)
- {
- var s = (CompactCustomerDC)klient;
- customerlist.Add(s);
- }
-
- BeWoUtils.CreateZeiterfassung(start, end, customerlist, employeelist, Notice.Text);
+ BeWoUtils.CreateZeiterfassung(start, end, customerlist, employeelist, Notice.Text);
}
}
@@ -393,25 +378,26 @@ namespace BeWo.Scheduler.View
{
var obj = ((Button) sender).Tag;
- var res = obj as ResourceDC;
- if (res != null)
- {
- SelectedResources.Remove(res);
- OnPropertyChanged("CountSelectedResources");
- }
+ switch(obj)
+ {
+ case ResourceDC res:
+ SelectedResources.Remove(res);
+ OnPropertyChanged(nameof(CountSelectedResources));
+ break;
+ case CompactCustomerDC cus:
+ SelectedCustomers.Remove(cus);
+ OnPropertyChanged(nameof(CountSelectedCustomers));
+ break;
+ }
- var cus = obj as CompactCustomerDC;
- if (cus != null)
- {
- SelectedCustomers.Remove(cus);
- OnPropertyChanged("CountSelectedCustomers");
- }
+ if (!(obj is Employee2SchedulerAppointmentDC))
+ {
+ return;
+ }
- if (!(obj is Employee2SchedulerAppointmentDC)) return;
-
- var emp = (Employee2SchedulerAppointmentDC) obj;
+ var emp = (Employee2SchedulerAppointmentDC) obj;
SelectedEmployees.Remove(emp);
- OnPropertyChanged("CountSelectedEmployees");
+ OnPropertyChanged(nameof(CountSelectedEmployees));
}
private void ResourcesTreeSearchView_OnSelectionChanged(object sender, RoutedEventArgs e)
@@ -420,11 +406,13 @@ namespace BeWo.Scheduler.View
var resOC = resourcesTreeSearchView.SelectedResources.ToObservableCollection();
foreach (var res in resOC.Where(res => !SelectedResources.Contains(res)))
- SelectedResources.Add(res);
+ {
+ SelectedResources.Add(res);
+ }
SelectedResources = SelectedResources.Except(SelectedResources.Where(sr => !resOC.Contains(sr)).ToList()).ToObservableCollection();
- OnPropertyChanged("CountSelectedResources");
+ OnPropertyChanged(nameof(CountSelectedResources));
}
private void MultiEmployeeSearch_OnSelectionChanged(object sender, RoutedEventArgs e)
@@ -433,14 +421,16 @@ namespace BeWo.Scheduler.View
var empOC = multiEmployeeSearch.SelectedEmployees.ToObservableCollection();
foreach (var emp in empOC.Where(emp => !SelectedEmployees.Any(se => se.Employee.Equals(emp))))
- SelectedEmployees.Add(new Employee2SchedulerAppointmentDC { Employee = emp, ParticipationAnswer = ParticipationAnswer.Offen });
+ {
+ SelectedEmployees.Add(new Employee2SchedulerAppointmentDC { Employee = emp, ParticipationAnswer = ParticipationAnswer.Offen });
+ }
var ex = SelectedEmployees.Where(se => !empOC.Contains(se.Employee));
var ab = SelectedEmployees.Except(ex);
var cd = ab.ToObservableCollection();
SelectedEmployees = cd;
- OnPropertyChanged("CountSelectedEmployees");
+ OnPropertyChanged(nameof(CountSelectedEmployees));
}
private void MultiCustomerSearch_OnSelectionChanged(object sender, RoutedEventArgs e)
@@ -448,77 +438,81 @@ namespace BeWo.Scheduler.View
var multiCustomerSearchView = (MultiCustomerSearchView)e.Source;
SelectedCustomers = multiCustomerSearchView.SelectedCustomers.ToObservableCollection();
- OnPropertyChanged("CountSelectedCustomers");
+ OnPropertyChanged(nameof(CountSelectedCustomers));
}
}
public class NewSchedulerAppointmentFormController : AppointmentFormController
{
- List SourceResourceList
+ private List SourceResourceList
{
- get { return (List)SourceAppointment.CustomFields["ResourceList"]; }
- set { SourceAppointment.CustomFields["ResourceList"] = value; }
+ get => (List)SourceAppointment.CustomFields["ResourceList"];
+ set => SourceAppointment.CustomFields["ResourceList"] = value;
}
public List ResourceList
{
- get { return (List)EditedAppointmentCopy.CustomFields["ResourceList"]; }
- set { EditedAppointmentCopy.CustomFields["ResourceList"] = value; }
+ get => (List)EditedAppointmentCopy.CustomFields["ResourceList"];
+ set => EditedAppointmentCopy.CustomFields["ResourceList"] = value;
}
- List SourceEmployeeList
+ private List SourceEmployeeList
{
- get { return (List)SourceAppointment.CustomFields["EmployeeList"]; }
- set { SourceAppointment.CustomFields["EmployeeList"] = value; }
- }
+ get => (List)SourceAppointment.CustomFields["EmployeeList"];
+ set => SourceAppointment.CustomFields["EmployeeList"] = value;
+ }
public List EmployeeList
{
- get { return (List)EditedAppointmentCopy.CustomFields["EmployeeList"]; }
- set { EditedAppointmentCopy.CustomFields["EmployeeList"] = value; }
+ get => (List)EditedAppointmentCopy.CustomFields["EmployeeList"];
+ set => EditedAppointmentCopy.CustomFields["EmployeeList"] = value;
}
- List SourceCustomerList
+ private List SourceCustomerList
{
- get { return (List)SourceAppointment.CustomFields["CustomerList"]; }
- set { SourceAppointment.CustomFields["CustomerList"] = value; }
- }
+ get => (List)SourceAppointment.CustomFields["CustomerList"];
+ set => SourceAppointment.CustomFields["CustomerList"] = value;
+ }
public List CustomerList
{
- get { return (List)EditedAppointmentCopy.CustomFields["CustomerList"]; }
- set { EditedAppointmentCopy.CustomFields["CustomerList"] = value; }
+ get => (List)EditedAppointmentCopy.CustomFields["CustomerList"];
+ set => EditedAppointmentCopy.CustomFields["CustomerList"] = value;
}
- CompactEmployeeDC SourceOriginator
+ private CompactEmployeeDC SourceOriginator
{
- get { return (CompactEmployeeDC)SourceAppointment.CustomFields["Originator"]; }
- set { SourceAppointment.CustomFields["Originator"] = value; }
- }
+ get => (CompactEmployeeDC)SourceAppointment.CustomFields["Originator"];
+ set => SourceAppointment.CustomFields["Originator"] = value;
+ }
public CompactEmployeeDC Originator
{
- get { return (CompactEmployeeDC)EditedAppointmentCopy.CustomFields["Originator"]; }
- set { EditedAppointmentCopy.CustomFields["Originator"] = value; }
+ get => (CompactEmployeeDC)EditedAppointmentCopy.CustomFields["Originator"];
+ set => EditedAppointmentCopy.CustomFields["Originator"] = value;
}
- bool SourceIsPrivate
+ private bool SourceIsPrivate
{
- get { return (bool)SourceAppointment.CustomFields["IsPrivate"]; }
- set { SourceAppointment.CustomFields["IsPrivate"] = value; }
+ get => (bool)SourceAppointment.CustomFields["IsPrivate"];
+ set => SourceAppointment.CustomFields["IsPrivate"] = value;
}
public bool IsPrivate
{
- get { return (bool)EditedAppointmentCopy.CustomFields["IsPrivate"]; }
- set { EditedAppointmentCopy.CustomFields["IsPrivate"] = value; }
+ get => (bool)EditedAppointmentCopy.CustomFields["IsPrivate"];
+ set => EditedAppointmentCopy.CustomFields["IsPrivate"] = value;
}
public override bool IsAppointmentChanged()
{
if (base.IsAppointmentChanged())
- return true;
+ {
+ return true;
+ }
if (SourceResourceList != null && ResourceList != null ||
SourceEmployeeList != null && EmployeeList != null ||
SourceCustomerList != null && CustomerList != null ||
SourceOriginator != null && Originator != null)
- return false;
+ {
+ return false;
+ }
var resourceListsAreEqual = SourceResourceList == null || ResourceList == null || !Equals(SourceResourceList, ResourceList);
var employeeListsAreEqual = SourceEmployeeList == null || EmployeeList == null || !Equals(SourceEmployeeList, EmployeeList);
diff --git a/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs b/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs
index fd8c5a9d5..713b24bda 100644
--- a/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs
+++ b/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs
@@ -41,31 +41,31 @@ namespace BeWo.Scheduler.ViewModel
return settings;
}
- private BindingList _appointmentList;
+ private BindingList _AppointmentList;
public BindingList Appointments
{
get
{
- if (_appointmentList != null)
+ if (_AppointmentList != null)
{
- return _appointmentList;
+ return _AppointmentList;
}
- _appointmentList = new BindingList();
- _appointmentList.AddingNew += AppointmentListAddingNew;
+ _AppointmentList = new BindingList();
+ _AppointmentList.AddingNew += AppointmentListAddingNew;
foreach (var item in VMList)
{
- _appointmentList.Add(item);
+ _AppointmentList.Add(item);
}
- return _appointmentList;
+ return _AppointmentList;
}
}
- private readonly List _allCustomers;
- private readonly List _allEmployees;
- private readonly Dictionary> _categories2Resources;
+ private readonly List _AllCustomers;
+ private readonly List _AllEmployees;
+ private readonly Dictionary> _Categories2Resources;
private static void AppointmentListAddingNew(object sender, AddingNewEventArgs e)
{
@@ -82,22 +82,22 @@ namespace BeWo.Scheduler.ViewModel
e.NewObject = neu;
}
- private Dictionary>> _changedOccurencyCustomFields;
+ private Dictionary>> _ChangedOccurencyCustomFields;
public Dictionary>> ChangedOccurencyCustomFields { get; }
- public List AllCustomers => _allCustomers;
+ public List AllCustomers => _AllCustomers;
- public List AllEmployees => _allEmployees;
+ public List AllEmployees => _AllEmployees;
- public Dictionary> Categories2Resources => _categories2Resources;
+ public Dictionary> Categories2Resources => _Categories2Resources;
- private Appointment _geoeffneterTermin;
+ private Appointment _GeoeffneterTermin;
public SchedulerAppointmentListVM(List appList, List allCustomers, List allEmployees, Dictionary> lCategoriesToResources) : base(appList)
{
- _categories2Resources = lCategoriesToResources;
- _allCustomers = allCustomers;
- _allEmployees = allEmployees;
+ _Categories2Resources = lCategoriesToResources;
+ _AllCustomers = allCustomers;
+ _AllEmployees = allEmployees;
InitChangedOccurrencyCustomFields(appList.Where(t => t.Type == 3).ToList());
@@ -185,9 +185,9 @@ namespace BeWo.Scheduler.ViewModel
}
}
- if (item.Type.Equals(AppointmentType.ChangedOccurrence) && _geoeffneterTermin != null)
+ if (item.Type.Equals(AppointmentType.ChangedOccurrence) && _GeoeffneterTermin != null)
{
- sindGleich = _geoeffneterTermin.Equals(item);
+ sindGleich = _GeoeffneterTermin.Equals(item);
}
if(!sindGleich)
@@ -341,16 +341,16 @@ namespace BeWo.Scheduler.ViewModel
var id = new Guid(app.RecurrenceInfo.Id.ToString());
- if (_changedOccurencyCustomFields.ContainsKey(id) && _changedOccurencyCustomFields[id].ContainsKey(index))
+ if (_ChangedOccurencyCustomFields.ContainsKey(id) && _ChangedOccurencyCustomFields[id].ContainsKey(index))
{
if (app.Type.Equals(AppointmentType.ChangedOccurrence))
{
- app.CustomFields[CustomField_EmployeeList] = _changedOccurencyCustomFields[id][index][CustomField_EmployeeList];
- app.CustomFields[CustomField_CustomerList] = _changedOccurencyCustomFields[id][index][CustomField_CustomerList];
- app.CustomFields[CustomField_ResourceList] = _changedOccurencyCustomFields[id][index][CustomField_ResourceList];
- app.CustomFields[CustomField_Originator] = _changedOccurencyCustomFields[id][index][CustomField_Originator];
- app.CustomFields[CustomField_IsPrivate] = _changedOccurencyCustomFields[id][index][CustomField_IsPrivate];
- app.CustomFields[CustomField_IsAbsenceTime] = _changedOccurencyCustomFields[id][index][CustomField_IsAbsenceTime];
+ app.CustomFields[CustomField_EmployeeList] = _ChangedOccurencyCustomFields[id][index][CustomField_EmployeeList];
+ app.CustomFields[CustomField_CustomerList] = _ChangedOccurencyCustomFields[id][index][CustomField_CustomerList];
+ app.CustomFields[CustomField_ResourceList] = _ChangedOccurencyCustomFields[id][index][CustomField_ResourceList];
+ app.CustomFields[CustomField_Originator] = _ChangedOccurencyCustomFields[id][index][CustomField_Originator];
+ app.CustomFields[CustomField_IsPrivate] = _ChangedOccurencyCustomFields[id][index][CustomField_IsPrivate];
+ app.CustomFields[CustomField_IsAbsenceTime] = _ChangedOccurencyCustomFields[id][index][CustomField_IsAbsenceTime];
}
}
}
@@ -360,52 +360,52 @@ namespace BeWo.Scheduler.ViewModel
AbstractAppointmentEditForm ISchedulerViewModel.GetEditAppointmentForm(SchedulerControl control, Appointment appointment)
{
- _geoeffneterTermin = control.Storage.CreateAppointment(AppointmentType.Normal);
- _geoeffneterTermin.AllDay = appointment.AllDay;
- _geoeffneterTermin.Start = appointment.Start;
- _geoeffneterTermin.End = appointment.End;
- _geoeffneterTermin.Description = appointment.Description;
+ _GeoeffneterTermin = control.Storage.CreateAppointment(AppointmentType.Normal);
+ _GeoeffneterTermin.AllDay = appointment.AllDay;
+ _GeoeffneterTermin.Start = appointment.Start;
+ _GeoeffneterTermin.End = appointment.End;
+ _GeoeffneterTermin.Description = appointment.Description;
foreach (CustomField cf in appointment.CustomFields)
{
- _geoeffneterTermin.CustomFields[cf.Name] = cf.Value;
+ _GeoeffneterTermin.CustomFields[cf.Name] = cf.Value;
}
if (!appointment.Type.Equals(AppointmentType.ChangedOccurrence))
{
- return new SchedulerAppointmentEditForm(this, control, appointment, _allEmployees, _allCustomers, _categories2Resources);
+ return new SchedulerAppointmentEditForm(this, control, appointment, _AllEmployees, _AllCustomers, _Categories2Resources);
}
var index = appointment.RecurrenceIndex;
var id = new Guid(appointment.RecurrenceInfo.Id.ToString());
- if (_changedOccurencyCustomFields.ContainsKey(id) && _changedOccurencyCustomFields[id].ContainsKey(index.ToString()))
+ if (_ChangedOccurencyCustomFields.ContainsKey(id) && _ChangedOccurencyCustomFields[id].ContainsKey(index.ToString()))
{
- var specialCustomFields = _changedOccurencyCustomFields[id][index.ToString()];
+ var specialCustomFields = _ChangedOccurencyCustomFields[id][index.ToString()];
foreach (var cf in specialCustomFields)
{
appointment.CustomFields[cf.Key] = cf.Value;
- _geoeffneterTermin.CustomFields[cf.Key] = cf.Value;
+ _GeoeffneterTermin.CustomFields[cf.Key] = cf.Value;
}
}
- return new SchedulerAppointmentEditForm(this, control, appointment, _allEmployees, _allCustomers, _categories2Resources);
+ return new SchedulerAppointmentEditForm(this, control, appointment, _AllEmployees, _AllCustomers, _Categories2Resources);
}
public void ApplyChangesToChangedOccurencyCustomFields(List employees, List customers, List resources, CompactEmployeeDC originator, bool isPrivate, string index, Guid id)
{
- if (!_changedOccurencyCustomFields.ContainsKey(id) || !_changedOccurencyCustomFields[id].ContainsKey(index))
+ if (!_ChangedOccurencyCustomFields.ContainsKey(id) || !_ChangedOccurencyCustomFields[id].ContainsKey(index))
{
return;
}
- _changedOccurencyCustomFields[id][index][CustomField_EmployeeList] = employees;
- _changedOccurencyCustomFields[id][index][CustomField_CustomerList] = customers;
- _changedOccurencyCustomFields[id][index][CustomField_ResourceList] = resources;
- _changedOccurencyCustomFields[id][index][CustomField_Originator] = originator;
- _changedOccurencyCustomFields[id][index][CustomField_IsPrivate] = isPrivate;
+ _ChangedOccurencyCustomFields[id][index][CustomField_EmployeeList] = employees;
+ _ChangedOccurencyCustomFields[id][index][CustomField_CustomerList] = customers;
+ _ChangedOccurencyCustomFields[id][index][CustomField_ResourceList] = resources;
+ _ChangedOccurencyCustomFields[id][index][CustomField_Originator] = originator;
+ _ChangedOccurencyCustomFields[id][index][CustomField_IsPrivate] = isPrivate;
}
public void AddCustomFieldsMapping(SchedulerStorage schedulerStorage)
@@ -519,8 +519,8 @@ namespace BeWo.Scheduler.ViewModel
var istEigen = ersteller.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid);
- var mVorhanden = appEList.Any(a2app => _allEmployees.Contains(a2app.Employee));
- var kVorhanden = customerList.Any(_allCustomers.Contains);
+ var mVorhanden = appEList.Any(a2app => _AllEmployees.Contains(a2app.Employee));
+ var kVorhanden = customerList.Any(_AllCustomers.Contains);
wirdAngezeigt = liste[0] && mVorhanden || liste[1] && resourceList.Any() || liste[2] && kVorhanden;
@@ -548,7 +548,7 @@ namespace BeWo.Scheduler.ViewModel
public void InitChangedOccurrencyCustomFields(IEnumerable appList)
{
- _changedOccurencyCustomFields = new Dictionary>>();
+ _ChangedOccurencyCustomFields = new Dictionary>>();
foreach (var termin in appList)
{
@@ -580,17 +580,17 @@ namespace BeWo.Scheduler.ViewModel
var id = new Guid(ri.Id.ToString());
- if(!_changedOccurencyCustomFields.ContainsKey(id))
+ if(!_ChangedOccurencyCustomFields.ContainsKey(id))
{
- _changedOccurencyCustomFields.Add(id, new Dictionary> { { index, customFieldCollection } });
+ _ChangedOccurencyCustomFields.Add(id, new Dictionary> { { index, customFieldCollection } });
}
- else if(!_changedOccurencyCustomFields[id].ContainsKey(index))
+ else if(!_ChangedOccurencyCustomFields[id].ContainsKey(index))
{
- _changedOccurencyCustomFields[id].Add(index, customFieldCollection);
+ _ChangedOccurencyCustomFields[id].Add(index, customFieldCollection);
}
else
{
- _changedOccurencyCustomFields[id][index] = customFieldCollection;
+ _ChangedOccurencyCustomFields[id][index] = customFieldCollection;
}
}
}
diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs
index 7cc98016e..ba1b072df 100644
--- a/BeWoPlanerMobil/Controllers/MainController.cs
+++ b/BeWoPlanerMobil/Controllers/MainController.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
-using System.Web;
using System.Web.Mvc;
using BeWoPlanerMobil.Models;
diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs
index afc0aeb6b..e0d3acc65 100644
--- a/Data/Access/SearchDAO.cs
+++ b/Data/Access/SearchDAO.cs
@@ -1170,7 +1170,6 @@ namespace BeWo.Data.Access
return c.List().Count > 0;
}
- //TODO: Hier vielleicht die neue CreateRecurrenceCriteria-Methode benutzen?
public bool OverlappingAppointmentsExist(DateTime start, DateTime end, IEnumerable employees, IEnumerable customers, IEnumerable resources, long originator, long? appointmentOid, string recurrenceId = "", int occurrenceIndex = 0)
{
var criteria = CreateCriteria()
@@ -1199,67 +1198,6 @@ namespace BeWo.Data.Access
)
);
- // TODO: nicht wichtig - ignorieren
- // TODO: RecurrenceInfo in die Parameter aufnehmen (wie beim Laden der Termine)
- // TODO: Periodicity beachten! OR RecurrenceInfo NOT LIKE '%Range%' AND RecurrenceInfo NOT LIKE '%Index%'
- // OR RecurrenceInfo NOT LIKE '%Range%' AND RecurrenceInfo NOT LIKE '%Index%'
-
- //var recurrenceBetween = String.Format(
- // "'{0} 00:00:00' BETWEEN STR_TO_DATE(SUBSTRING({1}, 24, 19), '%m/%d/%Y %H:%i:%s') AND STR_TO_DATE(SUBSTRING({1}, 50, 19), '%m/%d/%Y %H:%i:%s') " +
- // "AND(" +
- // "(" +
- // "(" +
- // "TIME({5}) > '{2}' AND TIME({5}) < '{3}'" +
- // ") " +
- // "OR(" +
- // "TIME({4}) > '{2}' AND TIME({4}) < '{3}'" +
- // ")" +
- // ") " +
- // "OR (" +
- // "(" +
- // "TIME({4}) > '{2}' AND TIME({5}) < '{2}'" +
- // ") " +
- // "OR(" +
- // "TIME({4}) > '{2}' AND TIME({5}) < '{3}'" +
- // ")" +
- // ")" +
- // ") OR {1} NOT LIKE '%Range=\"%' AND Type <> 3 AND Type <> 4",
- // start.ToString("yyyy-MM-dd"),
- // SchedulerAppointment.PropertyName_RecurrenceInfo,
- // start.ToString("HH:mm:ss"),
- // end.ToString("HH:mm:ss"),
- // SchedulerAppointment.PropertyName_StartDate,
- // SchedulerAppointment.PropertyName_EndDate);
-
- //criteria = CreateCriteria()
- // .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Active))
- // .Add(Restrictions.Or(
- // Restrictions.Or(
- // Restrictions.Or(
- // Restrictions.And(
- // Restrictions.Gt(SchedulerAppointment.PropertyName_EndDate, start),
- // Restrictions.Lt(SchedulerAppointment.PropertyName_EndDate, end)
- // ),
- // Restrictions.And(
- // Restrictions.Gt(SchedulerAppointment.PropertyName_StartDate, start),
- // Restrictions.Lt(SchedulerAppointment.PropertyName_StartDate, end)
- // )
- // ),
- // Restrictions.Or(
- // Restrictions.And(
- // Restrictions.Lt(SchedulerAppointment.PropertyName_StartDate, start),
- // Restrictions.Gt(SchedulerAppointment.PropertyName_EndDate, start)
- // ),
- // Restrictions.And(
- // Restrictions.Eq(SchedulerAppointment.PropertyName_StartDate, start),
- // Restrictions.Eq(SchedulerAppointment.PropertyName_EndDate, end)
- // )
- // )
- // ),
- // Expression.Sql(new SqlString(recurrenceBetween))
- // )
- // );
-
if (appointmentOid != null)
{
criteria.Add(Restrictions.Not(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, appointmentOid)));
@@ -1399,38 +1337,6 @@ namespace BeWo.Data.Access
return c.List();
}
- // Veraltet. Wird nicht mehr benutzt
- public IEnumerable FindAppointmentsForPrintingForEmployee(long employeeOid, List selectedDates, List userRights)
- {
- var abfrage = "SELECT Oid FROM newschedulerappointment WHERE IsActive = 1 AND ";
- var or = string.Empty;
-
- foreach (var d in selectedDates)
- {
- // TODO: RecurrenceInfo hat nicht immer ein Enddatum
- or += string.Format("StartDate LIKE '{0}%' OR RecurrenceInfo IS NOT NULL AND '{0} 00:00:00' BETWEEN STR_TO_DATE(SUBSTRING({1}, 24, 19), '%m/%d/%Y %H:%i:%s') AND STR_TO_DATE(SUBSTRING({1}, 50, 19), '%m/%d/%Y %H:%i:%s')", d.ToString("yyyy-MM-dd"), SchedulerAppointment.PropertyName_RecurrenceInfo);
- if (selectedDates.IndexOf(d) < selectedDates.Count - 1)
- {
- or += " OR ";
- }
- }
-
- abfrage += or;
- var sa = Session.CreateSQLQuery(abfrage);
- var l = sa.List().ToList();
-
- var c = CreateCriteria()
- .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Active))
- .Add(Restrictions.In(BeWoEntityBase.PropertyName_Oid, l));
-
- c.CreateCriteria(SchedulerAppointment.PropertyName_EmployeeList)
- .Add(Restrictions.And(
- Restrictions.Eq(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", employeeOid),
- Restrictions.Not(Restrictions.Eq(Employee2SchedulerAppointment.PropertyName_ParticipationAnswer, ParticipationAnswer.Absage))));
-
- return c.List();
- }
-
public IEnumerable GetActiveTextModuleByServiceCategory(long pServiceCategoryOid)
{
var c = CreateCriteriaIsActive();
@@ -1724,7 +1630,6 @@ namespace BeWo.Data.Access
return c.List();
}
-
public IEnumerable FindAllChatActiveEmployees()
{
@@ -2038,10 +1943,9 @@ namespace BeWo.Data.Access
return c;
}
- public ServiceRecord FindServiceRecordforHistory(long? ServiceRecordOid)
+ public ServiceRecord FindServiceRecordforHistory(long? pServiceRecordOid)
{
- var c =
- CreateCriteria().Add(Restrictions.Eq(ServiceRecord.PropertyName_Oid, ServiceRecordOid));
+ var c = CreateCriteria().Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, pServiceRecordOid));
return c.UniqueResult();
}