Begonnen, AbsenceTimes als Appointments im Kalender anzuzeigen.

Diverse Code-Clean-Ups
This commit is contained in:
staccatomamba
2017-08-23 17:17:08 +02:00
parent 874bb1fbcc
commit c914642d08
15 changed files with 118 additions and 66 deletions

View File

@@ -5,7 +5,7 @@ namespace BeWo.Scheduler
{
public interface IBeWoAppointment
{
Object Id { get; set; }
object Id { get; set; }
DateTime Start { get; set;}
@@ -13,18 +13,18 @@ namespace BeWo.Scheduler
int LabelId { get; set;}
String Subject { get; set;}
string Subject { get; set;}
String Description { get; set; }
string Description { get; set; }
String Location { get; set; }
string Location { get; set; }
bool AllDay { get; set; }
int EventType { get; set; }
String RecurrenceInfo { get; set; }
string RecurrenceInfo { get; set; }
Dictionary<String, Object> CustomFields { get; }
Dictionary<string, object> CustomFields { get; }
}
}

View File

@@ -638,21 +638,24 @@
</Button.Template>
</Button>
</StackPanel>
<Grid Grid.Column="2" Grid.Row="0" Margin="6,0,0,0" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Content="Mitarbeiterfarben Ein/Aus" x:Name="MitarbeiterfarbenEinAusCheckBox" Checked="MitarbeiterfarbenEinAusCheckBox_OnChecked"
Unchecked="MitarbeiterfarbenEinAusCheckBox_OnChecked"
IsChecked="{Binding Path=IsEmployeeBrushVisible, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type view:NewSchedulerView}}, Mode=TwoWay}" />
<TextBlock IsEnabled="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}" Grid.Column="0" Grid.ColumnSpan="3" VerticalAlignment="Center" HorizontalAlignment="Center">
<Hyperlink RequestNavigate="ShowAppointmentRequests" NavigateUri="#" IsEnabled="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}">
<TextBlock Text="{Binding Requests, UpdateSourceTrigger=PropertyChanged}" />
</Hyperlink>
</TextBlock>
<Grid Grid.Column="2" Grid.Row="0" Margin="6,0,0,0" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Content="Mitarbeiterfarben Ein/Aus" x:Name="MitarbeiterfarbenEinAusCheckBox" Checked="MitarbeiterfarbenEinAusCheckBox_OnChecked"
Unchecked="MitarbeiterfarbenEinAusCheckBox_OnChecked"
IsChecked="{Binding Path=IsEmployeeBrushVisible, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type view:NewSchedulerView}}, Mode=TwoWay}" />
<CheckBox Grid.Column="1" Content="Abwesenheiten Ein/Aus" Margin="17,0,0,0" x:Name="AbwesenheitenEinAusCheckBox" Checked="AbwesenheitenEinAusCheckBox_OnChecked"
Unchecked="AbwesenheitenEinAusCheckBox_OnChecked" Visibility="Collapsed"
IsChecked="{Binding Path=IsAbsenceTimeVisible, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type view:NewSchedulerView}}, Mode=TwoWay}" />
<TextBlock IsEnabled="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}" Grid.Column="0" Grid.ColumnSpan="3" VerticalAlignment="Center" HorizontalAlignment="Center">
<Hyperlink RequestNavigate="ShowAppointmentRequests" NavigateUri="#" IsEnabled="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}">
<TextBlock Text="{Binding Requests, UpdateSourceTrigger=PropertyChanged}" />
</Hyperlink>
</TextBlock>
<CheckBox Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Content="Nur private Termine anzeigen" x:Name="ShowPrivateAppointmentsCheckBox" Click="ShowPrivateAppointmentsCheckBox_OnClick" />
</Grid>
<Border Grid.Row="0" Grid.Column="3" Width="{Binding ElementName=RightExpanderButton, Path=ActualWidth}" />

View File

@@ -24,12 +24,14 @@ using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.Xpf.Bars;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Drawing;
using DevExpress.Xpf.Scheduler.Reporting;
using DevExpress.XtraScheduler;
using Appointment = DevExpress.XtraScheduler.Appointment;
using ColorConverter = System.Windows.Media.ColorConverter;
using SchedulerControl = DevExpress.Xpf.Scheduler.SchedulerControl;
@@ -52,6 +54,19 @@ namespace BeWo.Scheduler.View
}
}
private bool _IsAbsenceTimeVisible;
public bool IsAbsenceTimeVisible
{
get { return _IsAbsenceTimeVisible; }
set
{
_IsAbsenceTimeVisible = value;
OnPropertyChanged("IsAbsenceTimeVisible");
}
}
public bool IsInCustomerViewMode { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
@@ -65,7 +80,9 @@ namespace BeWo.Scheduler.View
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
public bool ZeigeNurMeineTermine
@@ -369,8 +386,6 @@ namespace BeWo.Scheduler.View
private void ConstructObject()
{
//SchedulerWriteLog();
IsEmployeeBrushVisible = true;
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen))
@@ -1812,6 +1827,12 @@ namespace BeWo.Scheduler.View
Scheduler.ActiveView.LayoutChanged();
}
private void AbwesenheitenEinAusCheckBox_OnChecked(object sender, RoutedEventArgs e)
{
var cb = (CheckBox) sender;
IsAbsenceTimeVisible = cb.IsChecked ?? true;
}
}
#region Converter

View File

@@ -54,6 +54,8 @@ namespace BeWo.Scheduler.ViewModel
var appointments = new List<SchedulerAppointmentDC>();
var allCust = new List<CompactCustomerDC>();
var abwesenheiten = new List<AbsenceTimeDC>();
allEmps = Cache.GetInstance().GetAllActiveEmployeesCompactSync();
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen))
@@ -61,15 +63,13 @@ namespace BeWo.Scheduler.ViewModel
ServiceFacade.DoEmployeeServiceSync(es => allEmps = new List<CompactEmployeeDC> { es.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value) });
}
//if (mAllCats2ResInDic == null)
//{
ServiceFacade.DoResourceServiceSync(s => mAllCats2ResInDic = s.GetAllCategories2ResourcesInDictionary());
//}
ServiceFacade.DoResourceServiceSync(s => mAllCats2ResInDic = s.GetAllCategories2ResourcesInDictionary());
var start = intervalStart - NewSchedulerView.FetchPadding;
var end = intervalEnd + NewSchedulerView.FetchPadding;
ServiceFacade.DoResourceServiceSync(rs => appointments = rs.GetAllActiveAppointmentsForEmployeeInInterval2(start, end, BeWoApp.LoggedOnEmployee.EmployeeOid.Value, BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)));
//ServiceFacade.DoResourceServiceSync(rs => abwesenheiten = rs.);
allCust = Cache.GetInstance().GetAllActiveCustomersCompactSync();

View File

@@ -27,6 +27,7 @@ namespace BeWo.Scheduler.ViewModel
public static string PropertyName_ResourceList = "ResourceList";
public static string PropertyName_IsPrivate = "IsPrivate";
public static string PropertyName_Originator = "Originator";
public static string PropertyName_IsAbsenceTime = "IsAbsenceTime";
private bool _AllDay;
private string _Description;
@@ -43,6 +44,7 @@ namespace BeWo.Scheduler.ViewModel
private List<CompactCustomerDC> _CustomerList;
private List<ResourceDC> _ResourceList;
private CompactEmployeeDC _Originator;
private bool _IsAbsenceTime;
public object Id { get; set; }
public int LabelId { get; set; }
@@ -259,7 +261,12 @@ namespace BeWo.Scheduler.ViewModel
set { }
}
public SchedulerAppointmentVM(SchedulerAppointmentDC pDC) : base(pDC, pDC.SchedulerAppointmentOid == null) { }
public virtual bool IsAbsenceTime
{
get { return _IsAbsenceTime; }
}
public SchedulerAppointmentVM(SchedulerAppointmentDC pDC) : base(pDC, pDC.SchedulerAppointmentOid == null) {}
public void UpdateCustomFields()
{

View File

@@ -2136,7 +2136,7 @@
<Style.Resources>
<SolidColorBrush x:Key="NavigationHeaderBrush" Color="#FF2A4958" />
<LinearGradientBrush x:Key="NavigationContentBrush" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF3B7799" Offset="0" />
<GradientStop Color="#FF565999" Offset="0" />
<GradientStop Color="#FF19485C" Offset="1" />
</LinearGradientBrush>
</Style.Resources>

View File

@@ -24,6 +24,7 @@ namespace BeWo.View.Navigation
{
if (refresh || recentList == null)
{
}
}

View File

@@ -4,7 +4,6 @@ using System.Linq;
using BeWo.Core.Service;
using BeWo.ServiceProxy;
using BeWo.Scheduler.ViewModel;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
@@ -12,7 +11,6 @@ using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.XtraPrinting.Native;
namespace BeWo.ViewModel
@@ -647,8 +645,6 @@ namespace BeWo.ViewModel
ServiceFacade.DoValueListServiceAsync(s => s.GetAllValueListEntrysByType(pType), r => pCallBack(new ValueListEntryListVM(pType, r)));
}
public static void CreateGoalCategoryVMAsync(Action<GenericValueListEntryListVM> pCallBack, bool pIsIncludingIndividualGoals = false)
{
var typeList = new List<ValueListEntryType> { ValueListEntryType.SupportConceptGoalType, ValueListEntryType.SupportConceptGoalCategoryType };
@@ -689,11 +685,6 @@ namespace BeWo.ViewModel
cb4 => pCallBack(new CustomerVM(pCustomerDC, cb, cb2, cb3, cb4))))));
}
public static void CreateNewSchedulerAppointmentListVM(Action<SchedulerAppointmentListVM> pCallBack, DateTime intervalStart, DateTime intervalEnd)
{
}
public static void CreateAppointmentCategoryListVMAsync(Action<AppointmentCategoryListVM> pCallBack)
{
ServiceFacade.DoCustomerServiceAsync(

View File

@@ -1909,7 +1909,7 @@ namespace BeWo.Data.Access
return c.List<ChatMessage>();
}
public string ToSql(ICriteria criteria)
public static string ToSql(ICriteria criteria)
{
var c = (CriteriaImpl)criteria;
var s = (SessionImpl)c.Session;
@@ -2038,7 +2038,6 @@ namespace BeWo.Data.Access
return c;
}
public IList<Person> GetAllPerson2OrganisationRelations(long organisationOid)
{
@@ -2099,7 +2098,6 @@ namespace BeWo.Data.Access
.List<SupportConcept>().Distinct().ToList();
}
public IList<QuittierungsCheck> FindQuittierungsCheckWithCustomerOids(List<long> oids)
{
var c = CreateCriteria<QuittierungsCheck>()
@@ -2120,5 +2118,25 @@ namespace BeWo.Data.Access
return c.List<QuittierungsCheck>();
}
public IEnumerable<AbsenceTime> GetAllAbsenceTimesInIntervalByEmployee(DateTime start, DateTime end, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments)
{
// Wenn das Enddatum null ist, wird das Ende des Intervalls als Enddatum gesetzt (Ist ja eh read-only).
var criteria = CreateCriteriaIsActive<AbsenceTime>()
.Add(Restrictions.Or
(Restrictions.Or(Restrictions.Or(
Restrictions.And(Restrictions.Ge(AbsenceTime.PropertyName_Start, start), Restrictions.Le(AbsenceTime.PropertyName_Start, end)),
Restrictions.Eq(AbsenceTime.PropertyName_Start, start)
), Restrictions.And(Restrictions.Le(AbsenceTime.PropertyName_Start, start), Restrictions.IsNull(AbsenceTime.PropertyName_End))
), Restrictions.And(Restrictions.Lt(AbsenceTime.PropertyName_Start, start), Restrictions.Gt(AbsenceTime.PropertyName_End, start)))
);
if (!pHasRightToSeeAllEmployeeAppointments)
{
criteria.Add(Restrictions.Eq(AbsenceTime.PropertyName_EmployeeOid, pEmployeeOid));
}
return criteria.List<AbsenceTime>();
}
}
}

View File

@@ -2,7 +2,6 @@
using BS.Shared;
using BS.Shared.Core;
using NHibernate.Mapping;
namespace BeWo.Data.Entities
{

View File

@@ -33,7 +33,7 @@ namespace BeWo.Data.Entities
private bool _IsPrivate;
private Employee _Originator;
private long? _FormerBookingSequenceOid;
private string _Notice2;
private string _Notice2;
private string _Notice3;
private string _Notice4;
private string _Notice5;
@@ -65,7 +65,7 @@ namespace BeWo.Data.Entities
_IsPrivate = value;
}
}
public virtual String Location { get; set; }
public virtual string Location { get; set; }
public virtual Employee Originator
{
get { return _Originator; }
@@ -75,8 +75,8 @@ namespace BeWo.Data.Entities
_Originator = value;
}
}
public virtual String RecurrenceInfo { get; set; }
public virtual String ReminderInfo { get; set; }
public virtual string RecurrenceInfo { get; set; }
public virtual string ReminderInfo { get; set; }
public virtual IList<Resource> ResourceList
{
get { return _ResourceList ?? (_ResourceList = new List<Resource>()); }
@@ -99,7 +99,7 @@ namespace BeWo.Data.Entities
}
public virtual DateTime? StartDate { get; set; }
public virtual int Status { get; set; }
public virtual String Subject { get; set; }
public virtual string Subject { get; set; }
public virtual int Type { get; set; }
public virtual long? FormerBookingSequenceOid

View File

@@ -7,10 +7,10 @@ namespace BeWo.Data.Entities
{
public class Team2Customer : BeWoEntityBase
{
public static string PropertyName_ValueList = "ValueList";
public static string PropertyName_Customer = "Customer";
public static string PropertyName_Team = "Team";
public static string PropertyName_TeamOid = "TeamOid";
public static string PropertyName_ValueList = "ValueList";
public static string PropertyName_Customer = "Customer";
public static string PropertyName_Team = "Team";
public static string PropertyName_TeamOid = "TeamOid";
public static string PropertyName_CustomerOid = "CustomerOid";
private IList<ValueListEntry2Object> _ValueList;
@@ -28,16 +28,9 @@ namespace BeWo.Data.Entities
{
if (base.AreDifferent(_Customer, value))
{
_Customer = value;
_Customer = value;
if (_Customer != null)
{
CustomerOid = _Customer.Oid;
}
else
{
CustomerOid = null;
}
CustomerOid = _Customer != null ? _Customer.Oid : null;
}
}
}

View File

@@ -168,5 +168,10 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<SchedulerAppointmentDC> GetAllActiveAppointmentsForEmployeeInInterval2(DateTime start, DateTime end, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<AbsenceTimeDC> GetAllActiveAbsenceTimesInInterval(DateTime pStart, DateTime pEnd, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments);
}
}

View File

@@ -420,11 +420,10 @@ namespace BeWo.Service.ServiceImplementations
{
return MapperFactory.CompactTeamDC_Team.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive<Team>());
}
if (Utils.UserHasRight(LoggedInUserOperationContextExt.Current.User, UserRightType.TeamView_ViewMyTeams))
{
var teams =
DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(
LoggedInUserOperationContextExt.Current.User.Employee.Oid.Value);
var teams = DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(LoggedInUserOperationContextExt.Current.User.Employee.Oid.Value);
return MapperFactory.CompactTeamDC_Team.MapToNewDCs(teams);
}

View File

@@ -937,13 +937,13 @@ namespace BeWo.Service.ServiceImplementations
return GetAllActiveAppointmentsForEmployeeInInterval2(start, end, pEmployeeOid, false);
}
public List<SchedulerAppointmentDC> GetAllActiveAppointmentsForEmployeeInInterval2(DateTime start, DateTime end, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments)
public List<SchedulerAppointmentDC> GetAllActiveAppointmentsForEmployeeInInterval2(DateTime pStart, DateTime pEnd, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments)
{
try
{
var apps = pHasRightToSeeAllEmployeeAppointments ?
DAOFactory.SearchDAO.GetAllActiveAppointmentsInInterval(start, end) :
DAOFactory.SearchDAO.GetAllActiveAppointmentsForEmployeeInInterval(start, end, pEmployeeOid);
DAOFactory.SearchDAO.GetAllActiveAppointmentsInInterval(pStart, pEnd) :
DAOFactory.SearchDAO.GetAllActiveAppointmentsForEmployeeInInterval(pStart, pEnd, pEmployeeOid);
return MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(apps).OrderBy(a => a.StartDate).ToList();
}
@@ -952,5 +952,20 @@ namespace BeWo.Service.ServiceImplementations
throw Utils.CreateBeWoFaultException(e);
}
}
public List<AbsenceTimeDC> GetAllActiveAbsenceTimesInInterval(DateTime pStart, DateTime pEnd, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments)
{
try
{
var absenceTimes = DAOFactory.SearchDAO.GetAllAbsenceTimesInIntervalByEmployee(pStart, pEnd, pEmployeeOid,
pHasRightToSeeAllEmployeeAppointments);
return MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewDCs(absenceTimes).OrderBy(a => a.Start).ToList();
}
catch(Exception e)
{
throw Utils.CreateBeWoFaultException(e);
}
}
}
}