Bei Abwesenheiten im Kalender werden jetzt die Mitarbeiternamen und -farben angezeigt.

This commit is contained in:
Lyndon
2018-03-05 15:27:18 +01:00
parent 4e5ec53b0d
commit 9e10e824d6
7 changed files with 67 additions and 48 deletions

View File

@@ -2002,7 +2002,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Chat\ChatController\ChatController.csproj">
<ProjectReference Include="..\..\Chat\ChatController\ChatController.csproj">
<Project>{8a83c4dc-a0b1-4a51-ae1d-366d7a05b298}</Project>
<Name>ChatController</Name>
</ProjectReference>

View File

@@ -20,15 +20,14 @@ namespace BeWo.Scheduler.View
var farbe = Color.FromRgb(192, 255, 208);
var gradientCollection = new GradientStopCollection { new GradientStop(farbe, 1) };
if (values[2] is bool && ((bool) values[2]) == false)
if(values[2] is bool b && b == false)
{
return gradientCollection;
}
try
{
var customViewInfo = values[1] as CustomFieldCollection;
if (customViewInfo == null)
if(!(values[1] is CustomFieldCollection customViewInfo))
{
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1));
}
@@ -36,12 +35,12 @@ namespace BeWo.Scheduler.View
var aptEmployees = (List<Employee2SchedulerAppointmentDC>) customViewInfo["EmployeeList"];
var ersteller = (CompactEmployeeDC) customViewInfo["Originator"];
if (aptEmployees.Count > 0)
if(aptEmployees.Count > 0)
{
var firstEmployeeInList = aptEmployees.First(f => f.Employee.EmployeeColor != null);
gradientCollection = new GradientStopCollection { new GradientStop(firstEmployeeInList.Employee.FilterableBrush.Color, 1) };
}
else if (!String.IsNullOrEmpty(ersteller.EmployeeColor))
else if(!string.IsNullOrEmpty(ersteller.EmployeeColor))
{
gradientCollection = new GradientStopCollection {new GradientStop(ersteller.FilterableBrush.Color, 1)};
}

View File

@@ -17,6 +17,7 @@
<localView:BeWoView.Resources>
<ResourceDictionary>
<dxschint:ToolTipVisibilityToVisibilityConverter x:Key="ToolTipVisibilityConverter" />
<view:ToolTipTimeVisibilityConverter x:Key="ToolTipTimeVisibilityConverter" />
<dx:BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
<localSchConv:TimeScale2TextConverter x:Key="TimeScale2TextConverter" />
<localSchConv:CheckBoxConverter x:Key="CheckBoxConverter" />
@@ -136,7 +137,7 @@
<dxschint:AppointmentBorder x:Name="back" DefaultCornerRadius="4" Opacity="1" ViewInfo="{TemplateBinding ViewInfo}"
Background="{Binding Path=ViewInfo.CustomViewInfo, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource AppointmentBorderZusageConverter}}">
<dxschint:AppointmentBorder DefaultCornerRadius="3" DefaultMargin="2" ViewInfo="{TemplateBinding ViewInfo}" Background="#c0ffd0" BorderThickness="1" DefaultBorderThickness="1">
<dxschint:AppointmentBorder x:Name="AppointmentBorder" DefaultCornerRadius="2" DefaultMargin="0" ViewInfo="{TemplateBinding ViewInfo}" Background="Transparent">
<dxschint:AppointmentBorder x:Name="AppointmentBorder" DefaultCornerRadius="2" DefaultMargin="0" ViewInfo="{TemplateBinding ViewInfo}" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@@ -205,7 +206,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Subject}" TextWrapping="NoWrap" Margin="6,0,0,3" Foreground="Black" />
<TextBlock Grid.Row="1" Text="{Binding Location}" TextWrapping="Wrap" Margin="6,0,0,3" Foreground="Black" />
<TextBlock Grid.Row="1" Text="{Binding Location}" TextWrapping="Wrap" Margin="6,0,0,3" Foreground="Black" />
</Grid>
<dxschint:AppointmentImagesControl Grid.Column="1" ViewInfo="{Binding}" Orientation="Vertical" SnapsToDevicePixels="True" />
</Grid>
@@ -381,9 +382,9 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<StackPanel Grid.Column="0" Orientation="Horizontal" Visibility="{Binding Path=CustomViewInfo, Converter={StaticResource ToolTipTimeVisibilityConverter}}">
<TextBlock Text="{Binding Path=StartTimeText}" />
<TextBlock Text=" - " />
<TextBlock Text=" - " />
<TextBlock Text="{Binding Path=EndTimeText}" />
<TextBlock Text=" Uhr" Margin="0,0,4,0" />
</StackPanel>

View File

@@ -26,7 +26,7 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Translation;
using DevExpress.Utils.Extensions;
using DevExpress.Xpf.Bars;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Scheduler;
@@ -276,11 +276,9 @@ namespace BeWo.Scheduler.View
if(!ListEquals(_SelectedCustomers, value))
{
_SelectedCustomers = value;
_SelectedCustomers.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName,
y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
_SelectedCustomers.Sort((x, y) => string.Compare(x.LastName + ", " + x.FirstName, y.LastName + ", " + y.FirstName, StringComparison.Ordinal));
if(NurMeineKlientenCB.IsChecked.HasValue && NurMeineKlientenCB.IsChecked.Value &&
value.Equals(GefilterteKlienten) || value.Equals(AllCustomers))
if(NurMeineKlientenCB.IsChecked.HasValue && NurMeineKlientenCB.IsChecked.Value && value.Equals(GefilterteKlienten) || value.Equals(AllCustomers))
{
AlleKlientenCB.IsChecked = true;
}
@@ -299,6 +297,7 @@ namespace BeWo.Scheduler.View
if(!ListEquals(_SelectedResources, value))
{
_SelectedResources = value;
if(value.Equals(AllResources))
{
AlleRessourcenCB.IsChecked = true;
@@ -315,6 +314,7 @@ namespace BeWo.Scheduler.View
get
{
var erg = new List<IDataContract>();
erg.AddRange(SelectedEmployees);
erg.AddRange(SelectedCustomers);
erg.AddRange(SelectedResources);
@@ -328,6 +328,7 @@ namespace BeWo.Scheduler.View
get
{
var erg = new List<IDataContract>();
erg.AddRange(GefilterteKlienten);
erg.AddRange(AllResources);
@@ -390,16 +391,6 @@ namespace BeWo.Scheduler.View
ConstructObject();
}
public static void SchedulerWriteLog(string info = "")
{
#if(DEBUG)
using (var sw = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "SchedulerLog.txt"), true))
{
sw.WriteLine(DateTime.Now.ToString("HH:mm:ss.ffff") + " " + info);
}
#endif
}
private void ConstructObject()
{
//WriteToDebugLog("Beginning");
@@ -1560,8 +1551,8 @@ namespace BeWo.Scheduler.View
return;
}
var start = pIntervalStart - NewSchedulerView.FetchPadding;
var end = pIntervalEnd + NewSchedulerView.FetchPadding;
var start = pIntervalStart - FetchPadding;
var end = pIntervalEnd + FetchPadding;
Cache.GetInstance().GetAllActiveEmployeesCompact(allEmployees =>
{
@@ -1584,12 +1575,15 @@ namespace BeWo.Scheduler.View
{
var prefilteredAppointments = appointments.Where(w => (w.EmployeeList.Count == 0 && w.Originator.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) ||
w.EmployeeList.Count > 0 && w.EmployeeList.Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) ||
BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) && (!w.EmployeeList.TrueForAll(e2a => e2a.ParticipationAnswer == ParticipationAnswer.Absage) || (w.EmployeeList == null || w.EmployeeList.Count == 0))).ToList();
BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) && (!w.EmployeeList.TrueForAll(e2a => e2a.ParticipationAnswer == ParticipationAnswer.Absage) || w.EmployeeList == null || w.EmployeeList.Count == 0)).ToList();
var vm = new SchedulerAppointmentListVM(prefilteredAppointments, customers, allEmployees, cats2Res);
if (pShouldShowAbsenceTimes)
{
vm.Appointments.AddRange(ViewModel.ConvertAbsenceTimesToAppointments(absenceTimes, end));
vm.Appointments.AddRange(ViewModel.ConvertAbsenceTimesToAppointments(absenceTimes.Where(w =>
{
return SelectedEmployees.Count == 0 || SelectedEmployees.Any(a => a.EmployeeOid == w.EmployeeOid);
}), end, allEmployees));
}
ViewModel.ActiveAppointmentViewModel = vm;
@@ -2331,5 +2325,27 @@ namespace BeWo.Scheduler.View
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); }
}
#endregion
public class ToolTipTimeVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var customFields = (CustomFieldCollection) value;
if(customFields == null || customFields.ToArray().ToList().Any(a => a == null))
{
return Visibility.Visible;
}
var isParsingSuccessful = bool.TryParse(customFields[SchedulerAppointmentListVM.CustomField_IsAbsenceTime].ToString(), out var isAbsenceTime);
return isParsingSuccessful && isAbsenceTime ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
#endregion
}

View File

@@ -2,17 +2,12 @@
using System.Collections.Generic;
using System.Linq;
using BeWo.Core.Service;
using BS.Shared.Core;
using BeWo.Scheduler.View;
using BeWo.ServiceProxy;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.DataProcessing;
using DevExpress.XtraScheduler;
namespace BeWo.Scheduler.ViewModel
@@ -21,27 +16,24 @@ namespace BeWo.Scheduler.ViewModel
{
public event EventHandler<EventArgs<ISchedulerViewModel>> ViewModelChanged;
private ISchedulerViewModel _activeAppointmentViewModel;
private Dictionary<ValueListEntryDC, List<ResourceDC>> _allCats2ResInDic;
private ISchedulerViewModel _ActiveAppointmentViewModel;
private Dictionary<ValueListEntryDC, List<ResourceDC>> _AllCats2ResInDic;
public ISchedulerViewModel ActiveAppointmentViewModel
{
get => _activeAppointmentViewModel;
get => _ActiveAppointmentViewModel;
set
{
if(value != null)
{
_activeAppointmentViewModel = value;
_ActiveAppointmentViewModel = value;
ViewModelChanged?.Invoke(this, new EventArgs<ISchedulerViewModel>(value));
}
}
}
private List<CompactEmployeeDC> _allEmployees = new List<CompactEmployeeDC>();
public AbstractAppointmentEditForm GetEditAppointmentForm(DevExpress.Xpf.Scheduler.SchedulerControl control, Appointment appointment)
{
return ActiveAppointmentViewModel?.GetEditAppointmentForm(control, appointment);
@@ -59,9 +51,20 @@ namespace BeWo.Scheduler.ViewModel
return ActiveAppointmentViewModel == null ? null : SchedulerSettings ?? ActiveAppointmentViewModel.GetDefaultSchedulerSettings();
}
public IEnumerable<SchedulerAppointmentVM> ConvertAbsenceTimesToAppointments(IEnumerable<AbsenceTimeDC> pAbsenceTimes, DateTime pIntervalEnd)
public IEnumerable<SchedulerAppointmentVM> ConvertAbsenceTimesToAppointments(IEnumerable<AbsenceTimeDC> pAbsenceTimes, DateTime pIntervalEnd, List<CompactEmployeeDC> allEmployees)
{
return pAbsenceTimes.Select(abwesenheit => new SchedulerAppointmentVM(true, abwesenheit.Reason.Description, abwesenheit.Start.Value, abwesenheit.End ?? pIntervalEnd, _allEmployees.FirstOrDefault(f => f.EmployeeOid == abwesenheit.EmployeeOid.Value))).ToList();
return pAbsenceTimes.Select(abwesenheit =>
{
var subject = $"{abwesenheit.Reason.Description}";
var employee = allEmployees.FirstOrDefault(f => f.EmployeeOid == abwesenheit.EmployeeOid.Value);
if(employee != null)
{
subject += $" ({employee.SimpleDescription})";
}
return new SchedulerAppointmentVM(true, subject, abwesenheit.Start.Value, abwesenheit.End ?? pIntervalEnd, employee);
}).ToList();
}
}
}

View File

@@ -34,7 +34,7 @@
</root>
</log4net>
<appSettings>
<add key="MultitenancyPath" value="F:\Projects\BeWo\Host\Multitenancy\"/>
<add key="MultitenancyPath" value="D:\Projects\BeWo\Host\Multitenancy\"/>
<!-- C:\Projekte\BeWo\Host\Multitenancy\-->
<add key="BeWoPlanerAndroid.AndroidSoapService" value="http://localhost/AndroidSoapService.asmx"/>
</appSettings>

View File

@@ -16,7 +16,7 @@
</property>
<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=chattest
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
</property>