Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/BeWo

This commit is contained in:
Waldi
2017-10-06 12:07:34 +02:00
10 changed files with 213 additions and 214 deletions

View File

@@ -15,20 +15,15 @@ namespace BeWo.Scheduler.View
{
public class AbstractAppointmentEditForm : UserControl
{
private readonly SchedulerControl mSchedulerControl;
private readonly Appointment mAppointment;
private readonly AppointmentFormController mController;
private RecurrenceVisualController mRecurrenceVisualController;
protected AbstractAppointmentEditForm() { }
protected AbstractAppointmentEditForm() { }
public AbstractAppointmentEditForm(SchedulerControl schedulerControl, Appointment appointment)
{
mSchedulerControl = schedulerControl;
mAppointment = appointment;
Control = schedulerControl;
Appointment = appointment;
mController = CreateFormController(schedulerControl, appointment);
mRecurrenceVisualController = new RecurrenceVisualController(mController);
Controller = CreateFormController(Control, Appointment);
RecurrenceVisualController = new RecurrenceVisualController(Controller);
}
public virtual AppointmentFormController CreateFormController(SchedulerControl schedulerControl, Appointment appointment)
@@ -36,45 +31,40 @@ namespace BeWo.Scheduler.View
return new AppointmentFormController(schedulerControl, appointment);
}
public SchedulerControl Control { get { return mSchedulerControl; } }
public Appointment Appointment { get { return mAppointment; } }
public AppointmentFormController Controller { get { return mController; } }
public string TimeEditMask { get { return CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern; } }
public RecurrenceVisualController RecurrenceVisualController { get { return mRecurrenceVisualController; } }
public SchedulerControl Control { get; }
protected internal bool IsNewAppointment { get { return mController == null || mController.IsNewAppointment; } }
public Appointment Appointment { get; }
protected bool ShouldShowRecurrence
{
get
{
return !mAppointment.IsOccurrence && mController.ShouldShowRecurrenceButton;
}
}
public AppointmentFormController Controller { get; }
public string TimeEditMask => CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern;
public RecurrenceVisualController RecurrenceVisualController { get; }
protected internal bool IsNewAppointment => Controller == null || Controller.IsNewAppointment;
protected bool ShouldShowRecurrence => !Appointment.IsOccurrence && Controller.ShouldShowRecurrenceButton;
protected virtual bool ApplyChanges()
{
if (!mController.IsConflictResolved())
if (!Controller.IsConflictResolved())
{
return false;
}
if (ShouldShowRecurrence)
{
mRecurrenceVisualController.ApplyRecurrence();
RecurrenceVisualController.ApplyRecurrence();
}
try
{
mController.ApplyChanges();
Controller.ApplyChanges();
}
catch (Exception e)
{
MessageBox.Show(string.Format("Es ist leider ein Fehler aufgetreten. Die von Ihnen getätigten Änderungen am Termin konnten leider nicht übernommen werden.\n{0}\n{1}", e.Message, e.StackTrace),
"Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show($"Es ist leider ein Fehler aufgetreten. Die von Ihnen getätigten Änderungen am Termin konnten leider nicht übernommen werden.\n{e.Message}\n{e.StackTrace}", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
SchedulerFormBehavior.Close(this, true);
return true;
@@ -88,29 +78,33 @@ namespace BeWo.Scheduler.View
protected virtual void DeleteAppointment()
{
if (IsNewAppointment)
return;
{
return;
}
mController.DeleteAppointment();
Controller.DeleteAppointment();
SchedulerFormBehavior.Close(this, false);
}
protected static void LocalizeVisualChild(DependencyObject obj)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
var child = VisualTreeHelper.GetChild(obj, i);
if (child is WeekOfMonthEdit)
{
var edt = child as WeekOfMonthEdit;
edt.CustomDisplayText -= edt_CustomDisplayText;
edt.CustomDisplayText += edt_CustomDisplayText;
edt.CustomDisplayText -= EditCustomDisplayText;
edt.CustomDisplayText += EditCustomDisplayText;
foreach (var womEditItem in edt.Items)
{
var ne = womEditItem as NamedElement;
if (ne != null)
ne.Caption = Translate(ne.Caption);
{
ne.Caption = Translate(ne.Caption);
}
}
}
@@ -118,14 +112,16 @@ namespace BeWo.Scheduler.View
{
var edt = child as WeekDaysEdit;
edt.CustomDisplayText -= edt_CustomDisplayText;
edt.CustomDisplayText += edt_CustomDisplayText;
edt.CustomDisplayText -= EditCustomDisplayText;
edt.CustomDisplayText += EditCustomDisplayText;
foreach (var womEditItem in edt.Items)
{
var ne = womEditItem as NamedElement;
if (ne != null)
ne.Caption = Translate(ne.Caption);
{
ne.Caption = Translate(ne.Caption);
}
}
}
@@ -133,13 +129,13 @@ namespace BeWo.Scheduler.View
}
}
static void edt_CustomDisplayText(object sender, DevExpress.Xpf.Editors.CustomDisplayTextEventArgs e)
private static void EditCustomDisplayText(object sender, DevExpress.Xpf.Editors.CustomDisplayTextEventArgs e)
{
e.DisplayText = Translate(e.DisplayText);
e.Handled = true;
}
private static string Translate(String text)
private static string Translate(string text)
{
switch (text)
{
@@ -159,8 +155,9 @@ namespace BeWo.Scheduler.View
return "Arbeitstag";
case "Weekend day":
return "Wochenendtag";
default:
return text;
}
return text;
}
}
}

View File

@@ -549,7 +549,6 @@ namespace BeWo.Scheduler.View
Scheduler.Storage.BeginUpdate();
UpdateSchedulerSettings();
int idx = 1;
foreach (var item in Scheduler.Storage.AppointmentStorage.Items)
{
@@ -560,7 +559,7 @@ namespace BeWo.Scheduler.View
foreach (var exc in ausnahmen)
{
var b = exc.GetSourceObject(Scheduler.GetCoreStorage()) as IBeWoAppointment;
if (b == null || b.CustomFields == null)
if (b?.CustomFields == null)
{
continue;
}
@@ -572,7 +571,10 @@ namespace BeWo.Scheduler.View
}
}
if (bapp == null || bapp.CustomFields == null) continue;
if (bapp?.CustomFields == null)
{
continue;
}
foreach (var field in bapp.CustomFields)
{
@@ -1496,10 +1498,10 @@ namespace BeWo.Scheduler.View
var testtesttest = ViewModel.ActiveAppointmentViewModel;
OnPropertyChanged("AllResources");
OnPropertyChanged("SelectedEmployees");
OnPropertyChanged("SelectedItems");
OnPropertyChanged("ViewModel");
OnPropertyChanged(nameof(AllResources));
OnPropertyChanged(nameof(SelectedEmployees));
OnPropertyChanged(nameof(SelectedItems));
OnPropertyChanged(nameof(ViewModel));
}
//private void ExportAsiCal(object sender, RoutedEventArgs e)
@@ -1829,8 +1831,8 @@ namespace BeWo.Scheduler.View
private void UpdateViewModelFilter()
{
OnPropertyChanged("SelectedEmployees");
OnPropertyChanged("SelectedItems");
OnPropertyChanged(nameof(SelectedEmployees));
OnPropertyChanged(nameof(SelectedItems));
Scheduler.ActiveView.LayoutChanged();
}

View File

@@ -55,13 +55,14 @@ namespace BeWo.Scheduler.View
}
}
public RequestAnswerView(IEnumerable<IBeWoAppointment> appointments, List<IBeWoAppointment> statusUpdates)
public RequestAnswerView(IEnumerable<IBeWoAppointment> appointments, IEnumerable<IBeWoAppointment> statusUpdates)
{
var statusUpdatesAsAppointments = new List<IBeWoAppointment>();
foreach(SchedulerAppointmentVM item in statusUpdates)
foreach(var beWoAppointment in statusUpdates)
{
foreach(var relation in item.EmployeeList.Where(emp => emp.IsPChanged && emp.ParticipationAnswer != ParticipationAnswer.Offen && emp.ParticipationAnswer != ParticipationAnswer.Verstrichen && !emp.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)))
var item = (SchedulerAppointmentVM) beWoAppointment;
foreach(var relation in item.EmployeeList.Where(emp => emp.IsPChanged && emp.ParticipationAnswer != ParticipationAnswer.Offen && emp.ParticipationAnswer != ParticipationAnswer.Verstrichen && !emp.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)))
{
if(statusUpdatesAsAppointments.All(a => a.LabelId != relation.Employee2SchedulerAppointmentOid))
{
@@ -81,24 +82,24 @@ namespace BeWo.Scheduler.View
{
return new SchedulerAppointmentVM(new SchedulerAppointmentDC
{
SchedulerAppointmentOid = item.CommitToDataContract().SchedulerAppointmentOid,
SchedulerAppointmentOid = item.CommitToDataContract().SchedulerAppointmentOid,
NewSchedulerAppointmentVersion = item.CommitToDataContract().NewSchedulerAppointmentVersion,
IsPrivate = item.IsPrivate,
RecurrenceInfo = item.RecurrenceInfo,
Type = item.EventType,
CustomerList = (List<CompactCustomerDC>)item.CustomFields["CustomerList"],
ResourceList = (List<ResourceDC>)item.CustomFields["ResourceList"],
AllDay = item.AllDay,
EmployeeList = item.EmployeeList,
Description = item.Description,
EndDate = item.End,
StartDate = item.Start,
Location = item.Location,
Subject = item.Subject,
Status = 1,
Originator = (CompactEmployeeDC)item.CustomFields["Originator"]
IsPrivate = item.IsPrivate,
RecurrenceInfo = item.RecurrenceInfo,
Type = item.EventType,
CustomerList = (List<CompactCustomerDC>)item.CustomFields["CustomerList"],
ResourceList = (List<ResourceDC>)item.CustomFields["ResourceList"],
AllDay = item.AllDay,
EmployeeList = item.EmployeeList,
Description = item.Description,
EndDate = item.End,
StartDate = item.Start,
Location = item.Location,
Subject = item.Subject,
Status = 1,
Originator = (CompactEmployeeDC)item.CustomFields["Originator"]
})
{ CustomFields = item.CustomFields, LabelId = Convert.ToInt32(emp2appOid)};
{ CustomFields = item.CustomFields, LabelId = Convert.ToInt32(emp2appOid)};
}
private void CloseButton_Click(object sender, RoutedEventArgs e)

View File

@@ -225,7 +225,7 @@
<Popup Grid.Column="1" Grid.Row="4" Margin="10" Name="PopupEmployee" StaysOpen="False" Placement="MousePoint" Width="370" Height="300" >
<search:MultiEmployeeSearch x:Name="MultiEmployeeSearch" ResultListBackground="{StaticResource EmployeeListBrush}" SelectionChanged="MultiEmployeeSearch_OnSelectionChanged" SelectedEmployees="{Binding Controller.EmployeeList, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</Popup>
<Button x:Name="MitarbeiterPopUpOeffnenBtn" Grid.Column="4" Grid.Row="4" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="popupedit_employee_PopUpClick">
<Button x:Name="MitarbeiterPopUpOeffnenBtn" Grid.Column="4" Grid.Row="4" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="Popupedit_employee_PopUpClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
@@ -257,7 +257,7 @@
<TextBox IsReadOnly="True" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountSelectedCustomers, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<ToggleButton Grid.Column="1" x:Name="KlientenToggleButton" IsThreeState="False" Margin="0,0,2,0" Height="19" Width="19" ToolTip="Ausgewählte Klienten anzeigen" Style="{StaticResource ExpanderLookAlikeToggleBotton}"/>
</Grid>
<Button x:Name="KlientenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="6" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="popupedit_customer_PopUpClick">
<Button x:Name="KlientenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="6" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="Popupedit_customer_PopUpClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
@@ -292,7 +292,7 @@
<TextBox IsReadOnly="True" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountSelectedResources, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<ToggleButton Grid.Column="1" x:Name="RessourcenToggleButton" IsThreeState="False" Margin="0,0,2,0" Height="19" Width="19" ToolTip="Ausgewählte Ressourcen anzeigen" Style="{StaticResource ExpanderLookAlikeToggleBotton}"/>
</Grid>
<Button x:Name="RessourcenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="8" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="popupedit_resource_PopUpClick">
<Button x:Name="RessourcenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="8" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="Popupedit_resource_PopUpClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
@@ -368,10 +368,10 @@
<!-- Region Buttons -->
<UniformGrid Grid.Column="0" Grid.Row="14" Grid.ColumnSpan="5" Columns="3" Rows="1" HorizontalAlignment="Right">
<Button Margin="3" Click="button_ok_Click" x:Name="OKButton" Content="OK" Height="25" Width="80" />
<Button Margin="3" Click="button_cancel_Click" Content="Abbrechen" Height="25" Width="80" />
<Button Margin="3" Click="Button_ok_Click" x:Name="OKButton" Content="OK" Height="25" Width="80" />
<Button Margin="3" Click="Button_cancel_Click" Content="Abbrechen" Height="25" Width="80" />
<!--<Button Margin="3" Click="button_CreatZeiterfassung_Click" x:Name="ZeiterfassButton" Content="Zeiterfassung" Height="25" Width="80" />-->
<Button Margin="3" Click="button_delete_Click" x:Name="DeleteButton" Content="Löschen" Height="25" Width="80" />
<Button Margin="3" Click="Button_delete_Click" x:Name="DeleteButton" Content="Löschen" Height="25" Width="80" />
</UniformGrid>
<!-- Endregion -->
</Grid>

View File

@@ -31,23 +31,23 @@ namespace BeWo.Scheduler.View
{
public bool IsInCustomerViewMode { get; set; }
private List<ValueListEntryDC> _Categories;
private List<ValueListEntryDC> categories;
public List<ValueListEntryDC> Categories
{
get { return _Categories; }
set { _Categories = value; OnPropertyChanged("Categories"); }
get { return categories; }
set { categories = value; OnPropertyChanged(nameof(Categories)); }
}
private List<ResourceDC> _ResourceList;
private List<ResourceDC> resourceList;
public List<ResourceDC> ResourceList
{
get { return _ResourceList; }
set { _ResourceList = value; OnPropertyChanged("ResourceList"); }
get { return resourceList; }
set { resourceList = value; OnPropertyChanged(nameof(ResourceList)); }
}
public SchedulerAppointmentListVM ViewModel { get; set; }
private static void recurrenceControl_Loaded(object sender, RoutedEventArgs e)
private static void RecurrenceControlLoaded(object sender, RoutedEventArgs e)
{
LocalizeVisualChild(sender as DependencyObject);
}
@@ -63,7 +63,7 @@ namespace BeWo.Scheduler.View
selectedResources = value;
SelectedResources.CollectionChanged += SelectedResourcesCollectionChanged;
NewSchedulerAppointmentFormController.ResourceList = value.ToList();
OnPropertyChanged("SelectedResources");
OnPropertyChanged(nameof(SelectedResources));
}
}
@@ -78,7 +78,7 @@ namespace BeWo.Scheduler.View
selectedEmployees = value;
SelectedEmployees.CollectionChanged += SelectedEmployeesCollectionChanged;
NewSchedulerAppointmentFormController.EmployeeList = value.ToList();
OnPropertyChanged("SelectedEmployees");
OnPropertyChanged(nameof(SelectedEmployees));
}
}
@@ -87,8 +87,7 @@ namespace BeWo.Scheduler.View
{
get
{
var newList = new ObservableCollection<CompactCustomerDC>(NewSchedulerAppointmentFormController.CustomerList ?? new List<CompactCustomerDC>());
return selectedCustomers ?? (selectedCustomers = newList);
return selectedCustomers ?? (selectedCustomers = new ObservableCollection<CompactCustomerDC>(NewSchedulerAppointmentFormController.CustomerList ?? new List<CompactCustomerDC>()));
}
set
{
@@ -97,12 +96,11 @@ namespace BeWo.Scheduler.View
selectedCustomers = value;
SelectedCustomers.CollectionChanged += SelectedCustomersCollectionChanged;
NewSchedulerAppointmentFormController.CustomerList = value.ToList();
OnPropertyChanged("SelectedCustomers");
OnPropertyChanged(nameof(SelectedCustomers));
}
}
public SchedulerAppointmentEditForm(SchedulerAppointmentListVM vm, SchedulerControl schedulerControl, Appointment appointment, IEnumerable<CompactEmployeeDC> employees, IEnumerable<CompactCustomerDC> customers, Dictionary<ValueListEntryDC, List<ResourceDC>> categoriesToResources)
: base(schedulerControl, appointment)
public SchedulerAppointmentEditForm(SchedulerAppointmentListVM vm, SchedulerControl schedulerControl, Appointment appointment, IEnumerable<CompactEmployeeDC> employees, IEnumerable<CompactCustomerDC> customers, Dictionary<ValueListEntryDC, List<ResourceDC>> categoriesToResources) : base(schedulerControl, appointment)
{
ViewModel = vm;
@@ -117,12 +115,14 @@ namespace BeWo.Scheduler.View
DataContext = this;
Categories = categoriesToResources.Keys.ToList();
if (categoriesToResources.Count > 0)
{
ResourceList = categoriesToResources.First().Value;
}
MonthlyRecurrenceControl.Loaded += recurrenceControl_Loaded;
YearlyRecurrenceControl.Loaded += recurrenceControl_Loaded;
MonthlyRecurrenceControl.Loaded += RecurrenceControlLoaded;
YearlyRecurrenceControl.Loaded += RecurrenceControlLoaded;
ResourcesTreeSearchView.Sauce = categoriesToResources;
ResourcesTreeSearchView.AusgewaehlteRessourcen = SelectedResources.ToList();
@@ -136,7 +136,7 @@ namespace BeWo.Scheduler.View
MultiCustomerSearch.AusgewaehlteKlienten = SelectedCustomers.ToList();
MultiCustomerSearch.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => this.Dispatch(() => { PopupCustomer.IsOpen = false; })));
EdtRecurrenceType.CustomDisplayText += edtRecurrenceType_CustomDisplayText;
EdtRecurrenceType.CustomDisplayText += EdtRecurrenceType_CustomDisplayText;
InitRights();
}
@@ -191,7 +191,7 @@ namespace BeWo.Scheduler.View
DeleteButton.Visibility = Visibility.Hidden;
}
private static void edtRecurrenceType_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
private static void EdtRecurrenceType_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
{
var conv = new Converter.Recurrence2GermanConverter();
@@ -199,18 +199,9 @@ namespace BeWo.Scheduler.View
e.Handled = true;
}
public string CountSelectedEmployees
{
get { return string.Format("{0} Mitarbeiter ausgewählt", SelectedEmployees.Count); }
}
public string CountSelectedResources
{
get { return string.Format("{0} Resourcen ausgewählt", SelectedResources.Count); }
}
public string CountSelectedCustomers
{
get { return string.Format("{0} Klienten ausgewählt", SelectedCustomers.Count); }
}
public string CountSelectedEmployees => $"{SelectedEmployees.Count} Mitarbeiter ausgewählt";
public string CountSelectedResources => $"{SelectedResources.Count} Resourcen ausgewählt";
public string CountSelectedCustomers => $"{SelectedCustomers.Count} Klienten ausgewählt";
public override AppointmentFormController CreateFormController(SchedulerControl schedulerControl, Appointment appointment)
{
@@ -243,26 +234,28 @@ namespace BeWo.Scheduler.View
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
private void popupedit_employee_PopUpClick(object sender, RoutedEventArgs e)
private void EmployeePopupClick(object sender, RoutedEventArgs e)
{
PopupEmployee.IsOpen = true;
}
private void popupedit_customer_PopUpClick(object sender, RoutedEventArgs e)
private void CustomerPopUpEditClick(object sender, RoutedEventArgs e)
{
ResourcesTreeSearchView.AusgewaehlteRessourcen = selectedResources.ToList();
PopupCustomer.IsOpen = true;
}
private void popupedit_resource_PopUpClick(object sender, RoutedEventArgs e)
private void ResourcePopUpClick(object sender, RoutedEventArgs e)
{
PopupResource.IsOpen = true;
}
private void button_ok_Click(object sender, RoutedEventArgs e)
private void OkButtonClick(object sender, RoutedEventArgs e)
{
try
{
Controller.Storage.BeginUpdate();
ViewModel.NewVM.EmployeeList = NewSchedulerAppointmentFormController.EmployeeList;
var employees = NewSchedulerAppointmentFormController.EmployeeList;
@@ -270,7 +263,7 @@ namespace BeWo.Scheduler.View
var resources = NewSchedulerAppointmentFormController.ResourceList;
var originator = NewSchedulerAppointmentFormController.Originator;
var isPrivate = NewSchedulerAppointmentFormController.IsPrivate;
ViewModel.NewVM.AllDay = !Appointment.AllDay;
ViewModel.NewVM.IsPrivate = isPrivate;
ViewModel.NewVM.ResourceList = resources;
@@ -285,7 +278,7 @@ namespace BeWo.Scheduler.View
Appointment.CustomFields["EmployeeList"] = employees;
NewSchedulerView.IgnoreChangeEvents = false;
// Änderung an den CustomFields lösen das NewSchedulerStorage_AppointmentsChanged-Event aus
// Änderung an den CustomFields lösen das NewSchedulerStorage_AppointmentsChanged-Event aus
var employeeOids = new List<long>();
var customerOids = new List<long>();
@@ -301,16 +294,17 @@ namespace BeWo.Scheduler.View
customerOids.AddIfNotIn(customer.CustomerOid);
}
var item = (SchedulerAppointmentVM) Appointment.GetSourceObject(Control.GetCoreStorage());
var item = (SchedulerAppointmentVM) Appointment.GetSourceObject(Control.GetCoreStorage());
ServiceFacade.DoResourceServiceSync(definedBelow => overlaps = definedBelow.OverlappingAppointmentsExist(Appointment.Start, Appointment.End, employeeOids, customerOids, resources.Select(res => res.ResourceOid.Value).ToList(), ViewModel.NewVM.Originator.EmployeeOid, (item != null ? item.CommitToDataContract().SchedulerAppointmentOid : null), String.Empty, Appointment.RecurrenceIndex));
if (overlaps)
ServiceFacade.DoResourceServiceSync(definedBelow => overlaps = definedBelow.OverlappingAppointmentsExist(Appointment.Start, Appointment.End, employeeOids, customerOids, resources.Select(res => res.ResourceOid.Value).ToList(), ViewModel.NewVM.Originator.EmployeeOid, item?.CommitToDataContract().SchedulerAppointmentOid, string.Empty, Appointment.RecurrenceIndex));
if(overlaps)
{
var erg = MessageBox.Show("Dieser Termin überschneidet sich mit einem anderen bereits existierenden Termin.\n Möchten Sie ihn wirklich speichern?", "Überschneidung", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
var erg = MessageBox.Show("Dieser Termin überschneidet sich mit einem anderen bereits existierenden Termin.\n Möchten Sie ihn wirklich speichern?", "Überschneidung", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (erg.Equals(MessageBoxResult.No))
if(erg.Equals(MessageBoxResult.No))
{
return;
return;
}
}
@@ -318,12 +312,10 @@ namespace BeWo.Scheduler.View
if (Appointment.RecurrenceInfo != null)
{
//###Lyndon testen!!!
ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), new Guid(Appointment.RecurrenceInfo.Id.ToString()));
//ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), Appointment.RecurrenceInfo.Id);
}
if (Appointment.IsOccurrence && item == null)
if (Appointment.IsOccurrence && item == null)
{
((List<Employee2SchedulerAppointmentDC>)Appointment.CustomFields["EmployeeList"]).ForEach(each =>
{
@@ -336,6 +328,9 @@ namespace BeWo.Scheduler.View
}
ApplyChanges();
Controller.Storage.EndUpdate();
ViewModel.ShouldLockOverlappingAppointmentCheck = false;
}
catch (Exception exception)
@@ -344,17 +339,17 @@ namespace BeWo.Scheduler.View
}
}
private void button_cancel_Click(object sender, RoutedEventArgs e)
private void CancelButtonClick(object sender, RoutedEventArgs e)
{
Cancel();
}
private void button_delete_Click(object sender, RoutedEventArgs e)
private void DeleteButtonClick(object sender, RoutedEventArgs e)
{
DeleteAppointment();
}
private void Button_CreatZeiterfassung_Click(object sender, RoutedEventArgs e)
private void CreatZeiterfassungButtonClick(object sender, RoutedEventArgs e)
{
var employ = SelectedMitarbeiter.Items;
var y = SelectedKlient.Items;

View File

@@ -26,12 +26,12 @@ namespace BeWo.Scheduler.ViewModel
{
public class SchedulerAppointmentListVM : AbstractDCListMapperVM<SchedulerAppointmentDC, SchedulerAppointmentVM>, ISchedulerViewModel
{
private const string CF_EMPLOYEELIST = "EmployeeList";
private const string CF_CUSTOMERLIST = "CustomerList";
private const string CF_RESOURCELIST = "ResourceList";
private const string CF_ORIGINATOR = "Originator";
private const string CF_ISPRIVATE = "IsPrivate";
private const string CF_ISABSENCETIME = "IsAbsenceTime";
private const string CustomField_EmployeeList = "EmployeeList";
private const string CustomField_CustomerList = "CustomerList";
private const string CustomField_ResourceList = "ResourceList";
private const string CustomField_Originator = "Originator";
private const string CustomField_IsPrivate = "IsPrivate";
private const string CustomField_IsAbsenceTime = "IsAbsenceTime";
public bool ShouldLockOverlappingAppointmentCheck { get; set; }
@@ -114,12 +114,12 @@ namespace BeWo.Scheduler.ViewModel
{
foreach (var item in VMList)
{
item.CustomFields.Add(CF_EMPLOYEELIST, item.EmployeeList);
item.CustomFields.Add(CF_CUSTOMERLIST, item.CustomerList);
item.CustomFields.Add(CF_RESOURCELIST, item.ResourceList);
item.CustomFields.Add(CF_ORIGINATOR, item.Originator);
item.CustomFields.Add(CF_ISPRIVATE, item.IsPrivate);
item.CustomFields.Add(CF_ISABSENCETIME, item.IsAbsenceTime);
item.CustomFields.Add(CustomField_EmployeeList, item.EmployeeList);
item.CustomFields.Add(CustomField_CustomerList, item.CustomerList);
item.CustomFields.Add(CustomField_ResourceList, item.ResourceList);
item.CustomFields.Add(CustomField_Originator, item.Originator);
item.CustomFields.Add(CustomField_IsPrivate, item.IsPrivate);
item.CustomFields.Add(CustomField_IsAbsenceTime, item.IsAbsenceTime);
item.Id = item.DataContract.SchedulerAppointmentOid;
@@ -178,7 +178,7 @@ namespace BeWo.Scheduler.ViewModel
vm.ResourceList.Select(r => r.ResourceOid.Value).ToList(),
vm.Originator.EmployeeOid,
vm.DataContract.SchedulerAppointmentOid,
item.RecurrenceInfo != null ? item.RecurrenceInfo.Id.ToString() : string.Empty, item.RecurrenceIndex));
item.RecurrenceInfo?.Id.ToString() ?? string.Empty, item.RecurrenceIndex));
if (isOverlapping)
{
@@ -284,40 +284,40 @@ namespace BeWo.Scheduler.ViewModel
private void UpdateSchedulerAppointment(Appointment app, SchedulerAppointmentVM vm)
{
vm.EmployeeList = app.CustomFields[CF_EMPLOYEELIST] as List<Employee2SchedulerAppointmentDC> ?? new List<Employee2SchedulerAppointmentDC>();
vm.CustomerList = app.CustomFields[CF_CUSTOMERLIST] as List<CompactCustomerDC>;
vm.ResourceList = app.CustomFields[CF_RESOURCELIST] as List<ResourceDC>;
vm.Originator = app.CustomFields[CF_ORIGINATOR] as CompactEmployeeDC;
vm.IsPrivate = app.CustomFields[CF_ISPRIVATE] != null && (bool) app.CustomFields[CF_ISPRIVATE];
vm.EmployeeList = app.CustomFields[CustomField_EmployeeList] as List<Employee2SchedulerAppointmentDC> ?? new List<Employee2SchedulerAppointmentDC>();
vm.CustomerList = app.CustomFields[CustomField_CustomerList] as List<CompactCustomerDC>;
vm.ResourceList = app.CustomFields[CustomField_ResourceList] as List<ResourceDC>;
vm.Originator = app.CustomFields[CustomField_Originator] as CompactEmployeeDC;
vm.IsPrivate = app.CustomFields[CustomField_IsPrivate] != null && (bool) app.CustomFields[CustomField_IsPrivate];
if (!vm.CustomFields.ContainsKey(CF_EMPLOYEELIST))
if (!vm.CustomFields.ContainsKey(CustomField_EmployeeList))
{
vm.CustomFields.Add(CF_EMPLOYEELIST, vm.EmployeeList);
vm.CustomFields.Add(CustomField_EmployeeList, vm.EmployeeList);
}
if (!vm.CustomFields.ContainsKey(CF_CUSTOMERLIST))
if (!vm.CustomFields.ContainsKey(CustomField_CustomerList))
{
vm.CustomFields.Add(CF_CUSTOMERLIST, vm.CustomerList);
vm.CustomFields.Add(CustomField_CustomerList, vm.CustomerList);
}
if (!vm.CustomFields.ContainsKey(CF_RESOURCELIST))
if (!vm.CustomFields.ContainsKey(CustomField_ResourceList))
{
vm.CustomFields.Add(CF_RESOURCELIST, vm.ResourceList);
vm.CustomFields.Add(CustomField_ResourceList, vm.ResourceList);
}
if (!vm.CustomFields.ContainsKey(CF_ORIGINATOR))
if (!vm.CustomFields.ContainsKey(CustomField_Originator))
{
vm.CustomFields.Add(CF_ORIGINATOR, vm.Originator);
vm.CustomFields.Add(CustomField_Originator, vm.Originator);
}
if (!vm.CustomFields.ContainsKey(CF_ISPRIVATE))
if (!vm.CustomFields.ContainsKey(CustomField_IsPrivate))
{
vm.CustomFields.Add(CF_ISPRIVATE, vm.IsPrivate);
vm.CustomFields.Add(CustomField_IsPrivate, vm.IsPrivate);
}
if(!vm.CustomFields.ContainsKey(CF_ISABSENCETIME))
if(!vm.CustomFields.ContainsKey(CustomField_IsAbsenceTime))
{
vm.CustomFields.Add(CF_ISABSENCETIME, vm.IsAbsenceTime);
vm.CustomFields.Add(CustomField_IsAbsenceTime, vm.IsAbsenceTime);
}
if (vm.CommitToDataContract() != null && vm.CommitToDataContract().SchedulerAppointmentOid.HasValue && vm.EmployeeList != null && vm.EmployeeList.Count > 0)
@@ -345,20 +345,18 @@ namespace BeWo.Scheduler.ViewModel
{
var index = app.RecurrenceIndex.ToString();
//###Lyndon testen!!!
//var id = app.RecurrenceInfo.Id;
var id = new Guid(app.RecurrenceInfo.Id.ToString());
if (changedOccurencyCustomFields.ContainsKey(id) && changedOccurencyCustomFields[id].ContainsKey(index))
{
if (app.Type.Equals(AppointmentType.ChangedOccurrence))
{
app.CustomFields[CF_EMPLOYEELIST] = changedOccurencyCustomFields[id][index][CF_EMPLOYEELIST];
app.CustomFields[CF_CUSTOMERLIST] = changedOccurencyCustomFields[id][index][CF_CUSTOMERLIST];
app.CustomFields[CF_RESOURCELIST] = changedOccurencyCustomFields[id][index][CF_RESOURCELIST];
app.CustomFields[CF_ORIGINATOR] = changedOccurencyCustomFields[id][index][CF_ORIGINATOR];
app.CustomFields[CF_ISPRIVATE] = changedOccurencyCustomFields[id][index][CF_ISPRIVATE];
app.CustomFields[CF_ISABSENCETIME] = changedOccurencyCustomFields[id][index][CF_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];
}
}
}
@@ -411,21 +409,21 @@ namespace BeWo.Scheduler.ViewModel
return;
}
changedOccurencyCustomFields[id][index][CF_EMPLOYEELIST] = employees;
changedOccurencyCustomFields[id][index][CF_CUSTOMERLIST] = customers;
changedOccurencyCustomFields[id][index][CF_RESOURCELIST] = resources;
changedOccurencyCustomFields[id][index][CF_ORIGINATOR] = originator;
changedOccurencyCustomFields[id][index][CF_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)
{
var employeeMapping = new SchedulerCustomFieldMapping(CF_EMPLOYEELIST, CF_EMPLOYEELIST);
var customerMapping = new SchedulerCustomFieldMapping(CF_CUSTOMERLIST, CF_CUSTOMERLIST);
var resourceMapping = new SchedulerCustomFieldMapping(CF_RESOURCELIST, CF_RESOURCELIST);
var originatorMapping = new SchedulerCustomFieldMapping(CF_ORIGINATOR, CF_ORIGINATOR);
var isPrivateMapping = new SchedulerCustomFieldMapping(CF_ISPRIVATE, CF_ISPRIVATE);
var isAbsenceTimeMapping = new SchedulerCustomFieldMapping(CF_ISABSENCETIME, CF_ISABSENCETIME);
var employeeMapping = new SchedulerCustomFieldMapping(CustomField_EmployeeList, CustomField_EmployeeList);
var customerMapping = new SchedulerCustomFieldMapping(CustomField_CustomerList, CustomField_CustomerList);
var resourceMapping = new SchedulerCustomFieldMapping(CustomField_ResourceList, CustomField_ResourceList);
var originatorMapping = new SchedulerCustomFieldMapping(CustomField_Originator, CustomField_Originator);
var isPrivateMapping = new SchedulerCustomFieldMapping(CustomField_IsPrivate, CustomField_IsPrivate);
var isAbsenceTimeMapping = new SchedulerCustomFieldMapping(CustomField_IsAbsenceTime, CustomField_IsAbsenceTime);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(employeeMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(customerMapping);
@@ -437,12 +435,12 @@ namespace BeWo.Scheduler.ViewModel
public void InitNewAppointment(Appointment appointment)
{
appointment.CustomFields[CF_CUSTOMERLIST] = new List<CompactCustomerDC>();
appointment.CustomFields[CF_EMPLOYEELIST] = new List<Employee2SchedulerAppointmentDC>();
appointment.CustomFields[CF_RESOURCELIST] = new List<ResourceDC>();
ServiceFacade.DoEmployeeServiceSync(s => appointment.CustomFields[CF_ORIGINATOR] = s.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
appointment.CustomFields[CF_ISPRIVATE] = false;
appointment.CustomFields[CF_ISABSENCETIME] = false;
appointment.CustomFields[CustomField_CustomerList] = new List<CompactCustomerDC>();
appointment.CustomFields[CustomField_EmployeeList] = new List<Employee2SchedulerAppointmentDC>();
appointment.CustomFields[CustomField_ResourceList] = new List<ResourceDC>();
ServiceFacade.DoEmployeeServiceSync(s => appointment.CustomFields[CustomField_Originator] = s.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
appointment.CustomFields[CustomField_IsPrivate] = false;
appointment.CustomFields[CustomField_IsAbsenceTime] = false;
appointment.StatusId = 0;
}
@@ -451,15 +449,15 @@ namespace BeWo.Scheduler.ViewModel
var wirdAngezeigt = true; // -> wird standardmäßig angezeigt
var isPrivate = false;
if (appointment.CustomFields[CF_ISPRIVATE] != null)
if (appointment.CustomFields[CustomField_IsPrivate] != null)
{
isPrivate = Convert.ToBoolean(appointment.CustomFields[CF_ISPRIVATE]);
isPrivate = Convert.ToBoolean(appointment.CustomFields[CustomField_IsPrivate]);
}
var isAbsenceTime = false;
if(appointment.CustomFields[CF_ISABSENCETIME] != null)
if(appointment.CustomFields[CustomField_IsAbsenceTime] != null)
{
isAbsenceTime = Convert.ToBoolean(appointment.CustomFields[CF_ISABSENCETIME]);
isAbsenceTime = Convert.ToBoolean(appointment.CustomFields[CustomField_IsAbsenceTime]);
}
if(isAbsenceTime && !showPrivateAppointments && !showAbsenceTimes)
@@ -472,10 +470,10 @@ namespace BeWo.Scheduler.ViewModel
return true;
}
var ersteller = (CompactEmployeeDC)appointment.CustomFields[CF_ORIGINATOR];
var employeeList = (List<Employee2SchedulerAppointmentDC>)appointment.CustomFields[CF_EMPLOYEELIST];
var customerList = (List<CompactCustomerDC>)appointment.CustomFields[CF_CUSTOMERLIST];
var resourceList = (List<ResourceDC>)appointment.CustomFields[CF_RESOURCELIST];
var ersteller = (CompactEmployeeDC)appointment.CustomFields[CustomField_Originator];
var employeeList = (List<Employee2SchedulerAppointmentDC>)appointment.CustomFields[CustomField_EmployeeList];
var customerList = (List<CompactCustomerDC>)appointment.CustomFields[CustomField_CustomerList];
var resourceList = (List<ResourceDC>)appointment.CustomFields[CustomField_ResourceList];
if (isPrivate)
{
@@ -514,7 +512,7 @@ namespace BeWo.Scheduler.ViewModel
break;
case "Ebenen":
var liste = (List<bool>)selectedObject; // mkr
var appEList = employeeList.Where(w => !w.Employee.Equals(appointment.CustomFields[CF_ORIGINATOR])).ToList();
var appEList = employeeList.Where(w => !w.Employee.Equals(appointment.CustomFields[CustomField_Originator])).ToList();
// Ersteller und Rechte beachten
@@ -563,26 +561,32 @@ namespace BeWo.Scheduler.ViewModel
}
if (index.Equals(""))
{
index = "0";
}
var customFieldCollection = new Dictionary<string, object>();
customFieldCollection[CF_CUSTOMERLIST] = termin.CustomerList;
customFieldCollection[CF_EMPLOYEELIST] = termin.EmployeeList;
customFieldCollection[CF_RESOURCELIST] = termin.ResourceList;
customFieldCollection[CF_ORIGINATOR] = termin.Originator;
customFieldCollection[CF_ISPRIVATE] = termin.IsPrivate;
customFieldCollection[CF_ISABSENCETIME] = false;
var customFieldCollection = new Dictionary<string, object>();
customFieldCollection[CustomField_CustomerList] = termin.CustomerList;
customFieldCollection[CustomField_EmployeeList] = termin.EmployeeList;
customFieldCollection[CustomField_ResourceList] = termin.ResourceList;
customFieldCollection[CustomField_Originator] = termin.Originator;
customFieldCollection[CustomField_IsPrivate] = termin.IsPrivate;
customFieldCollection[CustomField_IsAbsenceTime] = false;
//###Lyndon testen!!!
//var id = app.RecurrenceInfo.Id;
var id = new Guid(ri.Id.ToString());
if (!changedOccurencyCustomFields.ContainsKey(id))
changedOccurencyCustomFields.Add(id, new Dictionary<string, Dictionary<string, object>> { { index, customFieldCollection } });
{
changedOccurencyCustomFields.Add(id, new Dictionary<string, Dictionary<string, object>> { { index, customFieldCollection } });
}
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;
}
}
}

View File

@@ -15,13 +15,13 @@
NHibernate.Driver.MySqlDataDriver
</property>
<!-- <property name="connection.connection_string">
<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
</property>-->
</property>
<property name="connection.connection_string">
<!--<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=1234567890
</property>
</property>-->
<property name="dialect">
NHibernate.Dialect.MySQLDialect

View File

@@ -118,8 +118,8 @@
<add key="PreserveLoginUrl" value="true"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<!--<add key="MultitenancyPath" value="F:\Projects\BeWo\Host\Multitenancy\"/>-->
<add key="MultitenancyPath" value="C:\Projekte\BeWo\Host\Multitenancy\"/>
<add key="MultitenancyPath" value="F:\Projects\BeWo\Host\Multitenancy\"/>
<!--<add key="MultitenancyPath" value="C:\Projekte\BeWo\Host\Multitenancy\"/>-->
<!--<add key="MultitenancyPath" value="..\Host\Multitenancy"/>-->
</appSettings>
<!--

View File

@@ -15,13 +15,13 @@
NHibernate.Driver.MySqlDataDriver
</property>
<!-- <property name="connection.connection_string">
<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
</property>-->
</property>
<property name="connection.connection_string">
<!--<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=1234567890
</property>
</property>-->
<property name="dialect">
NHibernate.Dialect.MySQLDialect

View File

@@ -1,4 +1,4 @@
ALTER TABLE `1234567890`.`customer`
ALTER TABLE `customer`
ADD COLUMN `VertretungGewuenscht` TINYINT(4) NULL DEFAULT 1 COMMENT '' AFTER `AufenthaltsStatusValueListEntryOid`,
@@ -7,13 +7,13 @@ ADD COLUMN `AbWelchemKrankheitsTag` INT(10) NULL DEFAULT 0 COMMENT '' AFTER `Ver
ADD COLUMN `VertretungDringendErforderlich` TINYINT(4) NULL DEFAULT 1 COMMENT '' AFTER `AbWelchenKrankheitsTag`;
ALTER TABLE `1234567890`.`arbeitszeiteintrag`
ALTER TABLE `arbeitszeiteintrag`
ADD COLUMN `CustomerOid` BIGINT(19) NULL DEFAULT NULL COMMENT '' AFTER `UhrzeitBis`;
ALTER TABLE `1234567890`.`customerappcode`
ALTER TABLE `customerappcode`
ADD COLUMN `BenutzerName` VARCHAR(1024) NULL DEFAULT NULL COMMENT '' AFTER `IsChatActive`,