This commit is contained in:
Lyndon Jetten
2021-06-23 13:44:13 +02:00
parent b05684dac9
commit f5559d0e5a
7 changed files with 128 additions and 51 deletions

View File

@@ -51,8 +51,11 @@ namespace BeWo.Scheduler.View
return false;
}
// TODO: Endzeit und Startzeit werden als Dauer auf das Start-Objekt addiert
if (ShouldShowRecurrence)
{
var rvcStart = RecurrenceVisualController.Start;
RecurrenceVisualController.ApplyRecurrence();
}

View File

@@ -927,7 +927,9 @@
<dxsch:SchedulerControl Grid.Column="2" x:Name="Scheduler" dx:ThemeManager.ThemeName="Office2010Black"
FormCustomizationUsingMVVMLocal="False"
InplaceEditorShowing="Scheduler_OnInplaceEditorShowing"
GroupType="None" AppointmentDrag="Scheduler_OnAppointmentDrag" AppointmentDrop="Scheduler_OnAppointmentDrop"
GroupType="None"
AppointmentDrag="Scheduler_OnAppointmentDrag"
AppointmentDrop="Scheduler_OnAppointmentDrop"
VerticalAlignment="Stretch"
EditAppointmentFormShowing="Scheduler_EditAppointmentFormShowing"
EditRecurrentAppointmentFormShowing="SchedulerControl_EditRecurrentAppointmentFormShowing"

View File

@@ -296,7 +296,7 @@
<dxe:TextEdit Grid.Column="2" Grid.Row="2" IsEnabled="{Binding Path=Controller.AllDay, Converter={StaticResource BoolReverseConverter}}"
MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValueChanged="StartTimeTextEdit_OnEditValueChanged"
EditValue ="{Binding Controller.DisplayStartTime, Converter={StaticResource TimeSpanToDateTimeConverter}}" x:Name="StartTimeTextEdit"/>
<dxe:CheckEdit x:Name="AllDay" Grid.Column="3" Grid.Row="2" Content="Ganztägig" EditValue ="{Binding Controller.AllDay}" HorizontalAlignment="Right" Margin="3" />
<dxe:CheckEdit x:Name="AllDay" Grid.Column="3" Grid.Row="2" Content="Ganztägig" EditValueChanged="AllDay_OnEditValueChanged" EditValue ="{Binding Controller.AllDay}" HorizontalAlignment="Right" Margin="3" />
<!-- Endregion -->
<!-- Region Ende -->

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Windows;
@@ -184,7 +185,7 @@ namespace BeWo.Scheduler.View
SelectedEmployees.Add(new Employee2SchedulerAppointmentDC { Employee = BeWoApp.CompactLoggedOnEmployee });
MitarbeiterToggleButton.IsChecked = true;
}
InitRights();
}
@@ -447,7 +448,7 @@ namespace BeWo.Scheduler.View
var start = NewSchedulerAppointmentFormController.Start;
var end = NewSchedulerAppointmentFormController.End;
ViewModel.NewVM.AllDay = !Appointment.AllDay;
ViewModel.NewVM.AllDay = NewSchedulerAppointmentFormController.AllDay;
ViewModel.NewVM.IsPrivate = isPrivate;
ViewModel.NewVM.ResourceList = resources;
ViewModel.NewVM.CustomerList = customers;
@@ -483,7 +484,7 @@ namespace BeWo.Scheduler.View
customerOids.AddIfNotIn(customer.CustomerOid);
}
var item = (SchedulerAppointmentVM) Appointment.GetSourceObject(Control.GetCoreStorage());
var item = Appointment.GetSourceObject(Control.GetCoreStorage());
ViewModel.ShouldLockOverlappingAppointmentCheck = Appointment.Type == AppointmentType.ChangedOccurrence;
@@ -492,8 +493,8 @@ namespace BeWo.Scheduler.View
ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), new Guid(Appointment.RecurrenceInfo.Id.ToString()), isTask, taskDescription, completedDate, dueDate, completedNotice, supportConceptList, Appointment.Subject, Appointment.AllDay);
}
ApplyChanges();
}
ApplyChanges();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message + "\n" + exception.StackTrace);
@@ -648,14 +649,14 @@ namespace BeWo.Scheduler.View
private void DueDate_OnEditValueChanged(object sender, EditValueChangedEventArgs e)
{
if(e.NewValue != null && e.NewValue is DateTime dueDate)
{
var newEnd = dueDate.GetShortDateTime().AddDays(1);
// if(e.NewValue != null && e.NewValue is DateTime dueDate)
// {
// var newEnd = dueDate.GetShortDateTime().AddDays(1);
NewSchedulerAppointmentFormController.End = newEnd;
NewSchedulerAppointmentFormController.DisplayEnd = newEnd;
NewSchedulerAppointmentFormController.DisplayEndDate = newEnd;
}
// NewSchedulerAppointmentFormController.End = newEnd;
// NewSchedulerAppointmentFormController.DisplayEnd = newEnd;
// NewSchedulerAppointmentFormController.DisplayEndDate = newEnd;
//}
}
/*
@@ -668,47 +669,106 @@ namespace BeWo.Scheduler.View
* If the new Appointment. End property's value is less than the Appointment.
* Start property's value, an exception is raised.
*
* Endzeit = Startzeit + Vorherige Dauer
* Ende = Start + Vorherige Dauer
*/
private DateTime? _PreviousEndDate;
private DateTime? _PreviousEndDate2;
private bool _HasBeenChangedByStartTime;
private bool _EndTimeHasBeenChangedByStartTime;
private bool _EndDateHasBeenChangedByStartDate;
// TODO: Bei jeder Änderung darauf achten, dass keinn anderer Wert manipuliert wird!
// TOOD: KGW?
private void StartDate_OnChange(object sender, EditValueChangedEventArgs e)
{
//_HasBeenChangedByStartTime = false;
// BeWoApp.LogMessage("StartDate changed", Colors.DarkTurquoise);
// LogAllDates();
//_EndTimeHasBeenChangedByStartTime = false;
// _PreviousEndDate2 = NewSchedulerAppointmentFormController.End;
//_EndDateHasBeenChangedByStartDate = true;
}
// TOOD: KGW?
private void EndDate_OnChange(object sender, EditValueChangedEventArgs e)
private void EndDate_OnChange(object sender, EditValueChangedEventArgs e)
{
//_HasBeenChangedByStartTime = false;
}
// BeWoApp.LogMessage("EndDate changed", Colors.DarkTurquoise);
// LogAllDates();
//_EndTimeHasBeenChangedByStartTime = false;
// if(_EndDateHasBeenChangedByStartDate && _PreviousEndDate2.HasValue)
// {
// var start = NewSchedulerAppointmentFormController.Start;
// if(_PreviousEndDate2 > start)
// {
// var neuesEnddatum = NewSchedulerAppointmentFormController.End.MergeDatesByDateReversed(_PreviousEndDate2.Value);
// //NewSchedulerAppointmentFormController.End = neuesEnddatum;
// }
// }
// _EndDateHasBeenChangedByStartDate = true;
}
private void StartTimeTextEdit_OnEditValueChanged(object sender, EditValueChangedEventArgs e)
{
_PreviousEndDate = NewSchedulerAppointmentFormController.End;
// BeWoApp.LogMessage("StartTime changed", Colors.DarkTurquoise);
// LogAllDates();
//_PreviousEndDate = NewSchedulerAppointmentFormController.End;
_HasBeenChangedByStartTime = true;
// _EndTimeHasBeenChangedByStartTime = true;
}
private void EndTimeTextEdit_OnEditValueChanged(object sender, EditValueChangedEventArgs e)
{
//if (_HasBeenChangedByStartTime && _PreviousEndDate.HasValue)
//{
// var start = NewSchedulerAppointmentFormController.Start;
// BeWoApp.LogMessage("EndTime changed", Colors.DarkTurquoise);
// LogAllDates();
// if (_PreviousEndDate > start)
// {
// NewSchedulerAppointmentFormController.End = NewSchedulerAppointmentFormController.End.MergeDatesByDate(_PreviousEndDate.Value);
// }
//}
//if (_EndTimeHasBeenChangedByStartTime && _PreviousEndDate.HasValue)
// {
// var start = NewSchedulerAppointmentFormController.Start;
_HasBeenChangedByStartTime = false;
// if (_PreviousEndDate > start)
// {
// //NewSchedulerAppointmentFormController.End = NewSchedulerAppointmentFormController.End.MergeDatesByDate(_PreviousEndDate.Value);
// }
// }
// _EndTimeHasBeenChangedByStartTime = false;
}
}
// Was beeinflusst was? Startzeit -> Endzeit
// Ganztag -> DisplayEndDate
//
private void AllDay_OnEditValueChanged(object sender, EditValueChangedEventArgs e)
{
//BeWoApp.LogMessage("AllDay changed", Colors.DarkTurquoise);
//LogAllDates();
}
private void LogAllDates()
{
var initialStartValue = NewSchedulerAppointmentFormController.Start;
var initialEndValue = NewSchedulerAppointmentFormController.End;
var isAllDay = NewSchedulerAppointmentFormController.AllDay;
var initialDisplayStart = NewSchedulerAppointmentFormController.DisplayStart;
var initialDisplayEnd = NewSchedulerAppointmentFormController.DisplayEnd;
BeWoApp.LogMessage("\n" +
$"\t\t\tIs AllDay: {isAllDay}\n" +
$"\t\t\tStart: {initialStartValue:dd.MM.yy HH:mm}\n" +
$"\t\t\tEnd: {initialEndValue:dd.MM.yy HH:mm}\n" +
$"\t\t\tDisplayStart: {initialDisplayStart:dd.MM.yy HH:mm}\n" +
$"\t\t\tDisplayEnd: {initialDisplayEnd:dd.MM.yy HH:mm}");
}
}
public class NewSchedulerAppointmentFormController : AppointmentFormController
{

View File

@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BeWo.View.Detail"
WindowStartupLocation="Manual" Topmost="True"
Title="Debug Log" mc:Ignorable="d"
Height="900" Width="700">

View File

@@ -469,19 +469,19 @@ namespace BeWo.View
private void HyperlinkChat_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
{
#if DEBUG
//OpenServiceRecordEditViewTest();
////OpenServiceRecordEditViewTest();
////return;
//var kundennummer = "5473568546";
////var apikey = "0b50c09aff87f20d9ced75340e04e5ccaa11dd3e7bcf25e9c4f94dc20d3cbb97";
//Login _login = new Login(kundennummer, "kihqx-PiGka", "cb", "bewo", "0b50c09aff87f20d9ced75340e04e5ccaa11dd3e7bcf25e9c4f94dc20d3cbb97");
//var x1 = _login.AnmeldevorgangDurchFuehren();
//ServiceChatView = new ChatView(x1);
//ServiceChatView.Show();
//return;
var kundennummer = "5473568546";
//var apikey = "0b50c09aff87f20d9ced75340e04e5ccaa11dd3e7bcf25e9c4f94dc20d3cbb97";
Login _login = new Login(kundennummer, "kihqx-PiGka", "cb", "bewo", "0b50c09aff87f20d9ced75340e04e5ccaa11dd3e7bcf25e9c4f94dc20d3cbb97");
var x1 = _login.AnmeldevorgangDurchFuehren();
ServiceChatView = new ChatView(x1);
ServiceChatView.Show();
return;
#endif
@@ -491,10 +491,10 @@ namespace BeWo.View
#if DEBUG
if(true)
{
string _Code = "ZMCKb-BckTt";
string _kundennummer = "4368658436";
string _benutzername = "muellerp";
string _passwort = "F5aTk9Co47JFJCWB2Z7Y";
string _Code = "B7x0b-FhhJA";//"ZMCKb-BckTt";
string _kundennummer = "4368658436";//"4368658436";
string _benutzername = "jettenl";//"muellerp";
string _passwort = "n8-yR+3Q=6nX#";//"F5aTk9Co47JFJCWB2Z7Y";
string _apikey;
#else

View File

@@ -412,7 +412,7 @@ namespace BS.Shared.Extensions
/// <summary>
/// Erzeugt aus zwei Datumsobjekten ein neues mit den Datumsangaben des ersten und den Zeitangaben des zweiten Parameters.
/// </summary>
/// <param name="first">Datum dessen Datewerte übernommen werden.</param>
/// <param name="first">Datum dessen Datumswerte übernommen werden.</param>
/// <param name="second">Datum dessen Zeitwerte übernommen werden.</param>
/// <returns>Gibt ein neues Objekt der Klasse Datum mit dem Datum des ersten Parameters und der Zeit des zweiten Parameters zurück.</returns>
public static DateTime MergeDatesByDate(this DateTime first, DateTime second)
@@ -420,6 +420,17 @@ namespace BS.Shared.Extensions
return new DateTime(first.Year, first.Month, first.Day, second.Hour, second.Minute, second.Second);
}
/// <summary>
/// Erzeugt aus zwei Datumsobjekten ein neues mit den Datumsangaben des zweiten und den Zeitangaben des ersten Parameters.
/// </summary>
/// <param name="first">Datum dessen Zeitwerte übernommen werden.</param>
/// <param name="second">Datum dessen Datumswerte übernommen werden.</param>
/// <returns>Gibt ein neues Objekt der Klasse Datum mit dem Datum des zweiten Parameters und der Zeit des ersten Parameters zurück.</returns>
public static DateTime MergeDatesByDateReversed(this DateTime first, DateTime second)
{
return new DateTime(second.Year, second.Month, second.Day, first.Hour, first.Minute, first.Second);
}
public static DateTime MergeDateAndTimeSpan(this DateTime pDate, TimeSpan pTimeSpan)
{
return new DateTime(pDate.Year, pDate.Month, pDate.Day, pTimeSpan.Hours, pTimeSpan.Minutes, pTimeSpan.Seconds);