Konflikte gelöst.
This commit is contained in:
@@ -17,181 +17,191 @@ using BeWo.Data;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.ServiceContracts;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace BeWo.Service.Core
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
private static readonly Regex indexRegex = new Regex("(?:Index=\"){1}([0-9]+)\"{1}");
|
||||
private static readonly Regex idRegex = new Regex("(?:Id=\")(([a-z0-9]{8})-{1}([a-z0-9]{4})-{1}([a-z0-9]{4})-{1}([a-z0-9]{4})-{1}([a-z0-9]{12}))(?=\"{1})");
|
||||
public class Utils
|
||||
{
|
||||
private static readonly Regex indexRegex = new Regex("(?:Index=\"){1}([0-9]+)\"{1}");
|
||||
private static readonly Regex idRegex = new Regex("(?:Id=\")(([a-z0-9]{8})-{1}([a-z0-9]{4})-{1}([a-z0-9]{4})-{1}([a-z0-9]{4})-{1}([a-z0-9]{12}))(?=\"{1})");
|
||||
|
||||
public static FaultException<BeWoFault> CreateBeWoFaultException(Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
//SendErrorMail("MYSQL EXCEPTION - AUTOMATED MAIL NOTIFICATION", ex.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return new FaultException<BeWoFault>(new BeWoFault(ex), ex.ToString());
|
||||
}
|
||||
|
||||
public static string GetClientIP()
|
||||
{
|
||||
if (OperationContext.Current != null)
|
||||
{
|
||||
MessageProperties properties = OperationContext.Current.IncomingMessageProperties;
|
||||
var endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
|
||||
return endpoint.Address;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetMD5(string val)
|
||||
{
|
||||
var lMD5 = new MD5CryptoServiceProvider();
|
||||
string lHash = BitConverter.ToString(lMD5.ComputeHash(Encoding.UTF8.GetBytes(val)));
|
||||
return lHash;
|
||||
}
|
||||
|
||||
public static string GetSHA256(string val)
|
||||
{
|
||||
var csp = new SHA256CryptoServiceProvider();
|
||||
string lHash = BitConverter.ToString(csp.ComputeHash(Encoding.UTF8.GetBytes(val)));
|
||||
return lHash;
|
||||
}
|
||||
|
||||
public static bool IsValidEmail(string email)
|
||||
{
|
||||
//return Regex.IsMatch(email, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
|
||||
|
||||
return Regex.IsMatch(email,
|
||||
@"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
|
||||
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-0-9a-z]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$",
|
||||
RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250));
|
||||
}
|
||||
|
||||
public static bool SendErrorMail(string subject, string body)
|
||||
{
|
||||
string sendMailSetting = ConfigurationManager.AppSettings.Get("SendMailOnError");
|
||||
bool sendMail = false;
|
||||
if (bool.TryParse(sendMailSetting, out sendMail))
|
||||
{
|
||||
if (sendMail)
|
||||
return SendMail(subject, body, ConfigurationManager.AppSettings.Get("Recipient"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool SendMail(string subject, string body, string toAddress)
|
||||
{
|
||||
return SendMail(null, null, subject, body, toAddress);
|
||||
}
|
||||
|
||||
public static bool SendMail(string senderName, string senderEMail, string subject, string body, string toAddress)
|
||||
public static FaultException<BeWoFault> CreateBeWoFaultException(Exception ex)
|
||||
{
|
||||
var server = ConfigurationManager.AppSettings.Get("SmptServer");
|
||||
var user = ConfigurationManager.AppSettings.Get("SmtpUser");
|
||||
//var pass = ConfigurationManager.AppSettings.Get("SmtpPassword");
|
||||
var pass = "JJVjJntw2yaRDAxInotF";
|
||||
String to = toAddress;
|
||||
if (String.IsNullOrEmpty(to))
|
||||
to = ConfigurationManager.AppSettings.Get("SupportEMail");
|
||||
if (String.IsNullOrEmpty(to))
|
||||
to = "support@bewoplaner.de";
|
||||
|
||||
if (String.IsNullOrEmpty(senderEMail))
|
||||
senderEMail = "bewoapp@bewoplaner.de";
|
||||
|
||||
bool sendAsync = true;
|
||||
if (to.Equals("support@bewoplaner.de"))
|
||||
{
|
||||
sendAsync = false;
|
||||
}
|
||||
var body2 = "Kunde: " + MultitenancyOperationContextExt.Current.Tenant;
|
||||
//body2 += "\r\nIP: " + GetClientIP();
|
||||
body += "\n\n" + body2;
|
||||
//}
|
||||
|
||||
|
||||
//if (to.Equals())
|
||||
|
||||
return SendMail(senderEMail.Trim(), senderName, to, subject, body, server, user, pass, sendAsync);
|
||||
try
|
||||
{
|
||||
//SendErrorMail("MYSQL EXCEPTION - AUTOMATED MAIL NOTIFICATION", ex.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return new FaultException<BeWoFault>(new BeWoFault(ex), ex.ToString());
|
||||
}
|
||||
|
||||
public static bool SendMail(string fromEMail, string fromName, string to, string subject, string body, string smtpServer, string smtpUser, string smtpPassword, bool sendAsync)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsValidEmail(to) || !IsValidEmail(fromEMail))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public static string GetClientIP()
|
||||
{
|
||||
if (OperationContext.Current != null)
|
||||
{
|
||||
MessageProperties properties = OperationContext.Current.IncomingMessageProperties;
|
||||
var endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
|
||||
return endpoint.Address;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String from = fromEMail;
|
||||
public static string GetMD5(string val)
|
||||
{
|
||||
var lMD5 = new MD5CryptoServiceProvider();
|
||||
string lHash = BitConverter.ToString(lMD5.ComputeHash(Encoding.UTF8.GetBytes(val)));
|
||||
return lHash;
|
||||
}
|
||||
|
||||
if (to.Equals("support@bewoplaner.de"))
|
||||
{
|
||||
var supportSenderMail = ConfigurationManager.AppSettings.Get("SupportSenderEMail");
|
||||
if (String.IsNullOrEmpty(supportSenderMail))
|
||||
supportSenderMail = "noreply@bewoplaner.de";
|
||||
public static string GetSHA256(string val)
|
||||
{
|
||||
var csp = new SHA256CryptoServiceProvider();
|
||||
string lHash = BitConverter.ToString(csp.ComputeHash(Encoding.UTF8.GetBytes(val)));
|
||||
return lHash;
|
||||
}
|
||||
|
||||
from = supportSenderMail;
|
||||
|
||||
}
|
||||
public static bool SendErrorMail(string subject, string body)
|
||||
{
|
||||
string sendMailSetting = ConfigurationManager.AppSettings.Get("SendMailOnError");
|
||||
bool sendMail = false;
|
||||
if (bool.TryParse(sendMailSetting, out sendMail))
|
||||
{
|
||||
if (sendMail)
|
||||
return SendMail(subject, body, ConfigurationManager.AppSettings.Get("Recipient"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//public static bool SendMail(string subject, string body, string toAddress)
|
||||
// {
|
||||
// return SendMail(subject, body, toAddress, null, null);
|
||||
// }
|
||||
|
||||
public static bool SendMail(string subject, string body, string toAddress,
|
||||
string senderName = null, string senderEMail = null, bool skipTenant = false,
|
||||
string smtpServer = null, string smtpUser = null, string smtpPassword = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(smtpServer))
|
||||
smtpServer = ConfigurationManager.AppSettings.Get("SmptServer");
|
||||
|
||||
if (string.IsNullOrEmpty(smtpUser))
|
||||
smtpUser = ConfigurationManager.AppSettings.Get("SmtpUser");
|
||||
|
||||
if (string.IsNullOrEmpty(smtpPassword))
|
||||
smtpPassword = ConfigurationManager.AppSettings.Get("SmtpPassword");
|
||||
if (string.IsNullOrEmpty(smtpPassword))
|
||||
smtpPassword = "JJVjJntw2yaRDAxInotF";
|
||||
|
||||
string to = toAddress;
|
||||
if (string.IsNullOrEmpty(to))
|
||||
to = ConfigurationManager.AppSettings.Get("SupportEMail");
|
||||
if (string.IsNullOrEmpty(to))
|
||||
to = "support@bewoplaner.de";
|
||||
|
||||
if (string.IsNullOrEmpty(senderEMail))
|
||||
senderEMail = "bewoapp@bewoplaner.de";
|
||||
|
||||
bool sendAsync = true;
|
||||
if (to.Equals("support@bewoplaner.de"))
|
||||
{
|
||||
sendAsync = false;
|
||||
}
|
||||
|
||||
string body2;
|
||||
if (skipTenant)
|
||||
{
|
||||
body2 = "Kunde: " + (MultitenancyOperationContextExt.Current?.Tenant ?? "unknown");
|
||||
sendAsync = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
body2 = "Kunde: " + MultitenancyOperationContextExt.Current.Tenant;
|
||||
body2 += "\nE-Mail: " + senderEMail;
|
||||
//body2 += "\r\nIP: " + GetClientIP();
|
||||
}
|
||||
|
||||
body += "\n\n" + body2;
|
||||
|
||||
senderEMail = senderEMail.Trim();
|
||||
|
||||
return SendMail2(subject, body, to, senderName, senderEMail, smtpServer, smtpUser, smtpPassword, sendAsync);
|
||||
}
|
||||
|
||||
private static bool SendMail2(string subject, string body, string toAddress, string senderName, string senderEMail, string smtpServer, string smtpUser, string smtpPassword, bool sendAsync)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MailUtils.IsValidEmail(toAddress) || !MailUtils.IsValidEmail(senderEMail))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String from = senderEMail;
|
||||
|
||||
if (toAddress.Equals("support@bewoplaner.de"))
|
||||
{
|
||||
var supportSenderMail = ConfigurationManager.AppSettings.Get("SupportSenderEMail");
|
||||
if (String.IsNullOrEmpty(supportSenderMail))
|
||||
supportSenderMail = "noreply@bewoplaner.de";
|
||||
|
||||
from = supportSenderMail;
|
||||
|
||||
}
|
||||
|
||||
|
||||
MailMessage message = null;
|
||||
if (String.IsNullOrEmpty(fromName))
|
||||
message = new MailMessage(from, to, subject, body);
|
||||
MailMessage message = null;
|
||||
if (String.IsNullOrEmpty(senderName))
|
||||
message = new MailMessage(from, toAddress, subject, body);
|
||||
else
|
||||
{
|
||||
MailAddress fromMailAddress = new MailAddress(from);
|
||||
MailAddress toMailAddress = new MailAddress(to);
|
||||
MailAddress toMailAddress = new MailAddress(toAddress);
|
||||
|
||||
message = new MailMessage(fromMailAddress, toMailAddress);
|
||||
message.Subject = subject;
|
||||
message.Body = body;
|
||||
}
|
||||
if (fromEMail != from)
|
||||
{
|
||||
message.ReplyToList.Add(new MailAddress(fromEMail, fromName));
|
||||
}
|
||||
if (senderEMail != from)
|
||||
{
|
||||
//Das hier rausnehmen wenn Mike OK gibt
|
||||
message.ReplyToList.Add(new MailAddress(senderEMail, senderName));
|
||||
}
|
||||
|
||||
|
||||
message.BodyEncoding = Encoding.UTF8;
|
||||
message.IsBodyHtml = false;
|
||||
message.BodyEncoding = Encoding.UTF8;
|
||||
message.IsBodyHtml = false;
|
||||
|
||||
var mailClient = new SmtpClient(smtpServer, 587) { Credentials = new NetworkCredential(smtpUser, smtpPassword) };
|
||||
mailClient.EnableSsl = true;
|
||||
var mailClient = new SmtpClient(smtpServer, 587) { Credentials = new NetworkCredential(smtpUser, smtpPassword) };
|
||||
mailClient.EnableSsl = true;
|
||||
|
||||
if (sendAsync)
|
||||
{
|
||||
mailClient.SendAsync(message, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
mailClient.Send(message);
|
||||
}
|
||||
if (sendAsync)
|
||||
{
|
||||
mailClient.SendAsync(message, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
mailClient.Send(message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static string[][] T(List<string> pSearchParameter, int pSearchFieldCount)
|
||||
{
|
||||
//List<string> lDifferentParameter;
|
||||
public static string[][] T(List<string> pSearchParameter, int pSearchFieldCount)
|
||||
{
|
||||
//List<string> lDifferentParameter;
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetRecurringAppointmentsId(SchedulerAppointment appointment)
|
||||
{
|
||||
@@ -231,102 +241,102 @@ namespace BeWo.Service.Core
|
||||
}
|
||||
|
||||
|
||||
public static bool UserHasRight(ApplicationUser user, UserRightType right)
|
||||
{
|
||||
return GetGrantedRights(user).Contains(right);
|
||||
public static bool UserHasRight(ApplicationUser user, UserRightType right)
|
||||
{
|
||||
return GetGrantedRights(user).Contains(right);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static List<UserRightType> GetGrantedRights(ApplicationUser user)
|
||||
{
|
||||
var rights = new List<UserRightType>();
|
||||
foreach (var ug in user.UserGroups)
|
||||
{
|
||||
foreach (var rr in ug.Rights)
|
||||
{
|
||||
rights.Add(rr.RightType);
|
||||
}
|
||||
}
|
||||
public static List<UserRightType> GetGrantedRights(ApplicationUser user)
|
||||
{
|
||||
var rights = new List<UserRightType>();
|
||||
foreach (var ug in user.UserGroups)
|
||||
{
|
||||
foreach (var rr in ug.Rights)
|
||||
{
|
||||
rights.Add(rr.RightType);
|
||||
}
|
||||
}
|
||||
|
||||
return rights;
|
||||
}
|
||||
return rights;
|
||||
}
|
||||
|
||||
public static string GetRecurrenceIdFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
var regex = new Regex("(Id=\\\"[a-z0-9-]+\\\")");
|
||||
public static string GetRecurrenceIdFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
var regex = new Regex("(Id=\\\"[a-z0-9-]+\\\")");
|
||||
|
||||
var match = regex.Match(pRecurrenceInfo);
|
||||
if(match.Success)
|
||||
{
|
||||
var value = match.Value;
|
||||
var actualId = value.Split("\"");
|
||||
if(actualId.Count > 1)
|
||||
{
|
||||
return actualId[1];
|
||||
}
|
||||
}
|
||||
var match = regex.Match(pRecurrenceInfo);
|
||||
if (match.Success)
|
||||
{
|
||||
var value = match.Value;
|
||||
var actualId = value.Split("\"");
|
||||
if (actualId.Count > 1)
|
||||
{
|
||||
return actualId[1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetRecurrenceIndexFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
if(!pRecurrenceInfo.Contains("Index"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public static string GetRecurrenceIndexFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
if (!pRecurrenceInfo.Contains("Index"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var regex = new Regex("(Index=\\\"\\d+\\\")");
|
||||
var regex = new Regex("(Index=\\\"\\d+\\\")");
|
||||
|
||||
var match = regex.Match(pRecurrenceInfo);
|
||||
if(match.Success)
|
||||
{
|
||||
var value = match.Value;
|
||||
var actualIndex = value.Split("\"");
|
||||
var match = regex.Match(pRecurrenceInfo);
|
||||
if (match.Success)
|
||||
{
|
||||
var value = match.Value;
|
||||
var actualIndex = value.Split("\"");
|
||||
|
||||
if(actualIndex.Count > 1)
|
||||
{
|
||||
return actualIndex[1];
|
||||
}
|
||||
}
|
||||
if (actualIndex.Count > 1)
|
||||
{
|
||||
return actualIndex[1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<string> ExtractRecurrenceIdFromRecurrenceString(List<SchedulerAppointment> appointments)
|
||||
{
|
||||
var result = new List<string>();
|
||||
public static List<string> ExtractRecurrenceIdFromRecurrenceString(List<SchedulerAppointment> appointments)
|
||||
{
|
||||
var result = new List<string>();
|
||||
|
||||
foreach(var recurrenceInfo in appointments.Where(w => w.RecurrenceInfo != null).Select(s => s.RecurrenceInfo))
|
||||
{
|
||||
var id = GetRecurrenceIdFromRecurrenceInfo(recurrenceInfo);
|
||||
foreach (var recurrenceInfo in appointments.Where(w => w.RecurrenceInfo != null).Select(s => s.RecurrenceInfo))
|
||||
{
|
||||
var id = GetRecurrenceIdFromRecurrenceInfo(recurrenceInfo);
|
||||
|
||||
if(id != null)
|
||||
{
|
||||
result.AddIfNotIn(id);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
if (id != null)
|
||||
{
|
||||
result.AddIfNotIn(id);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ExtractIdFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
return pRecurrenceInfo != null ? idRegex.Match(pRecurrenceInfo).Groups[1].Value : null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int ExtractIndexFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
if (pRecurrenceInfo != null)
|
||||
{
|
||||
var indexString = indexRegex.Match(pRecurrenceInfo).Groups[1].Value;
|
||||
public static string ExtractIdFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
return pRecurrenceInfo != null ? idRegex.Match(pRecurrenceInfo).Groups[1].Value : null;
|
||||
}
|
||||
|
||||
var index = !string.IsNullOrEmpty(indexString) ? int.Parse(indexString) : 0;
|
||||
public static int ExtractIndexFromRecurrenceInfo(string pRecurrenceInfo)
|
||||
{
|
||||
if (pRecurrenceInfo != null)
|
||||
{
|
||||
var indexString = indexRegex.Match(pRecurrenceInfo).Groups[1].Value;
|
||||
|
||||
return index;
|
||||
}
|
||||
var index = !string.IsNullOrEmpty(indexString) ? int.Parse(indexString) : 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,64 @@ namespace BeWo.Service.DCEntityMapper
|
||||
return ServiceLogic.ConcurrencyCheck(pDataContractVersion, pEntity);
|
||||
}
|
||||
|
||||
public virtual List<TDC> MapToNewDCs(IEnumerable<TEntity> pEntitys)
|
||||
{
|
||||
List<TDC> lResult = new List<TDC>();
|
||||
if (pEntitys != null)
|
||||
{
|
||||
foreach (TEntity iEntity in pEntitys)
|
||||
{
|
||||
lResult.Add(this.MergeWithDC(iEntity, CreateNewDC()));
|
||||
}
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
public virtual TDC MapToNewDC(TEntity pEntity, bool ignoreNullEntity)
|
||||
{
|
||||
if (ignoreNullEntity || pEntity is object)
|
||||
return MapToNewDC(pEntity);
|
||||
|
||||
return CreateNewDC();
|
||||
}
|
||||
public virtual TDC MapToNewDC(TEntity pEntity)
|
||||
{
|
||||
return MergeWithDC(pEntity, CreateNewDC());
|
||||
}
|
||||
public virtual TDC CreateNewDC()
|
||||
{
|
||||
return new TDC();
|
||||
}
|
||||
|
||||
public virtual List<TEntity> MapToNewEntities(IEnumerable<TDC> pDataContracts)
|
||||
{
|
||||
List<TEntity> lResult = new List<TEntity>();
|
||||
if (pDataContracts != null)
|
||||
{
|
||||
foreach (TDC iDataContract in pDataContracts)
|
||||
{
|
||||
lResult.Add(this.MergeWithEntity(iDataContract, new TEntity()));
|
||||
}
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
public virtual TEntity MapToNewEntity(TDC pDataContract, bool ignoreNullDC)
|
||||
{
|
||||
if (ignoreNullDC || pDataContract is object)
|
||||
return MergeWithEntity(pDataContract, new TEntity());
|
||||
|
||||
return CreateNewEntity();
|
||||
}
|
||||
public virtual TEntity MapToNewEntity(TDC pDataContract)
|
||||
{
|
||||
return MergeWithEntity(pDataContract, new TEntity());
|
||||
}
|
||||
public virtual TEntity CreateNewEntity()
|
||||
{
|
||||
return new TEntity();
|
||||
}
|
||||
|
||||
public abstract TDC MergeWithDC(TEntity pEntity, TDC pDataContract);
|
||||
|
||||
public virtual void MergeWithEntitys(IList<TDC> pDataContractList, IList<TEntity> pEntityList)
|
||||
{
|
||||
if (pEntityList.Count == 0 && pDataContractList != null && pDataContractList.Count > 0)
|
||||
@@ -69,52 +127,20 @@ namespace BeWo.Service.DCEntityMapper
|
||||
// .Where(dc => pEntityList
|
||||
// .Count(entity => AreDCAndEntityEqual(dc, entity)) == 0)
|
||||
// .Select(dc => MapToNewEntity(dc)));
|
||||
|
||||
|
||||
}
|
||||
public virtual TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity, bool ignoreNullDC)
|
||||
{
|
||||
if (ignoreNullDC || pDataContract is object)
|
||||
{
|
||||
if (pEntity is null)
|
||||
pEntity = CreateNewEntity();
|
||||
|
||||
public virtual TDC MapToNewDC(TEntity pEntity)
|
||||
{
|
||||
return this.MergeWithDC(pEntity, CreateNewDC());
|
||||
}
|
||||
|
||||
public virtual List<TDC> MapToNewDCs(IEnumerable<TEntity> pEntitys)
|
||||
{
|
||||
List<TDC> lResult = new List<TDC>();
|
||||
if (pEntitys != null)
|
||||
{
|
||||
foreach (TEntity iEntity in pEntitys)
|
||||
{
|
||||
lResult.Add(this.MergeWithDC(iEntity, CreateNewDC()));
|
||||
}
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
|
||||
public virtual TDC CreateNewDC()
|
||||
{
|
||||
return new TDC();
|
||||
}
|
||||
|
||||
public virtual List<TEntity> MapToNewEntities(IEnumerable<TDC> pDataContracts)
|
||||
{
|
||||
List<TEntity> lResult = new List<TEntity>();
|
||||
if (pDataContracts != null)
|
||||
{
|
||||
foreach (TDC iDataContract in pDataContracts)
|
||||
{
|
||||
lResult.Add(this.MergeWithEntity(iDataContract, new TEntity()));
|
||||
}
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
|
||||
public virtual TEntity MapToNewEntity(TDC pDataContract)
|
||||
{
|
||||
return this.MergeWithEntity(pDataContract, new TEntity());
|
||||
}
|
||||
|
||||
public abstract TDC MergeWithDC(TEntity pEntity, TDC pDataContract);
|
||||
return MergeWithEntity(pDataContract, pEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public abstract TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity);
|
||||
|
||||
protected abstract bool AreDCAndEntityEqual(TDC pDC, TEntity pEntity);
|
||||
|
||||
54
Service/DCEntityMapper/BankAccountDC_BankAccount.cs
Normal file
54
Service/DCEntityMapper/BankAccountDC_BankAccount.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using BeWo.Data.Entities;
|
||||
using BS.Shared.DataContracts.Invoicing;
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
public class BankAccountDC_BankAccount : AbstractIDCEntityMapper<BankAccount, BankAccountDC>
|
||||
{
|
||||
public override BankAccountDC MergeWithDC(BankAccount from, BankAccountDC to)
|
||||
{
|
||||
to.AccountNumber = from.AccountNumber;
|
||||
to.BankCode = from.BankCode;
|
||||
to.BankName = from.BankName;
|
||||
to.Bic = from.Bic;
|
||||
to.IBAN = from.IBAN;
|
||||
to.Notice = from.Notice;
|
||||
to.Oid = from.Oid;
|
||||
to.Version = from.Version;
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
public override BankAccount MergeWithEntity(BankAccountDC from, BankAccount to)
|
||||
{
|
||||
ConcurrencyCheck(from.Version, to);
|
||||
|
||||
to.AccountNumber = from.AccountNumber.ToNullIfEmpty();
|
||||
to.BankCode = from.BankCode.ToNullIfEmpty();
|
||||
to.BankName = from.BankName.ToNullIfEmpty();
|
||||
to.Bic = from.Bic.ToNullIfEmpty();
|
||||
to.IBAN = from.IBAN.ToNullIfEmpty();
|
||||
to.Notice = from.Notice;
|
||||
to.Oid = from.Oid;
|
||||
to.Version = from.Version;
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
protected override bool AreDCAndEntityEqual(BankAccountDC pDC, BankAccount pEntity)
|
||||
{
|
||||
if (pDC.Oid == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pDC.Oid == pEntity.Oid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,9 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pDataContract.ActivationType = pEntity.IsActive;
|
||||
pDataContract.DebitorNumber = pEntity.DebitorNumber;
|
||||
pDataContract.BusinessPartnerId = pEntity.BusinessPartnerId;
|
||||
pDataContract.IKDatenannahmestelle = pEntity.IKDatenannahmestelle;
|
||||
pDataContract.IKKostentrager = pEntity.IKKostentrager;
|
||||
pDataContract.IKKrankenkasse = pEntity.IKKrankenkasse;
|
||||
|
||||
if (pEntity.CostBearer != null)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.GkvAbrechnung;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Interface;
|
||||
using NHibernate.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,7 +19,8 @@ namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
|
||||
}
|
||||
var orga = pEntity.GetOrganisation();
|
||||
|
||||
var orga = pEntity.Organisation;
|
||||
|
||||
pDataContract.GkvAbrechnungOid = pEntity.Oid;
|
||||
pDataContract.GkvAbrechnungVersion = pEntity.Version;
|
||||
@@ -88,10 +90,20 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
if (isReady)
|
||||
{
|
||||
if(!DakotaValidator.IsOrganisationInformationValid(orga.IKDatenannahmestelle, orga.IKKostentrager, orga.IKKrankenkasse, orga.BezDatenannahmestelle))
|
||||
if(!Validator.IsOrganisationInformationValid(orga.IKDatenannahmestelle, orga.IKKostentrager, orga.IKKrankenkasse, orga.BezDatenannahmestelle))
|
||||
{
|
||||
isReady = false;
|
||||
tooltip = "Organisation fehlen Informationen";
|
||||
}
|
||||
else if(pDataContract.TransferProtokolle is IList<GkvTransferProtokollDC> list && list.Any())
|
||||
{
|
||||
var last_prot_w_daten = list.Select(x => x.IKDatenannahmestelle).Where((x) => !string.IsNullOrEmpty(x)).LastOrDefault();
|
||||
|
||||
if (!string.IsNullOrEmpty(last_prot_w_daten) && last_prot_w_daten != orga.IKDatenannahmestelle)
|
||||
{
|
||||
isReady = false;
|
||||
tooltip = "Datenannahmestelle hat sich geändert. Bitte neue Abrechnung erstellen.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,11 +136,13 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
MapperFactory.GkvTransferProtokollDC_GkvTransferprotokoll.MergeWithEntitys(pDataContract.TransferProtokolle, pEntity.GkvTransferProtokolle);
|
||||
|
||||
if (pEntity.InvoiceBases is null)
|
||||
pEntity.InvoiceBases = new List<InvoiceBase>();
|
||||
|
||||
pEntity.InvoiceBases = DAOFactory.GenericDAO.LoadByIDs<InvoiceBase>(pDataContract.InvoiceBases.Select(x => x.InvoiceBaseOid.Value));
|
||||
|
||||
if(pDataContract.Organisation is null)
|
||||
{
|
||||
pEntity.Organisation = pEntity.InvoiceBases.First().CostBearer2SupportConcept.CostBearer.Organisation;
|
||||
}
|
||||
|
||||
//MapperFactory.InvoiceBaseDC_InvoiceBase.MergeWithEntitys(pDataContract.InvoiceBases, pEntity.InvoiceBases);
|
||||
|
||||
return pEntity;
|
||||
|
||||
@@ -145,9 +145,10 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
if(customer is object)
|
||||
{
|
||||
pDataContract.CustomerOid = customer.Oid.Value;
|
||||
pDataContract.CustomerFirstName = customer.Person.FirstName;
|
||||
pDataContract.CustomerLastName = customer.Person.LastName;
|
||||
var error = DakotaValidator.ValidateCustomer(customer.InsuranceNumber, customer.VersichertenStatus);
|
||||
var error = Validator.ValidateCustomer(customer.InsuranceNumber, customer.VersichertenStatus);
|
||||
pDataContract.IsGkvValidError = error;
|
||||
pDataContract.IsGkvValid = error is null;
|
||||
}
|
||||
|
||||
@@ -1,69 +1,122 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
|
||||
namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
public class MandatorDC_Mandator : AbstractIDCEntityMapper<Mandator, MandatorDC>
|
||||
{
|
||||
public override MandatorDC MergeWithDC(Mandator pEntity, MandatorDC pDataContract)
|
||||
{
|
||||
pDataContract.MandatorOid = pEntity.Oid;
|
||||
pDataContract.MandatorVersion = pEntity.Version;
|
||||
pDataContract.Name = pEntity.Name;
|
||||
pDataContract.ClientId = pEntity.ClientId;
|
||||
pDataContract.BeWoClientType = pEntity.BeWoClientType;
|
||||
pDataContract.Country = pEntity.Country;
|
||||
pDataContract.State = pEntity.State;
|
||||
pDataContract.Town = pEntity.Town;
|
||||
pDataContract.PostalCode = pEntity.PostalCode;
|
||||
pDataContract.Street = pEntity.Street;
|
||||
pDataContract.Settings = pEntity.Settings;
|
||||
pDataContract.RssFeedUrl = pEntity.RssFeedUrl;
|
||||
pDataContract.IsSchedulerAllowed = pEntity.IsSchedulerAllowed;
|
||||
pDataContract.IsMedicationAllowed = pEntity.IsMedicationAllowed;
|
||||
public class MandatorDC_Mandator : AbstractIDCEntityMapper<Mandator, MandatorDC>
|
||||
{
|
||||
public override MandatorDC MergeWithDC(Mandator from, MandatorDC to)
|
||||
{
|
||||
to.MandatorOid = from.Oid;
|
||||
to.MandatorVersion = from.Version;
|
||||
to.Website = from.Website;
|
||||
to.Name = from.Name;
|
||||
to.ClientId = from.ClientId;
|
||||
to.BeWoClientType = from.BeWoClientType;
|
||||
to.Country = from.Country;
|
||||
to.State = from.State;
|
||||
to.Town = from.Town;
|
||||
to.PostalCode = from.PostalCode;
|
||||
to.Street = from.Street;
|
||||
to.Settings = from.Settings;
|
||||
to.RssFeedUrl = from.RssFeedUrl;
|
||||
to.IsSchedulerAllowed = from.IsSchedulerAllowed;
|
||||
to.IsMedicationAllowed = from.IsMedicationAllowed;
|
||||
|
||||
pDataContract.AllowSbd = !string.IsNullOrEmpty(pDataContract.ClientId) && pDataContract.ClientId == "SBD";
|
||||
to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MapToNewDC(from.BankAccount, false);
|
||||
|
||||
to.AllowSbd = !string.IsNullOrEmpty(to.ClientId) && to.ClientId == "SBD";
|
||||
|
||||
to.ShowGkvBzEinzel = from.ShowGkvBzEinzel ?? true;
|
||||
to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege ?? true;
|
||||
to.ColorSendUrbelege = from.ColorSendUrbelege;
|
||||
to.ColorWaitTooLong = from.ColorWaitTooLong;
|
||||
|
||||
#if DEBUG
|
||||
//pDataContract.AllowSbd = true;
|
||||
//pDataContract.AllowSbd = true;
|
||||
#endif
|
||||
pDataContract.Apikey = pEntity.Apikey;
|
||||
pDataContract.IKLeistungserbringer = pEntity.IKLeistungserbringer;
|
||||
to.Apikey = from.Apikey;
|
||||
to.IKLeistungserbringer = from.IKLeistungserbringer;
|
||||
var can_edit = GetCanEditIKLeistungserbringer();
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
to.CanEditIKLeistungserbringer = can_edit;
|
||||
to.CanEditIKLeistungserbringerTooltip = can_edit ? null :
|
||||
"Mit dem Senden mind. einer GKV Abrechnung haben Sie sich bereits\n" +
|
||||
"mit dieser IK bei uns registiert. Bei Änderungswunsch wenden Sie\n" +
|
||||
"sich bitte an unseren Support.";
|
||||
|
||||
public override Mandator MergeWithEntity(MandatorDC pDataContract, Mandator pEntity)
|
||||
{
|
||||
this.ConcurrencyCheck(pDataContract.MandatorVersion, pEntity);
|
||||
if (from.SoziotherapieAnsprechpartner is object)
|
||||
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(from.SoziotherapieAnsprechpartner);
|
||||
|
||||
pEntity.Name = pDataContract.Name;
|
||||
pEntity.ClientId = pDataContract.ClientId;
|
||||
pEntity.BeWoClientType = pDataContract.BeWoClientType;
|
||||
pEntity.Country = pDataContract.Country;
|
||||
pEntity.State = pDataContract.State;
|
||||
pEntity.Town = pDataContract.Town;
|
||||
pEntity.PostalCode = pDataContract.PostalCode;
|
||||
pEntity.Street = pDataContract.Street;
|
||||
pEntity.Settings = pDataContract.Settings;
|
||||
pEntity.RssFeedUrl = pDataContract.RssFeedUrl;
|
||||
pEntity.IsSchedulerAllowed = pDataContract.IsSchedulerAllowed;
|
||||
pEntity.IsMedicationAllowed = pDataContract.IsMedicationAllowed;
|
||||
pEntity.Apikey = pDataContract.Apikey;
|
||||
pEntity.IKLeistungserbringer = pDataContract.IKLeistungserbringer;
|
||||
if (from.Logo is object)
|
||||
to.Logo = MapperFactory.ImageDC_Image.MapToNewDC(from.Logo);
|
||||
|
||||
return pEntity;
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
protected override bool AreDCAndEntityEqual(MandatorDC pDC, Mandator pEntity)
|
||||
{
|
||||
if (pDC.MandatorOid == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override Mandator MergeWithEntity(MandatorDC from, Mandator to)
|
||||
{
|
||||
this.ConcurrencyCheck(from.MandatorVersion, to);
|
||||
|
||||
return pDC.MandatorOid == pEntity.Oid;
|
||||
}
|
||||
}
|
||||
to.Name = from.Name;
|
||||
to.Website = from.Website.ToNullIfEmpty();
|
||||
to.ClientId = from.ClientId;
|
||||
to.BeWoClientType = from.BeWoClientType;
|
||||
to.Country = from.Country;
|
||||
to.State = from.State;
|
||||
to.Town = from.Town;
|
||||
to.PostalCode = from.PostalCode;
|
||||
to.Street = from.Street;
|
||||
to.Settings = from.Settings;
|
||||
to.RssFeedUrl = from.RssFeedUrl;
|
||||
to.IsSchedulerAllowed = from.IsSchedulerAllowed;
|
||||
to.IsMedicationAllowed = from.IsMedicationAllowed;
|
||||
to.Apikey = from.Apikey;
|
||||
to.IKLeistungserbringer = from.IKLeistungserbringer.ToNullIfEmpty();
|
||||
|
||||
if (from.BankAccount is object)
|
||||
{
|
||||
to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MergeWithEntity(from.BankAccount, to.BankAccount, false);
|
||||
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MergeWithEntity(from.SoziotherapieAnsprechpartner, to.SoziotherapieAnsprechpartner, false);
|
||||
to.Logo = MapperFactory.ImageDC_Image.MergeWithEntity(from.Logo, to.Logo, false);
|
||||
|
||||
to.ShowGkvBzEinzel = from.ShowGkvBzEinzel;
|
||||
to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege;
|
||||
to.ColorSendUrbelege = from.ColorSendUrbelege;
|
||||
to.ColorWaitTooLong = from.ColorWaitTooLong;
|
||||
}
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
protected override bool AreDCAndEntityEqual(MandatorDC pDC, Mandator pEntity)
|
||||
{
|
||||
if (pDC.MandatorOid == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pDC.MandatorOid == pEntity.Oid;
|
||||
}
|
||||
|
||||
private bool GetCanEditIKLeistungserbringer()
|
||||
{
|
||||
try
|
||||
{
|
||||
var row_count = DAOFactory.GenericDAO.GetRowCount<GkvTransferProtokoll>();
|
||||
|
||||
return row_count == 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,7 +437,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
public static CompactWohnheimDC_Wohnheim CompactWohnheimDC_Wohnheim =>
|
||||
_CompactWohnheimDC_Wohnheim ?? (_CompactWohnheimDC_Wohnheim = new CompactWohnheimDC_Wohnheim());
|
||||
|
||||
|
||||
public static WohnheimDC_Wohnheim WohnheimDC_Wohnheim =>
|
||||
_WohnheimDC_Wohnheim ?? (_WohnheimDC_Wohnheim = new WohnheimDC_Wohnheim());
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
public static CustomerAPPCodeDC_CustomerAPPCode CustomerAPPCodeDC_CustomerAPPCode =>
|
||||
_CustomerAPPCodeDC_CustomerAPPCode ?? (_CustomerAPPCodeDC_CustomerAPPCode = new CustomerAPPCodeDC_CustomerAPPCode());
|
||||
|
||||
|
||||
public static VertretungDC_Vertretung VertretungDC_Vertretung =>
|
||||
_VertretungDC_Vertretung ?? (_VertretungDC_Vertretung = new VertretungDC_Vertretung());
|
||||
|
||||
@@ -527,7 +527,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
public static EmployeeTokenRelationDC_Employee2Token EmployeeTokenRelationDC_Employee2Token =>
|
||||
_EmployeeTokenRelationDC_Employee2Token ?? (_EmployeeTokenRelationDC_Employee2Token = new EmployeeTokenRelationDC_Employee2Token());
|
||||
|
||||
|
||||
public static CompactTokenDC_Token CompactTokenDC_Token =>
|
||||
_CompactTokenDC_Token ?? (_CompactTokenDC_Token = new CompactTokenDC_Token());
|
||||
|
||||
@@ -745,7 +745,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
public static DokumentvorlageDC_Dokumentvorlage DokumentvorlageDC_Dokumentvorlage =>
|
||||
_DokumentvorlageDC_Dokumentvorlage ?? (_DokumentvorlageDC_Dokumentvorlage = new DokumentvorlageDC_Dokumentvorlage());
|
||||
|
||||
|
||||
public static VorlagentabelleDC_Vorlagentabelle VorlagentabelleDC_Vorlagentabelle =>
|
||||
_VorlagentabelleDC_Vorlagentabelle ?? (_VorlagentabelleDC_Vorlagentabelle = new VorlagentabelleDC_Vorlagentabelle());
|
||||
|
||||
@@ -758,7 +758,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
public static AddressRouteDC_AddressRoute AddressRouteDC_AddressRoute =>
|
||||
_AddressRouteDC_AddressRoute ?? (_AddressRouteDC_AddressRoute = new AddressRouteDC_AddressRoute());
|
||||
|
||||
public static BargeldtransaktionshistoryDC_Bargeldtransaktionshistory BargeldtransaktionshistoryDC_Bargeldtransaktionshistory =>
|
||||
public static BargeldtransaktionshistoryDC_Bargeldtransaktionshistory BargeldtransaktionshistoryDC_Bargeldtransaktionshistory =>
|
||||
_BargeldtransaktionshistoryDC_Bargeldtransaktionshistory ?? (_BargeldtransaktionshistoryDC_Bargeldtransaktionshistory = new BargeldtransaktionshistoryDC_Bargeldtransaktionshistory());
|
||||
|
||||
public static WohneinheitDC_Wohneinheit WohneinheitDC_Wohneinheit =>
|
||||
@@ -769,14 +769,17 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
public static ImageDC_Image ImageDC_Image =>
|
||||
_ImageDC_Image ?? (_ImageDC_Image = new ImageDC_Image());
|
||||
|
||||
|
||||
public static CustomerVermittlungArbeitDC_CustomerVermittlungArbeit CustomerVermittlungArbeitDC_CustomerVermittlungArbeit =>
|
||||
_CustomerVermittlungArbeitDC_CustomerVermittlungArbeit ?? (_CustomerVermittlungArbeitDC_CustomerVermittlungArbeit = new CustomerVermittlungArbeitDC_CustomerVermittlungArbeit());
|
||||
|
||||
|
||||
public static CustomerWohnhilfeDC_CustomerWohnhilfe CustomerWohnhilfeDC_CustomerWohnhilfe =>
|
||||
_CustomerWohnhilfeDC_CustomerWohnhilfe ?? (_CustomerWohnhilfeDC_CustomerWohnhilfe = new CustomerWohnhilfeDC_CustomerWohnhilfe());
|
||||
|
||||
public static AiSettingsDC_AiSettings AiSettingsDC_AiSettings =>
|
||||
_AiSettingsDC_AiSettings ?? (_AiSettingsDC_AiSettings = new AiSettingsDC_AiSettings());
|
||||
|
||||
public static BankAccountDC_BankAccount BankAccountDC_BankAccount { get; }
|
||||
= new BankAccountDC_BankAccount();
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pDataContract.BezDatenannahmestelle = pEntity.BezDatenannahmestelle;
|
||||
pDataContract.Leistungserbringergruppe = pEntity.Leistungserbringergruppe;
|
||||
pDataContract.Verfahrensstufe = pEntity.Verfahrensstufe;
|
||||
pDataContract.GkvAusblenden = pEntity.GkvAusblenden;
|
||||
|
||||
pDataContract.BusinessPartnerId = pEntity.BusinessPartnerId;
|
||||
|
||||
@@ -113,6 +114,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pEntity.BezDatenannahmestelle = pDataContract.BezDatenannahmestelle;
|
||||
pEntity.Leistungserbringergruppe = pDataContract.Leistungserbringergruppe;
|
||||
pEntity.Verfahrensstufe = pDataContract.Verfahrensstufe;
|
||||
pEntity.GkvAusblenden = pDataContract.GkvAusblenden;
|
||||
|
||||
pEntity.BusinessPartnerId = pDataContract.BusinessPartnerId;
|
||||
|
||||
|
||||
@@ -167,6 +167,13 @@ namespace BeWo.Service.Dienstplanung
|
||||
}
|
||||
root.DienstDCListe = sortierteDienstDCListe;
|
||||
}
|
||||
else if (wh.Sortierungsart == 2)
|
||||
{
|
||||
if (wh.AbsteigendeSortierung == 0)
|
||||
root.DienstDCListe = root.DienstDCListe.OrderBy(d => d.Employee.LastName).ToList();
|
||||
else
|
||||
root.DienstDCListe = root.DienstDCListe.OrderByDescending(d => d.Employee.LastName).ToList();
|
||||
}
|
||||
|
||||
|
||||
root.EnableStatuszeile = Convert.ToBoolean(wh.PflichtbesetzungEinblenden);
|
||||
@@ -814,7 +821,7 @@ namespace BeWo.Service.Dienstplanung
|
||||
berechnung.CreateReport(konto);
|
||||
List<DienstplanerMonthlySummaryDC> monatsZusammenfassung = new List<DienstplanerMonthlySummaryDC>();
|
||||
root.StundenBeiAbwesenheit = new Dictionary<long?, decimal>();
|
||||
|
||||
|
||||
foreach (var item in konto.EmployeeDetailList)
|
||||
{
|
||||
root.StundenBeiAbwesenheit.Add(item.Employee.Oid, item.SollProTag);
|
||||
|
||||
@@ -109,7 +109,17 @@ namespace BeWo.Service.Import.Perseh
|
||||
endIdx = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (endIdx < startIdx)
|
||||
{
|
||||
for (int i = zeilen.Length - 1; i >= 0; i--)
|
||||
{
|
||||
var z = zeilen[i];
|
||||
if (z.StartsWith("Gesamtübersicht Stunden pro Woche"))
|
||||
{
|
||||
endIdx = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (startIdx >= 0)
|
||||
|
||||
@@ -570,6 +570,34 @@ namespace BeWo.Service.Invoicing
|
||||
{
|
||||
if (sip.ApprovedHours.HasValue && !scap.IsApprovedBEShifting)
|
||||
{
|
||||
//Prüfen ob der abzurechnende Zeitraum kleiner als das Bewilligungsintervall ist
|
||||
if (scap.ApprovedBEInterval.HasValue)
|
||||
{
|
||||
var days = invoicePeriod.GetTimeSpan().Days + 1;
|
||||
switch (scap.ApprovedBEInterval.Value)
|
||||
{
|
||||
case SupportConceptApprovalInterval.Quarterly:
|
||||
if (days < 89) //CB: Machen wir es mal nicht zu kompliziert, wenn man weniger als 89 Tage abrechnet, gehen wir davon aus, dass nicht das gesamte Quartal abgerechnet wird
|
||||
{
|
||||
return; // Mach nix. TODO: Gesamtstunden prüfen und dann nur das abrechnen, was noch offen ist. Wer das macht bekommt ein Fleißsternchen:-)
|
||||
}
|
||||
break;
|
||||
case SupportConceptApprovalInterval.HalfYearly:
|
||||
if (days < 178) //CB: Siehe oben
|
||||
{
|
||||
return; // Mach nix. TODO: Gesamtstunden prüfen und dann nur das abrechnen, was noch offen ist. Wer das macht bekommt ein Fleißsternchen:-)
|
||||
}
|
||||
break;
|
||||
case SupportConceptApprovalInterval.Yearly:
|
||||
if (days < 365) //CB: Siehe oben
|
||||
{
|
||||
return; // Mach nix. TODO: Gesamtstunden prüfen und dann nur das abrechnen, was noch offen ist. Wer das macht bekommt ein Fleißsternchen:-)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
decimal totalHours = 0;
|
||||
|
||||
foreach (var ii in sip.InvoiceItemList.Where(ii => ii.UnitCount.HasValue))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1508,6 +1508,8 @@ namespace BeWo.Service.Plugins
|
||||
|
||||
if (hidc.Ziele != null)
|
||||
{
|
||||
alleZiele = SortiereZieleNachHierarchie(alleZiele);
|
||||
|
||||
foreach (var importziel in hidc.Ziele)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(importziel.Bereich))
|
||||
@@ -1542,6 +1544,42 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
private List<ValueListEntryDC> SortiereZieleNachHierarchie(List<ValueListEntryDC> alleZiele)
|
||||
{
|
||||
var sortierteListe = new List<ValueListEntryDC>();
|
||||
|
||||
AddChildrenToList(sortierteListe, new List<ValueListEntryDC>(), alleZiele);
|
||||
|
||||
return sortierteListe;
|
||||
}
|
||||
|
||||
private void AddChildrenToList(List<ValueListEntryDC> sortedList, List<ValueListEntryDC> parentGoals, List<ValueListEntryDC> allGoals)
|
||||
{
|
||||
var childGoals = new List<ValueListEntryDC>();
|
||||
|
||||
foreach (var item in allGoals)
|
||||
{
|
||||
if (parentGoals.Count == 0 && !item.ParentOid.HasValue)
|
||||
{
|
||||
childGoals.Add(item);
|
||||
}
|
||||
else if (item.ParentOid.HasValue && parentGoals.Any(g => g.ValueListEntryOid == item.ParentOid))
|
||||
{
|
||||
childGoals.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in childGoals)
|
||||
{
|
||||
sortedList.Add(item);
|
||||
}
|
||||
|
||||
if (childGoals.Count > 0)
|
||||
{
|
||||
AddChildrenToList(sortedList, childGoals, allGoals);
|
||||
}
|
||||
}
|
||||
|
||||
private void MatchMassnahme(HilfeplanImportZielDC importMass, SupportConceptDC supportConcept, ValueListEntryDC parentZiel)
|
||||
{
|
||||
var splitByNewLine = importMass.ZielName.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -1574,9 +1612,9 @@ namespace BeWo.Service.Plugins
|
||||
{
|
||||
var ziel = alleZiele.Where(z => z.DisplayName != null && z.DisplayName.Contains(bereich)).FirstOrDefault();
|
||||
|
||||
if (ziel == null)
|
||||
if (ziel == null && bereich.StartsWith("Lebensbereich "))
|
||||
{
|
||||
bereich = bereich.Replace("Lebensbereich", "").Trim();
|
||||
bereich = bereich.Substring(13).Trim();
|
||||
ziel = alleZiele.Where(z => z.DisplayName != null && z.DisplayName.Contains(bereich)).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace BeWo.Service.Plugins
|
||||
#if DEBUG
|
||||
var t = "demo";
|
||||
|
||||
//t = "irgendwaswasesnichtgibt";
|
||||
t = "irgendwaswasesnichtgibt";
|
||||
//t = "5473568546"; //Interner Chat
|
||||
//t = "2356097460"; // Lebenshilfe Würzburg
|
||||
//t = "1234567890"; // Präsentationsdatenbank
|
||||
@@ -50,7 +50,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "2499262621"; // HPH Bersenbrück
|
||||
//t = "4950382346"; // Holsinger
|
||||
//t = "5973016645"; // Verein Lebensgestaltung Hanau
|
||||
//t = "7375324044"; // Diakonie KK Kleve
|
||||
t = "7375324044"; // Diakonie KK Kleve
|
||||
//t = "1441747891"; // BeWo Mobil Köln
|
||||
//t = "5120047701"; // Trialog
|
||||
//t = "3629696651"; // Soziale Dienste Niederrhein (SDN)
|
||||
@@ -148,7 +148,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "9975231461"; // Selwo
|
||||
//t = "8181286349"; // BeWo am Rhein
|
||||
//t = "4595275645"; // Eigenständig
|
||||
//t = "7912635399"; // Prof. Dr. Eggers Stiftung
|
||||
t = "7912635399"; // Prof. Dr. Eggers Stiftung
|
||||
//t = "3549726254"; // Socia
|
||||
//t = "1992495802"; // Monvita
|
||||
//t = "7381352241"; // Ressource e.V.
|
||||
@@ -391,7 +391,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "8735029937"; // Caritas Ostvest
|
||||
//t = "7653029063"; // SkF Leverkusen JuHi
|
||||
//t = "1453324901"; // Akkurat
|
||||
//t = "5000000000";
|
||||
//t = "5000000000"; // Test-DB
|
||||
//t = "5564670353"; // Mittelpunkt GbR
|
||||
//t = "3788859817"; // Zukunft Leben (Stephan Hekermann)
|
||||
//t = "2663321234"; // Aachener Laienhelfer Initiative e.V.
|
||||
@@ -404,6 +404,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "8365918329"; // Lebenshilfe Stade e.V. Schulbegleitender Dienst
|
||||
//t = "6203102637"; // BeWo Neuss-Lauth u. Lauth GbR
|
||||
//t = "7060431533"; // Arche Tecklenburg e.V.
|
||||
//t = "1159580198"; // Wendepunkt Velbert gGmbH
|
||||
|
||||
return t;
|
||||
#else
|
||||
|
||||
@@ -514,7 +514,15 @@ namespace BeWo.Service.Plugins
|
||||
result.Add(resultdc);
|
||||
}
|
||||
|
||||
// 10. Prüfe Fehlkontakte > 2 Std.
|
||||
// 10. Prüfe Abwesenheit Mitarbeiter
|
||||
var resultMa = CheckAbwesenheitMitarbeiter(newServiceRecord, reldc, rd, isGroupRecord, result);
|
||||
|
||||
if (resultMa != null)
|
||||
{
|
||||
result.Add(resultMa);
|
||||
}
|
||||
|
||||
// 11. Prüfe Fehlkontakte > 2 Std.
|
||||
|
||||
if (duration > 120 && (newServiceRecord.ServiceDescription.Name.ToLower().Contains("fehlkontakt") || newServiceRecord.ServiceDescription.Category.Name.ToLower().Contains("fehlkontakt")))
|
||||
{
|
||||
@@ -549,6 +557,51 @@ namespace BeWo.Service.Plugins
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual ServiceRecordValidationResultDC CheckAbwesenheitMitarbeiter(ServiceRecordDC newServiceRecord, SupportConceptCostBearerRelDC reldc, decimal rd, bool isGroupRecord, List<ServiceRecordValidationResultDC> result)
|
||||
{
|
||||
var e = DAOFactory.GenericDAO.LoadByID<Employee>(newServiceRecord.Employee.EmployeeOid);
|
||||
long? userOid = SecurityUtils.GetLoggedInUser().Oid;
|
||||
|
||||
if (e.AbsenceTimes != null && e.AbsenceTimes.Count > 0)
|
||||
{
|
||||
if (e.AbsenceTimes.Any(a => a.AbsenceSpan.StartDate <= newServiceRecord.End.Value && (!a.End.HasValue || a.End >= newServiceRecord.End.Value)
|
||||
|| a.End.Value.Date == newServiceRecord.End.Value.Date))
|
||||
{
|
||||
foreach (var at in e.AbsenceTimes)
|
||||
{
|
||||
if (at.Start <= newServiceRecord.Start.Value && (!at.End.HasValue || at.End.Value >= newServiceRecord.Start.Value) // normalerweise
|
||||
|| (at.Start.Value.Date == newServiceRecord.Start.Value.Date // bei weniger als ganztägigen Abwesenheiten, kann es Überschneidung geben
|
||||
&& at.End.Value >= newServiceRecord.Start.Value && newServiceRecord.Start >= at.Start)
|
||||
|| (at.End.Value.Date == newServiceRecord.End.Value.Date // bei weniger als ganztägigen Abwesenheiten, kann es Überschneidung geben
|
||||
&& at.End.Value >= newServiceRecord.End.Value && newServiceRecord.Start <= at.Start))
|
||||
{
|
||||
if (SecurityUtils.GetLoggedInUser().Oid.HasValue && newServiceRecord.Employee.EmployeeOid == SecurityUtils.GetLoggedInUser().Oid.Value)
|
||||
{
|
||||
String message = String.Format("Achtung bei Ihnen ist zu diesem Termin eine Abwesenheit eingetragen.\nMöchten Sie trotzdem speichern?");
|
||||
return new ServiceRecordValidationResultDC
|
||||
{
|
||||
ResultType = ServiceRecordValidationResult.Custom,
|
||||
Message = message,
|
||||
Allow = true
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
String message = String.Format("{0} ist zu diesem Termin abwesend.\nMöchten Sie trotzdem speichern?", e.Person.FirstNameLastName);
|
||||
return new ServiceRecordValidationResultDC
|
||||
{
|
||||
ResultType = ServiceRecordValidationResult.Custom,
|
||||
Message = message,
|
||||
Allow = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void CheckArbeitszeitBedingungen(ServiceRecordDC newServiceRecord, DateTime start, decimal duration, List<ServiceRecordValidationResultDC> result)
|
||||
{
|
||||
if (!IstArbeitszeit(newServiceRecord.ServiceDescription.Category.Name, newServiceRecord.ServiceDescription.Name))
|
||||
@@ -655,14 +708,9 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
}
|
||||
//var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(newServiceRecord.CostBearer2SupportConceptOid.Value);
|
||||
|
||||
//var customer = c2s.SupportConcept.Customer;
|
||||
|
||||
//var absenceTimes = MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewDCs(customer.AbsenceTimes);
|
||||
|
||||
|
||||
|
||||
|
||||
Dictionary<DateTimeSpan, decimal> span2Geleistet = new Dictionary<DateTimeSpan, decimal>();
|
||||
foreach (var span in span2MaxHours.Keys)
|
||||
{
|
||||
@@ -673,29 +721,29 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
|
||||
foreach (var sr in allRecords)
|
||||
{
|
||||
if (sr.Start.HasValue && sr.End.HasValue)
|
||||
{
|
||||
if (sr.Start.HasValue && sr.End.HasValue)
|
||||
foreach (var span in span2MaxHours.Keys)
|
||||
{
|
||||
foreach (var span in span2MaxHours.Keys)
|
||||
if (sr.End.Value.Date >= span.StartDateTime &&
|
||||
sr.Start.Value.Date <= span.EndDateTime)
|
||||
{
|
||||
if (sr.End.Value.Date >= span.StartDateTime &&
|
||||
sr.Start.Value.Date <= span.EndDateTime)
|
||||
if (sr.ServiceDescription.ServiceCategory.IsBillable)
|
||||
{
|
||||
if (sr.ServiceDescription.ServiceCategory.IsBillable)
|
||||
if (!span2Geleistet.ContainsKey(span))
|
||||
{
|
||||
if (!span2Geleistet.ContainsKey(span))
|
||||
{
|
||||
span2Geleistet.Add(span, 0);
|
||||
}
|
||||
|
||||
var duration = sr.RoundedDuration;
|
||||
|
||||
span2Geleistet[span] += duration;
|
||||
span2Geleistet.Add(span, 0);
|
||||
}
|
||||
|
||||
var duration = sr.RoundedDuration;
|
||||
|
||||
span2Geleistet[span] += duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var span in span2MaxHours.Keys)
|
||||
{
|
||||
@@ -724,16 +772,9 @@ namespace BeWo.Service.Plugins
|
||||
Message = message,
|
||||
Allow = true
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace BeWo.Service.Plugins
|
||||
{
|
||||
var res = new List<long>();
|
||||
var filters = new List<string> { "URLAUB" };
|
||||
var reasons = DAOFactory.GenericDAO.GetAllActive<AbsenceReason>();
|
||||
var reasons = DAOFactory.GenericDAO.GetAll<AbsenceReason>();
|
||||
|
||||
foreach (var reason in reasons)
|
||||
{
|
||||
@@ -359,8 +359,8 @@ namespace BeWo.Service.Plugins
|
||||
return new DateTime(year, 3, 31);
|
||||
}
|
||||
|
||||
//Faktor bestimmt zu welchem Anteil der übergebene Tag als Feiertag gewertet wird. 1 = ganzer Feiertag, 0 = kein Feiertag.
|
||||
//Kann verwendet werden um z.B. halbe Feiertage zu definieren. Dann kann in abgeleiteter Klasse 0.5 zurückgegeben werden
|
||||
// Faktor bestimmt zu welchem Anteil der übergebene Tag als Feiertag gewertet wird. 1 = ganzer Feiertag, 0 = kein Feiertag.
|
||||
// Kann verwendet werden um z.B. halbe Feiertage zu definieren. Dann kann in abgeleiteter Klasse 0.5 zurückgegeben werden
|
||||
public virtual decimal GetFeiertagsFaktor(DateTime start)
|
||||
{
|
||||
if (IstFeiertag(start))
|
||||
@@ -532,10 +532,10 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 4. Verfallener Resturlaub
|
||||
// Verfallsdatum der Urlaubstage des letzten Jahres zur Darstellung (also ohne Uhrzeit)
|
||||
var expDate = GetExpirationDate(year).ToString().Split(' ');
|
||||
|
||||
|
||||
// Resturlaub und den verbleibenden Resturlaub nach Verfall erstellen
|
||||
if (aktuellesKonto.Value.ResturlaubVorjahrTotal > 0) // Wenn Urlaub aus dem Vorjahr mitgenommen wurde
|
||||
@@ -549,17 +549,24 @@ namespace BeWo.Service.Plugins
|
||||
IsDeletable = false
|
||||
}) ;
|
||||
}
|
||||
if (aktuellesKonto.Value.VerfallenerUrlaub > 0) // Wenn Urlaubstage verfallen sind
|
||||
var expDate = GetExpirationDate(year);
|
||||
if (expDate != null)
|
||||
{
|
||||
dcs.Add(new UrlaubskontoDarstellungDC()
|
||||
var expDateString = GetExpirationDate(year).ToString().Split(' ');
|
||||
|
||||
if (aktuellesKonto.Value.VerfallenerUrlaub > 0) // Wenn Urlaubstage verfallen sind
|
||||
{
|
||||
Erlaeuterung = string.Format("Urlaub am {0} verfallen: ", expDate[0]),
|
||||
AnzahlTage = string.Format("-{0:0.00}", aktuellesKonto.Value.VerfallenerUrlaub),
|
||||
DatumZurSortierung = GetExpirationDate(year),
|
||||
Tooltip = null,
|
||||
IsDeletable = false
|
||||
});
|
||||
dcs.Add(new UrlaubskontoDarstellungDC()
|
||||
{
|
||||
Erlaeuterung = string.Format("Urlaub am {0} verfallen: ", expDateString[0]),
|
||||
AnzahlTage = string.Format("-{0:0.00}", aktuellesKonto.Value.VerfallenerUrlaub),
|
||||
DatumZurSortierung = GetExpirationDate(year),
|
||||
Tooltip = null,
|
||||
IsDeletable = false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 5. Alle Urlaube, die Anfang oder Ende im gewählten Jahr haben
|
||||
@@ -801,7 +808,7 @@ namespace BeWo.Service.Plugins
|
||||
|
||||
if (year >= start && year <= end)
|
||||
workdays = contract.WeeklyDays;
|
||||
// Durch jedes Jahr des Vertrags gehen
|
||||
// Durch jedes Jahr des Vertrags gehen und vertr. Urlaubsanspruch setzen. Noch keine Abwesenheiten, nur Urlaubsanspruch
|
||||
for (int i = start; i <= end; i++)
|
||||
{
|
||||
if (konten.ContainsKey(i))
|
||||
@@ -860,7 +867,7 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
// Abwesenheiten in Jahr x zu einem Dictionary hinzufügen
|
||||
// Abwesenheiten in Jahr x zu einem Dictionary hinzufügen, noch kein Abzug vom Konto
|
||||
var absencesYear = new List<Tuple<int, AbsenceTime>>();
|
||||
foreach (var abs in absences)
|
||||
{
|
||||
@@ -882,16 +889,25 @@ namespace BeWo.Service.Plugins
|
||||
// Tuple = Key-Value-Paar
|
||||
foreach (var tuple in absencesYear)
|
||||
{
|
||||
if (tuple.Item1 == 2024)
|
||||
{ }
|
||||
|
||||
var absYear = tuple.Item1;
|
||||
var absence = tuple.Item2;
|
||||
|
||||
_Feiertage = GetFeiertage(absYear);
|
||||
|
||||
// Resturlaub aus Vorjahr übertragen
|
||||
while (berechnungsjahr < absYear)
|
||||
{
|
||||
var geschenkteTageFuerAbrechnungsjahr = geschenkteUrlaubstage.Where(g => g.Date.Year == berechnungsjahr).ToList();
|
||||
|
||||
var tmp = konten[berechnungsjahr];
|
||||
var tmp2 = konten[berechnungsjahr + 1];
|
||||
|
||||
var tmp = konten[berechnungsjahr]; // 2023
|
||||
var tmp2 = konten[berechnungsjahr + 1]; // 2024
|
||||
|
||||
if (berechnungsjahr == 2024)
|
||||
{ }
|
||||
|
||||
tmp2.ResturlaubVorjahrTotal = tmp.Resturlaub + geschenkteTageFuerAbrechnungsjahr.Sum(g => g.AnzahlTage);
|
||||
tmp2.ResturlaubVorjahr = tmp.Resturlaub + geschenkteTageFuerAbrechnungsjahr.Sum(g => g.AnzahlTage);
|
||||
@@ -900,7 +916,9 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
|
||||
var current = konten[absYear];
|
||||
|
||||
if (tuple.Item2.Oid == 566)
|
||||
{ }
|
||||
|
||||
// Start und Ende auf Jahresanfang/-ende setzen, wenn Start des Urlaubs im Vorjahr oder Ende des Urlaubs im nächsten Jahr liegt
|
||||
var start = DateTimeExtensions.GetMax(absence.Start, new DateTime(absYear, 1, 1));
|
||||
var end = DateTimeExtensions.GetMin(absence.End, new DateTime(absYear, 12, 31));
|
||||
@@ -939,14 +957,16 @@ namespace BeWo.Service.Plugins
|
||||
dauer = CountUrlaubstageStandard(spanne, absYear, contractsAndWeeklyDays);
|
||||
//dauer = BerechneAnzahlUrlaubstage(absence, null, absYear, workdays); // HIER MÜSSEN PARAMETER FÜR ISTWOCHENENDE() MITGEGEBEN WERDEN
|
||||
|
||||
if (absYear == 2024)
|
||||
{ }
|
||||
|
||||
// Verfallsdatum des Urlaubs festlegen
|
||||
var expiration = GetExpirationDate(absYear);
|
||||
current.UrlaubsVerfallsdatum = expiration;
|
||||
|
||||
// Resturlaub vom Vorjahr verwenden, wenn Resturlaub aus dem Vorjahr existiert und der Urlaub vor dem Verfallsdatum beginnt
|
||||
if (current.ResturlaubVorjahr > 0 && start <= expiration)
|
||||
if (expiration != null && current.ResturlaubVorjahr > 0 && start <= expiration || expiration == null && current.ResturlaubVorjahr > 0)
|
||||
{
|
||||
//var firstEnd = (DateTime)DateTimeExtensions.GetMin(end, expiration); // Ende von Urlaub oder Verfallsdatum, je nachdem was früher ist
|
||||
var firstEnd = GetFirstEnd(end, expiration); // Ende von Urlaub oder Verfallsdatum, je nachdem was früher ist
|
||||
|
||||
var dauerVorjahr = 0m;
|
||||
@@ -967,6 +987,9 @@ namespace BeWo.Service.Plugins
|
||||
zaehlerDatum = zaehlerDatum.AddDays(1);
|
||||
}
|
||||
|
||||
if (tuple.Item2.Oid == 566)
|
||||
{ }
|
||||
|
||||
var bucheVorjahr = Math.Min(current.ResturlaubVorjahr, dauerVorjahr);
|
||||
|
||||
// Urlaub, der mit Resturlaub Vorjahr abgedeckt werden kann, von diesem abziehen
|
||||
@@ -981,7 +1004,7 @@ namespace BeWo.Service.Plugins
|
||||
zuVerfallZuAddieren[absYear] -= dauer;
|
||||
}
|
||||
}
|
||||
else if (start > expiration) // Wenn der Urlaub nach dem Verfallsdatum beginnt, ist der verfallene Urlaub gleich dem Urlaub, der aus dem Vorjahr übrig ist
|
||||
else if (expiration != null && start > expiration) // Wenn der Urlaub nach dem Verfallsdatum beginnt, ist der verfallene Urlaub gleich dem Urlaub, der aus dem Vorjahr übrig ist
|
||||
{
|
||||
current.VerfallenerUrlaub = zuVerfallZuAddieren.ContainsKey(absYear) ? current.ResturlaubVorjahr + zuVerfallZuAddieren[absYear] : current.ResturlaubVorjahr;
|
||||
}
|
||||
|
||||
@@ -225,6 +225,7 @@
|
||||
<Compile Include="Core\Utils.cs" />
|
||||
<Compile Include="DCEntityMapper\AbwesenheitsInformationPrintDC_AbwesenheitsInformationPrint.cs" />
|
||||
<Compile Include="DCEntityMapper\AddressRouteDC_AddressRoute.cs" />
|
||||
<Compile Include="DCEntityMapper\BankAccountDC_BankAccount.cs" />
|
||||
<Compile Include="DCEntityMapper\BargeldtransaktionshistoryDC_Bargeldtransaktionshistory.cs" />
|
||||
<Compile Include="DCEntityMapper\ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.cs" />
|
||||
<Compile Include="DCEntityMapper\CustomerVermittlungArbeitDC_CustomerVermittlungArbeit.cs" />
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>de-DE</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1119,6 +1119,10 @@ namespace BeWo.Service.ServiceContracts
|
||||
[OperationContract]
|
||||
DokumentvorlageDC InsertTemplate(DokumentvorlageDC dc);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
List<PlatzhalterDC> GetPlatzhalterForTemplate(VorlagentabelleDC vt);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
List<PlatzhalterDC> GetPlatzhalterForSupportConcept();
|
||||
@@ -1143,6 +1147,10 @@ namespace BeWo.Service.ServiceContracts
|
||||
[OperationContract]
|
||||
List<DokumentvorlageDC> GetDokumentvorlagenInFolder(long folderOid);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
List<DokumentvorlageDC> GetDokumentvorlagenForType(TableID objecTid);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
List<SupportConceptDC> GetSupportConceptsById(IEnumerable<long> supportConceptOids);
|
||||
|
||||
@@ -27,12 +27,15 @@ using BS.Shared.DataContracts.GkvAbrechnung;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Exceptions;
|
||||
using BS.Shared.AppSender;
|
||||
using BeWo.Data.Security;
|
||||
|
||||
namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
|
||||
public class AccountingServiceImp : IAccountingService
|
||||
{
|
||||
public string Tenant => MultitenancyOperationContextExt.Current?.Tenant;
|
||||
|
||||
public void DeactivateInvoiceBases(List<InvoiceBaseDC> invoices)
|
||||
{
|
||||
try
|
||||
@@ -666,18 +669,18 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
|
||||
public List<long> UpdateServiceInvoices(List<ServiceInvoiceDC> invoices)
|
||||
{
|
||||
try
|
||||
{
|
||||
var acc = PluginLoader.FindClass<AccountingService>();
|
||||
return acc.UpdateServiceInvoices(invoices);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
public List<long> UpdateServiceInvoices(List<ServiceInvoiceDC> invoices)
|
||||
{
|
||||
try
|
||||
{
|
||||
var acc = PluginLoader.FindClass<AccountingService>();
|
||||
return acc.UpdateServiceInvoices(invoices);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateSettlementInvoice(List<Settlement2DC> invoices)
|
||||
{
|
||||
@@ -817,6 +820,10 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
try
|
||||
{
|
||||
var invoice_bases = DAOFactory.GenericDAO.LoadByIDs<InvoiceBase>(request.SelectedInvoiceBases);
|
||||
|
||||
ValidatorExtended.ValidateGkvAbrechnung(request.GkvAbrechnungDC, invoice_bases);
|
||||
|
||||
var gkv_abrechnung = MapperFactory.GkvAbrechnungDC_GkvAbrechnung.MapToNewEntity(request.GkvAbrechnungDC);
|
||||
|
||||
if (gkv_abrechnung.AbrechnungsZeitraumEnde.Value.Hour == 0)
|
||||
@@ -824,7 +831,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
gkv_abrechnung.AbrechnungsZeitraumEnde = gkv_abrechnung.AbrechnungsZeitraumEnde.Value.Date.AddDays(1).AddMilliseconds(-1);
|
||||
}
|
||||
|
||||
var orga = gkv_abrechnung.GetOrganisation();
|
||||
var orga = gkv_abrechnung.Organisation;
|
||||
|
||||
gkv_abrechnung.Verfahrensstufe = orga.Verfahrensstufe;
|
||||
|
||||
@@ -832,9 +839,6 @@ namespace BeWo.Service.ServiceImplementations
|
||||
foreach (var invoicebase_oid in request.SelectedInvoiceBases)
|
||||
{
|
||||
var service = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoicebase_oid);
|
||||
var invoicebase = DAOFactory.GenericDAO.GetByID<InvoiceBase>(invoicebase_oid);
|
||||
|
||||
var invoicebase_dc = MapperFactory.InvoiceBaseDC_InvoiceBase.MapToNewDC(invoicebase);
|
||||
|
||||
foreach (var peroid in service.ServiceInvoicePeriodList)
|
||||
{
|
||||
@@ -859,10 +863,16 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
catch (GkvException exc)
|
||||
{
|
||||
MailUtils.SendGkvModuleErrorMail("CreateNewGkvAbrechnung", exc, Tenant);
|
||||
|
||||
if (exc.Title.IsNotNullOrWhiteSpace())
|
||||
response.TitleMessage = exc.Title;
|
||||
response.Message = exc.Message;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MailUtils.SendGkvModuleErrorMail("CreateNewGkvAbrechnung", e, Tenant);
|
||||
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
|
||||
@@ -918,24 +928,26 @@ namespace BeWo.Service.ServiceImplementations
|
||||
return response;
|
||||
}
|
||||
|
||||
var protokoll = new GkvTransferProtokoll
|
||||
var protokoll = CreateGkvTransferProtokoll(entity, out var error);
|
||||
if (error is object)
|
||||
{
|
||||
ErstelltAm = DateTime.Now,
|
||||
GkvAbrechnungOid = entity.Oid.Value
|
||||
};
|
||||
MailUtils.SendGkvModuleErrorMail("SendNewGkvAbrechnung - CreateGkvTransferProtokoll", error, Tenant);
|
||||
|
||||
response.TitleMessage = "Protokoll Erstellung";
|
||||
response.Message = error;
|
||||
return response;
|
||||
}
|
||||
|
||||
if (entity.GkvTransferProtokolle is null)
|
||||
entity.GkvTransferProtokolle = new List<GkvTransferProtokoll>();
|
||||
|
||||
entity.GkvTransferProtokolle.Add(protokoll);
|
||||
|
||||
// Protokoll braucht Oid
|
||||
DAOFactory.GenericDAO.Update(entity);
|
||||
|
||||
try
|
||||
{
|
||||
CreateGkvTransferProtokoll(oid, entity, protokoll);
|
||||
|
||||
if (entity.GkvTransferProtokolle is null)
|
||||
entity.GkvTransferProtokolle = new List<GkvTransferProtokoll>();
|
||||
|
||||
entity.GkvTransferProtokolle.Add(protokoll);
|
||||
|
||||
// Protokoll braucht Oid
|
||||
DAOFactory.GenericDAO.Update(entity);
|
||||
|
||||
var app8_response = SendApp8SendNewRequest(protokoll);
|
||||
|
||||
var app8_protokoll = app8_response.GkvTransferProtokollDC;
|
||||
@@ -992,6 +1004,22 @@ namespace BeWo.Service.ServiceImplementations
|
||||
Success = app8res.Success
|
||||
};
|
||||
|
||||
if (res.Gefunden)
|
||||
{
|
||||
var orgas = DAOFactory.SearchDAO.GetAllOrganisationByIKKrankenkasse(req.IKKrankenkasse);
|
||||
|
||||
if (req.OrganisationOid is long oid)
|
||||
{
|
||||
orgas.RemoveAll(x => x.Oid == oid);
|
||||
}
|
||||
|
||||
if (orgas.Any())
|
||||
{
|
||||
res.BereitsEnthalten = true;
|
||||
res.BereitsEnthaltenBei = orgas.Select(x => x.Name).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -1000,26 +1028,50 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateGkvTransferProtokoll(long oid, GkvAbrechnung gkvAbrechnung, GkvTransferProtokoll protokoll)
|
||||
private GkvTransferProtokoll CreateGkvTransferProtokoll(GkvAbrechnung gkvAbrechnung, out string error)
|
||||
{
|
||||
var protokoll = new GkvTransferProtokoll
|
||||
{
|
||||
ErstelltAm = DateTime.Now,
|
||||
GkvAbrechnungOid = gkvAbrechnung.Oid.Value
|
||||
};
|
||||
|
||||
error = null;
|
||||
|
||||
try
|
||||
{
|
||||
ValidatorExtended.ValidateGkvAbrechnung(gkvAbrechnung, gkvAbrechnung.InvoiceBases);
|
||||
|
||||
var manager = new DakotaManager();
|
||||
var mandatordc = new OperationsServiceImp().GetMandator();
|
||||
|
||||
DakotaValidator.ValidateMandator(mandatordc);
|
||||
Validator.ValidateMandator(mandatordc);
|
||||
|
||||
var gkvAbrechnungDC = MapperFactory.GkvAbrechnungDC_GkvAbrechnung.MapToNewDC(gkvAbrechnung);
|
||||
var orgadc = gkvAbrechnungDC.Organisation;
|
||||
|
||||
DakotaValidator.ValidateOrganisation(orgadc);
|
||||
Validator.ValidateOrganisation(orgadc);
|
||||
|
||||
var datenannahmestelle = orgadc.IKDatenannahmestelle;
|
||||
var (datenaustauschreferenz, transfernummer) = GetNextDatenaustauschreferenzTransfernummer(gkvAbrechnung, datenannahmestelle);
|
||||
var (dat_short, tra_short) = ClearDatenaustauschreferenzTransfernummer(datenaustauschreferenz, transfernummer);
|
||||
|
||||
protokoll.Datenaustauschreferenz = datenaustauschreferenz;
|
||||
protokoll.Transfernummer = transfernummer;
|
||||
var first_cost = gkvAbrechnung.InvoiceBases.First().CostBearer2SupportConcept.SupportConcept.Customer;
|
||||
|
||||
var plugin = PluginLoader.FindClass<AccountingService>();
|
||||
var addressInfo = plugin.GetAddressInformation(first_cost.Oid);
|
||||
|
||||
foreach (var invoicebase in gkvAbrechnung.InvoiceBases)
|
||||
{
|
||||
var customer = invoicebase.CostBearer2SupportConcept.SupportConcept.Customer;
|
||||
|
||||
var addressInfo2 = plugin.GetAddressInformation(customer.Oid);
|
||||
|
||||
if (addressInfo.IKLeistungserbringer != addressInfo2.IKLeistungserbringer)
|
||||
{
|
||||
throw new GkvException($"Klient '{first_cost.Person.LastNameFirstName}' ({addressInfo.IKLeistungserbringer}) und '{customer.Person.LastNameFirstName}' ({addressInfo2.IKLeistungserbringer}) verweisen auf unterschiedliche Leistungserbringer.");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var invoicebase in gkvAbrechnung.InvoiceBases)
|
||||
{
|
||||
@@ -1032,16 +1084,18 @@ namespace BeWo.Service.ServiceImplementations
|
||||
var servicedc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(service);
|
||||
var customerdc = MapperFactory.CustomerDC_Customer.MapToNewDC(customer);
|
||||
|
||||
DakotaValidator.ValidateCustomer(customerdc);
|
||||
Validator.ValidateCustomer(customerdc);
|
||||
|
||||
manager.Add(servicedc, orgadc, customerdc, mandatordc, dat_short, tra_short);
|
||||
manager.Add(servicedc, orgadc, customerdc, addressInfo, dat_short, tra_short);
|
||||
}
|
||||
|
||||
manager.Apply();
|
||||
|
||||
if (manager.DakotaFileDict.Count != 1 || manager.DakotaFileDict.First().Value.GetKostenträgerCount() != 1)
|
||||
{
|
||||
throw new GkvException("Unerwartete Anzahl an Dakota Files berechnet.");
|
||||
var msg = "Unerwartete Anzahl an Dakota Files berechnet.";
|
||||
|
||||
throw new GkvException(msg);
|
||||
}
|
||||
|
||||
var file_from_manager = manager.DakotaFileDict.First().Value;
|
||||
@@ -1049,15 +1103,26 @@ namespace BeWo.Service.ServiceImplementations
|
||||
var nutzdatendatei = file_from_manager.GetNutzdatendatei();
|
||||
|
||||
// https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
|
||||
// A TEXT column with a maximum length of 65,535 (2^16 − 1) characters.
|
||||
// The effective maximum length is less if the value contains multibyte
|
||||
// characters. Each TEXT value is stored using a 2-byte length prefix
|
||||
// that indicates the number of bytes in the value.
|
||||
if (nutzdatendatei.Length > 65535)
|
||||
// A TEXT column with a maximum length of 16,777,215 (224 − 1) characters.
|
||||
// The effective maximum length is less if the value contains multibyte characters.
|
||||
// Each MEDIUMTEXT value is stored using a 3-byte length prefix that indicates the number of bytes in the value.
|
||||
//
|
||||
// Type | Maximum length
|
||||
// -----------+-------------------------------------
|
||||
// TINYTEXT | 255(2^8−1) bytes
|
||||
// TEXT | 65,535(2^16−1) bytes = 64 KiB
|
||||
// MEDIUMTEXT | 16,777,215(2^24−1) bytes = 16 MiB
|
||||
// LONGTEXT | 4,294,967,295(2^32−1) bytes = 4 GiB
|
||||
if (nutzdatendatei.Length > 16777215)
|
||||
{
|
||||
throw new GkvException($"nutzdatendatei - Länger als 65535: {nutzdatendatei.Length}");
|
||||
var msg = $"nutzdatendatei - Länger als 16777215: {nutzdatendatei.Length}";
|
||||
|
||||
throw new GkvException(msg);
|
||||
}
|
||||
|
||||
protokoll.Datenaustauschreferenz = datenaustauschreferenz;
|
||||
protokoll.Transfernummer = transfernummer;
|
||||
|
||||
protokoll.IKDatenannahmestelle = file_from_manager.GetIKDatenannahmestelle();
|
||||
protokoll.IKKostentrager = file_from_manager.GetIKKostenträger();
|
||||
protokoll.IKLeistungserbringer = file_from_manager.GetIKLeistungserbringer();
|
||||
@@ -1074,18 +1139,19 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
protokoll.AbsenderBezeichnung = "ownSoft GmbH";
|
||||
protokoll.EmpfangerBezeichnung = orgadc.BezDatenannahmestelle;
|
||||
|
||||
return protokoll;
|
||||
}
|
||||
catch (GkvException de)
|
||||
{
|
||||
if (string.IsNullOrEmpty(de.Title))
|
||||
de.Title = "Protokoll Erstellung";
|
||||
|
||||
throw de;
|
||||
error = de.ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new GkvException(e.Message, "Erstellung");
|
||||
error = e.ToString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Tuple<int, int> GetNextDatenaustauschreferenzTransfernummer(GkvAbrechnung gkvAbrechnung, string datenannahmestelle)
|
||||
@@ -1105,7 +1171,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Versucht Transfernummer zu laden, invalid state", nameof(state));
|
||||
throw new ArgumentException($"Versucht Transfernummer zu laden, invalid state: {state}", nameof(state));
|
||||
}
|
||||
|
||||
return new Tuple<int, int>(datenaustauschref, transfernummer);
|
||||
@@ -1171,14 +1237,14 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
MailUtils.SendGkvModuleErrorMail("GkvServerGetStatusRequest Error", e, Tenant);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!response_app8.Success)
|
||||
throw new GkvException("Success false - " + response_app8.Message);
|
||||
|
||||
|
||||
if (response_app8.Results is null)
|
||||
throw new GkvException("Result null - " + response_app8.Message);
|
||||
|
||||
@@ -1223,7 +1289,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
protokolls.Add(protokoll);
|
||||
}
|
||||
|
||||
if(protokolls.Any())
|
||||
if (protokolls.Any())
|
||||
DAOFactory.GenericDAO.Update(protokolls);
|
||||
|
||||
var follows = results.Where(x => x.ResultType == GkvTransferResultType.FailFollowUp);
|
||||
@@ -1261,14 +1327,14 @@ namespace BeWo.Service.ServiceImplementations
|
||||
request.Password = user.BCryptPassword;
|
||||
request.Tenant = MultitenancyOperationContextExt.Current.Tenant;
|
||||
|
||||
if(request is GkvServerSendNewRequestDC send_new_req)
|
||||
if (request is GkvServerSendNewRequestDC send_new_req)
|
||||
{
|
||||
send_new_req.ApplicationUserOid = user.Oid.Value;
|
||||
}
|
||||
|
||||
return GkvSender.SendApp8Request<Req, Res>(request, request.Tenant);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -859,7 +859,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
IList<Organisation> list = DAOFactory.GenericDAO.GetAllActiveAndArchived<Organisation>();
|
||||
|
||||
list = list.Where(x => DakotaValidator.IsOrganisationInformationValid(x.IKDatenannahmestelle, x.IKKostentrager, x.IKKrankenkasse, x.BezDatenannahmestelle)).ToList();
|
||||
list = list.Where(x => !x.GkvAusblenden &&
|
||||
Validator.IsOrganisationInformationValid(x.IKDatenannahmestelle, x.IKKostentrager, x.IKKrankenkasse, x.BezDatenannahmestelle)).ToList();
|
||||
|
||||
return CreateCompactOrganisations(list);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
|
||||
}
|
||||
return Utils.SendMail(senderName, senderEMail, subject, body, null);
|
||||
return Utils.SendMail(subject, body, null, senderName, senderEMail);
|
||||
}
|
||||
|
||||
private MailDC CreateMailDC(Mail2Receiver m2r)
|
||||
|
||||
@@ -2505,6 +2505,22 @@ namespace BeWo.Service.ServiceImplementations
|
||||
//pServiceRecordGroup.RoundedDuration = (decimal)originalEnde.Value.Subtract(originalStart.Value).TotalMinutes;
|
||||
}
|
||||
}
|
||||
|
||||
//Bug korrigieren, dass sich die Stunden nicht ändern, wenn in Start Sekunde > 0 und Stunde > 0 eingetragen ist, was eigentlich nicht sein darf. War aber bei einem Kunden HSH Netzwerk bei zwei Usern
|
||||
if (srOrg.Start.HasValue && srOrg.Start.Value.Hour > 0 && srOrg.Start.Value.Second > 0)
|
||||
{
|
||||
var minuten = srDc.RoundedDuration;
|
||||
if (srDc.DurationInStunden.HasValue && srDc.DurationInStunden.Value == ZeiterfassungsDauer.Stunden)
|
||||
{
|
||||
minuten *= 60;
|
||||
}
|
||||
|
||||
if (srOrg.RoundedDuration == minuten) // Die Dauer wurde nicht geändert, also setze Start auf 00:01
|
||||
{
|
||||
srDc.Start = srDc.Start.Value.Date.AddSeconds(1);
|
||||
srDc.End = srDc.Start.Value.AddMinutes((double)minuten);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6200,12 +6216,11 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: implementieren!
|
||||
public void DeleteAppointmentsInInterval(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomers, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments, Dictionary<UserRightType, bool> pUserRights)
|
||||
{
|
||||
try
|
||||
{
|
||||
var appointments2Delete = DAOFactory.SearchDAO.LoadFilteredAppointments(pHasRightToSeeAllEmployeeAppointments, pEmployeeOid, new DateTime(1, 1, 1), pIntervalEnd, pSelectedEmployees, pSelectedCustomers, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments, true);
|
||||
var appointments2Delete = DAOFactory.SearchDAO.LoadFilteredAppointments(pHasRightToSeeAllEmployeeAppointments, pEmployeeOid, new DateTime(1, 1, 1), pIntervalEnd, pSelectedEmployees, pSelectedCustomers, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments, true, false);
|
||||
DAOFactory.GenericDAO.Delete(appointments2Delete);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -6257,9 +6272,9 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
public string GetMessageFromServerForDeletingAppointments(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomers, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments, Dictionary<UserRightType, bool> pUserRights)
|
||||
{
|
||||
var appointments2Delete = DAOFactory.SearchDAO.LoadFilteredAppointments(pHasRightToSeeAllEmployeeAppointments, pEmployeeOid, new DateTime(1, 1, 1), pIntervalEnd, pSelectedEmployees, pSelectedCustomers, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments, true);
|
||||
var appointments2Delete = DAOFactory.SearchDAO.LoadFilteredAppointments(pHasRightToSeeAllEmployeeAppointments, pEmployeeOid, new DateTime(1, 1, 1), pIntervalEnd, pSelectedEmployees, pSelectedCustomers, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments, true, false);
|
||||
|
||||
var actualTextMessage = $"Achtung!

Das Löschen von {appointments2Delete.Count} {(appointments2Delete.Count == 1 ? "Termin" : "Terminen")} bis zum {pIntervalEnd.ToShortDateString()} kann nicht rückgängig gemacht werden!
";
|
||||
var actualTextMessage = $"Achtung!

Es werden ALLE Termine ALLER Klienten bis zum angegebenden Datum gelöscht.
Das Löschen von {appointments2Delete.Count} {(appointments2Delete.Count == 1 ? "Termin" : "Terminen")} bis zum {pIntervalEnd.ToShortDateString()} kann nicht rückgängig gemacht werden!
";
|
||||
|
||||
return $"<TextBlock xmlns =\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Grid.Row=\"0\" TextAlignment=\"Center\" FontWeight=\"Bold\" TextWrapping=\"Wrap\" Background=\"Transparent\" FontSize=\"14\" Margin=\"3\" Foreground=\"Red\" HorizontalAlignment=\"Center\" Text=\"{actualTextMessage}\"/>";
|
||||
}
|
||||
@@ -7726,7 +7741,9 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetVorlagentabelleDCs();
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
|
||||
return vm.GetVorlagentabelleDCs();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7739,18 +7756,35 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.InsertTemplate(dc);
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
|
||||
return vm.InsertTemplate(dc);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PlatzhalterDC> GetPlatzhalterForTemplate(VorlagentabelleDC vt)
|
||||
{
|
||||
try
|
||||
{
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetPlatzhalterForTemplate(vt);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PlatzhalterDC> GetPlatzhalterForCustomer()
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetPlatzhalterForCustomer();
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetPlatzhalterForCustomer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7761,7 +7795,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetPlatzhalterForSupportConcept();
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetPlatzhalterForSupportConcept();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7772,7 +7807,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetPlatzhalterForEmployee();
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetPlatzhalterForEmployee();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7783,7 +7819,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetFolderById(oid);
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetFolderById(oid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7794,7 +7831,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetVorlagentabelleById(oid);
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetVorlagentabelleById(oid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7805,7 +7843,21 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.GetDokumentvorlagenInFolder(folderOid);
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetDokumentvorlagenInFolder(folderOid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<DokumentvorlageDC> GetDokumentvorlagenForType(TableID objecTid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.GetDokumentvorlagenForType(objecTid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -7830,7 +7882,9 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
VorlagenManager.DeleteTemplates(vorlagen);
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
vm.DeleteTemplates(vorlagen);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -7854,7 +7908,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
return VorlagenManager.ReplacePlaceholdersInTemplate(template, objectOid, tableOid);
|
||||
var vm = PluginLoader.FindClass<VorlagenManager>();
|
||||
return vm.ReplacePlaceholdersInTemplate(template, objectOid, tableOid);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -15,15 +15,23 @@ namespace BeWo.Service.Vorlagen
|
||||
{
|
||||
public class VorlagenManager
|
||||
{
|
||||
public static List<VorlagentabelleDC> GetVorlagentabelleDCs()
|
||||
public List<VorlagentabelleDC> GetVorlagentabelleDCs()
|
||||
{
|
||||
|
||||
var alleVorlagentabellen = DAOFactory.GenericDAO.GetAllActive<Vorlagentabelle>();
|
||||
//Aus DB laden oder hardcoded erstellen??
|
||||
|
||||
return MapperFactory.VorlagentabelleDC_Vorlagentabelle.MapToNewDCs(alleVorlagentabellen);
|
||||
//var alleVorlagentabellen = DAOFactory.GenericDAO.GetAllActive<Vorlagentabelle>();
|
||||
//return MapperFactory.VorlagentabelleDC_Vorlagentabelle.MapToNewDCs(alleVorlagentabellen);
|
||||
|
||||
var list = new List<VorlagentabelleDC>();
|
||||
|
||||
list.Add(new VorlagentabelleDC() { VorlagentabelleOid = 1000, VorlagentabelleObjectTid = (int)TableID.Customer, Tabellenname = "Klienten", ImageName = "UserHomeBoyDisabled" });
|
||||
list.Add(new VorlagentabelleDC() { VorlagentabelleOid = 1001, VorlagentabelleObjectTid = (int)TableID.SupportConcept, Tabellenname = "Hilfepläne", ImageName = "IDBadgeDisabled" });
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
public static DokumentvorlageDC InsertTemplate(DokumentvorlageDC dc)
|
||||
public DokumentvorlageDC InsertTemplate(DokumentvorlageDC dc)
|
||||
{
|
||||
Dokumentvorlage entity = null;
|
||||
if (dc.DokumentvorlageOid == null)
|
||||
@@ -43,7 +51,26 @@ namespace BeWo.Service.Vorlagen
|
||||
var updatedTemplateDC = MapperFactory.DokumentvorlageDC_Dokumentvorlage.MapToNewDC(entity);
|
||||
return updatedTemplateDC;
|
||||
}
|
||||
public static List<PlatzhalterDC> GetPlatzhalterForCustomer()
|
||||
|
||||
public List<PlatzhalterDC> GetPlatzhalterForTemplate(VorlagentabelleDC vt)
|
||||
{
|
||||
var tid = (TableID)vt.VorlagentabelleObjectTid;
|
||||
switch (tid)
|
||||
{
|
||||
case TableID.Customer:
|
||||
return GetPlatzhalterForCustomer();
|
||||
case TableID.SupportConcept:
|
||||
return GetPlatzhalterForSupportConcept();
|
||||
case TableID.Employee:
|
||||
return GetPlatzhalterForEmployee();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<PlatzhalterDC> GetPlatzhalterForCustomer()
|
||||
{
|
||||
List<PlatzhalterDC> liste = new List<PlatzhalterDC>();
|
||||
|
||||
@@ -172,7 +199,7 @@ namespace BeWo.Service.Vorlagen
|
||||
|
||||
return liste;
|
||||
}
|
||||
public static List<PlatzhalterDC> GetPlatzhalterForSupportConcept()
|
||||
public List<PlatzhalterDC> GetPlatzhalterForSupportConcept()
|
||||
{
|
||||
List<PlatzhalterDC> liste = new List<PlatzhalterDC>();
|
||||
|
||||
@@ -242,7 +269,7 @@ namespace BeWo.Service.Vorlagen
|
||||
|
||||
return liste;
|
||||
}
|
||||
public static List<PlatzhalterDC> GetPlatzhalterForEmployee()
|
||||
public List<PlatzhalterDC> GetPlatzhalterForEmployee()
|
||||
{
|
||||
|
||||
List<PlatzhalterDC> liste = new List<PlatzhalterDC>();
|
||||
@@ -350,28 +377,38 @@ namespace BeWo.Service.Vorlagen
|
||||
|
||||
return liste;
|
||||
}
|
||||
public static BeWoFolderDC GetFolderById(long oid)
|
||||
public BeWoFolderDC GetFolderById(long oid)
|
||||
{
|
||||
BeWoFolder folder = DAOFactory.GenericDAO.GetByID<BeWoFolder>(oid);
|
||||
var dc = MapperFactory.BeWoFolderDC_BeWoFolder.MapToNewDC(folder);
|
||||
|
||||
return dc;
|
||||
}
|
||||
public static VorlagentabelleDC GetVorlagentabelleById(long oid)
|
||||
public VorlagentabelleDC GetVorlagentabelleById(long oid)
|
||||
{
|
||||
Vorlagentabelle tabelle = DAOFactory.GenericDAO.GetByID<Vorlagentabelle>(oid);
|
||||
var dc = MapperFactory.VorlagentabelleDC_Vorlagentabelle.MapToNewDC(tabelle);
|
||||
//Vorlagentabelle tabelle = DAOFactory.GenericDAO.GetByID<Vorlagentabelle>(oid);
|
||||
//var dc = MapperFactory.VorlagentabelleDC_Vorlagentabelle.MapToNewDC(tabelle);
|
||||
var alle = GetVorlagentabelleDCs();
|
||||
|
||||
return dc;
|
||||
return alle.FirstOrDefault(v => v.VorlagentabelleOid == oid);
|
||||
}
|
||||
public static List<DokumentvorlageDC> GetDokumentvorlagenInFolder(long folderOid)
|
||||
public List<DokumentvorlageDC> GetDokumentvorlagenInFolder(long folderOid)
|
||||
{
|
||||
List<Dokumentvorlage> liste = DAOFactory.SearchDAO.GetAllDokumentvorlagenInFolder(folderOid) as List<Dokumentvorlage>;
|
||||
var DCs = MapperFactory.DokumentvorlageDC_Dokumentvorlage.MapToNewDCs(liste);
|
||||
var dcs = MapperFactory.DokumentvorlageDC_Dokumentvorlage.MapToNewDCs(liste);
|
||||
|
||||
return DCs;
|
||||
return dcs;
|
||||
}
|
||||
public static void DeleteTemplates(List<DokumentvorlageDC> vorlagen)
|
||||
|
||||
public List<DokumentvorlageDC> GetDokumentvorlagenForType(TableID objecTid)
|
||||
{
|
||||
List<Dokumentvorlage> liste = DAOFactory.GenericDAO.GetAllActive<Dokumentvorlage>().Where(d => d.Tabellenzugehoerigkeit == (int)objecTid).ToList();
|
||||
var dcs = MapperFactory.DokumentvorlageDC_Dokumentvorlage.MapToNewDCs(liste);
|
||||
|
||||
return dcs;
|
||||
}
|
||||
|
||||
public void DeleteTemplates(List<DokumentvorlageDC> vorlagen)
|
||||
{
|
||||
for (int i = vorlagen.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -381,7 +418,7 @@ namespace BeWo.Service.Vorlagen
|
||||
DAOFactory.GenericDAO.Delete(origTemplate);
|
||||
}
|
||||
}
|
||||
public static string ReplacePlaceholdersInTemplate(DokumentvorlageDC template, long? objectOid, long? tableOid)
|
||||
public string ReplacePlaceholdersInTemplate(DokumentvorlageDC template, long? objectOid, long? tableOid)
|
||||
{
|
||||
string adaptedRTF = "";
|
||||
|
||||
@@ -394,7 +431,7 @@ namespace BeWo.Service.Vorlagen
|
||||
|
||||
return adaptedRTF;
|
||||
}
|
||||
private static string EmployeeTemplate(long? objectOid, string RTFWithPlaceholders)
|
||||
private string EmployeeTemplate(long? objectOid, string RTFWithPlaceholders)
|
||||
{
|
||||
bool allSet = true;
|
||||
List<string> attributeList = new List<string>();
|
||||
@@ -561,7 +598,7 @@ namespace BeWo.Service.Vorlagen
|
||||
}
|
||||
}
|
||||
|
||||
private static string CustomerTemplate(long? objectOid, string RTFWithPlaceholders)
|
||||
private string CustomerTemplate(long? objectOid, string RTFWithPlaceholders)
|
||||
{
|
||||
bool allSet = true;
|
||||
List<string> attributeList = new List<string>();
|
||||
@@ -814,7 +851,7 @@ namespace BeWo.Service.Vorlagen
|
||||
|
||||
//}
|
||||
|
||||
private static string SupportConceptTemplate(long? objectOid, string RTFWithPlaceholders)
|
||||
private string SupportConceptTemplate(long? objectOid, string RTFWithPlaceholders)
|
||||
{
|
||||
var supportConcept = DAOFactory.GenericDAO.GetByID<SupportConcept>((long)objectOid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user