diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 7a6ee61b6..cedf2a568 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -605,6 +605,9 @@ ProxyLoginView.xaml + + + SchulbegleitenderDienstEmployeeView.xaml diff --git a/BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs b/BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs new file mode 100644 index 000000000..21e797594 --- /dev/null +++ b/BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; + +using BeWo.Scheduler.ViewModel; +using DevExpress.Xpf.Scheduler.Drawing; +using DevExpress.XtraScheduler; + +namespace BeWo.Scheduler.Converter +{ + public class AppointmentBackgroundConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + var farbe = Color.FromRgb(192, 255, 208); + + if (!(value is VisualAppointmentViewInfo customViewInfo)) + { + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + + var customFields = (CustomFieldCollection) customViewInfo.CustomViewInfo; + + var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)]; + + if(isTaskValue != null && (bool)isTaskValue) + { + farbe = Color.FromRgb(153, 59, 59); + } + + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + catch (Exception) + { + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(Color.FromRgb(192, 255, 208), 1) }, new Point(.5, 0), new Point(.5, 1)); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs b/BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs new file mode 100644 index 000000000..b7a6d3b6e --- /dev/null +++ b/BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs @@ -0,0 +1,40 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; + +using BeWo.Scheduler.ViewModel; + +using DevExpress.XtraScheduler; + +namespace BeWo.Scheduler.Converter +{ + public class AppointmentForegroundConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var farbe = Color.FromRgb(0, 0, 0); + + if(!(value is CustomFieldCollection customViewInfo)) + { + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + + var isTaskValue = customViewInfo[nameof(SchedulerAppointmentVM.IsTask)]; + var isTask = (bool?) isTaskValue ?? false; + + if (isTask) + { + farbe = Color.FromRgb(224, 224, 224); + } + + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs b/BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs new file mode 100644 index 000000000..ef0090b4f --- /dev/null +++ b/BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +using BeWo.Scheduler.ViewModel; + +using DevExpress.Xpf.Scheduler.Drawing; +using DevExpress.XtraScheduler; + +namespace BeWo.Scheduler.Converter +{ + public class AppointmentToolTipTextConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is VisualAppointmentViewInfo viewInfo)) + { + return string.Empty; + } + + var result = viewInfo.Subject; + + var customFields = (CustomFieldCollection) viewInfo.CustomViewInfo; + + var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)]; + + var isTask = (bool?) isTaskValue ?? false; + + if (!isTask) + { + return result; + } + + var completedDate = (DateTime?) customFields[nameof(SchedulerAppointmentVM.CompletedDate)]; + var dueDate = (DateTime?) customFields[nameof(SchedulerAppointmentVM.DueDate)]; + + if (completedDate.HasValue) + { + return result + " erledigt am " + completedDate.Value.ToShortDateString(); + } + + if(dueDate.HasValue) + { + return result + " bis " + dueDate.Value.ToString("dd.MM.yyyy HH:mm"); + } + + return string.Empty; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Scheduler/IBeWoAppointment.cs b/BeWo/Scheduler/IBeWoAppointment.cs index fcbe9eeb3..48c118490 100644 --- a/BeWo/Scheduler/IBeWoAppointment.cs +++ b/BeWo/Scheduler/IBeWoAppointment.cs @@ -22,8 +22,8 @@ namespace BeWo.Scheduler bool AllDay { get; set; } int EventType { get; set; } - - string RecurrenceInfo { get; set; } + + string RecurrenceInfo { get; set; } Dictionary CustomFields { get; } } diff --git a/BeWo/Scheduler/ISchedulerViewModel.cs b/BeWo/Scheduler/ISchedulerViewModel.cs index deabbd317..b3900a820 100644 --- a/BeWo/Scheduler/ISchedulerViewModel.cs +++ b/BeWo/Scheduler/ISchedulerViewModel.cs @@ -25,7 +25,7 @@ namespace BeWo.Scheduler BindingList Appointments { get; } - Dictionary>> ChangedOccurencyCustomFields { get; } + Dictionary>> ChangedOccurenceCustomFields { get; } void UpdateViewModel(IEnumerable updatedDcList); @@ -39,7 +39,9 @@ namespace BeWo.Scheduler void InitNewAppointment(Appointment appointment); - bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes); + void InitNewTask(Appointment pAppointment, DateTime? pDueDate, IEnumerable pSelectedEmployees, IEnumerable pSelectedCustomers, IEnumerable pSelectedResources); + + bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes, bool pShowTasks); void InitChangedOccurrencyCustomFields(IEnumerable appList); } diff --git a/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs b/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs index 4c4e5618a..6e9f9d438 100644 --- a/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs +++ b/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs @@ -91,34 +91,28 @@ namespace BeWo.Scheduler.View for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { var child = VisualTreeHelper.GetChild(obj, i); - if (child is WeekOfMonthEdit) + if (child is WeekOfMonthEdit edt1) { - var edt = child as WeekOfMonthEdit; + edt1.CustomDisplayText -= EditCustomDisplayText; + edt1.CustomDisplayText += EditCustomDisplayText; - edt.CustomDisplayText -= EditCustomDisplayText; - edt.CustomDisplayText += EditCustomDisplayText; - - foreach (var womEditItem in edt.Items) + foreach (var womEditItem in edt1.Items) { - var ne = womEditItem as NamedElement; - if (ne != null) + if (womEditItem is NamedElement ne) { ne.Caption = Translate(ne.Caption); } } } - if (child is WeekDaysEdit) + if (child is WeekDaysEdit edt) { - var edt = child as WeekDaysEdit; - edt.CustomDisplayText -= EditCustomDisplayText; edt.CustomDisplayText += EditCustomDisplayText; foreach (var womEditItem in edt.Items) { - var ne = womEditItem as NamedElement; - if (ne != null) + if (womEditItem is NamedElement ne) { ne.Caption = Translate(ne.Caption); } diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml b/BeWo/Scheduler/View/NewSchedulerView.xaml index 580f4aa95..9c1de4f12 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml @@ -23,6 +23,7 @@ + - + - +