2016-06-27 01:45:38 +02:00
using System ;
using System.Collections.Generic ;
using System.Collections.ObjectModel ;
using System.ComponentModel ;
using System.Globalization ;
using System.Linq ;
using System.Windows ;
using System.Windows.Controls ;
using System.Windows.Data ;
2018-10-23 17:48:04 +02:00
2016-06-27 01:45:38 +02:00
using BeWo.Annotations ;
using BeWo.Scheduler.ViewModel ;
using BeWo.ServiceProxy ;
using BS.Shared ;
using BS.Shared.DataContracts ;
using BS.Shared.DataContracts.Compact ;
using BS.Shared.Extensions ;
2018-10-23 17:48:04 +02:00
using DevExpress.Xpf.Editors ;
using DevExpress.XtraScheduler ;
2017-12-14 18:33:17 -04:00
2016-06-27 01:45:38 +02:00
namespace BeWo.Scheduler.View
{
public partial class RequestAnswerView : INotifyPropertyChanged
{
2018-10-23 17:48:04 +02:00
public static readonly RoutedEvent ParticipationChangedEvent = EventManager . RegisterRoutedEvent ( nameof ( ParticipationChanged ) , RoutingStrategy . Bubble , typeof ( RoutedEventHandler ) , typeof ( RequestAnswerView ) ) ;
2016-06-27 01:45:38 +02:00
public event RoutedEventHandler ParticipationChanged
{
2018-10-23 17:48:04 +02:00
add = > AddHandler ( ParticipationChangedEvent , value ) ;
remove = > RemoveHandler ( ParticipationChangedEvent , value ) ;
2016-06-27 01:45:38 +02:00
}
2017-04-12 10:55:32 +02:00
private void RaiseParticipationChangedEventEvent ( )
2016-06-27 01:45:38 +02:00
{
var newEventArgs = new RoutedEventArgs ( ParticipationChangedEvent ) ;
RaiseEvent ( newEventArgs ) ;
}
public event PropertyChangedEventHandler PropertyChanged ;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged ( string propertyName )
{
2018-10-23 17:48:04 +02:00
PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( propertyName ) ) ;
}
2016-06-27 01:45:38 +02:00
2021-09-30 12:21:32 +02:00
public ObservableCollection < IMainSessionointment > OffeneTermine { get ; set ; }
2016-06-27 01:45:38 +02:00
2021-09-30 12:21:32 +02:00
private IMainSessionointment _selektierterTermin ;
public IMainSessionointment SelektierterTermin
2016-06-27 01:45:38 +02:00
{
2018-10-23 17:48:04 +02:00
get = > _selektierterTermin ;
set
2016-06-27 01:45:38 +02:00
{
2018-10-23 17:48:04 +02:00
_selektierterTermin = value ;
OnPropertyChanged ( nameof ( SelektierterTermin ) ) ;
2016-06-27 01:45:38 +02:00
}
}
2021-09-30 12:21:32 +02:00
public RequestAnswerView ( IEnumerable < IMainSessionointment > appointments , IEnumerable < IMainSessionointment > statusUpdates )
2016-06-27 01:45:38 +02:00
{
2021-09-30 12:21:32 +02:00
var statusUpdatesAsAppointments = new List < IMainSessionointment > ( ) ;
2017-04-12 10:55:32 +02:00
2021-09-30 12:21:32 +02:00
foreach ( var MainSessionointment in statusUpdates )
2017-04-12 10:55:32 +02:00
{
2021-09-30 12:21:32 +02:00
var item = ( SchedulerAppointmentVM ) MainSessionointment ;
foreach ( var relation in item . EmployeeList . Where ( emp = > emp . IsPChanged & & emp . ParticipationAnswer ! = ParticipationAnswer . Offen & & emp . ParticipationAnswer ! = ParticipationAnswer . Verstrichen & & ! emp . Employee . EmployeeOid . Equals ( MainSession . LoggedOnEmployee . EmployeeOid ) ) )
2017-04-12 10:55:32 +02:00
{
if ( statusUpdatesAsAppointments . All ( a = > a . LabelId ! = relation . Employee2SchedulerAppointmentOid ) )
{
2018-10-23 17:48:04 +02:00
if ( relation . Employee2SchedulerAppointmentOid ! = null )
{
statusUpdatesAsAppointments . Add ( BuildNewVMFromOldVM ( item , relation . Employee2SchedulerAppointmentOid . Value ) ) ;
}
2017-04-12 10:55:32 +02:00
}
}
}
2016-06-27 01:45:38 +02:00
OffeneTermine = appointments . ToObservableCollection ( ) ;
2021-09-30 12:21:32 +02:00
OffeneTermine . AddRange ( new List < IMainSessionointment > ( statusUpdatesAsAppointments ) ) ;
2017-04-12 10:55:32 +02:00
2016-06-27 01:45:38 +02:00
DataContext = this ;
InitializeComponent ( ) ;
2017-04-12 10:55:32 +02:00
}
2018-10-23 17:48:04 +02:00
private static SchedulerAppointmentVM BuildNewVMFromOldVM ( SchedulerAppointmentVM item , long emp2AppOid )
2017-04-12 10:55:32 +02:00
{
2019-02-28 12:38:29 +01:00
var customFieldStorage = ( CustomFieldStorage ) item . CustomFields [ nameof ( CustomFieldStorage ) ] ;
2017-04-12 10:55:32 +02:00
return new SchedulerAppointmentVM ( new SchedulerAppointmentDC
{
2017-09-28 14:00:40 +02:00
SchedulerAppointmentOid = item . CommitToDataContract ( ) . SchedulerAppointmentOid ,
2017-04-12 10:55:32 +02:00
NewSchedulerAppointmentVersion = item . CommitToDataContract ( ) . NewSchedulerAppointmentVersion ,
2017-09-28 14:00:40 +02:00
IsPrivate = item . IsPrivate ,
RecurrenceInfo = item . RecurrenceInfo ,
Type = item . EventType ,
2019-02-28 12:38:29 +01:00
CustomerList = customFieldStorage . CustomerList ,
ResourceList = customFieldStorage . ResourceList ,
2017-09-28 14:00:40 +02:00
AllDay = item . AllDay ,
2019-02-28 12:38:29 +01:00
EmployeeList = item . EmployeeList . ToList ( ) ,
2017-09-28 14:00:40 +02:00
Description = item . Description ,
EndDate = item . End ,
StartDate = item . Start ,
Location = item . Location ,
Subject = item . Subject ,
Status = 1 ,
2019-02-28 12:38:29 +01:00
Originator = customFieldStorage . Originator ,
IsTeilnahmeBestaetigung = true ,
SupportConceptList = customFieldStorage . SupportConceptList
2017-04-12 10:55:32 +02:00
} )
2018-10-23 17:48:04 +02:00
{ CustomFields = item . CustomFields , LabelId = Convert . ToInt32 ( emp2AppOid ) } ;
2017-04-12 10:55:32 +02:00
}
2016-06-27 01:45:38 +02:00
private void CloseButton_Click ( object sender , RoutedEventArgs e )
{
Close ( ) ;
}
private void Selector_OnSelected ( object sender , RoutedEventArgs e )
{
var lv = ( ListView ) sender ;
2021-09-30 12:21:32 +02:00
SelektierterTermin = ( IMainSessionointment ) lv . SelectedItem ;
2017-04-12 10:55:32 +02:00
}
2016-06-27 01:45:38 +02:00
2017-04-12 10:55:32 +02:00
private void Zusagen_OnClick ( object sender , RoutedEventArgs e )
2016-06-27 01:45:38 +02:00
{
var meinTermin = SelektierterTermin as SchedulerAppointmentVM ;
UpdateTeilnahme ( ParticipationAnswer . Zusage , meinTermin ) ;
}
private void Absagen_OnClick ( object sender , RoutedEventArgs e )
{
var meinTermin = SelektierterTermin as SchedulerAppointmentVM ;
UpdateTeilnahme ( ParticipationAnswer . Absage , meinTermin ) ;
}
private void MitVorbehalt_OnClick ( object sender , RoutedEventArgs e )
{
var meinTermin = SelektierterTermin as SchedulerAppointmentVM ;
UpdateTeilnahme ( ParticipationAnswer . Vorbehalt , meinTermin ) ;
}
private void UpdateTeilnahme ( ParticipationAnswer antwort , SchedulerAppointmentVM termin )
{
termin . EmployeeList . DoForEach ( e = >
{
2021-09-30 12:21:32 +02:00
if ( e . Employee . EmployeeOid . Equals ( MainSession . LoggedOnEmployee . EmployeeOid ) )
2016-06-27 01:45:38 +02:00
{
e . ParticipationAnswer = antwort ;
}
} ) ;
2017-12-14 18:33:17 -04:00
ToggleControls ( ) ;
ServiceFacade . DoResourceServiceAsync ( s = > s . UpdateSchedulerAppointments ( new List < SchedulerAppointmentDC > { termin . CommitToDataContract ( ) } ) , UpdateView ) ;
2016-06-27 01:45:38 +02:00
}
private void UpdateView ( List < SchedulerAppointmentDC > aktualisierteTermine )
{
foreach ( var dc in aktualisierteTermine )
{
foreach ( var ivm in OffeneTermine )
{
var vm = ivm as SchedulerAppointmentVM ;
2017-04-13 15:34:25 +02:00
if ( vm = = null | | ! vm . DataContract . Equals ( dc ) )
{
continue ;
}
2016-06-27 01:45:38 +02:00
var found = vm ;
found . DataContract = dc ;
2017-04-12 10:55:32 +02:00
UpdateViewModel ( dc , ( SchedulerAppointmentVM ) ivm ) ;
2016-06-27 01:45:38 +02:00
vm . UpdateCustomFields ( ) ;
2017-04-13 15:34:25 +02:00
if ( vm . LabelId = = 0 )
2017-04-12 10:55:32 +02:00
{
2017-04-13 15:34:25 +02:00
this . Dispatch ( ( ) = >
{
OffeneTermine = OffeneTermine . Where ( w = > ! w . Equals ( vm ) ) . ToObservableCollection ( ) ;
2018-10-23 17:48:04 +02:00
OnPropertyChanged ( nameof ( OffeneTermine ) ) ;
2017-04-13 15:34:25 +02:00
RaiseParticipationChangedEventEvent ( ) ;
} ) ;
2017-04-12 10:55:32 +02:00
}
2017-04-13 15:34:25 +02:00
else
{
2018-10-23 17:48:04 +02:00
var test = ( SchedulerAppointmentVM ) OffeneTermine . FirstOrDefault ( f = > dc . EmployeeList . Any ( a = > a . Employee2SchedulerAppointmentOid . HasValue & & a . Employee2SchedulerAppointmentOid . Value = = f . LabelId ) ) ;
2017-04-13 15:34:25 +02:00
this . Dispatch ( ( ) = >
{
OffeneTermine = OffeneTermine . Where ( w = > ! w . Equals ( test ) ) . ToObservableCollection ( ) ;
2018-10-23 17:48:04 +02:00
OnPropertyChanged ( nameof ( OffeneTermine ) ) ;
2017-04-13 15:34:25 +02:00
RaiseParticipationChangedEventEvent ( ) ;
} ) ;
}
2016-06-27 01:45:38 +02:00
}
}
this . Dispatch ( ( ) = >
{
RaiseParticipationChangedEventEvent ( ) ;
2017-12-14 18:33:17 -04:00
ToggleControls ( ) ;
if ( OffeneTermine . Count = = 0 & & OTListView . Items . Count = = 0 )
2016-06-27 01:45:38 +02:00
{
Close ( ) ;
}
else
{
OTListView . SelectedIndex = 0 ;
}
} ) ;
}
private void OK_OnClick ( object sender , RoutedEventArgs e )
{
2021-09-30 12:21:32 +02:00
SelektierterTermin = OTListView . SelectedItem as IMainSessionointment ;
2018-10-23 17:48:04 +02:00
if ( _selektierterTermin ! = null & & _selektierterTermin . Start < DateTime . Now & & _selektierterTermin . End < DateTime . Now )
2017-04-12 10:55:32 +02:00
{
2021-09-30 12:21:32 +02:00
if ( SelektierterTermin ! = null & & MainSession . LoggedOnEmployee . EmployeeOid . HasValue )
2018-10-23 17:48:04 +02:00
{
2019-02-28 12:38:29 +01:00
var customFieldStorage = ( CustomFieldStorage ) SelektierterTermin . CustomFields [ nameof ( CustomFieldStorage ) ] ;
var emp2App = customFieldStorage . EmployeeList . ToList ( ) . Find ( f = > f . Employee2SchedulerAppointmentOid = = SelektierterTermin . LabelId ) ? ?
2021-09-30 12:21:32 +02:00
customFieldStorage . EmployeeList . ToList ( ) . Find ( f = > f . Employee . EmployeeOid = = MainSession . LoggedOnEmployee . EmployeeOid . Value ) ;
2017-08-21 18:52:43 +02:00
2021-09-30 12:21:32 +02:00
if ( emp2App . Employee . EmployeeOid = = MainSession . LoggedOnEmployee . EmployeeOid . Value )
2018-10-23 17:48:04 +02:00
{
emp2App . ParticipationAnswer = ParticipationAnswer . Verstrichen ;
}
2017-08-21 18:52:43 +02:00
2018-10-23 17:48:04 +02:00
emp2App . IsPC_CheckedTs = DateTime . Now ;
emp2App . IsPChanged = false ;
}
2017-04-12 10:55:32 +02:00
2017-12-14 18:33:17 -04:00
ToggleControls ( ) ;
2017-04-12 10:55:32 +02:00
ServiceFacade . DoResourceServiceAsync ( s = > s . UpdateSchedulerAppointments ( new List < SchedulerAppointmentDC > { ( ( SchedulerAppointmentVM ) SelektierterTermin ) . DataContract } ) , UpdateView ) ;
return ;
}
2018-10-23 17:48:04 +02:00
if ( SelektierterTermin = = null | | SelektierterTermin . LabelId < = 0 )
2017-04-12 10:55:32 +02:00
{
return ;
}
2016-06-27 01:45:38 +02:00
2019-02-28 12:38:29 +01:00
var customFieldStorage2 = ( CustomFieldStorage ) SelektierterTermin . CustomFields [ nameof ( CustomFieldStorage ) ] ;
customFieldStorage2 . EmployeeList . ToList ( ) . Find ( f = > f . Employee2SchedulerAppointmentOid = = SelektierterTermin . LabelId ) . IsPC_CheckedTs = DateTime . Now ;
customFieldStorage2 . EmployeeList . ToList ( ) . Find ( f = > f . Employee2SchedulerAppointmentOid = = SelektierterTermin . LabelId ) . IsPChanged = false ;
2016-06-27 01:45:38 +02:00
2017-12-14 18:33:17 -04:00
ToggleControls ( ) ;
2018-10-23 17:48:04 +02:00
ServiceFacade . DoResourceServiceAsync ( s = > s . UpdateSchedulerAppointments ( new List < SchedulerAppointmentDC > { ( ( SchedulerAppointmentVM ) SelektierterTermin ) . DataContract } ) , UpdateView ) ;
2016-06-27 01:45:38 +02:00
}
private static void UpdateViewModel ( SchedulerAppointmentDC dc , SchedulerAppointmentVM vm )
{
2019-02-28 12:38:29 +01:00
vm . EmployeeList = new ObservableCollection < Employee2SchedulerAppointmentDC > ( dc . EmployeeList ) ;
2016-06-27 01:45:38 +02:00
}
2017-12-14 18:33:17 -04:00
private void ToggleControls ( )
{
ZusagenStack . IsEnabled = ! ZusagenStack . IsEnabled ;
OkButton . IsEnabled = ! OkButton . IsEnabled ;
CloseBtn . IsEnabled = ! CloseBtn . IsEnabled ;
}
2018-10-23 17:48:04 +02:00
private void PopupBaseEdit_OnPopupOpening ( object sender , OpenPopupEventArgs e )
{
// Es wird verhindert, dass das Popup angezeigt wird auch wenn das DateEdit readonly ist, damit man es nicht auf disabled setzen muss, da sonst die Schriftfarbe schwer lesbar ist.
e . Cancel = true ;
}
2019-02-28 12:38:29 +01:00
private void RequestAnswerView_OnClosing ( object sender , CancelEventArgs e )
{
2021-09-30 12:21:32 +02:00
MainSession . MainPage . AufOffeneTerminePruefen ( ) ;
2019-02-28 12:38:29 +01:00
}
2016-06-27 01:45:38 +02:00
}
public class LVItemConverter : IValueConverter
{
public object Convert ( object value , Type targetType , object parameter , CultureInfo culture )
{
2021-09-30 12:21:32 +02:00
var app = ( IMainSessionointment ) value ;
2016-06-27 01:45:38 +02:00
2018-10-23 17:48:04 +02:00
if ( app = = null )
{
return string . Empty ;
}
if ( app . LabelId < = 0 )
2016-06-27 01:45:38 +02:00
{
2018-10-23 17:48:04 +02:00
return $"{app.Start.ToShortDateString()}: {app.Subject}" ;
2016-06-27 01:45:38 +02:00
}
var s = string . Empty ;
2019-02-28 12:38:29 +01:00
var customFieldStorage = ( CustomFieldStorage ) app . CustomFields [ nameof ( CustomFieldStorage ) ] ;
var l = customFieldStorage . EmployeeList . ToList ( ) . Find ( f = > f . Employee2SchedulerAppointmentOid = = app . LabelId ) ;
2017-04-12 10:55:32 +02:00
2018-10-23 17:48:04 +02:00
switch ( l . ParticipationAnswer )
2016-06-27 01:45:38 +02:00
{
case ParticipationAnswer . Zusage :
s = "zugesagt" ;
break ;
case ParticipationAnswer . Vorbehalt :
s = "mit Vorbehalt zugesagt" ;
break ;
case ParticipationAnswer . Absage :
s = "abgesagt" ;
break ;
}
2018-10-23 17:48:04 +02:00
return $"{app.Start.ToShortDateString()}: {l.Employee.FirstName} {l.Employee.LastName} hat {s}" ;
2016-06-27 01:45:38 +02:00
}
public object ConvertBack ( object value , Type targetType , object parameter , CultureInfo culture )
{
throw new NotImplementedException ( ) ;
}
}
public class OriginatorExtraxtor : IValueConverter
{
public object Convert ( object value , Type targetType , object parameter , CultureInfo culture )
{
2018-10-23 17:48:04 +02:00
if ( value = = null )
2016-06-27 01:45:38 +02:00
{
return null ;
}
2021-09-30 12:21:32 +02:00
var app = ( IMainSessionointment ) value ;
2019-02-28 12:38:29 +01:00
var customFieldStorage = ( CustomFieldStorage ) app . CustomFields [ nameof ( CustomFieldStorage ) ] ;
var originator = customFieldStorage . Originator ;
2016-06-27 01:45:38 +02:00
return originator . FirstName + " " + originator . LastName ;
}
public object ConvertBack ( object value , Type targetType , object parameter , CultureInfo culture )
{
throw new NotImplementedException ( ) ;
}
}
public class Int2VisibilityConverter : IValueConverter
{
public object Convert ( object value , Type targetType , object parameter , CultureInfo culture )
{
2018-10-23 17:48:04 +02:00
if ( value = = null )
2017-04-12 10:55:32 +02:00
{
return Visibility . Collapsed ;
}
var appointment = ( SchedulerAppointmentVM ) value ;
2018-10-23 17:48:04 +02:00
var eternalEh = false ;
var liegtInDerVergangenheit = appointment . Start < DateTime . Now & & appointment . End < DateTime . Now ;
2017-04-12 10:55:32 +02:00
2018-10-23 17:48:04 +02:00
if ( appointment . RecurrenceInfo ! = null )
{
IRecurrenceInfo info = new RecurrenceInfo ( ) ;
info . FromXml ( appointment . RecurrenceInfo ) ;
eternalEh = info . Range = = RecurrenceRange . NoEndDate ;
liegtInDerVergangenheit = info . Start < DateTime . Now & & info . End < DateTime . Now ;
}
if ( parameter ! = null & & parameter . Equals ( "ZusagenStack" ) )
{
if ( appointment . IsTeilnahmeBestaetigung )
{
return Visibility . Collapsed ;
}
var shouldBeVisible = ! liegtInDerVergangenheit ;
if ( appointment . RecurrenceInfo ! = null )
{
shouldBeVisible = ! liegtInDerVergangenheit | | eternalEh ;
}
2017-04-12 10:55:32 +02:00
return shouldBeVisible ? Visibility . Visible : Visibility . Collapsed ;
2016-06-27 01:45:38 +02:00
}
2018-10-23 17:48:04 +02:00
if ( parameter ! = null & & parameter . Equals ( "OKBtn" ) )
{
return appointment . IsTeilnahmeBestaetigung | | liegtInDerVergangenheit & & ! eternalEh ? Visibility . Visible : Visibility . Collapsed ;
}
if ( parameter ! = null & & parameter . Equals ( "TerminVerstrichen" ) )
2017-04-12 10:55:32 +02:00
{
2018-10-23 17:48:04 +02:00
return liegtInDerVergangenheit & & ! eternalEh ? Visibility . Visible : Visibility . Collapsed ;
2017-04-12 10:55:32 +02:00
}
2018-10-23 17:48:04 +02:00
if ( parameter ! = null & & parameter . Equals ( "SerienterminLabel" ) )
{
return appointment . RecurrenceInfo ! = null ? Visibility . Visible : Visibility . Collapsed ;
}
return appointment . IsTeilnahmeBestaetigung | | liegtInDerVergangenheit ? Visibility . Visible : Visibility . Collapsed ;
2016-06-27 01:45:38 +02:00
}
public object ConvertBack ( object value , Type targetType , object parameter , CultureInfo culture )
{
throw new NotImplementedException ( ) ;
}
}
2018-10-23 17:48:04 +02:00
public class SerienterminDauerAnzeigeConverter : IValueConverter
{
public object Convert ( object value , Type targetType , object parameter , CultureInfo culture )
{
if ( value = = null )
{
return null ;
}
var appointment = ( SchedulerAppointmentVM ) value ;
if ( appointment . RecurrenceInfo = = null )
{
return "" ;
}
IRecurrenceInfo info = new RecurrenceInfo ( ) ;
info . FromXml ( appointment . RecurrenceInfo ) ;
var rangeString = "" ;
var suffix = "" ;
var periodicity = info . Periodicity ;
var intervalPlural = "" ;
var wochentage = "" ;
string wocheDesMonats ;
switch ( info . Range )
{
case RecurrenceRange . EndByDate :
rangeString + = "bis zum " + info . End . ToShortDateString ( ) + " " ;
break ;
case RecurrenceRange . OccurrenceCount :
rangeString + = info . OccurrenceCount + " mal " ;
break ;
}
switch ( info . Type )
{
case RecurrenceType . Daily :
if ( periodicity = = 1 )
{
suffix = info . WeekDays . Equals ( WeekDays . WorkDays ) ? "jeden Arbeitstag " : "täglich " ;
}
intervalPlural = " Tage " ;
break ;
case RecurrenceType . Weekly :
if ( periodicity = = 1 )
{
suffix = "wöchentlich " ;
}
intervalPlural = " Wochen " ;
wochentage = TranslateWorkDays ( info . WeekDays . ToString ( ) , true ) ;
break ;
case RecurrenceType . Yearly :
wochentage = TranslateWorkDays ( info . WeekDays . ToString ( ) , false ) ;
wocheDesMonats = TranslateWeekOfMonth ( info . WeekOfMonth ) ;
var tag = info . DayNumber ;
suffix = "jährlich " ;
if ( info . WeekOfMonth ! = WeekOfMonth . None )
{
suffix + = "jeden " + wocheDesMonats + wochentage + "im " + GetMonthByInt ( info . Month ) ;
}
else
{
suffix + = "am " + tag + ". " + GetMonthByInt ( info . Month ) ;
}
wochentage = "" ;
break ;
case RecurrenceType . Monthly :
string monatlichesInterval ;
if ( info . WeekOfMonth ! = WeekOfMonth . None )
{
wocheDesMonats = TranslateWeekOfMonth ( info . WeekOfMonth ) ;
wochentage = TranslateWorkDays ( info . WeekDays . ToString ( ) , false ) ;
suffix = "jeden " + wocheDesMonats + wochentage ;
if ( periodicity = = 1 )
{
monatlichesInterval = "jedes Monats " ;
}
else
{
monatlichesInterval = "jedes " + periodicity + ". Monats " ;
}
suffix + = monatlichesInterval ;
wochentage = "" ;
}
else
{
if ( periodicity = = 1 )
{
monatlichesInterval = "jedes Monats " ;
}
else
{
monatlichesInterval = "jedes " + periodicity + ". Monats " ;
}
suffix = "am " + info . DayNumber + ". " + monatlichesInterval ;
wochentage = "" ;
}
break ;
}
if ( periodicity > 1 & & info . Type ! = RecurrenceType . Monthly )
{
suffix = "alle " + periodicity + intervalPlural ;
}
return "Dieser Termin wird " + rangeString + suffix + wochentage + "wiederholt" ;
}
public object ConvertBack ( object value , Type targetType , object parameter , CultureInfo culture )
{
throw new NotImplementedException ( ) ;
}
private static string TranslateWorkDays ( string weekDays , bool mitGenitivS )
{
weekDays = weekDays . Replace ( "Monday" , mitGenitivS ? "Montags" : "Montag" ) ;
weekDays = weekDays . Replace ( "Tuesday" , mitGenitivS ? "Dienstags" : "Dienstag" ) ;
weekDays = weekDays . Replace ( "Wednesday" , mitGenitivS ? "Mittwochs" : "Mittwoch" ) ;
weekDays = weekDays . Replace ( "Thursday" , mitGenitivS ? "Donnerstags" : "Donnerstag" ) ;
weekDays = weekDays . Replace ( "Friday" , mitGenitivS ? "Freitags" : "Freitag" ) ;
weekDays = weekDays . Replace ( "Saturday" , mitGenitivS ? "Samstags" : "Samstag" ) ;
weekDays = weekDays . Replace ( "Sunday" , mitGenitivS ? "Sonntags" : "Sonntag" ) ;
weekDays = weekDays . Replace ( "EveryDay" , "jeden Tag" ) ;
var lastComma = weekDays . LastIndexOf ( ',' ) ;
if ( lastComma ! = - 1 )
{
weekDays = weekDays . Remove ( lastComma , 1 ) . Insert ( lastComma , " und" ) ;
}
return weekDays + " " ;
}
private static string TranslateWeekOfMonth ( WeekOfMonth weekOfMonth )
{
var result = " " ;
switch ( weekOfMonth )
{
case WeekOfMonth . First :
result = "ersten " ;
break ;
case WeekOfMonth . Second :
result = "zweiten " ;
break ;
case WeekOfMonth . Third :
result = "dritten " ;
break ;
case WeekOfMonth . Fourth :
result = "vierten " ;
break ;
case WeekOfMonth . Last :
result = "letzten " ;
break ;
case WeekOfMonth . None :
return result ;
default :
return result ;
}
return result ;
}
private static string GetMonthByInt ( int month )
{
switch ( month )
{
case 1 :
return "Januar " ;
case 2 :
return "Februar " ;
case 3 :
return "März " ;
case 4 :
return "April " ;
case 5 :
return "Mai " ;
case 6 :
return "Juni " ;
case 7 :
return "Juli " ;
case 8 :
return "August " ;
case 9 :
return "September " ;
case 10 :
return "Oktober " ;
case 11 :
return "November " ;
case 12 :
return "Dezember " ;
default :
return " " ;
}
}
}
2016-06-27 01:45:38 +02:00
}