71 lines
2.5 KiB
C#
71 lines
2.5 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared.DataContracts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WendepunktVelbert.Service
|
|
{
|
|
public class CustomVacationService : VacationService
|
|
{
|
|
public override List<UrlaubskontoDarstellungDC> CreateSonderurlaubItems(Employee emp, Contract contract, Dictionary<string, decimal> sonderurlaubDict, List<UrlaubskontoDarstellungDC> darstellungDCs)
|
|
{
|
|
var sonderurlaubsItems = base.CreateSonderurlaubItems(emp, contract, sonderurlaubDict, darstellungDCs);
|
|
|
|
if (emp.Notice2 != null && emp.Notice2.Contains("SD") && darstellungDCs != null && !darstellungDCs.Any(dc => dc.Erlaeuterung.Contains("Regenerationstage")))
|
|
{
|
|
sonderurlaubsItems.Add(new UrlaubskontoDarstellungDC()
|
|
{
|
|
AnzahlTage = string.Format("{0:0.00}", 2), // 2 Regenerationstage
|
|
Herkunft = string.Format("EmpOid:{0} ContractOid:{1}", emp.Oid, contract.Oid),
|
|
Tooltip = "Regenerationstage",
|
|
IsDeletable = false,
|
|
DatumZurSortierung = null,
|
|
Erlaeuterung = "Regenerationstage"
|
|
});
|
|
}
|
|
|
|
return sonderurlaubsItems;
|
|
}
|
|
// In die VacationReasonIDs müssen auch die Regenerationstage einbezogen werden, da diese sonst nicht vom Urlaubskontingent abgezogen werden
|
|
public override List<long> GetVacationReasonIDs()
|
|
{
|
|
var res = new List<long>();
|
|
var filters = new List<string> { "URLAUB", "REGENERATION" };
|
|
var reasons = DAOFactory.GenericDAO.GetAll<AbsenceReason>();
|
|
|
|
foreach (var reason in reasons)
|
|
{
|
|
var desc = reason.Description.ToUpper();
|
|
|
|
foreach (var filter in filters)
|
|
{
|
|
if (desc.Contains(filter))
|
|
{
|
|
res.Add(reason.Oid.Value);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
public override List<FeiertagDC> GetFeiertage(int year, string bundesland)
|
|
{
|
|
var list = base.GetFeiertage(year, bundesland);
|
|
|
|
if (year >= 2025)
|
|
{
|
|
list.Add(new FeiertagDC() { Datum = new DateTime(year, 12, 31), Name = "Silvester" });
|
|
}
|
|
|
|
return list;
|
|
}
|
|
}
|
|
}
|