Überstunden Historie (OvertimeHistory) eingebaut

This commit is contained in:
2025-12-02 14:38:16 +01:00
parent 3ebd7e7743
commit 5a085eee83
7 changed files with 168 additions and 6 deletions

View File

@@ -234,6 +234,7 @@
<Compile Include="Access\UserDAO.cs" />
<Compile Include="ASPHibernateSessionManager.cs" />
<Compile Include="DefaultHibernateSessionManager.cs" />
<Compile Include="Entities\OvertimeHistory.cs" />
<Compile Include="Entities\AiConversation.cs" />
<Compile Include="Entities\AiConversationMessage.cs" />
<Compile Include="Entities\AiConfig.cs" />
@@ -857,6 +858,9 @@
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Mappings\Person2Team.hbm.xml" />
<EmbeddedResource Include="Mappings\OvertimeHistory.hbm.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<Content Include="Mappings\Timesheet2Mail.hbm.xml" />
<EmbeddedResource Include="Mappings\ContactHistory.hbm.xml">
<SubType>Designer</SubType>

View File

@@ -0,0 +1,28 @@
using System;
using BS.Shared;
using BS.Shared.Core;
namespace BeWo.Data.Entities
{
public class OvertimeHistory : BeWoEntityBase
{
public OvertimeHistory()
{
this._Tid = TableID.OvertimeHistory;
}
public virtual StatementType ChangeType { get; set; }
public virtual long OvertimeOid { get; set; }
public virtual long? OvertimeEmployeeOid { get; set; }
public virtual DateTime? OvertimeDatum { get; set; }
public virtual decimal? OvertimeBetrag { get; set; }
public virtual long? OvertimeAuszahlungsartOid { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BeWo.Data.Entities.OvertimeHistory, BeWo.Data" table="OvertimeHistory">
<id name="Oid" column="Oid" type="Int64" unsaved-value="null">
<generator class="identity" />
</id>
<version type="Int64" column="Version" name="Version" />
<property column="Tid" type="BS.Shared.TableID, BS.Shared" name="_Tid" access="field" />
<property column="Notice" type="String" name="Notice" length="1024" />
<property column="InsTs" type="DateTime" name="InsTs" />
<property column="InsUser" type="String" name="InsUser" length="256" />
<property column="UdpUser" type="String" name="UdpUser" length="256" />
<property column="UpdTs" type="DateTime" name="UpdTs" />
<property column="IsActive" type="BS.Shared.ActivationTypeId, BS.Shared" name="IsActive" />
<property column="SystemEntryID" type="BS.Shared.SystemEntryID, BS.Shared" name="SystemEntryID" />
<property name="ChangeType" type="BS.Shared.StatementType, BS.Shared" />
<property name="OvertimeOid" type="Int64" />
<property name="OvertimeEmployeeOid" type="Int64" />
<property name="OvertimeDatum" type="DateTime" />
<property name="OvertimeBetrag" type="Decimal" />
<property name="OvertimeAuszahlungsartOid" type="Int64" />
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,20 @@
CREATE TABLE IF NOT EXISTS `OvertimeHistory` (
`Oid` bigint NOT NULL AUTO_INCREMENT,
`Tid` int NOT NULL,
`Notice` varchar(1024) DEFAULT NULL,
`InsTs` datetime DEFAULT NULL,
`InsUser` varchar(256) DEFAULT NULL,
`Version` bigint DEFAULT NULL,
`UdpUser` varchar(256) DEFAULT NULL,
`UpdTs` datetime DEFAULT NULL,
`IsActive` tinyint DEFAULT NULL,
`SystemEntryID` int DEFAULT NULL,
`ChangeType` tinyint NULL DEFAULT NULL,
`OvertimeOid` bigint NULL DEFAULT NULL,
`OvertimeEmployeeOid` bigint DEFAULT NULL,
`OvertimeDatum` datetime DEFAULT NULL,
`OvertimeBetrag` decimal(18,10) DEFAULT NULL,
`OvertimeAuszahlungsartOid` bigint DEFAULT NULL,
PRIMARY KEY (`Oid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

View File

@@ -1738,3 +1738,24 @@ ALTER TABLE `team`
ADD CONSTRAINT `FK_TEAM_LEADER_EMPLOYEE`
FOREIGN KEY (`EmployeeOid`)
REFERENCES `employee` (`Oid`);
CREATE TABLE IF NOT EXISTS `OvertimeHistory` (
`Oid` bigint NOT NULL AUTO_INCREMENT,
`Tid` int NOT NULL,
`Notice` varchar(1024) DEFAULT NULL,
`InsTs` datetime DEFAULT NULL,
`InsUser` varchar(256) DEFAULT NULL,
`Version` bigint DEFAULT NULL,
`UdpUser` varchar(256) DEFAULT NULL,
`UpdTs` datetime DEFAULT NULL,
`IsActive` tinyint DEFAULT NULL,
`SystemEntryID` int DEFAULT NULL,
`ChangeType` tinyint NULL DEFAULT NULL,
`OvertimeOid` bigint NULL DEFAULT NULL,
`OvertimeEmployeeOid` bigint DEFAULT NULL,
`OvertimeDatum` datetime DEFAULT NULL,
`OvertimeBetrag` decimal(18,10) DEFAULT NULL,
`OvertimeAuszahlungsartOid` bigint DEFAULT NULL,
PRIMARY KEY (`Oid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

View File

@@ -74,10 +74,11 @@ namespace BeWo.ServiceUtils.History
}
}
CreateAbsenceTimeHistoryEntry(originalEmployee.AbsenceTimes, newEmployee.AbsenceTimes);
DAOFactory.GenericDAO.Insert(employeeHistory);
CreateOvertimeHistoryEntry(originalEmployee.Overtimes, newEmployee.Overtimes);
DAOFactory.GenericDAO.Insert(employeeHistory);
}
@@ -209,6 +210,61 @@ namespace BeWo.ServiceUtils.History
}
public static void CreateOvertimeHistoryEntry(IList<Overtime> originalOvertimes, IList<OvertimeDC> newOvertimes)
{
if (newOvertimes != null)
{
foreach (var na in newOvertimes)
{
if (!na.OvertimeOid.HasValue)
{
CreateOvertimeHistoryEntry(na, StatementType.Insert);
}
else
{
var oldAt = originalOvertimes.Where(a => a.Oid == na.OvertimeOid).FirstOrDefault();
if (oldAt != null)
{
CreateOvertimeHistoryEntry(na, StatementType.Update);
}
else
{
//Wurde gelöscht?
}
}
}
}
foreach (var oat in originalOvertimes)
{
//wenn es eine Abwesenheit gibt, der nicht mehr in der neuen Liste enthalten ist, wurde er gelöscht
var na = newOvertimes.Where(a => a.OvertimeOid == oat.Oid).FirstOrDefault();
if (na == null)
{
CreateOvertimeHistoryEntry(MapperFactory.OvertimeDC_Overtime.MapToNewDC(oat), StatementType.Delete);
}
}
}
public static void CreateOvertimeHistoryEntry(OvertimeDC newOvertime, StatementType statementType)
{
var historyEntry = new OvertimeHistory()
{
OvertimeOid = newOvertime.OvertimeOid ?? 0,
OvertimeAuszahlungsartOid = newOvertime.Auszahlungsart?.AuszahlungsartOid,
OvertimeDatum = newOvertime.Date,
OvertimeBetrag = newOvertime.Betrag,
OvertimeEmployeeOid = newOvertime.EmployeeOid,
Notice = newOvertime.Notice,
ChangeType = statementType
};
DAOFactory.GenericDAO.Insert(historyEntry);
}
public static void MakeCustomerHistoryEntry(Customer lOriginal, CustomerDC newCustomer, long? Oid, StatementType statementType, List<Customer2Person> originalCustomer2PersonList, List<Customer2Organisation> originalC2OList, List<Employee2Customer> originale2CList, List<AbsenceTime> originaleAbsenceTimeList)
{
var lCustomerHistory = new CustomerHistory
@@ -754,6 +810,13 @@ namespace BeWo.ServiceUtils.History
atDc.CustomerOid = customerOid;
CreateAbsenceTimeHistoryEntry(atDc, sType);
}
else if (entityObj is Overtime)
{
var ent = entityObj as Overtime;
var dc = MapperFactory.OvertimeDC_Overtime.MapToNewDC(ent);
CreateOvertimeHistoryEntry(dc, sType);
}
}
}
}

View File

@@ -191,8 +191,9 @@ namespace BS.Shared
AiContext2BeWoObject = 181,
AiConfig = 182,
StoredFile = 183,
Person2Team = 184
}
Person2Team = 184,
OvertimeHistory = 185
}
public enum SystemEntryID
{