Die Abfrage nach der Ressourcenbelegung kommt nur ein mal und das Abbrechen des Speicherns hat keinen "kaputten" Reload zur Folge
Das Löschen eines Serientermins mit veränderten oder gelöschten Elementen führt zu keiner Exception mehr, da ich den Service-Aufruf auf synchron geändert habe.
Es gibt allerdings noch Bugs! -> Serientermin erstellen und ein Element davon ändern führt zu einer doppelten Abfrage, ausgelöst durch die Überlappungsprüfung, die eine Überlappung mit der Serie selbst feststellt!
318 lines
9.7 KiB
C#
318 lines
9.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BS.Shared;
|
|
|
|
namespace BeWo.Data.Entities
|
|
{
|
|
public class SchedulerAppointment : BeWoEntityBase
|
|
{
|
|
public static string PropertyName_AllDay = "AllDay";
|
|
public static string PropertyName_CustomerList = "CustomerList";
|
|
public static string PropertyName_EmployeeList = "EmployeeList";
|
|
public static string PropertyName_EndDate = "EndDate";
|
|
public static string PropertyName_IsPrivate = "IsPrivate";
|
|
public static string PropertyName_Location = "Location";
|
|
public static string PropertyName_Originator = "Originator";
|
|
public static string PropertyName_RecurrenceInfo = "RecurrenceInfo";
|
|
public static string PropertyName_ReminderInfo = "ReminderInfo";
|
|
public static string PropertyName_ResourceList = "ResourceList";
|
|
public static string PropertyName_StartDate = "StartDate";
|
|
public static string PropertyName_Status = "Status";
|
|
public static string PropertyName_Subject = "Subject";
|
|
public static string PropertyName_Type = "Type";
|
|
public static string PropertyName_FormerBookingSequenceOid = "FormerBookingSequenceOid";
|
|
public static string PropertyName_Notice2 = "Notice2";
|
|
public static string PropertyName_Notice3 = "Notice3";
|
|
public static string PropertyName_Notice4 = "Notice4";
|
|
public static string PropertyName_Notice5 = "Notice5";
|
|
public static string PropertyName_IsTask = nameof(IsTask);
|
|
public static string PropertyName_CompletedNotice = nameof(CompletedNotice);
|
|
public static string PropertyName_CompletedDate = nameof(CompletedDate);
|
|
public static string PropertyName_TaskDescription = nameof(TaskDescription);
|
|
public static string PropertyName_DueDate = nameof(DueDate);
|
|
public static string PropertyName_SupportConceptList = nameof(SupportConceptList);
|
|
|
|
|
|
private IList<Employee2SchedulerAppointment> _EmployeeList;
|
|
private IList<Customer> _CustomerList;
|
|
private IList<Resource> _ResourceList;
|
|
private IList<SupportConcept> _SupportConceptList;
|
|
private bool _IsPrivate;
|
|
private Employee _Originator;
|
|
private long? _FormerBookingSequenceOid;
|
|
private string _Notice2;
|
|
private string _Notice3;
|
|
private string _Notice4;
|
|
private string _Notice5;
|
|
private long? _FormerTaskOid;
|
|
private bool _HasServiceRecordEntry;
|
|
|
|
public virtual bool HasServiceRecordEntry
|
|
{
|
|
get => _HasServiceRecordEntry;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_HasServiceRecordEntry, value))
|
|
{
|
|
_HasServiceRecordEntry = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Customer> CustomerList
|
|
{
|
|
get => _CustomerList ?? (_CustomerList = new List<Customer>());
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_CustomerList, value))
|
|
{
|
|
_CustomerList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual bool IsPrivate
|
|
{
|
|
get => _IsPrivate;
|
|
set
|
|
{
|
|
if(AreDifferent(_IsPrivate, value))
|
|
{
|
|
_IsPrivate = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual Employee Originator
|
|
{
|
|
get => _Originator;
|
|
set
|
|
{
|
|
if(AreDifferent(_Originator, value))
|
|
{
|
|
_Originator = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Resource> ResourceList
|
|
{
|
|
get => _ResourceList ?? (_ResourceList = new List<Resource>());
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_ResourceList, value))
|
|
{
|
|
_ResourceList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Employee2SchedulerAppointment> EmployeeList
|
|
{
|
|
get => _EmployeeList ?? (_EmployeeList = new List<Employee2SchedulerAppointment>());
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_EmployeeList, value))
|
|
{
|
|
_EmployeeList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public SchedulerAppointment()
|
|
{
|
|
_Tid = TableID.NewSchedulerAppointment;
|
|
}
|
|
|
|
public virtual bool AllDay { get; set; }
|
|
public virtual DateTime? EndDate { get; set; }
|
|
public virtual string Location { get; set; }
|
|
public virtual string RecurrenceInfo { get; set; }
|
|
public virtual string ReminderInfo { get; set; }
|
|
public virtual DateTime? StartDate { get; set; }
|
|
public virtual int Status { get; set; }
|
|
public virtual string Subject { get; set; }
|
|
|
|
|
|
//Normal = 0,
|
|
//Pattern = 1,
|
|
//Occurrence = 2,
|
|
//ChangedOccurrence = 3,
|
|
//DeletedOccurrence = 4
|
|
public virtual int Type { get; set; }
|
|
|
|
public virtual bool IsTask { get; set; }
|
|
public virtual string TaskDescription { get; set; }
|
|
public virtual string CompletedNotice { get; set; }
|
|
public virtual DateTime? CompletedDate { get; set; }
|
|
public virtual DateTime? DueDate { get; set; }
|
|
|
|
public virtual long? FormerBookingSequenceOid
|
|
{
|
|
get => _FormerBookingSequenceOid;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_FormerBookingSequenceOid, value))
|
|
{
|
|
_FormerBookingSequenceOid = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual long? FormerTaskOid
|
|
{
|
|
get => _FormerTaskOid;
|
|
set
|
|
{
|
|
if(AreDifferent(_FormerTaskOid, value))
|
|
{
|
|
_FormerTaskOid = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string Notice2
|
|
{
|
|
get => _Notice2;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_Notice2, value))
|
|
{
|
|
_Notice2 = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string Notice3
|
|
{
|
|
get => _Notice3;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_Notice3, value))
|
|
{
|
|
_Notice3 = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string Notice4
|
|
{
|
|
get => _Notice4;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_Notice4, value))
|
|
{
|
|
_Notice4 = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string Notice5
|
|
{
|
|
get => _Notice5;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_Notice5, value))
|
|
{
|
|
_Notice5 = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<SupportConcept> SupportConceptList
|
|
{
|
|
get => _SupportConceptList ?? (_SupportConceptList = new List<SupportConcept>());
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_SupportConceptList, value))
|
|
{
|
|
_SupportConceptList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual Guid? GetRecurrenceIdAndIndex(out int index)
|
|
{
|
|
if(RecurrenceInfo != null)
|
|
{
|
|
var recurrenceId = BS.Shared.Core.Utils.GetSpecificValueFromRecurrenceInfo(RecurrenceInfo, RecurrenceInfo.IndexOf("Id=\"") + 4);
|
|
var recurrenceIndex = BS.Shared.Core.Utils.GetSpecificValueFromRecurrenceInfo(RecurrenceInfo, RecurrenceInfo.IndexOf("Index=\"") + 7);
|
|
|
|
int.TryParse(recurrenceIndex, out index);
|
|
|
|
if(Guid.TryParse(recurrenceId, out var guid))
|
|
{
|
|
return guid;
|
|
}
|
|
}
|
|
|
|
index = -1;
|
|
|
|
return null;
|
|
}
|
|
|
|
public virtual string GetAppointmentType()
|
|
{
|
|
switch(Type)
|
|
{
|
|
case 0:
|
|
return "Normal";
|
|
case 1:
|
|
return "Pattern";
|
|
case 2:
|
|
return "Occurrence";
|
|
case 3:
|
|
return "Changed Occurrence";
|
|
case 4:
|
|
return "Deleted Occurrence";
|
|
default:
|
|
return "Normal";
|
|
}
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{StartDate?.ToString("dd.MM.yyyy HH:mm:ss")} - {EndDate?.ToString("dd.MM.yyyy HH:mm:ss")}: {Subject}";
|
|
}
|
|
|
|
public virtual int? GetRecurrenceIndex()
|
|
{
|
|
if(RecurrenceInfo != null)
|
|
{
|
|
var indexString = BS.Shared.Core.Utils.GetSpecificValueFromRecurrenceInfo(RecurrenceInfo, RecurrenceInfo.IndexOf("Index=\\") + 7);
|
|
|
|
if(int.TryParse(indexString, out var index))
|
|
{
|
|
return index;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public virtual Guid? GetRecurrenceId()
|
|
{
|
|
if(RecurrenceInfo != null)
|
|
{
|
|
var idString = BS.Shared.Core.Utils.GetSpecificValueFromRecurrenceInfo(RecurrenceInfo, RecurrenceInfo.IndexOf("Id=\"") + 4);
|
|
|
|
if(Guid.TryParse(idString, out var guid))
|
|
{
|
|
return guid;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |