Files
BeWoPlaner/ReportImp/VkmAachenSbd/Service/CustomTimeSheetService.cs
Christian 104a7e6972 cb
2021-09-07 15:51:34 +02:00

118 lines
3.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Mail;
using BeWo.Data;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.Core;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.MessageContracts;
using BeWo.Service.Plugins;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Services;
using Utils = BS.Shared.Core.Utils;
namespace VkmAachenSbd.Service
{
public class CustomTimeSheetService : TimeSheetService
{
protected override bool HasValidRelation(Employee2Customer e2C)
{
foreach (var v2o in e2C.ValueList)
{
if (v2o.Entry.Type == ValueListEntryType.StaffRoleType && v2o.Entry.Value == "ehemalige Betreuung")
{
return false;
}
}
return true;
}
protected override bool HasValidSupportConcept(Customer c, DateTime monat)
{
return true;
}
public override string GetReplyAddress(TimeSheetStatusItemDC item)
{
#if DEBUG
return base.GetReplyAddress(item);
#endif
ApplicationUser loggedInUser = null;
if (LoggedInUserOperationContextExt.Current != null &&
LoggedInUserOperationContextExt.Current.User != null)
{
loggedInUser = LoggedInUserOperationContextExt.Current.User;
}
else
{
loggedInUser = SessionFacade.LoggedInUser;
}
if (loggedInUser != null && loggedInUser.Employee != null)
{
var contact =
loggedInUser.Employee.Person.Contacts.FirstOrDefault(c => c.Type == ContactType.business_Mail);
if (contact != null)
{
return contact.Value;
}
}
return "sbd-service@vkm-aachen.de";
}
public override string GetMailMessageTemplate()
{
String message = @"{MitarbeiterAnrede} {MitarbeiterNachname},
anbei erhalten Sie den Stundenzettel für {Monat} {Jahr}. Bitte tragen Sie dafür Sorge, dass Ihr Stundenzettel bis zum dritten Werktag bei uns in der Vaalser Straße eingeht oder Sie ihn so vorgesehen im entsprechenden Fach/Mappe des VKMs in Ihrer Schule hinterlegt haben.
Mit freundlichen Grüßen
{BenutzerVorname} {BenutzerNachname}
Verwaltung Schulbegleitender Dienst
VKM Aachen e.V.
Verein für Körper - und Mehrfachbehinderte Aachen e.V.
Schulbegleitender Dienst
Vaalser Straße 40
52066 Aachen
https://vkm-aachen.de
Telefon Durchwahl: {BenutzerTelefon}
Telefon zentral: +49 241 / 912 840 0
Fax: +49 241 / 912 888 48
";
return message;
}
public override SmtpClient CreateSmtpClient()
{
#if DEBUG
return base.CreateSmtpClient();
#endif
//return base.CreateSmtpClient();
var mailClient = new SmtpClient("mail2.vkm-aachen.de", 587) { Credentials = new NetworkCredential("sbd-service@vkm-aachen.de", "E_YmipGqdkC_YCcDcSpx") };
mailClient.EnableSsl = true;
return mailClient;
}
}
}