Intervallfinder überarbeitet & Bug gefixt, der zu einem Fehler beim Suchen nach freien Intervallen über mehrere Tage geführt hatte, wenn die Enduhrzeit vor der Startuhrzeit lag. Berichte mit Parametern. Verbesserte Mitarbeiter-, Klienten-, Team-, und Organisationsdropdowns mit Suche. Quittierungsbelegresultate (zum Unterschreiben) wird wie die Zeiterfassung paginiert. FaC: neuer Kalender noch nicht fertig.
222 lines
8.5 KiB
C#
222 lines
8.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using BeWo.Scheduling.SchedulingUtils;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using DevExpress.Xpf.Scheduling;
|
|
using DevExpress.XtraScheduler;
|
|
using SchedulerControl = DevExpress.Xpf.Scheduling.SchedulerControl;
|
|
using Utils = BS.Shared.Core.Utils;
|
|
|
|
namespace BeWo.Scheduling.ViewModel
|
|
{
|
|
public class AppointmentWindowVM : AppointmentWindowViewModel
|
|
{
|
|
#region Verfügbage Mitarbeiter, Klienten und Ressourcen
|
|
private ObservableCollection<CompactEmployeeDC> _AllEmployees;
|
|
public ObservableCollection<CompactEmployeeDC> AllEmployees
|
|
{
|
|
get => _AllEmployees;
|
|
set
|
|
{
|
|
if(!ICollectionExtensions.ListEquals(_AllEmployees, value))
|
|
{
|
|
_AllEmployees = value;
|
|
|
|
RaisePropertyChanged(nameof(AllEmployees));
|
|
}
|
|
}
|
|
}
|
|
|
|
private ObservableCollection<CompactCustomerDC> _AllCustomers;
|
|
public ObservableCollection<CompactCustomerDC> AllCustomers
|
|
{
|
|
get => _AllCustomers;
|
|
set
|
|
{
|
|
if(!ICollectionExtensions.ListEquals(_AllCustomers, value))
|
|
{
|
|
_AllCustomers = value;
|
|
|
|
RaisePropertyChanged(nameof(AllCustomers));
|
|
}
|
|
}
|
|
}
|
|
|
|
private ObservableDictionary<CategoryDependencyObject, List<ResourceDependencyObject>> _AllCategories2Resources;
|
|
public ObservableDictionary<CategoryDependencyObject, List<ResourceDependencyObject>> AllCategories2Resources
|
|
{
|
|
get => _AllCategories2Resources;
|
|
set
|
|
{
|
|
if(!SchedulingUtils.Utils.Categories2ResourcesEquals(_AllCategories2Resources, value))
|
|
{
|
|
_AllCategories2Resources = value;
|
|
|
|
RaisePropertiesChanged(nameof(AllCategories2Resources));
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
public string OriginalRecurrenceInfo { get; }
|
|
|
|
public SchedulingAppointmentVM ActualViewModel { get; }
|
|
|
|
public ObservableCollection<Employee2SchedulerAppointmentDC> EmployeeList
|
|
{
|
|
get => ActualViewModel.EmployeeList; //Appointment.CustomFields["EmployeeList"] as ObservableCollection<Employee2SchedulerAppointmentDC>;
|
|
set => ActualViewModel.EmployeeList = value; //Appointment.CustomFields["EmployeeList"] = value;
|
|
}
|
|
|
|
public List<CompactCustomerDC> CustomerList
|
|
{
|
|
get => ActualViewModel.CustomerList; //Appointment.CustomFields["CustomerList"] as List<CompactCustomerDC>;
|
|
set => ActualViewModel.CustomerList = value; //Appointment.CustomFields["CustomerList"] = value;
|
|
}
|
|
|
|
public List<ResourceDC> ResourceList
|
|
{
|
|
get => ActualViewModel.ResourceList; //Appointment.CustomFields["ResourceList"] as List<ResourceDC>;
|
|
set => ActualViewModel.ResourceList = value; //Appointment.CustomFields["ResourceList"] = value;
|
|
}
|
|
|
|
public ObservableCollection<CompactSupportConceptDC> SupportConceptList
|
|
{
|
|
get => ActualViewModel.SupportConceptList; //Appointment.CustomFields["SupportConceptList"] as List<CompactSupportConceptDC>;
|
|
set => ActualViewModel.SupportConceptList = value; //Appointment.CustomFields["SupportConceptList"] = value;
|
|
}
|
|
|
|
public bool IsTask
|
|
{
|
|
get => ActualViewModel.IsTask; //Appointment.CustomFields["IsTask"] is bool isTask && isTask;
|
|
set => ActualViewModel.IsTask = value; //Appointment.CustomFields["IsTask"] = value;
|
|
}
|
|
|
|
public bool IsPrivate
|
|
{
|
|
get => ActualViewModel.IsPrivate; //Appointment.CustomFields["IsPrivate"] is bool isPrivate && isPrivate;
|
|
set => ActualViewModel.IsPrivate = value; //Appointment.CustomFields["IsPrivate"] = value;
|
|
}
|
|
|
|
public bool IsReadyOnly { get; }
|
|
|
|
public bool IsNew => ActualViewModel?.IsNew ?? false;
|
|
|
|
public CompactEmployeeDC Originator
|
|
{
|
|
get => ActualViewModel.Originator; //Appointment.CustomFields["Originator"] as CompactEmployeeDC;
|
|
set => ActualViewModel.Originator = value; //Appointment.CustomFields["Originator"] = value;
|
|
}
|
|
|
|
public bool IsAbsenceTime => ActualViewModel.IsAbsenceTime; //Appointment.CustomFields["IsAbsenceTime"] is bool isAbsenceTime && isAbsenceTime;
|
|
|
|
public string TaskDescription
|
|
{
|
|
get => ActualViewModel.TaskDescription; //Appointment.CustomFields["TaskDescription"] as string;
|
|
set => ActualViewModel.TaskDescription = value; //Appointment.CustomFields["TaskDescription"] = value;
|
|
}
|
|
|
|
public string CompletedNotice
|
|
{
|
|
get => ActualViewModel.CompletedNotice; //Appointment.CustomFields["CompletedNotice"] as string;
|
|
set => ActualViewModel.CompletedNotice = value; //Appointment.CustomFields["CompletedNotice"] = value;
|
|
}
|
|
|
|
public DateTime? CompletedDate
|
|
{
|
|
get => ActualViewModel.CompletedDate; //Appointment.CustomFields["CompletedDate"] as DateTime?;
|
|
set => ActualViewModel.CompletedDate = value; //Appointment.CustomFields["CompletedDate"] = value;
|
|
}
|
|
|
|
public DateTime? DueDate
|
|
{
|
|
get => ActualViewModel.DueDate; //Appointment.CustomFields["DueDate"] as DateTime?;
|
|
set => ActualViewModel.DueDate = value; //Appointment.CustomFields["DueDate"] = value;
|
|
}
|
|
|
|
public DateTime? DueTime
|
|
{
|
|
get => ActualViewModel.DueTime; //Appointment.CustomFields["DueTime"] as DateTime?;
|
|
set => ActualViewModel.DueTime = value; //Appointment.CustomFields["DueTime"] = value;
|
|
}
|
|
|
|
public long? Oid => Appointment.Id as long?;
|
|
|
|
public string RecurrenceTypeName => TranslateRecurrenceInfoType();
|
|
|
|
|
|
public ObservableCollection<string> AvailableAppointmentRecurrenceTypes
|
|
{
|
|
get;
|
|
}
|
|
|
|
public Visibility RecurrenceButtonVisibility => (Appointment.Type == AppointmentType.Pattern || Appointment.Type == AppointmentType.Normal) && !IsTask ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
public AppointmentWindowVM(
|
|
AppointmentItem appointmentItem,
|
|
SchedulerControl scheduler,
|
|
ObservableCollection<CompactEmployeeDC> allEmployees,
|
|
ObservableCollection<CompactCustomerDC> allCustomers,
|
|
ObservableDictionary<CategoryDependencyObject, List<ResourceDependencyObject>> allCategories2Resources,
|
|
CompactEmployeeDC originator,
|
|
List<long> teamMemberCustomerOids,
|
|
SchedulingAppointmentVM viewModel)
|
|
: base(appointmentItem, scheduler)
|
|
{
|
|
ActualViewModel = viewModel;
|
|
|
|
OriginalRecurrenceInfo = viewModel.RecurrenceInfo;
|
|
|
|
AllEmployees = allEmployees;
|
|
AllCustomers = allCustomers;
|
|
AllCategories2Resources = allCategories2Resources;
|
|
|
|
ActualViewModel.Originator = originator;
|
|
|
|
ActualViewModel.SetDirty(false);
|
|
|
|
var userRightsCheckType = IsNew ? SchedulerRightsCheckType.Create : SchedulerRightsCheckType.Edit;
|
|
|
|
IsReadyOnly = !Utils.CheckSchedulerRights(CustomerList.ToList(), ResourceList.ToList(), EmployeeList.ToList(), Originator, IsNew, userRightsCheckType, BeWoApp.LoggedOnUser, teamMemberCustomerOids);
|
|
|
|
AvailableAppointmentRecurrenceTypes = new ObservableCollection<string>
|
|
{
|
|
"(keine)",
|
|
"täglich",
|
|
"wöchentlich",
|
|
"monatlich",
|
|
"jährlich"
|
|
};
|
|
}
|
|
|
|
private string TranslateRecurrenceInfoType()
|
|
{
|
|
if(RecurrenceInfo is null)
|
|
{
|
|
return "(keine)";
|
|
}
|
|
|
|
switch(RecurrenceInfo.Type)
|
|
{
|
|
case RecurrenceType.Daily:
|
|
return "täglich";
|
|
case RecurrenceType.Weekly:
|
|
return "wöchentlich";
|
|
case RecurrenceType.Monthly:
|
|
return "monatlich";
|
|
case RecurrenceType.Yearly:
|
|
return "jährlich";
|
|
default:
|
|
return "(keine)";
|
|
}
|
|
}
|
|
}
|
|
}
|